Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: Canada Cargo/Train Manifest response - EDI350

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

🎯 Canada Cargo/Train Manifest response - EDI350 Scope Detected: Extracted 2273 rules, Optimally Merged into 291 Feature Scenarios.
R-CCISCOM-cbl-00001 (+129) File: CCISCOM.cblFile: CERR.cblFile: CIMS.cblFile: GCCIH.cblFile: GCCMQERR.cblFile: GCCTBIO.cblFile: GCCUSIO.cblFile: GCX126R.cblFile: WRITMSGL.cbl Overview Rules Merged 130 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - iscom structure exists with a sit version field and cccom structure contains common area data:
    For 1:Version Check and Data Transfer:
    When the sit version in iscom matches the working storage iscom version, then copy common area from cccom to iscom and update iscom sit version to working storage version.
  • Context - iscom structure exists with incompatible sit version and cccom structure contains source data:
    For 2:ISCOM Initialization:
    When the sit version in iscom does not match the working storage iscom version, then initialize iscom with default values from iscomval, copy common area from cccom, and update sit version.
  • Context - cccom and iscom structures require cross-referencing for communication:
    For 3:Cross-Reference Address Setup:
    When iscom version mismatch triggers full initialization process, then set cccom address in iscom structure and set iscom address in cccom structure.
  • Context - cccom contains lt-pcbs information and iscom requires pcb data:
    For 4:PCB Transfer:
    When full iscom initialization is required due to version mismatch, then copy lt-pcbs data from cccom to iscom structure.
  • Context - cccom table contains database entries with names and cccom-table-size defines maximum entries:
    For 5:Database Name Scanning:
    When database address scanning is initiated during iscom initialization, then process each cccom entry from position 1 until reaching table size limit or finding empty database name.
  • Context - cccom entry contains database number field that may be empty or contain spaces:
    For 6:PCB Number Processing:
    When processing a cccom database entry during scanning, then initialize iscom pcb number to zero, copy database number from cccom, and if database number is spaces then set cccom pcb number to '1'.
  • Context - cccom entry has database name and iscom table contains database entries with names:
    For 7:Database Name Matching:
    When scanning iscom table for matching database names during address mapping, then process each iscom entry from position 1 until reaching table size limit or finding empty database name.
  • Context - cccom database name matches iscom database name during scanning process:
    For 8:PCB Counter Management:
    When database names are identical between cccom entry and iscom entry, then increment iscom pcb number by 1.
  • Context - iscom pcb number equals cccom pcb number for matching database names:
    For 9:PCB Address Mapping:
    When pcb numbers match after incrementing iscom pcb counter, then set pcb address in iscom entry to match pcb address from corresponding cccom entry.
  • Context - cccom structure exists with sit version field and iscom structure contains source data:
    For 10:Reverse Conversion Version Check:
    When reverse conversion entry point is accessed and cccom sit version matches working storage cccom version, then copy common area from iscom to cccom and update cccom sit version to working storage version.
  • Context - cccom sit version does not match working storage version and iscom contains source data:
    For 11:Reverse Data Transfer:
    When reverse conversion is initiated with version mismatch, then copy common area from iscom to cccom and update cccom sit version to working storage version.
  • Context - iscom contains lt-pcbs information and cccom requires pcb data during reverse conversion:
    For 12:Reverse PCB Transfer:
    When cccom version mismatch triggers full reverse initialization, then copy lt-pcbs data from iscom to cccom structure and set up cross-reference addresses.
  • Context - iscom table contains entries with pcb address fields that may be zero or non-zero:
    For 13:Active PCB Identification:
    When scanning iscom entries during reverse conversion process, then process only entries where pcb address is not equal to zero.
  • Context - iscom entry has non-zero pcb address and database name:
    For 14:PCB Sequence Numbering:
    When processing active iscom entry during reverse conversion, then initialize iscom pcb number to 1 and count matching database names in previous entries to determine sequence number.
  • Context - active iscom entry contains database name and pcb information:
    For 15:Database Entry Creation:
    When processing iscom entry with non-zero pcb address during reverse conversion, then increment cccom entry counter and copy database name from iscom to cccom entry.
  • Context - iscom entry contains pcb address and corresponding cccom entry has been created:
    For 16:Reverse PCB Address Mapping:
    When creating cccom database entry from active iscom entry, then set pcb address in cccom entry to match pcb address from iscom entry.
  • Context - iscom pcb number has been calculated for database entry and cccom entry requires database number:
    For 17:Database Number Assignment:
    When finalizing cccom database entry creation during reverse conversion, then if iscom pcb number equals '1' then set cccom database number to spaces, otherwise set cccom database number to iscom pcb number value.
  • Context - a message processing operation is initiated:
    For 1:Initialize Program Control:
    When the system begins message processing, then the current program name is saved and the module name becomes the active program identifier.
  • Context - a new ih notification needs to be processed:
    For 2:Prepare IH Notification Data:
    When the notification data structure is being prepared, then the input structure is initialized and security byte is set to high values for maximum security.
  • Context - ih notification data is prepared with security controls:
    For 3:Format CCN Status Message:
    When the ccn status message is being formatted, then the 91-byte input data is moved to positions 2-91 of the message structure and the formatted input is copied to the message area.
  • Context - a ccn status message is formatted and ready for processing:
    For 3:Format CCN Status Message:
    When the message is prepared for transmission, then the accept status is set to spaces to indicate a cleared/ready state.
  • Context - a formatted ccn status message with cleared accept status:
    For 4:Send Initial IMS Message:
    When the message is sent for initial processing, then the cims service is invoked with change operation parameters to process the message.
  • Context - a message has been processed through initial ims processing:
    For 5:Write Message Log:
    When the message logging is performed, then the writmsgl service is invoked with message code, content, length, and module name for complete audit logging.
  • Context - a message has been processed and logged successfully:
    For 6:Purge IMS Message:
    When the cleanup operation is performed, then the cims service is invoked with purge operation to remove the processed message from the system.
  • Context - a user requests a database operation with a function code:
    For 4:Set SSA Type for Get Operations:
    When the function code is ghu (get hold unique) or gu (get unique), then the system sets accept status to ge and configures qualified ssa for precise record targeting.
    For 5:Set SSA Type for Next Operations:
    When the function code is ghn, ghnp, gn, or gnp (sequential navigation operations), then the system sets accept status to gagbgegk and determines ssa qualification based on unqualified ssa flag setting.
    For 6:Set SSA Type for Insert Operations:
    When the function code is isrt (insert), then the system sets accept status to ii and configures unqualified ssa for record insertion.
    For 7:Set SSA Type for Update/Delete Operations:
    When the function code is dlet (delete) or repl (replace), then the system configures no ssa requirement for the modification operation.
    For 3:Validate Function Code:
    When the function code is not ghu, gu, ghn, ghnp, gn, gnp, isrt, dlet, or repl, then the system marks the operation as not valid and prevents further processing.
  • Context - a validated operation targets the root segment gcstbrt:
    For 8:Initialize Root Segment SSA:
    When the ssa flag indicates qualified search is required, then the system sets the root segment key value for targeted access.
  • Context - a validated operation targets the dependent segment gcstbdp with qualified ssa:
    For 9:Initialize Dependent Segment SSA:
    When the unqualified ssa flag is not set, then the system sets both root segment key value and dependent segment key value for hierarchical access.
  • Context - a validated operation targets the dependent segment gcstbdp:
    For 10:Handle Dependent Segment Unqualified Access:
    When either the unqualified ssa flag is set or the ssa flag indicates unqualified search, then the system sets only the root segment key value and configures unqualified ssa for broader search scope.
  • Context - a validated operation specifies a segment name:
    For 9:Initialize Dependent Segment SSA:
    When the segment name is neither gcstbrt (root) nor gcstbdp (dependent), then the system marks the operation as not valid and prevents database access.
  • Context - a validated operation targets the root segment with initialized ssa:
    For 11:Route Root Segment Access:
    When the operation is ready for database access, then the system routes to primary pcb if second pcb flag is not set, otherwise routes to secondary pcb.
  • Context - a validated operation targets the dependent segment with initialized ssa:
    For 14:Route Dependent Segment Access:
    When the operation is ready for database access, then the system routes to primary pcb if second pcb flag is not set, otherwise routes to secondary pcb.
  • Context - a root segment operation is routed to primary pcb:
    For 12:Execute Root Segment Database Call with Primary PCB:
    When the ssa configuration determines the call parameters, then the system calls cims with appropriate ssa parameters: qualified ssa for targeted access, unqualified ssa for broader access, or no ssa for direct operations.
  • Context - a root segment operation is routed to secondary pcb:
    For 13:Execute Root Segment Database Call with Secondary PCB:
    When the ssa configuration determines the call parameters, then the system calls cims with secondary pcb and appropriate ssa parameters: qualified ssa for targeted access, unqualified ssa for broader access, or no ssa for direct operations.
  • Context - a dependent segment operation is routed to primary pcb:
    For 15:Execute Dependent Segment Database Call with Primary PCB:
    When the ssa configuration determines the call parameters, then the system calls cims with hierarchical ssa parameters: both root and dependent qualified ssas for targeted access, root qualified and dependent unqualified ssas for mixed access, or no ssa for direct operations.
  • Context - a dependent segment operation is routed to secondary pcb:
    For 16:Execute Dependent Segment Database Call with Secondary PCB:
    When the ssa configuration determines the call parameters, then the system calls cims with secondary pcb and hierarchical ssa parameters: both root and dependent qualified ssas for targeted access, root qualified and dependent unqualified ssas for mixed access, or no ssa for direct operations.
  • Context - a database operation has been executed through cims:
    For 17:Evaluate Operation Success:
    When the operation completes and returns a status code, then the system sets return flag to successful if status code is spaces, otherwise sets return flag to unsuccessful.
  • Context - a cargo processing request is received with a segment name:
    For 1:Parameter Validation:
    When the segment name is not one of gcsusrt, gcsa2rt, gcsa8rt, or gcst2rt, then the system rejects the request with error code 0012 and message 'segment name invalid'.
  • Context - a cargo processing request is received with a function code:
    For 1:Parameter Validation:
    When the function code is not gu, gn, isrt, repl, or dlet, then the system rejects the request with error code 0012 and message 'function code invalid'.
  • Context - a request targets gcst2rt segment:
    For 1:Parameter Validation:
    When the function code is not gu (get unique), then the system rejects the request with error code 0012 and message 'invalid function code'.
  • Context - a cargo processing request is received:
    For 1:Parameter Validation:
    When the operator field is empty or contains spaces, then the system sets the operator to equals (=) as default.
  • Context - a validated cargo processing request:
    For Segment Type?:
    When the segment type is gcsusrt, gcsa2rt, gcsa8rt, or gcst2rt, then the system routes to primary, secondary, message, or table processing respectively.
  • Context - a cargo record modification request:
    For Function Code?:
    When the function code is isrt, dlet, repl, or zap, then the system sets the update-by-module field to the current transaction code.
  • Context - a new cargo record is being inserted:
    For 2:Primary Cargo Record Insert:
    When the creation timestamp field is empty, then the system sets creation date, time, terminal, and user id from current system values and copies to last-modify fields.
  • Context - a cargo record is being inserted:
    For 2:Primary Cargo Record Insert:
    When the creation timestamp field already contains data, then the system updates only the last-modify date, time, terminal, and user id with current system values.
  • Context - a cargo record index update is requested:
    For 6:Index Field Management:
    When the cargo status indicates the record is deleted, then the system skips all index field setting operations.
  • Context - a cargo record requires bond number indexing:
    For 18:Bond Control Number Processing:
    When in-bond control number exists, use it; else if entry number exists, use entry number; else set to spaces, then the system sets the bond index field according to the priority hierarchy.
  • Context - a cargo record deletion is requested:
    For 4:Primary Cargo Record Delete:
    When the delete operation is initiated, then the system retrieves the record, blanks index fields, sets status to deleted, and updates the record.
  • Context - a cargo record replacement is requested:
    For 3:Primary Cargo Record Update:
    When the replace operation is performed, then the system updates last-modify date, time, terminal, and user id with current system values.
  • Context - a cargo record status update is processed:
    For 14:GCSB1RT Index Database Management:
    When the cargo has no error conditions and no hold conditions (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, hold-d, pr-h-de, holdfda), then the system deletes the cargo record from the gcsb1rt status index.
  • Context - a cargo record has error or pending status:
    For 14:GCSB1RT Index Database Management:
    When the cargo status indicates cpcargo-error, cpcargo-pending, or uscargo-error, then the system fills error fields and either updates existing status record or inserts new status record.
  • Context - a cargo record has hold status:
    For 14:GCSB1RT Index Database Management:
    When the cargo status indicates any hold condition (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, hold-d, pr-h-de, holdfda), then the system fills hold fields and either updates existing status record or inserts new status record.
  • Context - a cargo search request with secondary index specified:
    For 8:Secondary Index Processing:
    When the index type is car-id, waybill, car-wb, bond, manifest, dest, lead-ccn, held-dest, held-border, err-orig, err-border, or err-dest, then the system routes to the appropriate index processing for that search type.
  • Context - a secondary cargo data operation is requested:
    For 11:Secondary Database Processing:
    When for repl function: if record exists and new data is empty, delete; if record exists and new data has content, replace; if record not found and new data has content, insert, then the system performs the appropriate database operation based on the content and existence logic.
  • Context - a cargo status change triggers notification processing:
    For 15:Iron Highway Notification Processing:
    When both us cargo status and cp cargo status are empty, or the status matches the previous notification, or the status is release, then the system skips sending the notification.
  • Context - a cargo status notification is being prepared:
    For 15:Iron Highway Notification Processing:
    When us cargo status is empty and cp status is sent, use sent; for deleted or release status, always process; otherwise use us cargo short description, then the system selects the appropriate status value according to the priority rules.
  • Context - a cargo status code needs to be displayed or processed:
    For 7:Cargo Status Description Setting:
    When the internal status is ok, pending, acknwlg, error, sent, deleted, delpend, relsd, arrival, aarr, export, aexp, imed-ex, or xfered, then the system maps to corresponding business descriptions: ok, pending, ack, error, sent, deleted, delpend, released, mnl-arrv, aut-arrv, mnl-exp, aut-exp, imed-exp, xfered respectively.
  • Context - a secondary segment retrieval operation is requested:
    For 11:Secondary Database Processing:
    When the function is gu or gn and the secondary key is empty or spaces, then the system returns error code 0012 with message 'secn-key equal spaces'.
  • Context - a gcsa8rt message segment retrieval operation is requested:
    For 12:GCSA8RT Message Processing:
    When the function is gu or gn and the gcsa8rt key is empty or spaces, then the system returns error code 0012 with message 'gcsa8rt-key equal spaces'.
  • Context - a gcsa8rt message segment insert operation is requested:
    For 12:GCSA8RT Message Processing:
    When a record with the same key already exists, perform replace operation; if no existing record, perform insert operation, then the system executes the appropriate database operation and restructures the message data format.
  • Context - a cargo notification requires shipment reference information:
    For 16:Reference Number Processing:
    When n9 reference segments exist for the cargo with qualifier 'cn', then the system extracts the reference number as shipment id for the notification.
  • Context - a cargo operation requires station or border information:
    For 19:Station Code Processing:
    When the system needs to resolve location codes to station numbers, then the system retrieves station information from gcstbrt table segments using location id.
  • Context - a cargo status change is requested:
    For 20:Cargo Status Transition Management:
    When the new status represents a valid business transition from the current status, then the system updates the cargo status and triggers appropriate downstream processing including notifications and index updates.
  • Context - the error processing program starts execution:
    For 4:Common Error Processing - Call DCCCOM:
    When the program begins error handling workflow, then the common communication area cccom is initialized through dcccom service.
  • Context - the common communication area has been initialized:
    For 3:Dump Only Check - WS-DUMP-ONLY?:
    When the system checks the dump-only mode flag ws-dump-only, then if ws-dump-only is true, skip environment-specific error handling and proceed directly to error notification; if ws-dump-only is false, continue with environment detection.
  • Context - the system is not in dump-only mode and environment detection is required:
    For 2:Environment Detection - CC-PROD-TEST-IMS = WS-PROD?:
    When the system compares cc-prod-test-ims with ws-prod value, then if cc-prod-test-ims equals ws-prod, route to production error handling; otherwise route to test error handling.
  • Context - the system has detected production environment (cc-prod-test-ims equals ws-prod):
    For 5:Production Error Handling - Call CERRPROD:
    When production error handling is required, then the cerrprod service is invoked with cccom communication area to handle production-specific error processing.
  • Context - the system has detected test environment (cc-prod-test-ims does not equal ws-prod):
    For 6:Test Error Handling - Call CERRTEST:
    When test error handling is required, then the cerrtest service is invoked with cccom communication area to handle test-specific error processing.
  • Context - error processing has completed (either environment-specific handling or dump-only mode):
    For 7:Error Notification Display - Display blocking error message:
    When error notification is required, then display blocking error message with header and footer delimiters to system error output (syserr).
  • Context - all error processing steps and notifications have been completed:
    For 8:Program Termination - Return control:
    When the error processing workflow reaches completion, then return control to the calling program using goback statement.
  • Context - a cims program is invoked with linkage parameters:
    For 1:Parameter Address Linkage Setup:
    When the system processes the parameter count and argument addresses, then memory addresses are established for cccom, func, and addr-area parameters and the argument count is stored for subsequent processing.
  • Context - parameter addresses are established and argument count is available:
    For 2:Function and SSA Parameter Processing:
    When the system processes parameters 4 through 10 representing io-area and ssa1 through ssa6, then function code is stored in cccom last ims function, ssa parameters are mapped to their respective addresses and stored in cccom last ssa fields, and io-area address is established when 4 or more arguments are provided.
  • Context - cccom iscom address is not null and not blank pointer:
    For 3:ISCOM Address Validation:
    When the system checks iscom address availability, then iscom address is established for subsequent processing.
  • Context - cccom structure is available with version information:
    For 4:CCCOM Version Compatibility Check:
    When the system compares cccom sit version with working storage cccom version, then iscom compatibility check is performed only when versions match.
  • Context - addr-area is not null, pcb address is valid, cccom version is compatible, and pcb copy is available:
    For 5:PCB Address Reset Logic:
    When segment level is not '98' or '99' or force reset flag is true, then first 8 positions of addr-area are cleared with spaces.
  • Context - pcb address is null or blank pointer:
    For 6:PCB Address Resolution:
    When the system searches through up to 249 database name entries, then search continues until valid pcb address is found, maximum entries reached, or database name entry is spaces, and matching pcb address is retrieved when database name matches table entry.
  • Context - pcb address resolution process is completed:
    For 7:PCB Address Validation:
    When pcb address remains null after resolution attempts, then error message is generated with pcb name and number information and error handling routine cerr is invoked.
  • Context - valid pcb address exists, function code is available, and all ssa parameters are processed:
    For 8:IMS Function Call Execution:
    When the system invokes cbltdli with function, pcb copy, io area, and ssa parameters, then ims database operation is executed and control returns with status information in pcb.
  • Context - ims function call is completed:
    For 9:IO PCB Date Time Refresh:
    When function is 'gu' (get unique) and pcb address equals cccom io pcb address, then ims call counter is reset to zero, current system date is obtained and stored in cccom machine century and date fields, and current system time is captured and stored in cccom machine time field.
  • Context - ims function call is executed:
    For 10:IMS Call Counter Management:
    When any ims database operation is performed, then ims call counter in cccom is incremented by 1.
  • Context - ims call counter is updated and pcb copy is available:
    For 11:PCB Status Information Update:
    When pcb information needs to be synchronized with cccom, then pcb copy is moved to cccom copy of pcb field and feedback key length is updated in cccom when segment level is not '98' or '99'.
  • Context - pcb status information is updated:
    For 12:Terminal and User Information Capture:
    When function is 'gu' (get unique) or 'chkp' (checkpoint) and pcb address equals cccom io pcb address, then cccom lterm name is copied to cccom original lterm field and cccom user id is copied to cccom acf2 user id field.
  • Context - ims operation is completed with status code in cccom:
    For 13:Status Code Validation:
    When status code is not blank (spaces), then status code is compared against up to 12 acceptable status codes in cccom acceptable status table.
  • Context - status code validation is completed:
    For 14:Error Message Generation:
    When status code is not found in acceptable status code table after checking all 12 entries, then error message is constructed with status code and 'ims rc code not in acceptable list' text, error message is stored in cccom error message field, and error handling routine cerr is invoked.
  • Context - ims operation completed successfully with blank status code or acceptable status code found:
    For 18:Common Area Synchronization:
    When cccom iscom address is not null and not blank pointer, then cccom common area is copied to iscom common area to maintain data consistency.
  • Context - the program has started execution:
    For 1:Message Writing Initialization:
    When the message writing initialization is triggered, then the basic message writing function writmsg is invoked.
  • Context - the basic message writing has been completed and six parameters p1, p2, p3, p4, p5, p6 are available:
    For 2:Parameterized Message Writing:
    When the parameterized message writing is triggered, then the extended message writing function writmsgx is invoked with parameters p1, p2, p3, p4, p5, p6.
  • Context - the program execution begins:
    For Program Start to Program End:
    When message processing workflow is initiated, then basic message writing must be completed before parameterized message writing, and program terminates after both operations complete.
  • Context - an input error number is provided and an error table exists with error numbers and corresponding text messages:
    For Error Code Lookup:
    When the system performs a sequential search through the error table starting from index 1 and incrementing by 1, then the search continues until either the input error number matches an error number in the table or an empty entry (spaces) is encountered indicating end of table.
  • Context - the error table search has completed and the input error number was found in the table:
    For Error Message Retrieval:
    When the error number at the current index position matches the input error number, then the system moves the corresponding error text from the table to the output message text field.
  • Context - the error table search has completed and the input error number was not found in the table:
    For Unknown Error Handling:
    When the error number at the current index position does not match the input error number, then the system moves the input error number to the unknown number field and moves the unknown message to the output message text field.
  • Context - the program gcx126 starts execution:
    For 1:Initialize Program Configuration:
    When initialization is performed, then set log index to 1, clear remark index, clear log array, clear previous crn, set all segment flags to not found, set cargo not found flag, initialize line counters, set from usercode to 'om01247', set accept status to 'ge', initialize all segment structures (m10, p4, v9, k1, x4, n7), retrieve admin table with table id 'ad' and sequence id 'adminid', if admin segment found then set merlin recipient to admin dc merlin 1 value, format machine date and time from system values, initialize date conversion parameters, convert machine date to julian format, read message queue, connect to mq manager, and open mq queue.
  • Context - mq connection is established and queue is open:
    For 2:Read EDI 350 Message from Queue:
    When mqget operation is performed, then read message into mqs-message buffer, calculate maximum mqs entries as (data length minus header length) divided by entry length rounded, if calculated entries exceed maximum constant then set to maximum constant value.
  • Context - an edi 350 message has been retrieved from the queue:
    For Message Available? and Message Valid?:
    When message status is evaluated, then if completion code is not ok and reason code is 2033 then set message not available flag, else if completion code is ok and backout count is not zero then set skip message flag, else if completion code is ok and maximum mqs entries is less than 1 then abort with error 'user abend 350 message too short', else if completion code is ok and backout count is zero then set good message found flag, else set end of queue flag.
  • Context - a valid edi 350 message has been loaded:
    For 3:Determine Message Type:
    When message header is examined, then if mqs cross-way header positions 1 through 10 equal '+++3505040' then set conveyance 350 flag to true, else set cargo 350 flag to true.
  • Context - message has been validated and type determined:
    For 4:Parse EDI Segments and Segment Type?:
    When each message line is processed, then if table id is 'st' then set header found and first x4 flags, else if table id is 'm10' then perform m10 segment processing, else if table id is 'p4' then perform p4 segment processing, else if table id is 'v9' then perform v9 segment processing, else if table id is 'vid' then continue, else if table id is 'k1' then perform k1 segment processing, else if table id is 'x4' then initialize k1 comments and perform x4 segment processing, else if table id is 'n7' then perform n7 segment processing, else if table id is 'se' then set trailer found and end found flags and perform rest of message processing.
  • Context - message line contains m10 segment identifier:
    For 5:Process M10 Notice Segment:
    When m10 segment is processed, then set m10 segment found flag to true, initialize m10 segment structure, and move table entry to m10 segment structure.
  • Context - message line contains p4 segment identifier:
    For 6:Process P4 Port Segment:
    When p4 segment is processed, then set p4 segment found flag to true, initialize p4 segment structure, and move table entry to p4 segment structure.
  • Context - message line contains v9 segment identifier:
    For 7:Process V9 Notice Reason Segment:
    When v9 segment is processed, then set v9 segment found flag to true, initialize v9 segment structure, and move table entry to v9 segment structure.
  • Context - message line contains k1 segment identifier:
    For 8:Process K1 Remarks Segment:
    When k1 segment is processed, then set k1 segment found flag to true, initialize k1 segment structure, move table entry to k1 segment structure, add 1 to k1 remark index, if k1 remark index exceeds maximum (50) then set index to maximum value, else move k1 segment to k1 remark array at current index position.
  • Context - message line contains n7 segment identifier:
    For 9:Process N7 Equipment Segment:
    When n7 segment is processed, then set n7 segment found flag to true, initialize n7 segment structure, move table entry to n7 segment structure, if n7 equipment number is not spaces then move equipment number to log data at current log index with type 'edi 350 eqp#:' and add 1 to log index.
  • Context - x4 segment is being processed and entry type code is '992' and conveyance 350 flag is true:
    For 10:Process Conveyance 350 Train Arrival and Train Found?:
    When x4 segment processing is performed, then if x4 release document id positions 1 through 25 equal previous crn then continue, else move x4 release document id positions 1 through 25 to b4 key value and previous crn, perform train lookup by crn, if train not found (status code not spaces) then prepare unknown train error message with crn, set line count to 4, set message type to unknown, and perform email send preparation, else if train found then move log information, format date and time from machine values, set action code to 'zzz', move crn to train or us ccn field, set cargo type to ca train, set message to '350 ack - arrival ack at border', and spawn log entry.
  • Context - train has been validated and x4 cbsa release reference id positions 1 through 25 are moved to cargo key value:
    For 11:Update Cargo Border Arrival Status:
    When cargo border update is performed, then perform cargo lookup by ccn, if cargo is found then set message to '350 ack - arrival ack at border', move cargo ccn key to current ccn key, perform log cargo info message, set cargo border arrival acknowledgment flag to true, clear status code, set accept status to spaces, and replace cargo record.
  • Context - cargo has been updated with border arrival and cargo is master manifest type:
    For 12:Process Master Manifest Border Arrival:
    When master manifest processing is performed, then move cargo ccn key to b0 ccn key, clear follower manifest array, set follower not end of database flag, set index to 1, perform until follower end of database or index exceeds 100: set accept status to 'gegb', call database with get next function for cargo using b0 qualifier, if status code is spaces and master manifest ccn equals x4 cbsa release reference id positions 1 through 25 then if cargo is follower manifest then move cargo ccn key to follower manifest array at index position and add 1 to index, else set follower end of database flag, subtract 1 from index, if index is less than or equal to zero then exit, else perform varying index from 1 by 1 until follower manifest at index is spaces or low values or index exceeds limit: move follower manifest ccn to cargo key value, perform cargo lookup, if cargo found then perform cargo border update.
  • Context - train lookup by crn has failed (status code is not spaces):
    For 13:Send Train Not Found Error:
    When error notification is prepared, then clear detail line 1, concatenate 'unknown train entry in edi 350 ' with x4 release document id positions 1 through 25 into detail line 1, move 'this crn was not found.' to detail line 3, set line count to 4, set message type to unknown, and perform email send preparation.
  • Context - se trailer segment has been processed and k1 segment found flag is true:
    For 14:Log K1 Remarks:
    When rest of message processing is performed, then perform varying index from 1 by 1 until index exceeds k1 remark index: if k1 remark for x4 at index is not spaces then initialize k1 segment, move k1 remark for x4 at index to k1 segment, clear info message, concatenate 'edi 350 k1: ' with k1 free form message 1 into info message, perform log cargo info message, if k1 free form message 2 is not spaces then clear info message, concatenate 'edi 350 k1: ' with k1 free form message 2 into info message, and perform log cargo info message.
  • Context - se trailer segment has been processed and n7 segment found flag is true:
    For 15:Log N7 Equipment Information:
    When rest of message processing is performed, then perform varying log index from 1 by 1 until log line at index is spaces or log index exceeds 50: clear info message, move log line at index to info message, and perform log cargo info message.
  • Context - m10 segment has been processed and contains ccn in positions 1 through 25:
    For 16:Lookup Cargo by CCN:
    When cargo lookup is performed, then move m10 ccn positions 1 through 25 to cargo key value, set accept status to 'ge', call database with get hold unique function for cargo using cargo qualifier, perform cargo switch setting, if cargo found then set accept status to 'ge' and call database with get hold unique function for cargo secondary using a2 qualifier, if status code is 'ge' then clear cargo secondary segment.
  • Context - cargo lookup has failed (cargo not found) and v9 notice reason indicates released:
    For 17:Handle Unknown Cargo Release:
    When unknown cargo processing is performed, then clear detail line 1, concatenate 'unknown edi 350 release from cbsa ' with m10 ccn positions 1 through 25 into detail line 1, move 'this ccn was not found.' to detail line 3, concatenate 'release number: ' with x4 cbsa release reference id positions 1 through 15, ' done by port ' with p4 port code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation.
  • Context - cargo lookup has failed (cargo not found) and v9 notice reason indicates deconsolidation:
    For 18:Handle Unknown Cargo Deconsolidation:
    When unknown cargo processing is performed, then clear detail line 1, concatenate 'unknown edi 350 dcon notice ' with m10 ccn positions 1 through 25 into detail line 1, move 'this ccn was not found.' to detail line 3, concatenate 'house bill close number' with x4 cbsa release reference id positions 1 through 25, ' done by port ' with p4 port code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation.
  • Context - cargo lookup has failed (cargo not found) and v9 notice reason is not released or deconsolidation:
    For 19:Handle Unknown Cargo Entry:
    When unknown cargo processing is performed, then clear detail line 1, concatenate 'unknown edi 350 entry from cbsa ' with m10 ccn positions 1 through 25 into detail line 1, move 'this ccn was not found.' to detail line 3, concatenate 'notice doc type: ' with m10 notice document type code, ' with reason code ' with v9 notice reason code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation.
  • Context - cargo has been found and v9 notice reason indicates not matched:
    For 20:Process Document Not Matched:
    When cargo processing is performed, then clear info message, move 'edi 350: doc not matched ' to info message, and perform log cargo info message.
  • Context - cargo has been found and v9 notice reason indicates cargo complete:
    For 21:Process Cargo Complete:
    When cargo processing is performed, then clear info message, move 'edi 350: cargo complete message ' to info message, and perform log cargo info message.
  • Context - cargo has been found and v9 notice reason indicates document package complete:
    For 22:Process Document Package Complete:
    When cargo processing is performed, then if x4 cbsa release reference id positions 1 through 15 not equal cargo broker entry positions 1 through 15 or x4 cbsa release reference id positions 1 through 14 not equal cargo customs transaction number positions 1 through 14, and x4 cbsa release reference id is not spaces, then move x4 cbsa release reference id positions 1 through 15 to cargo broker entry, move x4 cbsa release reference id positions 1 through 14 to cargo customs transaction number, move machine date to cargo broker date, move machine time positions 1 through 4 to cargo broker time, clear info message, concatenate 'edi 350: doc pkg complete : ' with x4 cbsa release reference id positions 1 through 15 into info message, perform log cargo info message, and perform cargo replace.
  • Context - cargo has been found and v9 notice reason indicates document not on file:
    For 23:Process Document Not On File:
    When cargo processing is performed, then clear info message, if x4 release document type code position 1 equals 'r' then concatenate 'edi 350: doc not on file for release ' with x4 cbsa release reference id positions 1 through 15 into info message and perform log cargo info message, else concatenate 'edi 350:doc not on file h-bill close ' with x4 cbsa release reference id positions 1 through 25 into info message and perform log cargo info message.
  • Context - cargo has been found and v9 notice reason indicates reported:
    For 24:Process Cargo Reported:
    When cargo processing is performed, then clear info message, concatenate 'edi 350: cargo reported ' into info message, and perform log cargo info message.
  • Context - cargo has been found and v9 notice reason indicates arrived:
    For 25:Process Cargo Arrived:
    When cargo processing is performed, then clear info message, concatenate 'edi 350: cargo arrived at port ' with p4 port code positions 1 through 4 into info message, and perform log cargo info message.
  • Context - cargo has been found and v9 notice reason indicates released:
    For 26:Process Cargo Release:
    When cargo processing is performed, then perform set release information, clear info message, concatenate 'edi 350: release : ' with x4 cbsa release reference id positions 1 through 15, ' at port ' with p4 port code positions 1 through 4 into info message, concatenate x4 cbsa release reference id positions 1 through 15, '/' with p4 port code positions 1 through 4 into cargo release reason, perform log cargo info message, perform process us manifest, move cargo release date to hold date, move cargo release time to hold time, perform cargo replace, if cargo is master manifest then save cargo segment, move cargo ccn key to b0 ccn key, set follower not end of database flag, perform process multi follower manifests, restore cargo segment, move cargo waybill key to save waybill index, and move cargo equipment car to current car id key.
  • Context - cargo has been found and v9 notice reason indicates authorized to deliver:
    For 27:Process Authorized to Deliver:
    When cargo processing is performed, then if cargo csa indicator is on then move 'edi 350: accepted - csa' to info message, perform log cargo info message, set cargo status to csa delivery, set cargo csa authorization to deliver received flag to true, and perform cargo replace, else move 'edi 350: not accepted - non-csa' to info message and perform log cargo info message, then perform process us manifest.
  • Context - cargo has been found and v9 notice reason indicates held:
    For 28:Process Cargo Hold:
    When cargo processing is performed, then clear info message, move 'edi 350: goods held for examination' to info message, perform log cargo info message, set cargo status to hold, perform cargo replace, if cargo ccn key positions 1 through 4 equal '6105' then perform merlin prepare hold notification.
  • Context - cargo has been found and v9 notice reason indicates deconsolidation:
    For 29:Process Deconsolidation Release:
    When cargo processing is performed, then perform set release information, clear info message, concatenate 'edi 350: release via decon at port ' with p4 port code positions 1 through 4 into info message, concatenate 'deconsolidation at ' with p4 port code positions 1 through 4 into cargo release reason, perform log cargo info message, perform process us manifest, move cargo release date to hold date, move cargo release time to hold time, perform cargo replace, if cargo is master manifest then save cargo segment, move cargo ccn key to b0 ccn key, set follower not end of database flag, perform process multi follower manifests, restore cargo segment, move cargo waybill key to save waybill index, and move cargo equipment car to current car id key.
  • Context - cargo is being released or deconsolidated:
    For 30:Set Release Information:
    When release information setting is performed, then clear cargo destination station number index, clear cargo destination station number for index, move machine date to cargo release date, move machine time to cargo release time, move acf2 user id to cargo release by, move 'released' to cargo current status, move 'r' to cargo release status, move 'a' to cargo release type, clear cargo release reason, clear cargo error or release status index, and clear cargo error status.
  • Context - canadian cargo has been released or authorized to deliver:
    For 31:Process Associated US Manifest:
    When us manifest processing is performed, then set us manifest not found flag, set not end of file flag, perform get unique us cargo by car and waybill, perform get next us cargo by car and waybill until us manifest found or end of file, if end of file then exit, else move log information, concatenate machine century with machine date into log date, move machine time to log time, move log use input message to action code, move us cargo ccn key to train or us ccn field, set cargo type to us cargo, concatenate 'cdn ccn rlsed by edi 350: ' with cargo ccn key into message, and perform spawn log entry.
  • Context - v9 notice reason indicates authorized to deliver:
    For 32:Process CSA Authorization:
    When csa authorization processing is performed, then if cargo csa indicator is on then move 'edi 350: accepted - csa' to info message, perform log cargo info message, set cargo status to csa delivery, set cargo csa authorization to deliver received flag to true, and perform cargo replace, else move 'edi 350: not accepted - non-csa' to info message and perform log cargo info message.
  • Context - master manifest has been released or deconsolidated:
    For 33:Process Follower Manifests:
    When multi follower processing is performed, then set accept status to 'gegb', clear follower manifest array, set index to 1, perform until follower end of database or index exceeds 100: call database with get next function for cargo using b0 qualifier, if status code is spaces and saved ccn equals master manifest ccn then if cargo is master manifest then continue else move cargo ccn key to follower manifest array at index and add 1 to index, else set follower end of database flag, subtract 1 from index, if index is less than or equal to zero then exit, else perform varying index from 1 by 1 until follower manifest at index is spaces or low values or index exceeds limit: move follower manifest ccn to cargo key value, perform cargo lookup, if cargo found then perform set release information, clear info message, if v9 released then concatenate 'edi 350: release : ' with x4 cbsa release reference id positions 1 through 15, ' at port ' with p4 port code positions 1 through 4 into info message and concatenate x4 cbsa release reference id positions 1 through 15, '/' with p4 port code positions 1 through 4 into cargo release reason, else concatenate 'edi 350: release via decon at port ' with p4 port code positions 1 through 4 into info message and concatenate 'deconsolidation at ' with p4 port code positions 1 through 4 into cargo release reason, move cargo ccn key to current ccn key, perform log cargo info message, move cargo waybill key to save waybill index, move cargo equipment car to current car id key, perform process us manifest, clear status code, set accept status to spaces, and call database with replace function for cargo.
  • Context - cargo has been placed on hold and ccn starts with 6105:
    For 34:Prepare Cargo Hold Email:
    When merlin hold preparation is performed, then clear detail line 1, concatenate 'cargo on hold for inspection by cbsa - edi350' into detail line 1, clear detail line 2, concatenate 'equipment : ' with cargo equipment id for index into detail line 3, concatenate 'waybill : ' with cargo ccn carrier index, cargo origin station number index, cargo waybill number index into detail line 4, concatenate 'ccn : ' with cargo ccn key into detail line 5, concatenate 'destination : ' with cargo destination station name, ', ' with cargo destination station state code into detail line 6, concatenate 'manifest upon : ' with cargo manifest to station name into detail line 7, set line count to 7, set message type to hold, and perform email send preparation.
  • Context - email notification has been prepared with message type and content:
    For 39:Send Email Notification:
    When email send preparation is performed, then if message type is error then concatenate 'customs received err msg ' with cargo ccn key into subject, else if message type is info then concatenate 'broker/manifest mismatch ' with cargo ccn key into subject, else if message type is hold then concatenate 'cbsa cargo hold - ' with cargo ccn key into subject, else move detail line 1 to subject, save current recipient and filename, clear recipient, if admin segment found then move admin dc merlin 1 to recipient 1 and admin dc merlin 5 to recipient 2, else move 'om01247' to recipient 1 and clear recipient 2, if keywords are spaces or low values then if cargo found and cargo ccn key not spaces then move cargo ccn key to keywords, else move current ccn key to keywords, if message type is unknown then move 'unknown' to filename, clear recipient, move 'om01247' to recipient 1, and perform call email send, else if message type is error then move 'caerror' to filename, perform call email send, move 'in' to filename, clear recipient, move 'om01247' to recipient 1, and perform call email send, else if message type is info then move 'in' to filename, clear recipient, move 'om01247' to recipient 1, and perform call email send, else if message type is unrelease then move 'in' to filename, perform call email send, clear recipient, perform fetch manifest station segment, if manifest station merlin id not spaces then move 'in' to filename, move manifest station merlin id to recipient 1, and perform call email send, else if message type is release then clear recipient, perform fetch manifest station segment, if manifest station merlin id not spaces then move 'in' to filename, move manifest station merlin id to recipient 1, and perform call email send, else if message type is hold then move 'cahold' to filename, clear recipient, move 'om01247' to recipient 1, and perform call email send, then perform reset report fields.
👨‍💻 Technical ACs (Gherkin)
Context: ISCOM structure exists with a SIT version field and CCCOM structure contains common area data
GIVEN
ISCOM structure exists with a SIT version field and CCCOM structure contains common area data
Applied to: 1:Version Check and Data Transfer
WHEN
The SIT version in ISCOM matches the working storage ISCOM version
THEN
Copy common area from CCCOM to ISCOM and update ISCOM SIT version to working storage version
Context: ISCOM structure exists with incompatible SIT version and CCCOM structure contains source data
GIVEN
ISCOM structure exists with incompatible SIT version and CCCOM structure contains source data
Applied to: 2:ISCOM Initialization
WHEN
The SIT version in ISCOM does not match the working storage ISCOM version
THEN
Initialize ISCOM with default values from ISCOMVAL, copy common area from CCCOM, and update SIT version
Context: CCCOM and ISCOM structures require cross-referencing for communication
GIVEN
CCCOM and ISCOM structures require cross-referencing for communication
Applied to: 3:Cross-Reference Address Setup
WHEN
ISCOM version mismatch triggers full initialization process
THEN
Set CCCOM address in ISCOM structure and set ISCOM address in CCCOM structure
Context: CCCOM contains LT-PCBS information and ISCOM requires PCB data
GIVEN
CCCOM contains LT-PCBS information and ISCOM requires PCB data
Applied to: 4:PCB Transfer
WHEN
Full ISCOM initialization is required due to version mismatch
THEN
Copy LT-PCBS data from CCCOM to ISCOM structure
Context: CCCOM table contains database entries with names and CCCOM-TABLE-SIZE defines maximum entries
GIVEN
CCCOM table contains database entries with names and CCCOM-TABLE-SIZE defines maximum entries
Applied to: 5:Database Name Scanning
WHEN
Database address scanning is initiated during ISCOM initialization
THEN
Process each CCCOM entry from position 1 until reaching table size limit or finding empty database name
Context: CCCOM entry contains database number field that may be empty or contain spaces
GIVEN
CCCOM entry contains database number field that may be empty or contain spaces
Applied to: 6:PCB Number Processing
WHEN
Processing a CCCOM database entry during scanning
THEN
Initialize ISCOM PCB number to zero, copy database number from CCCOM, and if database number is spaces then set CCCOM PCB number to '1'
Context: CCCOM entry has database name and ISCOM table contains database entries with names
GIVEN
CCCOM entry has database name and ISCOM table contains database entries with names
Applied to: 7:Database Name Matching
WHEN
Scanning ISCOM table for matching database names during address mapping
THEN
Process each ISCOM entry from position 1 until reaching table size limit or finding empty database name
Context: CCCOM database name matches ISCOM database name during scanning process
GIVEN
CCCOM database name matches ISCOM database name during scanning process
Applied to: 8:PCB Counter Management
WHEN
Database names are identical between CCCOM entry and ISCOM entry
THEN
Increment ISCOM PCB number by 1
Context: ISCOM PCB number equals CCCOM PCB number for matching database names
GIVEN
ISCOM PCB number equals CCCOM PCB number for matching database names
Applied to: 9:PCB Address Mapping
WHEN
PCB numbers match after incrementing ISCOM PCB counter
THEN
Set PCB address in ISCOM entry to match PCB address from corresponding CCCOM entry
Context: CCCOM structure exists with SIT version field and ISCOM structure contains source data
GIVEN
CCCOM structure exists with SIT version field and ISCOM structure contains source data
Applied to: 10:Reverse Conversion Version Check
WHEN
Reverse conversion entry point is accessed and CCCOM SIT version matches working storage CCCOM version
THEN
Copy common area from ISCOM to CCCOM and update CCCOM SIT version to working storage version
Context: CCCOM SIT version does not match working storage version and ISCOM contains source data
GIVEN
CCCOM SIT version does not match working storage version and ISCOM contains source data
Applied to: 11:Reverse Data Transfer
WHEN
Reverse conversion is initiated with version mismatch
THEN
Copy common area from ISCOM to CCCOM and update CCCOM SIT version to working storage version
Context: ISCOM contains LT-PCBS information and CCCOM requires PCB data during reverse conversion
GIVEN
ISCOM contains LT-PCBS information and CCCOM requires PCB data during reverse conversion
Applied to: 12:Reverse PCB Transfer
WHEN
CCCOM version mismatch triggers full reverse initialization
THEN
Copy LT-PCBS data from ISCOM to CCCOM structure and set up cross-reference addresses
Context: ISCOM table contains entries with PCB address fields that may be zero or non-zero
GIVEN
ISCOM table contains entries with PCB address fields that may be zero or non-zero
Applied to: 13:Active PCB Identification
WHEN
Scanning ISCOM entries during reverse conversion process
THEN
Process only entries where PCB address is not equal to zero
Context: ISCOM entry has non-zero PCB address and database name
GIVEN
ISCOM entry has non-zero PCB address and database name
Applied to: 14:PCB Sequence Numbering
WHEN
Processing active ISCOM entry during reverse conversion
THEN
Initialize ISCOM PCB number to 1 and count matching database names in previous entries to determine sequence number
Context: Active ISCOM entry contains database name and PCB information
GIVEN
Active ISCOM entry contains database name and PCB information
Applied to: 15:Database Entry Creation
WHEN
Processing ISCOM entry with non-zero PCB address during reverse conversion
THEN
Increment CCCOM entry counter and copy database name from ISCOM to CCCOM entry
Context: ISCOM entry contains PCB address and corresponding CCCOM entry has been created
GIVEN
ISCOM entry contains PCB address and corresponding CCCOM entry has been created
Applied to: 16:Reverse PCB Address Mapping
WHEN
Creating CCCOM database entry from active ISCOM entry
THEN
Set PCB address in CCCOM entry to match PCB address from ISCOM entry
Context: ISCOM PCB number has been calculated for database entry and CCCOM entry requires database number
GIVEN
ISCOM PCB number has been calculated for database entry and CCCOM entry requires database number
Applied to: 17:Database Number Assignment
WHEN
Finalizing CCCOM database entry creation during reverse conversion
THEN
If ISCOM PCB number equals '1' then set CCCOM database number to spaces, otherwise set CCCOM database number to ISCOM PCB number value
Context: A message processing operation is initiated
GIVEN
A message processing operation is initiated
Applied to: 1:Initialize Program Control
WHEN
The system begins message processing
THEN
The current program name is saved and the module name becomes the active program identifier
Context: A new IH notification needs to be processed
GIVEN
A new IH notification needs to be processed
Applied to: 2:Prepare IH Notification Data
WHEN
The notification data structure is being prepared
THEN
The input structure is initialized and security byte is set to high values for maximum security
Context: IH notification data is prepared with security controls
GIVEN
IH notification data is prepared with security controls
Applied to: 3:Format CCN Status Message
WHEN
The CCN status message is being formatted
THEN
The 91-byte input data is moved to positions 2-91 of the message structure and the formatted input is copied to the message area
Context: A CCN status message is formatted and ready for processing
GIVEN
A CCN status message is formatted and ready for processing
Applied to: 3:Format CCN Status Message
WHEN
The message is prepared for transmission
THEN
The accept status is set to spaces to indicate a cleared/ready state
Context: A formatted CCN status message with cleared accept status
GIVEN
A formatted CCN status message with cleared accept status
Applied to: 4:Send Initial IMS Message
WHEN
The message is sent for initial processing
THEN
The CIMS service is invoked with change operation parameters to process the message
Context: A message has been processed through initial IMS processing
GIVEN
A message has been processed through initial IMS processing
Applied to: 5:Write Message Log
WHEN
The message logging is performed
THEN
The WRITMSGL service is invoked with message code, content, length, and module name for complete audit logging
Context: A message has been processed and logged successfully
GIVEN
A message has been processed and logged successfully
Applied to: 6:Purge IMS Message
WHEN
The cleanup operation is performed
THEN
The CIMS service is invoked with purge operation to remove the processed message from the system
Context: A user requests a database operation with a function code
GIVEN
A user requests a database operation with a function code
Applied to: 4:Set SSA Type for Get Operations
WHEN
The function code is GHU (Get Hold Unique) or GU (Get Unique)
THEN
The system sets accept status to GE and configures qualified SSA for precise record targeting
Applied to: 5:Set SSA Type for Next Operations
WHEN
The function code is GHN, GHNP, GN, or GNP (sequential navigation operations)
THEN
The system sets accept status to GAGBGEGK and determines SSA qualification based on unqualified SSA flag setting
Applied to: 6:Set SSA Type for Insert Operations
WHEN
The function code is ISRT (Insert)
THEN
The system sets accept status to II and configures unqualified SSA for record insertion
Applied to: 7:Set SSA Type for Update/Delete Operations
WHEN
The function code is DLET (Delete) or REPL (Replace)
THEN
The system configures no SSA requirement for the modification operation
Applied to: 3:Validate Function Code
WHEN
The function code is not GHU, GU, GHN, GHNP, GN, GNP, ISRT, DLET, or REPL
THEN
The system marks the operation as not valid and prevents further processing
Context: A validated operation targets the root segment GCSTBRT
GIVEN
A validated operation targets the root segment GCSTBRT
Applied to: 8:Initialize Root Segment SSA
WHEN
The SSA flag indicates qualified search is required
THEN
The system sets the root segment key value for targeted access
Context: A validated operation targets the dependent segment GCSTBDP with qualified SSA
GIVEN
A validated operation targets the dependent segment GCSTBDP with qualified SSA
Applied to: 9:Initialize Dependent Segment SSA
WHEN
The unqualified SSA flag is not set
THEN
The system sets both root segment key value and dependent segment key value for hierarchical access
Context: A validated operation targets the dependent segment GCSTBDP
GIVEN
A validated operation targets the dependent segment GCSTBDP
Applied to: 10:Handle Dependent Segment Unqualified Access
WHEN
Either the unqualified SSA flag is set or the SSA flag indicates unqualified search
THEN
The system sets only the root segment key value and configures unqualified SSA for broader search scope
Context: A validated operation specifies a segment name
GIVEN
A validated operation specifies a segment name
Applied to: 9:Initialize Dependent Segment SSA
WHEN
The segment name is neither GCSTBRT (root) nor GCSTBDP (dependent)
THEN
The system marks the operation as not valid and prevents database access
Context: A validated operation targets the root segment with initialized SSA
GIVEN
A validated operation targets the root segment with initialized SSA
Applied to: 11:Route Root Segment Access
WHEN
The operation is ready for database access
THEN
The system routes to primary PCB if second PCB flag is not set, otherwise routes to secondary PCB
Context: A validated operation targets the dependent segment with initialized SSA
GIVEN
A validated operation targets the dependent segment with initialized SSA
Applied to: 14:Route Dependent Segment Access
WHEN
The operation is ready for database access
THEN
The system routes to primary PCB if second PCB flag is not set, otherwise routes to secondary PCB
Context: A root segment operation is routed to primary PCB
GIVEN
A root segment operation is routed to primary PCB
Applied to: 12:Execute Root Segment Database Call with Primary PCB
WHEN
The SSA configuration determines the call parameters
THEN
The system calls CIMS with appropriate SSA parameters: qualified SSA for targeted access, unqualified SSA for broader access, or no SSA for direct operations
Context: A root segment operation is routed to secondary PCB
GIVEN
A root segment operation is routed to secondary PCB
Applied to: 13:Execute Root Segment Database Call with Secondary PCB
WHEN
The SSA configuration determines the call parameters
THEN
The system calls CIMS with secondary PCB and appropriate SSA parameters: qualified SSA for targeted access, unqualified SSA for broader access, or no SSA for direct operations
Context: A dependent segment operation is routed to primary PCB
GIVEN
A dependent segment operation is routed to primary PCB
Applied to: 15:Execute Dependent Segment Database Call with Primary PCB
WHEN
The SSA configuration determines the call parameters
THEN
The system calls CIMS with hierarchical SSA parameters: both root and dependent qualified SSAs for targeted access, root qualified and dependent unqualified SSAs for mixed access, or no SSA for direct operations
Context: A dependent segment operation is routed to secondary PCB
GIVEN
A dependent segment operation is routed to secondary PCB
Applied to: 16:Execute Dependent Segment Database Call with Secondary PCB
WHEN
The SSA configuration determines the call parameters
THEN
The system calls CIMS with secondary PCB and hierarchical SSA parameters: both root and dependent qualified SSAs for targeted access, root qualified and dependent unqualified SSAs for mixed access, or no SSA for direct operations
Context: A database operation has been executed through CIMS
GIVEN
A database operation has been executed through CIMS
Applied to: 17:Evaluate Operation Success
WHEN
The operation completes and returns a status code
THEN
The system sets return flag to SUCCESSFUL if status code is spaces, otherwise sets return flag to UNSUCCESSFUL
Context: A cargo processing request is received with a segment name
GIVEN
A cargo processing request is received with a segment name
Applied to: 1:Parameter Validation
WHEN
The segment name is not one of GCSUSRT, GCSA2RT, GCSA8RT, or GCST2RT
THEN
The system rejects the request with error code 0012 and message 'SEGMENT NAME INVALID'
Context: A cargo processing request is received with a function code
GIVEN
A cargo processing request is received with a function code
Applied to: 1:Parameter Validation
WHEN
The function code is not GU, GN, ISRT, REPL, or DLET
THEN
The system rejects the request with error code 0012 and message 'FUNCTION CODE INVALID'
Context: A request targets GCST2RT segment
GIVEN
A request targets GCST2RT segment
Applied to: 1:Parameter Validation
WHEN
The function code is not GU (Get Unique)
THEN
The system rejects the request with error code 0012 and message 'INVALID FUNCTION CODE'
Context: A cargo processing request is received
GIVEN
A cargo processing request is received
Applied to: 1:Parameter Validation
WHEN
The operator field is empty or contains spaces
THEN
The system sets the operator to equals (=) as default
Context: A validated cargo processing request
GIVEN
A validated cargo processing request
Applied to: Segment Type?
WHEN
The segment type is GCSUSRT, GCSA2RT, GCSA8RT, or GCST2RT
THEN
The system routes to primary, secondary, message, or table processing respectively
Context: A cargo record modification request
GIVEN
A cargo record modification request
Applied to: Function Code?
WHEN
The function code is ISRT, DLET, REPL, or ZAP
THEN
The system sets the update-by-module field to the current transaction code
Context: A new cargo record is being inserted
GIVEN
A new cargo record is being inserted
Applied to: 2:Primary Cargo Record Insert
WHEN
The creation timestamp field is empty
THEN
The system sets creation date, time, terminal, and user ID from current system values and copies to last-modify fields
Context: A cargo record is being inserted
GIVEN
A cargo record is being inserted
Applied to: 2:Primary Cargo Record Insert
WHEN
The creation timestamp field already contains data
THEN
The system updates only the last-modify date, time, terminal, and user ID with current system values
Context: A cargo record index update is requested
GIVEN
A cargo record index update is requested
Applied to: 6:Index Field Management
WHEN
The cargo status indicates the record is deleted
THEN
The system skips all index field setting operations
Context: A cargo record requires bond number indexing
GIVEN
A cargo record requires bond number indexing
Applied to: 18:Bond Control Number Processing
WHEN
In-bond control number exists, use it; else if entry number exists, use entry number; else set to spaces
THEN
The system sets the bond index field according to the priority hierarchy
Context: A cargo record deletion is requested
GIVEN
A cargo record deletion is requested
Applied to: 4:Primary Cargo Record Delete
WHEN
The delete operation is initiated
THEN
The system retrieves the record, blanks index fields, sets status to DELETED, and updates the record
Context: A cargo record replacement is requested
GIVEN
A cargo record replacement is requested
Applied to: 3:Primary Cargo Record Update
WHEN
The replace operation is performed
THEN
The system updates last-modify date, time, terminal, and user ID with current system values
Context: A cargo record status update is processed
GIVEN
A cargo record status update is processed
Applied to: 14:GCSB1RT Index Database Management
WHEN
The cargo has no error conditions and no hold conditions (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA)
THEN
The system deletes the cargo record from the GCSB1RT status index
Context: A cargo record has error or pending status
GIVEN
A cargo record has error or pending status
Applied to: 14:GCSB1RT Index Database Management
WHEN
The cargo status indicates CPCARGO-ERROR, CPCARGO-PENDING, or USCARGO-ERROR
THEN
The system fills error fields and either updates existing status record or inserts new status record
Context: A cargo record has hold status
GIVEN
A cargo record has hold status
Applied to: 14:GCSB1RT Index Database Management
WHEN
The cargo status indicates any hold condition (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA)
THEN
The system fills hold fields and either updates existing status record or inserts new status record
Context: A cargo search request with secondary index specified
GIVEN
A cargo search request with secondary index specified
Applied to: 8:Secondary Index Processing
WHEN
The index type is CAR-ID, WAYBILL, CAR-WB, BOND, MANIFEST, DEST, LEAD-CCN, HELD-DEST, HELD-BORDER, ERR-ORIG, ERR-BORDER, or ERR-DEST
THEN
The system routes to the appropriate index processing for that search type
Context: A secondary cargo data operation is requested
GIVEN
A secondary cargo data operation is requested
Applied to: 11:Secondary Database Processing
WHEN
For REPL function: if record exists and new data is empty, delete; if record exists and new data has content, replace; if record not found and new data has content, insert
THEN
The system performs the appropriate database operation based on the content and existence logic
Context: A cargo status change triggers notification processing
GIVEN
A cargo status change triggers notification processing
Applied to: 15:Iron Highway Notification Processing
WHEN
Both US cargo status and CP cargo status are empty, or the status matches the previous notification, or the status is RELEASE
THEN
The system skips sending the notification
Context: A cargo status notification is being prepared
GIVEN
A cargo status notification is being prepared
Applied to: 15:Iron Highway Notification Processing
WHEN
US cargo status is empty and CP status is SENT, use SENT; for DELETED or RELEASE status, always process; otherwise use US cargo short description
THEN
The system selects the appropriate status value according to the priority rules
Context: A cargo status code needs to be displayed or processed
GIVEN
A cargo status code needs to be displayed or processed
Applied to: 7:Cargo Status Description Setting
WHEN
The internal status is OK, PENDING, ACKNWLG, ERROR, SENT, DELETED, DELPEND, RELSD, ARRIVAL, AARR, EXPORT, AEXP, IMED-EX, or XFERED
THEN
The system maps to corresponding business descriptions: OK, PENDING, ACK, ERROR, SENT, DELETED, DELPEND, RELEASED, MNL-ARRV, AUT-ARRV, MNL-EXP, AUT-EXP, IMED-EXP, XFERED respectively
Context: A secondary segment retrieval operation is requested
GIVEN
A secondary segment retrieval operation is requested
Applied to: 11:Secondary Database Processing
WHEN
The function is GU or GN and the secondary key is empty or spaces
THEN
The system returns error code 0012 with message 'SECN-KEY EQUAL SPACES'
Context: A GCSA8RT message segment retrieval operation is requested
GIVEN
A GCSA8RT message segment retrieval operation is requested
Applied to: 12:GCSA8RT Message Processing
WHEN
The function is GU or GN and the GCSA8RT key is empty or spaces
THEN
The system returns error code 0012 with message 'GCSA8RT-KEY EQUAL SPACES'
Context: A GCSA8RT message segment insert operation is requested
GIVEN
A GCSA8RT message segment insert operation is requested
Applied to: 12:GCSA8RT Message Processing
WHEN
A record with the same key already exists, perform replace operation; if no existing record, perform insert operation
THEN
The system executes the appropriate database operation and restructures the message data format
Context: A cargo notification requires shipment reference information
GIVEN
A cargo notification requires shipment reference information
Applied to: 16:Reference Number Processing
WHEN
N9 reference segments exist for the cargo with qualifier 'CN'
THEN
The system extracts the reference number as shipment ID for the notification
Context: A cargo operation requires station or border information
GIVEN
A cargo operation requires station or border information
Applied to: 19:Station Code Processing
WHEN
The system needs to resolve location codes to station numbers
THEN
The system retrieves station information from GCSTBRT table segments using location ID
Context: A cargo status change is requested
GIVEN
A cargo status change is requested
Applied to: 20:Cargo Status Transition Management
WHEN
The new status represents a valid business transition from the current status
THEN
The system updates the cargo status and triggers appropriate downstream processing including notifications and index updates
Context: The error processing program starts execution
GIVEN
The error processing program starts execution
Applied to: 4:Common Error Processing - Call DCCCOM
WHEN
The program begins error handling workflow
THEN
The common communication area CCCOM is initialized through DCCCOM service
Context: The common communication area has been initialized
GIVEN
The common communication area has been initialized
Applied to: 3:Dump Only Check - WS-DUMP-ONLY?
WHEN
The system checks the dump-only mode flag WS-DUMP-ONLY
THEN
If WS-DUMP-ONLY is true, skip environment-specific error handling and proceed directly to error notification; if WS-DUMP-ONLY is false, continue with environment detection
Context: The system is not in dump-only mode and environment detection is required
GIVEN
The system is not in dump-only mode and environment detection is required
Applied to: 2:Environment Detection - CC-PROD-TEST-IMS = WS-PROD?
WHEN
The system compares CC-PROD-TEST-IMS with WS-PROD value
THEN
If CC-PROD-TEST-IMS equals WS-PROD, route to production error handling; otherwise route to test error handling
Context: The system has detected production environment (CC-PROD-TEST-IMS equals WS-PROD)
GIVEN
The system has detected production environment (CC-PROD-TEST-IMS equals WS-PROD)
Applied to: 5:Production Error Handling - Call CERRPROD
WHEN
Production error handling is required
THEN
The CERRPROD service is invoked with CCCOM communication area to handle production-specific error processing
Context: The system has detected test environment (CC-PROD-TEST-IMS does not equal WS-PROD)
GIVEN
The system has detected test environment (CC-PROD-TEST-IMS does not equal WS-PROD)
Applied to: 6:Test Error Handling - Call CERRTEST
WHEN
Test error handling is required
THEN
The CERRTEST service is invoked with CCCOM communication area to handle test-specific error processing
Context: Error processing has completed (either environment-specific handling or dump-only mode)
GIVEN
Error processing has completed (either environment-specific handling or dump-only mode)
Applied to: 7:Error Notification Display - Display blocking error message
WHEN
Error notification is required
THEN
Display blocking error message with header and footer delimiters to system error output (SYSERR)
Context: All error processing steps and notifications have been completed
GIVEN
All error processing steps and notifications have been completed
Applied to: 8:Program Termination - Return control
WHEN
The error processing workflow reaches completion
THEN
Return control to the calling program using GOBACK statement
Context: A CIMS program is invoked with linkage parameters
GIVEN
A CIMS program is invoked with linkage parameters
Applied to: 1:Parameter Address Linkage Setup
WHEN
The system processes the parameter count and argument addresses
THEN
Memory addresses are established for CCCOM, FUNC, and ADDR-AREA parameters and the argument count is stored for subsequent processing
Context: Parameter addresses are established and argument count is available
GIVEN
Parameter addresses are established and argument count is available
Applied to: 2:Function and SSA Parameter Processing
WHEN
The system processes parameters 4 through 10 representing IO-AREA and SSA1 through SSA6
THEN
Function code is stored in CCCOM last IMS function, SSA parameters are mapped to their respective addresses and stored in CCCOM last SSA fields, and IO-AREA address is established when 4 or more arguments are provided
Context: CCCOM ISCOM address is not null and not blank pointer
GIVEN
CCCOM ISCOM address is not null and not blank pointer
Applied to: 3:ISCOM Address Validation
WHEN
The system checks ISCOM address availability
THEN
ISCOM address is established for subsequent processing
Context: CCCOM structure is available with version information
GIVEN
CCCOM structure is available with version information
Applied to: 4:CCCOM Version Compatibility Check
WHEN
The system compares CCCOM SIT version with working storage CCCOM version
THEN
ISCOM compatibility check is performed only when versions match
Context: ADDR-AREA is not null, PCB address is valid, CCCOM version is compatible, and PCB copy is available
GIVEN
ADDR-AREA is not null, PCB address is valid, CCCOM version is compatible, and PCB copy is available
Applied to: 5:PCB Address Reset Logic
WHEN
Segment level is not '98' or '99' OR force reset flag is true
THEN
First 8 positions of ADDR-AREA are cleared with spaces
Context: PCB address is null or blank pointer
GIVEN
PCB address is null or blank pointer
Applied to: 6:PCB Address Resolution
WHEN
The system searches through up to 249 database name entries
THEN
Search continues until valid PCB address is found, maximum entries reached, or database name entry is spaces, and matching PCB address is retrieved when database name matches table entry
Context: PCB address resolution process is completed
GIVEN
PCB address resolution process is completed
Applied to: 7:PCB Address Validation
WHEN
PCB address remains null after resolution attempts
THEN
Error message is generated with PCB name and number information and error handling routine CERR is invoked
Context: Valid PCB address exists, function code is available, and all SSA parameters are processed
GIVEN
Valid PCB address exists, function code is available, and all SSA parameters are processed
Applied to: 8:IMS Function Call Execution
WHEN
The system invokes CBLTDLI with function, PCB copy, IO area, and SSA parameters
THEN
IMS database operation is executed and control returns with status information in PCB
Context: IMS function call is completed
GIVEN
IMS function call is completed
Applied to: 9:IO PCB Date Time Refresh
WHEN
Function is 'GU' (Get Unique) AND PCB address equals CCCOM IO PCB address
THEN
IMS call counter is reset to zero, current system date is obtained and stored in CCCOM machine century and date fields, and current system time is captured and stored in CCCOM machine time field
Context: IMS function call is executed
GIVEN
IMS function call is executed
Applied to: 10:IMS Call Counter Management
WHEN
Any IMS database operation is performed
THEN
IMS call counter in CCCOM is incremented by 1
Context: IMS call counter is updated and PCB copy is available
GIVEN
IMS call counter is updated and PCB copy is available
Applied to: 11:PCB Status Information Update
WHEN
PCB information needs to be synchronized with CCCOM
THEN
PCB copy is moved to CCCOM copy of PCB field and feedback key length is updated in CCCOM when segment level is not '98' or '99'
Context: PCB status information is updated
GIVEN
PCB status information is updated
Applied to: 12:Terminal and User Information Capture
WHEN
Function is 'GU' (Get Unique) OR 'CHKP' (Checkpoint) AND PCB address equals CCCOM IO PCB address
THEN
CCCOM LTERM name is copied to CCCOM original LTERM field and CCCOM user ID is copied to CCCOM ACF2 user ID field
Context: IMS operation is completed with status code in CCCOM
GIVEN
IMS operation is completed with status code in CCCOM
Applied to: 13:Status Code Validation
WHEN
Status code is not blank (spaces)
THEN
Status code is compared against up to 12 acceptable status codes in CCCOM acceptable status table
Context: Status code validation is completed
GIVEN
Status code validation is completed
Applied to: 14:Error Message Generation
WHEN
Status code is not found in acceptable status code table after checking all 12 entries
THEN
Error message is constructed with status code and 'IMS RC CODE NOT IN ACCEPTABLE LIST' text, error message is stored in CCCOM error message field, and error handling routine CERR is invoked
Context: IMS operation completed successfully with blank status code OR acceptable status code found
GIVEN
IMS operation completed successfully with blank status code OR acceptable status code found
Applied to: 18:Common Area Synchronization
WHEN
CCCOM ISCOM address is not null and not blank pointer
THEN
CCCOM common area is copied to ISCOM common area to maintain data consistency
Context: The program has started execution
GIVEN
The program has started execution
Applied to: 1:Message Writing Initialization
WHEN
The message writing initialization is triggered
THEN
The basic message writing function WRITMSG is invoked
Context: The basic message writing has been completed and six parameters P1, P2, P3, P4, P5, P6 are available
GIVEN
The basic message writing has been completed and six parameters P1, P2, P3, P4, P5, P6 are available
Applied to: 2:Parameterized Message Writing
WHEN
The parameterized message writing is triggered
THEN
The extended message writing function WRITMSGX is invoked with parameters P1, P2, P3, P4, P5, P6
Context: The program execution begins
GIVEN
The program execution begins
Applied to: Program Start to Program End
WHEN
Message processing workflow is initiated
THEN
Basic message writing must be completed before parameterized message writing, and program terminates after both operations complete
Context: An input error number is provided and an error table exists with error numbers and corresponding text messages
GIVEN
An input error number is provided and an error table exists with error numbers and corresponding text messages
Applied to: Error Code Lookup
WHEN
The system performs a sequential search through the error table starting from index 1 and incrementing by 1
THEN
The search continues until either the input error number matches an error number in the table OR an empty entry (spaces) is encountered indicating end of table
Context: The error table search has completed and the input error number was found in the table
GIVEN
The error table search has completed and the input error number was found in the table
Applied to: Error Message Retrieval
WHEN
The error number at the current index position matches the input error number
THEN
The system moves the corresponding error text from the table to the output message text field
Context: The error table search has completed and the input error number was not found in the table
GIVEN
The error table search has completed and the input error number was not found in the table
Applied to: Unknown Error Handling
WHEN
The error number at the current index position does not match the input error number
THEN
The system moves the input error number to the unknown number field AND moves the unknown message to the output message text field
Context: The program GCX126 starts execution
GIVEN
The program GCX126 starts execution
Applied to: 1:Initialize Program Configuration
WHEN
Initialization is performed
THEN
Set log index to 1, clear remark index, clear log array, clear previous CRN, set all segment flags to not found, set cargo not found flag, initialize line counters, set from usercode to 'OM01247', set accept status to 'GE', initialize all segment structures (M10, P4, V9, K1, X4, N7), retrieve admin table with table ID 'AD' and sequence ID 'ADMINID', if admin segment found then set Merlin recipient to admin DC Merlin 1 value, format machine date and time from system values, initialize date conversion parameters, convert machine date to Julian format, read message queue, connect to MQ manager, and open MQ queue
Context: MQ connection is established and queue is open
GIVEN
MQ connection is established and queue is open
Applied to: 2:Read EDI 350 Message from Queue
WHEN
MQGET operation is performed
THEN
Read message into MQS-MESSAGE buffer, calculate maximum MQS entries as (data length minus header length) divided by entry length rounded, if calculated entries exceed maximum constant then set to maximum constant value
Context: An EDI 350 message has been retrieved from the queue
GIVEN
An EDI 350 message has been retrieved from the queue
Applied to: Message Available? and Message Valid?
WHEN
Message status is evaluated
THEN
If completion code is not OK and reason code is 2033 then set message not available flag, else if completion code is OK and backout count is not zero then set skip message flag, else if completion code is OK and maximum MQS entries is less than 1 then abort with error 'USER ABEND 350 MESSAGE TOO SHORT', else if completion code is OK and backout count is zero then set good message found flag, else set end of queue flag
Context: A valid EDI 350 message has been loaded
GIVEN
A valid EDI 350 message has been loaded
Applied to: 3:Determine Message Type
WHEN
Message header is examined
THEN
If MQS cross-way header positions 1 through 10 equal '+++3505040' then set conveyance 350 flag to true, else set cargo 350 flag to true
Context: Message has been validated and type determined
GIVEN
Message has been validated and type determined
Applied to: 4:Parse EDI Segments and Segment Type?
WHEN
Each message line is processed
THEN
If table ID is 'ST' then set header found and first X4 flags, else if table ID is 'M10' then perform M10 segment processing, else if table ID is 'P4' then perform P4 segment processing, else if table ID is 'V9' then perform V9 segment processing, else if table ID is 'VID' then continue, else if table ID is 'K1' then perform K1 segment processing, else if table ID is 'X4' then initialize K1 comments and perform X4 segment processing, else if table ID is 'N7' then perform N7 segment processing, else if table ID is 'SE' then set trailer found and end found flags and perform rest of message processing
Context: Message line contains M10 segment identifier
GIVEN
Message line contains M10 segment identifier
Applied to: 5:Process M10 Notice Segment
WHEN
M10 segment is processed
THEN
Set M10 segment found flag to true, initialize M10 segment structure, and move table entry to M10 segment structure
Context: Message line contains P4 segment identifier
GIVEN
Message line contains P4 segment identifier
Applied to: 6:Process P4 Port Segment
WHEN
P4 segment is processed
THEN
Set P4 segment found flag to true, initialize P4 segment structure, and move table entry to P4 segment structure
Context: Message line contains V9 segment identifier
GIVEN
Message line contains V9 segment identifier
Applied to: 7:Process V9 Notice Reason Segment
WHEN
V9 segment is processed
THEN
Set V9 segment found flag to true, initialize V9 segment structure, and move table entry to V9 segment structure
Context: Message line contains K1 segment identifier
GIVEN
Message line contains K1 segment identifier
Applied to: 8:Process K1 Remarks Segment
WHEN
K1 segment is processed
THEN
Set K1 segment found flag to true, initialize K1 segment structure, move table entry to K1 segment structure, add 1 to K1 remark index, if K1 remark index exceeds maximum (50) then set index to maximum value, else move K1 segment to K1 remark array at current index position
Context: Message line contains N7 segment identifier
GIVEN
Message line contains N7 segment identifier
Applied to: 9:Process N7 Equipment Segment
WHEN
N7 segment is processed
THEN
Set N7 segment found flag to true, initialize N7 segment structure, move table entry to N7 segment structure, if N7 equipment number is not spaces then move equipment number to log data at current log index with type 'EDI 350 EQP#:' and add 1 to log index
Context: X4 segment is being processed and entry type code is '992' and conveyance 350 flag is true
GIVEN
X4 segment is being processed and entry type code is '992' and conveyance 350 flag is true
Applied to: 10:Process Conveyance 350 Train Arrival and Train Found?
WHEN
X4 segment processing is performed
THEN
If X4 release document ID positions 1 through 25 equal previous CRN then continue, else move X4 release document ID positions 1 through 25 to B4 key value and previous CRN, perform train lookup by CRN, if train not found (status code not spaces) then prepare unknown train error message with CRN, set line count to 4, set message type to unknown, and perform email send preparation, else if train found then move log information, format date and time from machine values, set action code to 'ZZZ', move CRN to train or US CCN field, set cargo type to CA train, set message to '350 ACK - ARRIVAL ACK AT BORDER', and spawn log entry
Context: Train has been validated and X4 CBSA release reference ID positions 1 through 25 are moved to cargo key value
GIVEN
Train has been validated and X4 CBSA release reference ID positions 1 through 25 are moved to cargo key value
Applied to: 11:Update Cargo Border Arrival Status
WHEN
Cargo border update is performed
THEN
Perform cargo lookup by CCN, if cargo is found then set message to '350 ACK - ARRIVAL ACK AT BORDER', move cargo CCN key to current CCN key, perform log cargo info message, set cargo border arrival acknowledgment flag to true, clear status code, set accept status to spaces, and replace cargo record
Context: Cargo has been updated with border arrival and cargo is master manifest type
GIVEN
Cargo has been updated with border arrival and cargo is master manifest type
Applied to: 12:Process Master Manifest Border Arrival
WHEN
Master manifest processing is performed
THEN
Move cargo CCN key to B0 CCN key, clear follower manifest array, set follower not end of database flag, set index to 1, perform until follower end of database or index exceeds 100: set accept status to 'GEGB', call database with get next function for cargo using B0 qualifier, if status code is spaces and master manifest CCN equals X4 CBSA release reference ID positions 1 through 25 then if cargo is follower manifest then move cargo CCN key to follower manifest array at index position and add 1 to index, else set follower end of database flag, subtract 1 from index, if index is less than or equal to zero then exit, else perform varying index from 1 by 1 until follower manifest at index is spaces or low values or index exceeds limit: move follower manifest CCN to cargo key value, perform cargo lookup, if cargo found then perform cargo border update
Context: Train lookup by CRN has failed (status code is not spaces)
GIVEN
Train lookup by CRN has failed (status code is not spaces)
Applied to: 13:Send Train Not Found Error
WHEN
Error notification is prepared
THEN
Clear detail line 1, concatenate 'UNKNOWN TRAIN ENTRY IN EDI 350 ' with X4 release document ID positions 1 through 25 into detail line 1, move 'THIS CRN WAS NOT FOUND.' to detail line 3, set line count to 4, set message type to unknown, and perform email send preparation
Context: SE trailer segment has been processed and K1 segment found flag is true
GIVEN
SE trailer segment has been processed and K1 segment found flag is true
Applied to: 14:Log K1 Remarks
WHEN
Rest of message processing is performed
THEN
Perform varying index from 1 by 1 until index exceeds K1 remark index: if K1 remark for X4 at index is not spaces then initialize K1 segment, move K1 remark for X4 at index to K1 segment, clear info message, concatenate 'EDI 350 K1: ' with K1 free form message 1 into info message, perform log cargo info message, if K1 free form message 2 is not spaces then clear info message, concatenate 'EDI 350 K1: ' with K1 free form message 2 into info message, and perform log cargo info message
Context: SE trailer segment has been processed and N7 segment found flag is true
GIVEN
SE trailer segment has been processed and N7 segment found flag is true
Applied to: 15:Log N7 Equipment Information
WHEN
Rest of message processing is performed
THEN
Perform varying log index from 1 by 1 until log line at index is spaces or log index exceeds 50: clear info message, move log line at index to info message, and perform log cargo info message
Context: M10 segment has been processed and contains CCN in positions 1 through 25
GIVEN
M10 segment has been processed and contains CCN in positions 1 through 25
Applied to: 16:Lookup Cargo by CCN
WHEN
Cargo lookup is performed
THEN
Move M10 CCN positions 1 through 25 to cargo key value, set accept status to 'GE', call database with get hold unique function for cargo using cargo qualifier, perform cargo switch setting, if cargo found then set accept status to 'GE' and call database with get hold unique function for cargo secondary using A2 qualifier, if status code is 'GE' then clear cargo secondary segment
Context: Cargo lookup has failed (cargo not found) and V9 notice reason indicates released
GIVEN
Cargo lookup has failed (cargo not found) and V9 notice reason indicates released
Applied to: 17:Handle Unknown Cargo Release
WHEN
Unknown cargo processing is performed
THEN
Clear detail line 1, concatenate 'UNKNOWN EDI 350 RELEASE FROM CBSA ' with M10 CCN positions 1 through 25 into detail line 1, move 'THIS CCN WAS NOT FOUND.' to detail line 3, concatenate 'RELEASE NUMBER: ' with X4 CBSA release reference ID positions 1 through 15, ' DONE BY PORT ' with P4 port code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation
Context: Cargo lookup has failed (cargo not found) and V9 notice reason indicates deconsolidation
GIVEN
Cargo lookup has failed (cargo not found) and V9 notice reason indicates deconsolidation
Applied to: 18:Handle Unknown Cargo Deconsolidation
WHEN
Unknown cargo processing is performed
THEN
Clear detail line 1, concatenate 'UNKNOWN EDI 350 DCON NOTICE ' with M10 CCN positions 1 through 25 into detail line 1, move 'THIS CCN WAS NOT FOUND.' to detail line 3, concatenate 'HOUSE BILL CLOSE NUMBER' with X4 CBSA release reference ID positions 1 through 25, ' DONE BY PORT ' with P4 port code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation
Context: Cargo lookup has failed (cargo not found) and V9 notice reason is not released or deconsolidation
GIVEN
Cargo lookup has failed (cargo not found) and V9 notice reason is not released or deconsolidation
Applied to: 19:Handle Unknown Cargo Entry
WHEN
Unknown cargo processing is performed
THEN
Clear detail line 1, concatenate 'UNKNOWN EDI 350 ENTRY FROM CBSA ' with M10 CCN positions 1 through 25 into detail line 1, move 'THIS CCN WAS NOT FOUND.' to detail line 3, concatenate 'NOTICE DOC TYPE: ' with M10 notice document type code, ' WITH REASON CODE ' with V9 notice reason code positions 1 through 4 into detail line 4, set line count to 5, set message type to unknown, and perform email send preparation
Context: Cargo has been found and V9 notice reason indicates not matched
GIVEN
Cargo has been found and V9 notice reason indicates not matched
Applied to: 20:Process Document Not Matched
WHEN
Cargo processing is performed
THEN
Clear info message, move 'EDI 350: DOC NOT MATCHED ' to info message, and perform log cargo info message
Context: Cargo has been found and V9 notice reason indicates cargo complete
GIVEN
Cargo has been found and V9 notice reason indicates cargo complete
Applied to: 21:Process Cargo Complete
WHEN
Cargo processing is performed
THEN
Clear info message, move 'EDI 350: CARGO COMPLETE MESSAGE ' to info message, and perform log cargo info message
Context: Cargo has been found and V9 notice reason indicates document package complete
GIVEN
Cargo has been found and V9 notice reason indicates document package complete
Applied to: 22:Process Document Package Complete
WHEN
Cargo processing is performed
THEN
If X4 CBSA release reference ID positions 1 through 15 not equal cargo broker entry positions 1 through 15 or X4 CBSA release reference ID positions 1 through 14 not equal cargo customs transaction number positions 1 through 14, and X4 CBSA release reference ID is not spaces, then move X4 CBSA release reference ID positions 1 through 15 to cargo broker entry, move X4 CBSA release reference ID positions 1 through 14 to cargo customs transaction number, move machine date to cargo broker date, move machine time positions 1 through 4 to cargo broker time, clear info message, concatenate 'EDI 350: DOC PKG COMPLETE : ' with X4 CBSA release reference ID positions 1 through 15 into info message, perform log cargo info message, and perform cargo replace
Context: Cargo has been found and V9 notice reason indicates document not on file
GIVEN
Cargo has been found and V9 notice reason indicates document not on file
Applied to: 23:Process Document Not On File
WHEN
Cargo processing is performed
THEN
Clear info message, if X4 release document type code position 1 equals 'R' then concatenate 'EDI 350: DOC NOT ON FILE FOR RELEASE ' with X4 CBSA release reference ID positions 1 through 15 into info message and perform log cargo info message, else concatenate 'EDI 350:DOC NOT ON FILE H-BILL CLOSE ' with X4 CBSA release reference ID positions 1 through 25 into info message and perform log cargo info message
Context: Cargo has been found and V9 notice reason indicates reported
GIVEN
Cargo has been found and V9 notice reason indicates reported
Applied to: 24:Process Cargo Reported
WHEN
Cargo processing is performed
THEN
Clear info message, concatenate 'EDI 350: CARGO REPORTED ' into info message, and perform log cargo info message
Context: Cargo has been found and V9 notice reason indicates arrived
GIVEN
Cargo has been found and V9 notice reason indicates arrived
Applied to: 25:Process Cargo Arrived
WHEN
Cargo processing is performed
THEN
Clear info message, concatenate 'EDI 350: CARGO ARRIVED AT PORT ' with P4 port code positions 1 through 4 into info message, and perform log cargo info message
Context: Cargo has been found and V9 notice reason indicates released
GIVEN
Cargo has been found and V9 notice reason indicates released
Applied to: 26:Process Cargo Release
WHEN
Cargo processing is performed
THEN
Perform set release information, clear info message, concatenate 'EDI 350: RELEASE : ' with X4 CBSA release reference ID positions 1 through 15, ' AT PORT ' with P4 port code positions 1 through 4 into info message, concatenate X4 CBSA release reference ID positions 1 through 15, '/' with P4 port code positions 1 through 4 into cargo release reason, perform log cargo info message, perform process US manifest, move cargo release date to hold date, move cargo release time to hold time, perform cargo replace, if cargo is master manifest then save cargo segment, move cargo CCN key to B0 CCN key, set follower not end of database flag, perform process multi follower manifests, restore cargo segment, move cargo waybill key to save waybill index, and move cargo equipment car to current car ID key
Context: Cargo has been found and V9 notice reason indicates authorized to deliver
GIVEN
Cargo has been found and V9 notice reason indicates authorized to deliver
Applied to: 27:Process Authorized to Deliver
WHEN
Cargo processing is performed
THEN
If cargo CSA indicator is on then move 'EDI 350: ACCEPTED - CSA' to info message, perform log cargo info message, set cargo status to CSA delivery, set cargo CSA authorization to deliver received flag to true, and perform cargo replace, else move 'EDI 350: NOT ACCEPTED - NON-CSA' to info message and perform log cargo info message, then perform process US manifest
Context: Cargo has been found and V9 notice reason indicates held
GIVEN
Cargo has been found and V9 notice reason indicates held
Applied to: 28:Process Cargo Hold
WHEN
Cargo processing is performed
THEN
Clear info message, move 'EDI 350: GOODS HELD FOR EXAMINATION' to info message, perform log cargo info message, set cargo status to hold, perform cargo replace, if cargo CCN key positions 1 through 4 equal '6105' then perform Merlin prepare hold notification
Context: Cargo has been found and V9 notice reason indicates deconsolidation
GIVEN
Cargo has been found and V9 notice reason indicates deconsolidation
Applied to: 29:Process Deconsolidation Release
WHEN
Cargo processing is performed
THEN
Perform set release information, clear info message, concatenate 'EDI 350: RELEASE VIA DECON AT PORT ' with P4 port code positions 1 through 4 into info message, concatenate 'DECONSOLIDATION AT ' with P4 port code positions 1 through 4 into cargo release reason, perform log cargo info message, perform process US manifest, move cargo release date to hold date, move cargo release time to hold time, perform cargo replace, if cargo is master manifest then save cargo segment, move cargo CCN key to B0 CCN key, set follower not end of database flag, perform process multi follower manifests, restore cargo segment, move cargo waybill key to save waybill index, and move cargo equipment car to current car ID key
Context: Cargo is being released or deconsolidated
GIVEN
Cargo is being released or deconsolidated
Applied to: 30:Set Release Information
WHEN
Release information setting is performed
THEN
Clear cargo destination station number index, clear cargo destination station number for index, move machine date to cargo release date, move machine time to cargo release time, move ACF2 user ID to cargo release by, move 'RELEASED' to cargo current status, move 'R' to cargo release status, move 'A' to cargo release type, clear cargo release reason, clear cargo error or release status index, and clear cargo error status
Context: Canadian cargo has been released or authorized to deliver
GIVEN
Canadian cargo has been released or authorized to deliver
Applied to: 31:Process Associated US Manifest
WHEN
US manifest processing is performed
THEN
Set US manifest not found flag, set not end of file flag, perform get unique US cargo by car and waybill, perform get next US cargo by car and waybill until US manifest found or end of file, if end of file then exit, else move log information, concatenate machine century with machine date into log date, move machine time to log time, move log use input message to action code, move US cargo CCN key to train or US CCN field, set cargo type to US cargo, concatenate 'CDN CCN RLSED BY EDI 350: ' with cargo CCN key into message, and perform spawn log entry
Context: V9 notice reason indicates authorized to deliver
GIVEN
V9 notice reason indicates authorized to deliver
Applied to: 32:Process CSA Authorization
WHEN
CSA authorization processing is performed
THEN
If cargo CSA indicator is on then move 'EDI 350: ACCEPTED - CSA' to info message, perform log cargo info message, set cargo status to CSA delivery, set cargo CSA authorization to deliver received flag to true, and perform cargo replace, else move 'EDI 350: NOT ACCEPTED - NON-CSA' to info message and perform log cargo info message
Context: Master manifest has been released or deconsolidated
GIVEN
Master manifest has been released or deconsolidated
Applied to: 33:Process Follower Manifests
WHEN
Multi follower processing is performed
THEN
Set accept status to 'GEGB', clear follower manifest array, set index to 1, perform until follower end of database or index exceeds 100: call database with get next function for cargo using B0 qualifier, if status code is spaces and saved CCN equals master manifest CCN then if cargo is master manifest then continue else move cargo CCN key to follower manifest array at index and add 1 to index, else set follower end of database flag, subtract 1 from index, if index is less than or equal to zero then exit, else perform varying index from 1 by 1 until follower manifest at index is spaces or low values or index exceeds limit: move follower manifest CCN to cargo key value, perform cargo lookup, if cargo found then perform set release information, clear info message, if V9 released then concatenate 'EDI 350: RELEASE : ' with X4 CBSA release reference ID positions 1 through 15, ' AT PORT ' with P4 port code positions 1 through 4 into info message and concatenate X4 CBSA release reference ID positions 1 through 15, '/' with P4 port code positions 1 through 4 into cargo release reason, else concatenate 'EDI 350: RELEASE VIA DECON AT PORT ' with P4 port code positions 1 through 4 into info message and concatenate 'DECONSOLIDATION AT ' with P4 port code positions 1 through 4 into cargo release reason, move cargo CCN key to current CCN key, perform log cargo info message, move cargo waybill key to save waybill index, move cargo equipment car to current car ID key, perform process US manifest, clear status code, set accept status to spaces, and call database with replace function for cargo
Context: Cargo has been placed on hold and CCN starts with 6105
GIVEN
Cargo has been placed on hold and CCN starts with 6105
Applied to: 34:Prepare Cargo Hold Email
WHEN
Merlin hold preparation is performed
THEN
Clear detail line 1, concatenate 'Cargo on HOLD for inspection by CBSA - EDI350' into detail line 1, clear detail line 2, concatenate 'Equipment : ' with cargo equipment ID for index into detail line 3, concatenate 'Waybill : ' with cargo CCN carrier index, cargo origin station number index, cargo waybill number index into detail line 4, concatenate 'CCN : ' with cargo CCN key into detail line 5, concatenate 'DESTINATION : ' with cargo destination station name, ', ' with cargo destination station state code into detail line 6, concatenate 'MANIFEST UPON : ' with cargo manifest to station name into detail line 7, set line count to 7, set message type to hold, and perform email send preparation
Context: Email notification has been prepared with message type and content
GIVEN
Email notification has been prepared with message type and content
Applied to: 39:Send Email Notification
WHEN
Email send preparation is performed
THEN
If message type is error then concatenate 'CUSTOMS RECEIVED ERR MSG ' with cargo CCN key into subject, else if message type is info then concatenate 'BROKER/MANIFEST MISMATCH ' with cargo CCN key into subject, else if message type is hold then concatenate 'CBSA CARGO HOLD - ' with cargo CCN key into subject, else move detail line 1 to subject, save current recipient and filename, clear recipient, if admin segment found then move admin DC Merlin 1 to recipient 1 and admin DC Merlin 5 to recipient 2, else move 'OM01247' to recipient 1 and clear recipient 2, if keywords are spaces or low values then if cargo found and cargo CCN key not spaces then move cargo CCN key to keywords, else move current CCN key to keywords, if message type is unknown then move 'UNKNOWN' to filename, clear recipient, move 'OM01247' to recipient 1, and perform call email send, else if message type is error then move 'CAERROR' to filename, perform call email send, move 'IN' to filename, clear recipient, move 'OM01247' to recipient 1, and perform call email send, else if message type is info then move 'IN' to filename, clear recipient, move 'OM01247' to recipient 1, and perform call email send, else if message type is unrelease then move 'IN' to filename, perform call email send, clear recipient, perform fetch manifest station segment, if manifest station Merlin ID not spaces then move 'IN' to filename, move manifest station Merlin ID to recipient 1, and perform call email send, else if message type is release then clear recipient, perform fetch manifest station segment, if manifest station Merlin ID not spaces then move 'IN' to filename, move manifest station Merlin ID to recipient 1, and perform call email send, else if message type is hold then move 'CAHOLD' to filename, clear recipient, move 'OM01247' to recipient 1, and perform call email send, then perform reset report fields
R-WRITMSGL-cbl-00004 (+2) File: WRITMSGL.cbl Message Writing Initialization Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Writing Initialization':
  • Context - the message writing system needs to be initialized:
    For Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality:
    When the program execution begins, then the writmsg program is called to initialize message writing functionality.
  • Context - the message writing system is initialized and six parameters p1, p2, p3, p4, p5, p6 are available:
    For Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality:
    When extended message writing is required, then the writmsgx program is called with parameters p1, p2, p3, p4, p5, p6.
  • Context - both basic and extended message writing operations are required:
    For Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality:
    When message processing is initiated, then writmsg is called first, followed by writmsgx with parameters.
👨‍💻 Technical ACs (Gherkin)
Context: The message writing system needs to be initialized
GIVEN
The message writing system needs to be initialized
Applied to: Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality
WHEN
The program execution begins
THEN
The WRITMSG program is called to initialize message writing functionality
Context: The message writing system is initialized and six parameters P1, P2, P3, P4, P5, P6 are available
GIVEN
The message writing system is initialized and six parameters P1, P2, P3, P4, P5, P6 are available
Applied to: Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality
WHEN
Extended message writing is required
THEN
The WRITMSGX program is called with parameters P1, P2, P3, P4, P5, P6
Context: Both basic and extended message writing operations are required
GIVEN
Both basic and extended message writing operations are required
Applied to: Message Writing Initialization - Calls the WRITMSG program to initialize message writing functionality
WHEN
Message processing is initiated
THEN
WRITMSG is called first, followed by WRITMSGX with parameters
R-GCCMQERR-cbl-00004 (+5) File: GCCMQERR.cbl Error Code Lookup Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Code Lookup':
  • Context - an error number needs to be looked up in the error message table:
    For Initialize Search Index to 1:
    When the error lookup process begins, then the search index is set to position 1 to start searching from the beginning of the error table.
  • Context - the system is examining an error number at the current table position:
    For Does Error Number Match Input?:
    When the error number at the current index is compared with the input error number, then if the error numbers match exactly, the search is successful and the corresponding error message is identified.
  • Context - the system is examining an error number at the current table position and no match was found:
    For Is Error Number Empty/Spaces?:
    When the error number at the current index contains spaces or is empty, then the search process recognizes that the end of the error table has been reached.
  • Context - the current error number does not match the input and the end of table has not been reached:
    For Increment Index by 1:
    When the system needs to continue searching the error table, then the search index is incremented by 1 to examine the next error number in the table.
  • Context - a matching error number has been found in the error table:
    For Search Complete - Match Found:
    When the search process completes successfully, then the corresponding error message text is moved to the output message field.
  • Context - the end of the error table has been reached without finding a matching error number:
    For Search Complete - End of Table Reached:
    When the search process completes without success, then the input error number is stored in the unknown number field and a default unknown error message is moved to the output message field.
👨‍💻 Technical ACs (Gherkin)
Context: An error number needs to be looked up in the error message table
GIVEN
An error number needs to be looked up in the error message table
Applied to: Initialize Search Index to 1
WHEN
The error lookup process begins
THEN
The search index is set to position 1 to start searching from the beginning of the error table
Context: The system is examining an error number at the current table position
GIVEN
The system is examining an error number at the current table position
Applied to: Does Error Number Match Input?
WHEN
The error number at the current index is compared with the input error number
THEN
If the error numbers match exactly, the search is successful and the corresponding error message is identified
Context: The system is examining an error number at the current table position and no match was found
GIVEN
The system is examining an error number at the current table position and no match was found
Applied to: Is Error Number Empty/Spaces?
WHEN
The error number at the current index contains spaces or is empty
THEN
The search process recognizes that the end of the error table has been reached
Context: The current error number does not match the input and the end of table has not been reached
GIVEN
The current error number does not match the input and the end of table has not been reached
Applied to: Increment Index by 1
WHEN
The system needs to continue searching the error table
THEN
The search index is incremented by 1 to examine the next error number in the table
Context: A matching error number has been found in the error table
GIVEN
A matching error number has been found in the error table
Applied to: Search Complete - Match Found
WHEN
The search process completes successfully
THEN
The corresponding error message text is moved to the output message field
Context: The end of the error table has been reached without finding a matching error number
GIVEN
The end of the error table has been reached without finding a matching error number
Applied to: Search Complete - End of Table Reached
WHEN
The search process completes without success
THEN
The input error number is stored in the unknown number field and a default unknown error message is moved to the output message field
R-WRITMSGL-cbl-00007 File: WRITMSGL.cbl Parameterized Message Writing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parameterized Message Writing':
  • Context - six input parameters p1, p2, p3, p4, p5, p6 are available:
    For Call WRITMSGX Program with Parameters:
    When the system needs to write a formatted message, then the writmsgx program is called with all six parameters to produce the formatted message output.
👨‍💻 Technical ACs (Gherkin)
Context: Six input parameters P1, P2, P3, P4, P5, P6 are available
GIVEN
Six input parameters P1, P2, P3, P4, P5, P6 are available
Applied to: Call WRITMSGX Program with Parameters
WHEN
The system needs to write a formatted message
THEN
The WRITMSGX program is called with all six parameters to produce the formatted message output
R-GCCIH-cbl-00008 (+1) File: GCCIH.cbl Initialize Program Control Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Program Control':
  • Context - a program control initialization process is starting:
    For Save Current Program Name - CC-PROG → PROG-NAME-SAVED:
    When the system needs to track the current program context, then the current program identifier must be saved to preserve execution context.
  • Context - the current program context has been preserved:
    For Set Module Name for Tracking - MODULE-NAME → CC-PROG:
    When the system switches to module execution mode, then the module name must be assigned as the current program identifier for tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A program control initialization process is starting
GIVEN
A program control initialization process is starting
Applied to: Save Current Program Name - CC-PROG → PROG-NAME-SAVED
WHEN
The system needs to track the current program context
THEN
The current program identifier must be saved to preserve execution context
Context: The current program context has been preserved
GIVEN
The current program context has been preserved
Applied to: Set Module Name for Tracking - MODULE-NAME → CC-PROG
WHEN
The system switches to module execution mode
THEN
The module name must be assigned as the current program identifier for tracking purposes
R-CERR-cbl-00008 (+4) File: CERR.cbl Error Handler Initialization Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Handler Initialization':
  • Context - the error handling process is starting:
    For No explicit initialization code found in provided COBOL snippet:
    When the main procedure begins execution, then the communication area cccom is initialized through the dcccom module.
  • Context - the system has a dump-only mode flag ws-dump-only:
    For No explicit initialization code found in provided COBOL snippet:
    When the dump-only mode is active (ws-dump-only is true), then error processing is bypassed and control proceeds to program termination.
  • Context - the system is not in dump-only mode and environment indicator cc-prod-test-ims is available:
    For No explicit initialization code found in provided COBOL snippet:
    When the environment indicator cc-prod-test-ims equals the production value ws-prod, then the production error handler cerrprod is invoked with cccom parameters.
    For No explicit initialization code found in provided COBOL snippet:
    When the environment indicator cc-prod-test-ims does not equal the production value ws-prod, then the test error handler cerrtest is invoked with cccom parameters.
  • Context - the error handling process has completed initialization and conditional processing:
    For No explicit initialization code found in provided COBOL snippet:
    When the program reaches the notification phase, then a blocking error message is displayed to the system error output.
👨‍💻 Technical ACs (Gherkin)
Context: The error handling process is starting
GIVEN
The error handling process is starting
Applied to: No explicit initialization code found in provided COBOL snippet
WHEN
The main procedure begins execution
THEN
The communication area CCCOM is initialized through the DCCCOM module
Context: The system has a dump-only mode flag WS-DUMP-ONLY
GIVEN
The system has a dump-only mode flag WS-DUMP-ONLY
Applied to: No explicit initialization code found in provided COBOL snippet
WHEN
The dump-only mode is active (WS-DUMP-ONLY is true)
THEN
Error processing is bypassed and control proceeds to program termination
Context: The system is not in dump-only mode and environment indicator CC-PROD-TEST-IMS is available
GIVEN
The system is not in dump-only mode and environment indicator CC-PROD-TEST-IMS is available
Applied to: No explicit initialization code found in provided COBOL snippet
WHEN
The environment indicator CC-PROD-TEST-IMS equals the production value WS-PROD
THEN
The production error handler CERRPROD is invoked with CCCOM parameters
Applied to: No explicit initialization code found in provided COBOL snippet
WHEN
The environment indicator CC-PROD-TEST-IMS does not equal the production value WS-PROD
THEN
The test error handler CERRTEST is invoked with CCCOM parameters
Context: The error handling process has completed initialization and conditional processing
GIVEN
The error handling process has completed initialization and conditional processing
Applied to: No explicit initialization code found in provided COBOL snippet
WHEN
The program reaches the notification phase
THEN
A blocking error message is displayed to the system error output
R-GCCIH-cbl-00010 (+2) File: GCCIH.cbl Prepare IH Notification Data Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare IH Notification Data':
  • Context - a ccn status notification needs to be processed:
    For Clear Input Structure:
    When the system begins preparing the ih notification data, then the gcx153-input structure is initialized to clear any previous data.
  • Context - the input structure has been initialized for ccn status notification:
    For Set Security Parameters to High Values:
    When security parameters need to be established, then the gcx153-security-byte is set to high-values to enforce maximum security level.
  • Context - the input structure is initialized and security parameters are set:
    For Input Structure Ready for CCN Status:
    When ccn status data needs to be loaded into the notification structure, then 91 bytes of gcwih data are moved to positions 2-91 of gcx153-input structure.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN status notification needs to be processed
GIVEN
A CCN status notification needs to be processed
Applied to: Clear Input Structure
WHEN
The system begins preparing the IH notification data
THEN
The GCX153-INPUT structure is initialized to clear any previous data
Context: The input structure has been initialized for CCN status notification
GIVEN
The input structure has been initialized for CCN status notification
Applied to: Set Security Parameters to High Values
WHEN
Security parameters need to be established
THEN
The GCX153-SECURITY-BYTE is set to HIGH-VALUES to enforce maximum security level
Context: The input structure is initialized and security parameters are set
GIVEN
The input structure is initialized and security parameters are set
Applied to: Input Structure Ready for CCN Status
WHEN
CCN status data needs to be loaded into the notification structure
THEN
91 bytes of GCWIH data are moved to positions 2-91 of GCX153-INPUT structure
R-GCCMQERR-cbl-00010 File: GCCMQERR.cbl Error Message Retrieval
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Retrieval':
  • Context - an error code has been found in the error message table at a specific index position:
    For Retrieve Error Message Text from Table:
    When the error code at the current index position equals the input error number, then the corresponding error message text at that same index position is moved to the output message field.
👨‍💻 Technical ACs (Gherkin)
Context: An error code has been found in the error message table at a specific index position
GIVEN
An error code has been found in the error message table at a specific index position
Applied to: Retrieve Error Message Text from Table
WHEN
The error code at the current index position equals the input error number
THEN
The corresponding error message text at that same index position is moved to the output message field
R-GCCMQERR-cbl-00011 (+1) File: GCCMQERR.cbl Unknown Error Handling Merged 2 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Unknown Error Handling':
  • Context - an error code has been searched in the error message table and error-number (error-index) does not equal input-error-number:
    For Move Input Error Number to Unknown Number Field:
    When the system determines the error code is not found in the table, then the input error number is moved to the unknown number field for inclusion in the default message.
  • Context - an error code is not found in the error message table and the unknown number field has been populated:
    For Move Unknown Message Template to Output:
    When the system needs to provide an error message for an unrecognized error code, then the unknown message template is moved to the output message text field.
👨‍💻 Technical ACs (Gherkin)
Context: An error code has been searched in the error message table and ERROR-NUMBER (ERROR-INDEX) does not equal INPUT-ERROR-NUMBER
GIVEN
An error code has been searched in the error message table and ERROR-NUMBER (ERROR-INDEX) does not equal INPUT-ERROR-NUMBER
Applied to: Move Input Error Number to Unknown Number Field
WHEN
The system determines the error code is not found in the table
THEN
The input error number is moved to the unknown number field for inclusion in the default message
Context: An error code is not found in the error message table and the unknown number field has been populated
GIVEN
An error code is not found in the error message table and the unknown number field has been populated
Applied to: Move Unknown Message Template to Output
WHEN
The system needs to provide an error message for an unrecognized error code
THEN
The unknown message template is moved to the output message text field
R-GCCIH-cbl-00013 (+3) File: GCCIH.cbl Format CCN Status Message Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format CCN Status Message':
  • Context - gcwih input structure contains ccn data in positions 1 through 91:
    For Extract CCN Data from GCWIH:
    When ccn data extraction is initiated, then 91 bytes of ccn data are extracted from gcwih starting at position 1.
  • Context - 91 bytes of ccn data have been extracted from gcwih:
    For Move CCN Data to Input Structure Position 2-92:
    When ccn data is moved to the input structure, then ccn data is placed in positions 2 through 92 of gcx153-input structure.
  • Context - a ccn status message is being prepared:
    For Move CCN Data to Input Structure Position 2-92:
    When security initialization is performed, then the security byte is set to high-values indicating maximum security level.
  • Context - gcx153-input structure contains properly formatted ccn data with security byte:
    For Transfer Formatted Input to IH Message Structure:
    When message structure transfer is initiated, then the complete formatted input is transferred to gct1531e-msg for ih processing.
👨‍💻 Technical ACs (Gherkin)
Context: GCWIH input structure contains CCN data in positions 1 through 91
GIVEN
GCWIH input structure contains CCN data in positions 1 through 91
Applied to: Extract CCN Data from GCWIH
WHEN
CCN data extraction is initiated
THEN
91 bytes of CCN data are extracted from GCWIH starting at position 1
Context: 91 bytes of CCN data have been extracted from GCWIH
GIVEN
91 bytes of CCN data have been extracted from GCWIH
Applied to: Move CCN Data to Input Structure Position 2-92
WHEN
CCN data is moved to the input structure
THEN
CCN data is placed in positions 2 through 92 of GCX153-INPUT structure
Context: A CCN status message is being prepared
GIVEN
A CCN status message is being prepared
Applied to: Move CCN Data to Input Structure Position 2-92
WHEN
Security initialization is performed
THEN
The security byte is set to HIGH-VALUES indicating maximum security level
Context: GCX153-INPUT structure contains properly formatted CCN data with security byte
GIVEN
GCX153-INPUT structure contains properly formatted CCN data with security byte
Applied to: Transfer Formatted Input to IH Message Structure
WHEN
Message structure transfer is initiated
THEN
The complete formatted input is transferred to GCT1531E-MSG for IH processing
R-CERR-cbl-00013 File: CERR.cbl Environment Detection
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Environment Detection':
  • Context - the system has access to cc-prod-test-ims environment flag and ws-prod production environment value:
    For Compare CC-PROD-TEST-IMS with WS-PROD Value:
    When the system compares cc-prod-test-ims with ws-prod value, then if cc-prod-test-ims equals ws-prod then environment is identified as production, otherwise environment is identified as test.
👨‍💻 Technical ACs (Gherkin)
Context: The system has access to CC-PROD-TEST-IMS environment flag and WS-PROD production environment value
GIVEN
The system has access to CC-PROD-TEST-IMS environment flag and WS-PROD production environment value
Applied to: Compare CC-PROD-TEST-IMS with WS-PROD Value
WHEN
The system compares CC-PROD-TEST-IMS with WS-PROD value
THEN
If CC-PROD-TEST-IMS equals WS-PROD then environment is identified as Production, otherwise environment is identified as Test
R-CERR-cbl-00014 File: CERR.cbl Dump Only Check
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Dump Only Check':
  • Context - the system has initialized communication area and ws-dump-only flag is available:
    For Check WS-DUMP-ONLY Flag:
    When the system checks the ws-dump-only flag status, then if ws-dump-only is set to true, skip all further error processing and proceed to program termination; if ws-dump-only is false, continue to environment detection for error processing.
👨‍💻 Technical ACs (Gherkin)
Context: The system has initialized communication area and WS-DUMP-ONLY flag is available
GIVEN
The system has initialized communication area and WS-DUMP-ONLY flag is available
Applied to: Check WS-DUMP-ONLY Flag
WHEN
The system checks the WS-DUMP-ONLY flag status
THEN
If WS-DUMP-ONLY is set to true, skip all further error processing and proceed to program termination; If WS-DUMP-ONLY is false, continue to environment detection for error processing
R-CERR-cbl-00015 File: CERR.cbl Common Error Processing
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Common Error Processing':
  • Context - the system needs to perform error processing:
    For Call DCCCOM Program:
    When the main error processing procedure is executed, then the system calls dcccom program using cccom communication area to perform standard error processing initialization.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to perform error processing
GIVEN
The system needs to perform error processing
Applied to: Call DCCCOM Program
WHEN
The main error processing procedure is executed
THEN
The system calls DCCCOM program using CCCOM communication area to perform standard error processing initialization
R-CERR-cbl-00016 File: CERR.cbl Production Error Handling
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Production Error Handling':
  • Context - the system is running in production environment (cc-prod-test-ims equals ws-prod) and dump-only mode is disabled (not ws-dump-only is true) and communication area cccom is available:
    For Call CERRPROD with Communication Area:
    When an error condition requires processing through the production error handler, then the system invokes the production error handler cerrprod with the communication area cccom to process the error according to production standards.
👨‍💻 Technical ACs (Gherkin)
Context: The system is running in production environment (CC-PROD-TEST-IMS equals WS-PROD) and dump-only mode is disabled (NOT WS-DUMP-ONLY is true) and communication area CCCOM is available
GIVEN
The system is running in production environment (CC-PROD-TEST-IMS equals WS-PROD) and dump-only mode is disabled (NOT WS-DUMP-ONLY is true) and communication area CCCOM is available
Applied to: Call CERRPROD with Communication Area
WHEN
An error condition requires processing through the production error handler
THEN
The system invokes the production error handler CERRPROD with the communication area CCCOM to process the error according to production standards
R-CIMS-cbl-00016 (+5) File: CIMS.cbl Parameter Address Linkage Setup Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parameter Address Linkage Setup':
  • Context - the cims program is starting parameter linkage setup:
    For Set No Force Reset Flag:
    When the system begins parameter processing initialization, then the no-force-reset flag is set to true to control reset behavior.
  • Context - the no-force-reset flag has been set:
    For Execute Address Linkage Parameters Routine:
    When the system needs to establish parameter address linkage, then the address-linkage-parameters routine is performed to set up parameter addressing.
  • Context - the address linkage parameters routine has been executed:
    For Get Parameter Count from Linkage:
    When the system needs to determine the number of parameters passed, then the parameter count is moved from csilkcrd-parms-count to arg-count.
  • Context - the parameter count has been retrieved from linkage data:
    For Set CCCOM Address from Parameter 1:
    When the system needs to access the cccom control block, then the address of cccom is set to the address stored in arg-addr position 1.
  • Context - the cccom control block address has been established:
    For Set Function Code Address from Parameter 2:
    When the system needs to access the function code for database operations, then the address of func is set to the address stored in arg-addr position 2.
  • Context - the function code address has been established:
    For Set PCB Address Area from Parameter 3:
    When the system needs to access the pcb address area for database operations, then the address of addr-area is set to the address stored in arg-addr position 3.
👨‍💻 Technical ACs (Gherkin)
Context: The CIMS program is starting parameter linkage setup
GIVEN
The CIMS program is starting parameter linkage setup
Applied to: Set No Force Reset Flag
WHEN
The system begins parameter processing initialization
THEN
The NO-FORCE-RESET flag is set to TRUE to control reset behavior
Context: The NO-FORCE-RESET flag has been set
GIVEN
The NO-FORCE-RESET flag has been set
Applied to: Execute Address Linkage Parameters Routine
WHEN
The system needs to establish parameter address linkage
THEN
The ADDRESS-LINKAGE-PARAMETERS routine is performed to set up parameter addressing
Context: The address linkage parameters routine has been executed
GIVEN
The address linkage parameters routine has been executed
Applied to: Get Parameter Count from Linkage
WHEN
The system needs to determine the number of parameters passed
THEN
The parameter count is moved from CSILKCRD-PARMS-COUNT to ARG-COUNT
Context: The parameter count has been retrieved from linkage data
GIVEN
The parameter count has been retrieved from linkage data
Applied to: Set CCCOM Address from Parameter 1
WHEN
The system needs to access the CCCOM control block
THEN
The address of CCCOM is set to the address stored in ARG-ADDR position 1
Context: The CCCOM control block address has been established
GIVEN
The CCCOM control block address has been established
Applied to: Set Function Code Address from Parameter 2
WHEN
The system needs to access the function code for database operations
THEN
The address of FUNC is set to the address stored in ARG-ADDR position 2
Context: The function code address has been established
GIVEN
The function code address has been established
Applied to: Set PCB Address Area from Parameter 3
WHEN
The system needs to access the PCB address area for database operations
THEN
The address of ADDR-AREA is set to the address stored in ARG-ADDR position 3
R-GCCIH-cbl-00017 File: GCCIH.cbl Send Initial IMS Message
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Initial IMS Message':
  • Context - message input data has been prepared in gcx153-input structure and accept status is cleared:
    For Execute CIMS Call with CHNG Function:
    When system calls cims program with chng function using cccom, alt-pcb, and gct1531e parameters, then ims message processing is initiated for the prepared message.
👨‍💻 Technical ACs (Gherkin)
Context: Message input data has been prepared in GCX153-INPUT structure and accept status is cleared
GIVEN
Message input data has been prepared in GCX153-INPUT structure and accept status is cleared
Applied to: Execute CIMS Call with CHNG Function
WHEN
System calls CIMS program with CHNG function using CCCOM, ALT-PCB, and GCT1531E parameters
THEN
IMS message processing is initiated for the prepared message
R-GCCTBIO-cbl-00017 (+2) File: GCCTBIO.cbl Initialize Module Control Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Module Control':
  • Context - a module control initialization is requested:
    For Save Current Program Name to PROG-NAME-SAVED:
    When the system begins module control setup, then the current program name (cc-prog) is saved to prog-name-saved for later restoration.
  • Context - the calling program name has been saved:
    For Set Module Name as Current Program:
    When module control initialization continues, then the module-name is set as the current program (cc-prog).
  • Context - module control setup is in progress:
    For Module Control Initialized:
    When control field initialization is performed, then return-flag, cc-accept-status, and ws-ssa-flag are cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A module control initialization is requested
GIVEN
A module control initialization is requested
Applied to: Save Current Program Name to PROG-NAME-SAVED
WHEN
The system begins module control setup
THEN
The current program name (CC-PROG) is saved to PROG-NAME-SAVED for later restoration
Context: The calling program name has been saved
GIVEN
The calling program name has been saved
Applied to: Set Module Name as Current Program
WHEN
Module control initialization continues
THEN
The MODULE-NAME is set as the current program (CC-PROG)
Context: Module control setup is in progress
GIVEN
Module control setup is in progress
Applied to: Module Control Initialized
WHEN
Control field initialization is performed
THEN
RETURN-FLAG, CC-ACCEPT-STATUS, and WS-SSA-FLAG are cleared to spaces
R-CERR-cbl-00017 (+2) File: CERR.cbl Test Error Handling Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Test Error Handling':
  • Context - the system is running in test environment (cc-prod-test-ims is not equal to ws-prod) and dump-only mode is disabled (ws-dump-only is false):
    For Test Environment Detected:
    When an error condition occurs requiring error processing, then the system routes the error to the test error handler (cerrtest) and passes error information through the communication area (cccom).
  • Context - the system is operating in dump-only mode (ws-dump-only is true):
    For Route Error to Test Handler:
    When an error condition occurs, then the system bypasses all error processing routines and skips calling any error handlers.
  • Context - error processing is required for test environment and dump mode is not active:
    For Call CERRTEST Program:
    When the system determines test environment error handling is needed, then the system calls the cerrtest program and passes the communication area (cccom) containing error details.
👨‍💻 Technical ACs (Gherkin)
Context: The system is running in test environment (CC-PROD-TEST-IMS is not equal to WS-PROD) and dump-only mode is disabled (WS-DUMP-ONLY is false)
GIVEN
The system is running in test environment (CC-PROD-TEST-IMS is not equal to WS-PROD) and dump-only mode is disabled (WS-DUMP-ONLY is false)
Applied to: Test Environment Detected
WHEN
An error condition occurs requiring error processing
THEN
The system routes the error to the test error handler (CERRTEST) and passes error information through the communication area (CCCOM)
Context: The system is operating in dump-only mode (WS-DUMP-ONLY is true)
GIVEN
The system is operating in dump-only mode (WS-DUMP-ONLY is true)
Applied to: Route Error to Test Handler
WHEN
An error condition occurs
THEN
The system bypasses all error processing routines and skips calling any error handlers
Context: Error processing is required for test environment and dump mode is not active
GIVEN
Error processing is required for test environment and dump mode is not active
Applied to: Call CERRTEST Program
WHEN
The system determines test environment error handling is needed
THEN
The system calls the CERRTEST program and passes the communication area (CCCOM) containing error details
R-CCISCOM-cbl-00018 (+2) File: CCISCOM.cbl Version Check and Data Transfer Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Version Check and Data Transfer':
  • Context - iscom communication area exists with a sit version field and ws-iscom-version contains the expected version:
    For Is ISCOM Version Already Set?:
    When the system compares cc-sit-version of iscom with ws-iscom-version, then if versions match, proceed with simple data transfer; if versions don't match, proceed with full initialization.
  • Context - cccom and iscom communication areas exist with cc-common-area fields:
    For Transfer Common Area Data from CCCOM to ISCOM:
    When version compatibility check passes, then copy cc-common-area from cccom to cc-common-area of iscom.
  • Context - ws-iscom-version contains the current version and iscom has cc-sit-version field:
    For Set ISCOM Version:
    When common area data transfer is completed, then set cc-sit-version of iscom to ws-iscom-version.
👨‍💻 Technical ACs (Gherkin)
Context: ISCOM communication area exists with a SIT version field and WS-ISCOM-VERSION contains the expected version
GIVEN
ISCOM communication area exists with a SIT version field and WS-ISCOM-VERSION contains the expected version
Applied to: Is ISCOM Version Already Set?
WHEN
The system compares CC-SIT-VERSION of ISCOM with WS-ISCOM-VERSION
THEN
If versions match, proceed with simple data transfer; if versions don't match, proceed with full initialization
Context: CCCOM and ISCOM communication areas exist with CC-COMMON-AREA fields
GIVEN
CCCOM and ISCOM communication areas exist with CC-COMMON-AREA fields
Applied to: Transfer Common Area Data from CCCOM to ISCOM
WHEN
Version compatibility check passes
THEN
Copy CC-COMMON-AREA from CCCOM to CC-COMMON-AREA of ISCOM
Context: WS-ISCOM-VERSION contains the current version and ISCOM has CC-SIT-VERSION field
GIVEN
WS-ISCOM-VERSION contains the current version and ISCOM has CC-SIT-VERSION field
Applied to: Set ISCOM Version
WHEN
Common area data transfer is completed
THEN
Set CC-SIT-VERSION of ISCOM to WS-ISCOM-VERSION
R-GCCIH-cbl-00018 (+1) File: GCCIH.cbl Write Message Log Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Write Message Log':
  • Context - a ccn status notification message needs to be logged:
    For Prepare Log Parameters:
    When the system prepares logging parameters, then the message code, message content, message length, and module name are made available for the logging operation.
  • Context - all logging parameters are prepared for the ccn status message:
    For Call WRITMSGL Program:
    When the system calls the writmsgl program with message code, message content, message length, and module name, then the writmsgl program is invoked to log the ccn status notification message.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN status notification message needs to be logged
GIVEN
A CCN status notification message needs to be logged
Applied to: Prepare Log Parameters
WHEN
The system prepares logging parameters
THEN
The message code, message content, message length, and module name are made available for the logging operation
Context: All logging parameters are prepared for the CCN status message
GIVEN
All logging parameters are prepared for the CCN status message
Applied to: Call WRITMSGL Program
WHEN
The system calls the WRITMSGL program with message code, message content, message length, and module name
THEN
The WRITMSGL program is invoked to log the CCN status notification message
R-GCCIH-cbl-00020 (+1) File: GCCIH.cbl Purge IMS Message Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Purge IMS Message':
  • Context - message processing has been completed and logged:
    For Execute PURG Function:
    When system initiates message cleanup process, then cims program is called with purg function to purge the message.
  • Context - message has been processed and purge function has been executed:
    For Complete Message Processing:
    When all message operations are completed, then system returns control to the calling program to complete the process.
👨‍💻 Technical ACs (Gherkin)
Context: Message processing has been completed and logged
GIVEN
Message processing has been completed and logged
Applied to: Execute PURG Function
WHEN
System initiates message cleanup process
THEN
CIMS program is called with PURG function to purge the message
Context: Message has been processed and purge function has been executed
GIVEN
Message has been processed and purge function has been executed
Applied to: Complete Message Processing
WHEN
All message operations are completed
THEN
System returns control to the calling program to complete the process
R-GCCTBIO-cbl-00020 File: GCCTBIO.cbl Clear Return Status
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Clear Return Status':
  • Context - a database operation is about to be processed:
    For Clear Return Status - Initialize return flag, accept status, and SSA flag to default values:
    When the system begins operation initialization, then the return flag is set to spaces, the accept status is set to spaces, and the ssa flag is set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation is about to be processed
GIVEN
A database operation is about to be processed
Applied to: Clear Return Status - Initialize return flag, accept status, and SSA flag to default values
WHEN
The system begins operation initialization
THEN
The return flag is set to spaces, the accept status is set to spaces, and the SSA flag is set to spaces
R-CERR-cbl-00020 File: CERR.cbl Error Notification Display
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Notification Display':
  • Context - a blocking error condition has occurred in the cims system:
    For Display blocking error message to system error output:
    When the error notification display process is executed, then display a top border line of hash symbols to system error output and display the blocking error message 'cims: blocking error.' to system error output and display a bottom border line of hash symbols to system error output.
👨‍💻 Technical ACs (Gherkin)
Context: A blocking error condition has occurred in the CIMS system
GIVEN
A blocking error condition has occurred in the CIMS system
Applied to: Display blocking error message to system error output
WHEN
The error notification display process is executed
THEN
Display a top border line of hash symbols to system error output AND display the blocking error message 'CIMS: BLOCKING ERROR.' to system error output AND display a bottom border line of hash symbols to system error output
R-CCISCOM-cbl-00021 (+3) File: CCISCOM.cbl ISCOM Initialization Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ISCOM Initialization':
  • Context - iscom version (cc-sit-version of iscom) does not equal the working storage iscom version (ws-iscom-version):
    For Initialize ISCOM with Default Values:
    When the system processes iscom initialization, then iscom structure is populated with default values from iscomval.
  • Context - iscom version does not match expected version and iscom has been initialized with default values:
    For Copy Common Area Data from CCCOM:
    When the system processes common area data transfer, then common area data (cc-common-area) is copied from cccom to iscom.
  • Context - iscom has been initialized and common area data has been copied:
    For Set ISCOM Version Number:
    When the system finalizes iscom structure setup, then iscom version (cc-sit-version of iscom) is set to the working storage iscom version (ws-iscom-version).
  • Context - iscom version does not match expected version and initialization is in progress:
    For Initialize ISCOM with Default Values:
    When the system processes lt-pcbs data transfer, then lt-pcbs data (cc-lt-pcbs) is copied from cccom to iscom.
👨‍💻 Technical ACs (Gherkin)
Context: ISCOM version (CC-SIT-VERSION OF ISCOM) does not equal the working storage ISCOM version (WS-ISCOM-VERSION)
GIVEN
ISCOM version (CC-SIT-VERSION OF ISCOM) does not equal the working storage ISCOM version (WS-ISCOM-VERSION)
Applied to: Initialize ISCOM with Default Values
WHEN
The system processes ISCOM initialization
THEN
ISCOM structure is populated with default values from ISCOMVAL
Context: ISCOM version does not match expected version and ISCOM has been initialized with default values
GIVEN
ISCOM version does not match expected version and ISCOM has been initialized with default values
Applied to: Copy Common Area Data from CCCOM
WHEN
The system processes common area data transfer
THEN
Common area data (CC-COMMON-AREA) is copied from CCCOM to ISCOM
Context: ISCOM has been initialized and common area data has been copied
GIVEN
ISCOM has been initialized and common area data has been copied
Applied to: Set ISCOM Version Number
WHEN
The system finalizes ISCOM structure setup
THEN
ISCOM version (CC-SIT-VERSION OF ISCOM) is set to the working storage ISCOM version (WS-ISCOM-VERSION)
Context: ISCOM version does not match expected version and initialization is in progress
GIVEN
ISCOM version does not match expected version and initialization is in progress
Applied to: Initialize ISCOM with Default Values
WHEN
The system processes LT-PCBS data transfer
THEN
LT-PCBS data (CC-LT-PCBS) is copied from CCCOM to ISCOM
R-GCCTBIO-cbl-00021 (+5) File: GCCTBIO.cbl Validate Function Code Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Function Code':
  • Context - a user function code is provided for validation:
    For Function Code = GHU or GU?:
    When the function code is ghu (get hold unique) or gu (get unique), then the system sets accept status to ge and configures the request to use qualified ssa for precise record retrieval.
    For Set Return Flag to NOT-VALID:
    When the function code is not ghu, gu, ghn, ghnp, gn, gnp, isrt, dlet, or repl, then the system sets the return flag to not-valid to indicate the function code is not supported.
  • Context - a user function code is provided that is not ghu or gu:
    For Function Code = GHN, GHNP, GN, or GNP?:
    When the function code is ghn (get hold next), ghnp (get hold next in parent), gn (get next), or gnp (get next in parent), then the system sets accept status to gagbgegk to enable sequential processing capabilities.
  • Context - a sequential read operation (ghn, ghnp, gn, or gnp) has been validated:
    For Unqualified SSA Flag = SPACE?:
    When the unqualified ssa flag is set to space (not specified), then the system configures the request to use qualified ssa for structured searching, otherwise it uses unqualified ssa for broader searching.
  • Context - a user function code is provided that is not a read or sequential read operation:
    For Function Code = ISRT?:
    When the function code is isrt (insert), then the system sets accept status to ii and configures the request to use unqualified ssa for insert operations.
  • Context - a user function code is provided that is not a read, sequential read, or insert operation:
    For Function Code = DLET or REPL?:
    When the function code is dlet (delete) or repl (replace), then the system configures the request to use no ssa since modification operations work on already positioned records.
👨‍💻 Technical ACs (Gherkin)
Context: A user function code is provided for validation
GIVEN
A user function code is provided for validation
Applied to: Function Code = GHU or GU?
WHEN
The function code is GHU (Get Hold Unique) or GU (Get Unique)
THEN
The system sets accept status to GE and configures the request to use qualified SSA for precise record retrieval
Applied to: Set Return Flag to NOT-VALID
WHEN
The function code is not GHU, GU, GHN, GHNP, GN, GNP, ISRT, DLET, or REPL
THEN
The system sets the return flag to NOT-VALID to indicate the function code is not supported
Context: A user function code is provided that is not GHU or GU
GIVEN
A user function code is provided that is not GHU or GU
Applied to: Function Code = GHN, GHNP, GN, or GNP?
WHEN
The function code is GHN (Get Hold Next), GHNP (Get Hold Next in Parent), GN (Get Next), or GNP (Get Next in Parent)
THEN
The system sets accept status to GAGBGEGK to enable sequential processing capabilities
Context: A sequential read operation (GHN, GHNP, GN, or GNP) has been validated
GIVEN
A sequential read operation (GHN, GHNP, GN, or GNP) has been validated
Applied to: Unqualified SSA Flag = SPACE?
WHEN
The unqualified SSA flag is set to SPACE (not specified)
THEN
The system configures the request to use qualified SSA for structured searching, otherwise it uses unqualified SSA for broader searching
Context: A user function code is provided that is not a read or sequential read operation
GIVEN
A user function code is provided that is not a read or sequential read operation
Applied to: Function Code = ISRT?
WHEN
The function code is ISRT (Insert)
THEN
The system sets accept status to II and configures the request to use unqualified SSA for insert operations
Context: A user function code is provided that is not a read, sequential read, or insert operation
GIVEN
A user function code is provided that is not a read, sequential read, or insert operation
Applied to: Function Code = DLET or REPL?
WHEN
The function code is DLET (Delete) or REPL (Replace)
THEN
The system configures the request to use no SSA since modification operations work on already positioned records
R-CERR-cbl-00021 File: CERR.cbl Program Termination
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Program Termination':
  • Context - error processing activities have been completed including communication setup, environment-based error handler execution, and blocking error message display:
    For Program Termination - Return control to calling program after error processing completion:
    When the program reaches the termination point, then the system executes program termination and returns control to the calling program.
👨‍💻 Technical ACs (Gherkin)
Context: Error processing activities have been completed including communication setup, environment-based error handler execution, and blocking error message display
GIVEN
Error processing activities have been completed including communication setup, environment-based error handler execution, and blocking error message display
Applied to: Program Termination - Return control to calling program after error processing completion
WHEN
The program reaches the termination point
THEN
The system executes program termination and returns control to the calling program
R-CIMS-cbl-00022 (+8) File: CIMS.cbl Function and SSA Parameter Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Function and SSA Parameter Processing':
  • Context - an ims function code is provided as input parameter:
    For Store IMS Function Code:
    When the function parameter processing begins, then the function code is stored in the last ims function field of the common control area.
  • Context - ssa parameter processing is initiated:
    For Clear Previous SSA Data:
    When before capturing new ssa parameters, then the last ssa field in the common control area is cleared to spaces.
  • Context - parameter count and argument addresses are available:
    For Parameter Count >= 4?:
    When parameter count is 4 or greater, then io area address is set from the 4th argument and stored in the common control area.
    For Parameter Count >= 5?:
    When parameter count is 5 or greater, then ssa1 address is set from the 5th argument and ssa1 content is stored in the last ssa1 field of the common control area.
    For Parameter Count >= 6?:
    When parameter count is 6 or greater, then ssa2 address is set from the 6th argument and ssa2 content is stored in the last ssa2 field of the common control area.
    For Parameter Count >= 7?:
    When parameter count is 7 or greater, then ssa3 address is set from the 7th argument and ssa3 content is stored in the last ssa3 field of the common control area.
    For Parameter Count >= 8?:
    When parameter count is 8 or greater, then ssa4 address is set from the 8th argument and ssa4 content is stored in the last ssa4 field of the common control area.
    For Parameter Count >= 9?:
    When parameter count is 9 or greater, then ssa5 address is set from the 9th argument and ssa5 content is stored in the last ssa5 field of the common control area.
    For Parameter Count >= 10?:
    When parameter count is 10 or greater, then ssa6 address is set from the 10th argument and ssa6 content is stored in the last ssa6 field of the common control area.
👨‍💻 Technical ACs (Gherkin)
Context: An IMS function code is provided as input parameter
GIVEN
An IMS function code is provided as input parameter
Applied to: Store IMS Function Code
WHEN
The function parameter processing begins
THEN
The function code is stored in the last IMS function field of the common control area
Context: SSA parameter processing is initiated
GIVEN
SSA parameter processing is initiated
Applied to: Clear Previous SSA Data
WHEN
Before capturing new SSA parameters
THEN
The last SSA field in the common control area is cleared to spaces
Context: Parameter count and argument addresses are available
GIVEN
Parameter count and argument addresses are available
Applied to: Parameter Count >= 4?
WHEN
Parameter count is 4 or greater
THEN
IO area address is set from the 4th argument and stored in the common control area
Applied to: Parameter Count >= 5?
WHEN
Parameter count is 5 or greater
THEN
SSA1 address is set from the 5th argument and SSA1 content is stored in the last SSA1 field of the common control area
Applied to: Parameter Count >= 6?
WHEN
Parameter count is 6 or greater
THEN
SSA2 address is set from the 6th argument and SSA2 content is stored in the last SSA2 field of the common control area
Applied to: Parameter Count >= 7?
WHEN
Parameter count is 7 or greater
THEN
SSA3 address is set from the 7th argument and SSA3 content is stored in the last SSA3 field of the common control area
Applied to: Parameter Count >= 8?
WHEN
Parameter count is 8 or greater
THEN
SSA4 address is set from the 8th argument and SSA4 content is stored in the last SSA4 field of the common control area
Applied to: Parameter Count >= 9?
WHEN
Parameter count is 9 or greater
THEN
SSA5 address is set from the 9th argument and SSA5 content is stored in the last SSA5 field of the common control area
Applied to: Parameter Count >= 10?
WHEN
Parameter count is 10 or greater
THEN
SSA6 address is set from the 10th argument and SSA6 content is stored in the last SSA6 field of the common control area
R-CCISCOM-cbl-00025 File: CCISCOM.cbl Cross
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cross':
  • Context - cccom and iscom communication structures exist and need to reference each other:
    For Cross-Reference Address Setup - Set up bidirectional address references between CCCOM and ISCOM structures:
    When cross-reference setup is initiated, then cccom address reference is stored in iscom structure and iscom address reference is stored in cccom structure and bidirectional references are established.
👨‍💻 Technical ACs (Gherkin)
Context: CCCOM and ISCOM communication structures exist and need to reference each other
GIVEN
CCCOM and ISCOM communication structures exist and need to reference each other
Applied to: Cross-Reference Address Setup - Set up bidirectional address references between CCCOM and ISCOM structures
WHEN
Cross-reference setup is initiated
THEN
CCCOM address reference is stored in ISCOM structure AND ISCOM address reference is stored in CCCOM structure AND bidirectional references are established
R-CCISCOM-cbl-00026 (+1) File: CCISCOM.cbl PCB Transfer Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Transfer':
  • Context - cccom and iscom structures exist and cc-sit-version of iscom does not equal ws-iscom-version:
    For Transfer PCB Data to ISCOM Structure:
    When the system performs version compatibility processing, then cc-lt-pcbs data from cccom structure is copied to cc-lt-pcbs field in iscom structure.
  • Context - iscom and cccom structures exist and cc-sit-version of cccom does not equal ws-cccom-version:
    For Transfer PCB Data to ISCOM Structure:
    When the system performs reverse version compatibility processing via iscccom entry point, then cc-lt-pcbs data from iscom structure is copied to cc-lt-pcbs field in cccom structure.
👨‍💻 Technical ACs (Gherkin)
Context: CCCOM and ISCOM structures exist and CC-SIT-VERSION of ISCOM does not equal WS-ISCOM-VERSION
GIVEN
CCCOM and ISCOM structures exist and CC-SIT-VERSION of ISCOM does not equal WS-ISCOM-VERSION
Applied to: Transfer PCB Data to ISCOM Structure
WHEN
The system performs version compatibility processing
THEN
CC-LT-PCBS data from CCCOM structure is copied to CC-LT-PCBS field in ISCOM structure
Context: ISCOM and CCCOM structures exist and CC-SIT-VERSION of CCCOM does not equal WS-CCCOM-VERSION
GIVEN
ISCOM and CCCOM structures exist and CC-SIT-VERSION of CCCOM does not equal WS-CCCOM-VERSION
Applied to: Transfer PCB Data to ISCOM Structure
WHEN
The system performs reverse version compatibility processing via ISCCCOM entry point
THEN
CC-LT-PCBS data from ISCOM structure is copied to CC-LT-PCBS field in CCCOM structure
R-GCCTBIO-cbl-00027 File: GCCTBIO.cbl Set SSA Type for Get Operations
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set SSA Type for Get Operations':
  • Context - a database operation request is being processed:
    For Set SSA Type for Get Operations - Determine whether to use qualified or unqualified SSA for GET UNIQUE and GET HOLD UNIQUE operations:
    When the function code is ghu (get hold unique) or gu (get unique), then the system sets the accept status to ge and configures the ssa type to qualified-ssa for precise record matching.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation request is being processed
GIVEN
A database operation request is being processed
Applied to: Set SSA Type for Get Operations - Determine whether to use qualified or unqualified SSA for GET UNIQUE and GET HOLD UNIQUE operations
WHEN
The function code is GHU (Get Hold Unique) or GU (Get Unique)
THEN
The system sets the accept status to GE and configures the SSA type to QUALIFIED-SSA for precise record matching
R-GCCUSIO-cbl-00027 (+5) File: GCCUSIO.cbl Parameter Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parameter Validation':
  • Context - the parameter validation process is starting:
    For Set Parameter Valid Flag to TRUE:
    When the system begins validation, then the parameter valid flag should be set to true as the initial state.
  • Context - the system is initializing for parameter validation:
    For Get Current Machine Time:
    When time capture is required, then the current machine time should be stored in working storage for later use.
  • Context - a segment name is provided for processing:
    For Is Segment Name Valid?:
    When the segment name is not gcsusrt and not gcsa2rt and not gcsa8rt and not gcst2rt, then the parameter should be marked as invalid with error code '0012' and message 'segment name invalid'.
  • Context - a function code is provided for processing:
    For Is Function Code Valid?:
    When the function code is not equal to 'gu ' and not equal to 'gn ' and not equal to 'isrt' and not equal to 'repl' and not equal to 'dlet', then the parameter should be marked as invalid with error code '0012' and message 'function code invalid'.
  • Context - the segment name is gcst2rt:
    For Special Validation: GCST2RT with Non-GU Function?:
    When the function code is not 'gu ', then the parameter should be marked as invalid with error code '0012' and message 'invalid function code'.
  • Context - an operator field is provided in the input parameters:
    For Set Default Operator to ' =':
    When the operator field contains only spaces, then the operator should be set to ' =' as the default value.
👨‍💻 Technical ACs (Gherkin)
Context: The parameter validation process is starting
GIVEN
The parameter validation process is starting
Applied to: Set Parameter Valid Flag to TRUE
WHEN
The system begins validation
THEN
The parameter valid flag should be set to TRUE as the initial state
Context: The system is initializing for parameter validation
GIVEN
The system is initializing for parameter validation
Applied to: Get Current Machine Time
WHEN
Time capture is required
THEN
The current machine time should be stored in working storage for later use
Context: A segment name is provided for processing
GIVEN
A segment name is provided for processing
Applied to: Is Segment Name Valid?
WHEN
The segment name is not GCSUSRT and not GCSA2RT and not GCSA8RT and not GCST2RT
THEN
The parameter should be marked as invalid with error code '0012' and message 'SEGMENT NAME INVALID'
Context: A function code is provided for processing
GIVEN
A function code is provided for processing
Applied to: Is Function Code Valid?
WHEN
The function code is not equal to 'GU ' and not equal to 'GN ' and not equal to 'ISRT' and not equal to 'REPL' and not equal to 'DLET'
THEN
The parameter should be marked as invalid with error code '0012' and message 'FUNCTION CODE INVALID'
Context: The segment name is GCST2RT
GIVEN
The segment name is GCST2RT
Applied to: Special Validation: GCST2RT with Non-GU Function?
WHEN
The function code is not 'GU '
THEN
The parameter should be marked as invalid with error code '0012' and message 'INVALID FUNCTION CODE'
Context: An operator field is provided in the input parameters
GIVEN
An operator field is provided in the input parameters
Applied to: Set Default Operator to ' ='
WHEN
The operator field contains only spaces
THEN
The operator should be set to ' =' as the default value
R-CCISCOM-cbl-00028 (+4) File: CCISCOM.cbl Database Name Scanning Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Name Scanning':
  • Context - a database scanning operation needs to begin:
    For Initialize Index I = 1:
    When the system starts processing database entries, then the index counter is set to position 1 to begin scanning from the first entry.
  • Context - a database entry scanning operation is in progress with current index position i:
    For Index I > CCCOM Table Size?:
    When the system checks if the current index exceeds the cccom table size limit, then if index i is greater than cccom table size, terminate the scanning process, otherwise continue to next validation.
  • Context - a database entry at position i within the valid table range:
    For Database Name at Position I = SPACES?:
    When the system examines the database name field at the current position, then if the database name contains only spaces (empty), terminate the scanning process, otherwise proceed to process the current entry.
  • Context - a valid database entry at position i with a non-empty database name:
    For Process Current Database Entry:
    When the system needs to process the database entry for address mapping, then invoke the database address scanning procedure (100-scan-cc-db-addr) to handle pcb number processing and database name matching.
  • Context - a database entry has been successfully processed at position i:
    For Increment Index I by 1:
    When the system completes processing the current database entry, then increment the index i by 1 to move to the next database entry position for continued scanning.
👨‍💻 Technical ACs (Gherkin)
Context: A database scanning operation needs to begin
GIVEN
A database scanning operation needs to begin
Applied to: Initialize Index I = 1
WHEN
The system starts processing database entries
THEN
The index counter is set to position 1 to begin scanning from the first entry
Context: A database entry scanning operation is in progress with current index position I
GIVEN
A database entry scanning operation is in progress with current index position I
Applied to: Index I > CCCOM Table Size?
WHEN
The system checks if the current index exceeds the CCCOM table size limit
THEN
If index I is greater than CCCOM table size, terminate the scanning process, otherwise continue to next validation
Context: A database entry at position I within the valid table range
GIVEN
A database entry at position I within the valid table range
Applied to: Database Name at Position I = SPACES?
WHEN
The system examines the database name field at the current position
THEN
If the database name contains only spaces (empty), terminate the scanning process, otherwise proceed to process the current entry
Context: A valid database entry at position I with a non-empty database name
GIVEN
A valid database entry at position I with a non-empty database name
Applied to: Process Current Database Entry
WHEN
The system needs to process the database entry for address mapping
THEN
Invoke the database address scanning procedure (100-SCAN-CC-DB-ADDR) to handle PCB number processing and database name matching
Context: A database entry has been successfully processed at position I
GIVEN
A database entry has been successfully processed at position I
Applied to: Increment Index I by 1
WHEN
The system completes processing the current database entry
THEN
Increment the index I by 1 to move to the next database entry position for continued scanning
R-GCCTBIO-cbl-00028 (+1) File: GCCTBIO.cbl Set SSA Type for Next Operations Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set SSA Type for Next Operations':
  • Context - a user function code is provided for database operation:
    For Set Accept Status to GAGBGEGK:
    When the function code is ghn (get hold next) or ghnp (get hold next in parent) or gn (get next) or gnp (get next in parent), then the accept status should be set to gagbgegk to allow sequential data access.
  • Context - a get next type operation (ghn, ghnp, gn, or gnp) is being processed:
    For Is Unqualified SSA Flag Set?:
    When the unqualified ssa flag is checked, then if the unqualified ssa flag is not set (space), use qualified ssa type; if the unqualified ssa flag is set, use unqualified ssa type.
👨‍💻 Technical ACs (Gherkin)
Context: A user function code is provided for database operation
GIVEN
A user function code is provided for database operation
Applied to: Set Accept Status to GAGBGEGK
WHEN
The function code is GHN (Get Hold Next) OR GHNP (Get Hold Next in Parent) OR GN (Get Next) OR GNP (Get Next in Parent)
THEN
The accept status should be set to GAGBGEGK to allow sequential data access
Context: A GET NEXT type operation (GHN, GHNP, GN, or GNP) is being processed
GIVEN
A GET NEXT type operation (GHN, GHNP, GN, or GNP) is being processed
Applied to: Is Unqualified SSA Flag Set?
WHEN
The unqualified SSA flag is checked
THEN
If the unqualified SSA flag is not set (SPACE), use qualified SSA type; if the unqualified SSA flag is set, use unqualified SSA type
R-GCCTBIO-cbl-00030 (+1) File: GCCTBIO.cbl Set SSA Type for Insert Operations Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set SSA Type for Insert Operations':
  • Context - a database operation request is being processed:
    For Set Accept Status to II:
    When the function code is isrt (insert), then the system sets the accept status to ii and configures unqualified ssa flag for the insert operation.
  • Context - a database insert operation is being configured:
    For Configure Unqualified SSA Flag:
    When the function code is isrt (insert), then the system sets the ssa flag to unqualified ssa type.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation request is being processed
GIVEN
A database operation request is being processed
Applied to: Set Accept Status to II
WHEN
The function code is ISRT (Insert)
THEN
The system sets the accept status to II and configures unqualified SSA flag for the insert operation
Context: A database insert operation is being configured
GIVEN
A database insert operation is being configured
Applied to: Configure Unqualified SSA Flag
WHEN
The function code is ISRT (Insert)
THEN
The system sets the SSA flag to unqualified SSA type
R-CIMS-cbl-00031 (+1) File: CIMS.cbl ISCOM Address Validation Merged 2 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ISCOM Address Validation':
  • Context - the system has a common control area (cccom) that may contain an iscom address and the system version matches the expected cccom version:
    For Check ISCOM Address in CCCOM:
    When the system checks for iscom address availability during communication setup, then if iscom address is not null and not blank, the system establishes the iscom communication channel, otherwise it continues processing without iscom communication.
  • Context - a valid iscom address exists in cccom that is not null and not blank:
    For Set ISCOM Address for Communication:
    When the system needs to establish iscom communication, then the system sets the address of iscom to the cccom iscom address to enable communication.
👨‍💻 Technical ACs (Gherkin)
Context: The system has a common control area (CCCOM) that may contain an ISCOM address and the system version matches the expected CCCOM version
GIVEN
The system has a common control area (CCCOM) that may contain an ISCOM address and the system version matches the expected CCCOM version
Applied to: Check ISCOM Address in CCCOM
WHEN
The system checks for ISCOM address availability during communication setup
THEN
If ISCOM address is not null and not blank, the system establishes the ISCOM communication channel, otherwise it continues processing without ISCOM communication
Context: A valid ISCOM address exists in CCCOM that is not null and not blank
GIVEN
A valid ISCOM address exists in CCCOM that is not null and not blank
Applied to: Set ISCOM Address for Communication
WHEN
The system needs to establish ISCOM communication
THEN
The system sets the address of ISCOM to the CCCOM ISCOM address to enable communication
R-GCCTBIO-cbl-00032 File: GCCTBIO.cbl Set SSA Type for Update/Delete Operations
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set SSA Type for Update/Delete Operations':
  • Context - a database operation request is being processed:
    For Set SSA Flag to NO-SSA:
    When the function code is dlet (delete) or the function code is repl (replace), then the system sets the ssa flag to no-ssa to indicate no search arguments are required.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation request is being processed
GIVEN
A database operation request is being processed
Applied to: Set SSA Flag to NO-SSA
WHEN
The function code is DLET (Delete) OR the function code is REPL (Replace)
THEN
The system sets the SSA flag to NO-SSA to indicate no search arguments are required
R-CCISCOM-cbl-00033 (+1) File: CCISCOM.cbl PCB Number Processing Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Number Processing':
  • Context - a database entry from cccom table with pcb number field that may be empty or contain spaces:
    For PCB Number Processing - Process and validate PCB numbers, defaulting to '1' when spaces are found:
    When the pcb number field contains spaces or is empty, then the system assigns default pcb number '1' to the cccom pcb number field.
  • Context - a database entry from cccom table with a valid pcb number that is not spaces:
    For PCB Number Processing - Process and validate PCB numbers, defaulting to '1' when spaces are found:
    When the pcb number field contains a valid non-space value, then the system preserves the existing pcb number value without modification.
👨‍💻 Technical ACs (Gherkin)
Context: A database entry from CCCOM table with PCB number field that may be empty or contain spaces
GIVEN
A database entry from CCCOM table with PCB number field that may be empty or contain spaces
Applied to: PCB Number Processing - Process and validate PCB numbers, defaulting to '1' when spaces are found
WHEN
The PCB number field contains spaces or is empty
THEN
The system assigns default PCB number '1' to the CCCOM PCB number field
Context: A database entry from CCCOM table with a valid PCB number that is not spaces
GIVEN
A database entry from CCCOM table with a valid PCB number that is not spaces
Applied to: PCB Number Processing - Process and validate PCB numbers, defaulting to '1' when spaces are found
WHEN
The PCB number field contains a valid non-space value
THEN
The system preserves the existing PCB number value without modification
R-GCCTBIO-cbl-00033 (+3) File: GCCTBIO.cbl Initialize Root Segment SSA Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Root Segment SSA':
  • Context - a segment name is provided for processing:
    For Check if Segment is Root Segment:
    When the system evaluates the segment name against the root segment identifier, then the system determines if the segment is a root segment type and routes accordingly.
  • Context - a root segment has been identified for processing:
    For SSA Type = QUALIFIED-SSA?:
    When the system checks the ssa flag type for qualified search requirements, then the system determines whether to use qualified or unqualified ssa for the root segment access.
  • Context - a root segment requires qualified ssa processing:
    For Set Root Segment Key Value:
    When the ssa flag indicates qualified search is needed, then the system assigns the root segment key value to enable precise segment access.
  • Context - a root segment is being processed with unqualified ssa requirements:
    For Skip Key Setup:
    When the ssa flag indicates unqualified search is acceptable, then the system skips the key value assignment and continues processing without specific key setup.
👨‍💻 Technical ACs (Gherkin)
Context: A segment name is provided for processing
GIVEN
A segment name is provided for processing
Applied to: Check if Segment is Root Segment
WHEN
The system evaluates the segment name against the root segment identifier
THEN
The system determines if the segment is a root segment type and routes accordingly
Context: A root segment has been identified for processing
GIVEN
A root segment has been identified for processing
Applied to: SSA Type = QUALIFIED-SSA?
WHEN
The system checks the SSA flag type for qualified search requirements
THEN
The system determines whether to use qualified or unqualified SSA for the root segment access
Context: A root segment requires qualified SSA processing
GIVEN
A root segment requires qualified SSA processing
Applied to: Set Root Segment Key Value
WHEN
The SSA flag indicates qualified search is needed
THEN
The system assigns the root segment key value to enable precise segment access
Context: A root segment is being processed with unqualified SSA requirements
GIVEN
A root segment is being processed with unqualified SSA requirements
Applied to: Skip Key Setup
WHEN
The SSA flag indicates unqualified search is acceptable
THEN
The system skips the key value assignment and continues processing without specific key setup
R-GCCUSIO-cbl-00033 (+15) File: GCCUSIO.cbl Primary Cargo Record Insert Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Cargo Record Insert':
  • Context - a cargo record is being inserted into the primary database:
    For Set Creation Audit Trail:
    When the creation timestamp field is empty or spaces, then the system sets creation century, date, time, terminal, and user id from current system values and copies this information to last modify fields.
    For Set Last Modify Audit Trail:
    When the creation timestamp field already contains data, then the system updates only the last modify century, date, time, terminal, and user id with current system values while preserving the original creation timestamp.
  • Context - a cargo record is being processed for index field population:
    For Populate Index Fields:
    When the cargo status indicates the record is marked as deleted, then the system skips all index field population and exits the index setting process.
  • Context - a cargo record with a ccn key is being processed:
    For Populate Index Fields:
    When index fields are being populated, then the system copies the ccn key to car id index, waybill index, and car-waybill index fields.
  • Context - a cargo record is being processed for index population:
    For Populate Index Fields:
    When the destination index field is not empty or spaces, then the system copies the ccn key to the destination index field.
  • Context - a cargo record contains equipment car information:
    For Set Car ID Index:
    When car id indexes are being populated, then the system assigns the equipment car value to both the car id number index and car-waybill car id index.
  • Context - a cargo record contains waybill information including road number, station number, waybill number, and waybill date:
    For Set Waybill Index Fields:
    When waybill indexes are being populated, then the system assigns road number to road index, station number to station index, waybill number to waybill index, waybill date to waybill date index, and copies waybill number to car-waybill index.
  • Context - a cargo record may contain in-bond control number or entry number:
    For Set Bond Control Number Index:
    When bond number index is being populated, then the system uses in-bond control number if available, otherwise uses entry number if available, otherwise sets bond index to spaces.
  • Context - a cargo record has a ccn key:
    For Set Manifest Index:
    When manifest index is being populated, then the system assigns the ccn key value to the manifest index field.
  • Context - a cargo record has an internal cargo status code:
    For Set Cargo Status Description:
    When status description is being set, then the system maps the status code to corresponding description: ok to 'ok', pending to 'pending', acknwlg to 'ack', error to 'error', sent to 'sent', deleted to 'deleted', delpend to 'delpend', relsd to 'released', arrival to 'mnl-arrv', aarr to 'aut-arrv', export to 'mnl-exp', aexp to 'aut-exp', imed-ex to 'imed-exp', xfered to 'xfered', or uses the original status if no mapping exists.
  • Context - a cargo record is prepared with all required fields populated:
    For Insert Record to Primary Database:
    When the record insertion is requested, then the system calls the database interface to insert the record using the primary pcb and unqualified ssa.
  • Context - a cargo record has been processed:
    For Save Iron Highway Status:
    When iron highway notification data is being prepared, then the system saves the us cargo short description to the iron highway status field.
  • Context - a cargo record contains waybill number index information:
    For Save Waybill Number:
    When notification data is being prepared, then the system extracts the first 15 characters of the waybill number index and saves it for notification processing.
  • Context - a cargo record contains car id number index information:
    For Save Car Number:
    When notification data is being prepared, then the system saves the car id number index value for notification processing.
  • Context - cargo status information has been captured and prepared:
    For Process Iron Highway Notification:
    When iron highway notification processing is invoked, then the system calls the iron highway notification module to send status updates to external systems.
  • Context - a cargo record has been inserted or updated in the primary database:
    For Update Index Database:
    When index database update is requested, then the system calls the index database update process to maintain cargo status tracking tables based on error and hold conditions.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being inserted into the primary database
GIVEN
A cargo record is being inserted into the primary database
Applied to: Set Creation Audit Trail
WHEN
The creation timestamp field is empty or spaces
THEN
The system sets creation century, date, time, terminal, and user ID from current system values and copies this information to last modify fields
Applied to: Set Last Modify Audit Trail
WHEN
The creation timestamp field already contains data
THEN
The system updates only the last modify century, date, time, terminal, and user ID with current system values while preserving the original creation timestamp
Context: A cargo record is being processed for index field population
GIVEN
A cargo record is being processed for index field population
Applied to: Populate Index Fields
WHEN
The cargo status indicates the record is marked as deleted
THEN
The system skips all index field population and exits the index setting process
Context: A cargo record with a CCN key is being processed
GIVEN
A cargo record with a CCN key is being processed
Applied to: Populate Index Fields
WHEN
Index fields are being populated
THEN
The system copies the CCN key to car ID index, waybill index, and car-waybill index fields
Context: A cargo record is being processed for index population
GIVEN
A cargo record is being processed for index population
Applied to: Populate Index Fields
WHEN
The destination index field is not empty or spaces
THEN
The system copies the CCN key to the destination index field
Context: A cargo record contains equipment car information
GIVEN
A cargo record contains equipment car information
Applied to: Set Car ID Index
WHEN
Car ID indexes are being populated
THEN
The system assigns the equipment car value to both the car ID number index and car-waybill car ID index
Context: A cargo record contains waybill information including road number, station number, waybill number, and waybill date
GIVEN
A cargo record contains waybill information including road number, station number, waybill number, and waybill date
Applied to: Set Waybill Index Fields
WHEN
Waybill indexes are being populated
THEN
The system assigns road number to road index, station number to station index, waybill number to waybill index, waybill date to waybill date index, and copies waybill number to car-waybill index
Context: A cargo record may contain in-bond control number or entry number
GIVEN
A cargo record may contain in-bond control number or entry number
Applied to: Set Bond Control Number Index
WHEN
Bond number index is being populated
THEN
The system uses in-bond control number if available, otherwise uses entry number if available, otherwise sets bond index to spaces
Context: A cargo record has a CCN key
GIVEN
A cargo record has a CCN key
Applied to: Set Manifest Index
WHEN
Manifest index is being populated
THEN
The system assigns the CCN key value to the manifest index field
Context: A cargo record has an internal cargo status code
GIVEN
A cargo record has an internal cargo status code
Applied to: Set Cargo Status Description
WHEN
Status description is being set
THEN
The system maps the status code to corresponding description: OK to 'OK', PENDING to 'PENDING', ACKNWLG to 'ACK', ERROR to 'ERROR', SENT to 'SENT', DELETED to 'DELETED', DELPEND to 'DELPEND', RELSD to 'RELEASED', ARRIVAL to 'MNL-ARRV', AARR to 'AUT-ARRV', EXPORT to 'MNL-EXP', AEXP to 'AUT-EXP', IMED-EX to 'IMED-EXP', XFERED to 'XFERED', or uses the original status if no mapping exists
Context: A cargo record is prepared with all required fields populated
GIVEN
A cargo record is prepared with all required fields populated
Applied to: Insert Record to Primary Database
WHEN
The record insertion is requested
THEN
The system calls the database interface to insert the record using the primary PCB and unqualified SSA
Context: A cargo record has been processed
GIVEN
A cargo record has been processed
Applied to: Save Iron Highway Status
WHEN
Iron Highway notification data is being prepared
THEN
The system saves the US cargo short description to the Iron Highway status field
Context: A cargo record contains waybill number index information
GIVEN
A cargo record contains waybill number index information
Applied to: Save Waybill Number
WHEN
Notification data is being prepared
THEN
The system extracts the first 15 characters of the waybill number index and saves it for notification processing
Context: A cargo record contains car ID number index information
GIVEN
A cargo record contains car ID number index information
Applied to: Save Car Number
WHEN
Notification data is being prepared
THEN
The system saves the car ID number index value for notification processing
Context: Cargo status information has been captured and prepared
GIVEN
Cargo status information has been captured and prepared
Applied to: Process Iron Highway Notification
WHEN
Iron Highway notification processing is invoked
THEN
The system calls the Iron Highway notification module to send status updates to external systems
Context: A cargo record has been inserted or updated in the primary database
GIVEN
A cargo record has been inserted or updated in the primary database
Applied to: Update Index Database
WHEN
Index database update is requested
THEN
The system calls the index database update process to maintain cargo status tracking tables based on error and hold conditions
R-CIMS-cbl-00033 (+8) File: CIMS.cbl CCCOM Version Compatibility Check Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCCOM Version Compatibility Check':
  • Context - a cccom control block with a version identifier and a system with an expected cccom version:
    For Check CCCOM Version:
    When the system checks cccom version compatibility, then the system compares cccom version against expected version and determines whether to proceed with iscom checks.
  • Context - cccom version has been validated against expected system version:
    For CCCOM Version = Expected Version?:
    When cccom version equals the expected system version, then system proceeds with iscom compatibility checks, otherwise skips iscom processing.
  • Context - cccom version compatibility has been confirmed and cccom contains database pcb area:
    For Set Base Address to CCCOM DB PCBs:
    When system needs to perform iscom address calculations, then system sets the base address pointer to the cccom database pcbs area.
  • Context - base address has been set to cccom database pcbs and an address area is available:
    For Set Offset Address to Address Area:
    When system needs to calculate iscom address offset, then system sets the offset address pointer to the provided address area.
  • Context - iscom structure is available with database pcbs area:
    For Calculate ISCOM Table Size:
    When system needs to determine iscom table boundaries, then system computes the length of iscom database pcbs area and stores as table size.
  • Context - base address and offset address have been established for iscom calculations:
    For Base Address > Zero?:
    When base address value is greater than zero, then system uses method 1 for address calculation, otherwise uses method 2.
  • Context - base address is greater than zero and offset address is available:
    For Calculate Address Offset Method 1:
    When system applies address calculation method 1, then system assigns offset address to address-1 and base address to address-2 for final offset computation.
  • Context - base address is not greater than zero and offset address is available:
    For Calculate Address Offset Method 2:
    When system applies address calculation method 2, then system assigns base address to address-1 and offset address to address-2 for final offset computation.
  • Context - address-1 and address-2 have been assigned based on selected calculation method:
    For Compute Final Address Offset:
    When system performs final address offset calculation, then system computes address offset as the difference between address-1 and address-2.
👨‍💻 Technical ACs (Gherkin)
Context: A CCCOM control block with a version identifier and a system with an expected CCCOM version
GIVEN
A CCCOM control block with a version identifier and a system with an expected CCCOM version
Applied to: Check CCCOM Version
WHEN
The system checks CCCOM version compatibility
THEN
The system compares CCCOM version against expected version and determines whether to proceed with ISCOM checks
Context: CCCOM version has been validated against expected system version
GIVEN
CCCOM version has been validated against expected system version
Applied to: CCCOM Version = Expected Version?
WHEN
CCCOM version equals the expected system version
THEN
System proceeds with ISCOM compatibility checks, otherwise skips ISCOM processing
Context: CCCOM version compatibility has been confirmed and CCCOM contains database PCB area
GIVEN
CCCOM version compatibility has been confirmed and CCCOM contains database PCB area
Applied to: Set Base Address to CCCOM DB PCBs
WHEN
System needs to perform ISCOM address calculations
THEN
System sets the base address pointer to the CCCOM database PCBs area
Context: Base address has been set to CCCOM database PCBs and an address area is available
GIVEN
Base address has been set to CCCOM database PCBs and an address area is available
Applied to: Set Offset Address to Address Area
WHEN
System needs to calculate ISCOM address offset
THEN
System sets the offset address pointer to the provided address area
Context: ISCOM structure is available with database PCBs area
GIVEN
ISCOM structure is available with database PCBs area
Applied to: Calculate ISCOM Table Size
WHEN
System needs to determine ISCOM table boundaries
THEN
System computes the length of ISCOM database PCBs area and stores as table size
Context: Base address and offset address have been established for ISCOM calculations
GIVEN
Base address and offset address have been established for ISCOM calculations
Applied to: Base Address > Zero?
WHEN
Base address value is greater than zero
THEN
System uses method 1 for address calculation, otherwise uses method 2
Context: Base address is greater than zero and offset address is available
GIVEN
Base address is greater than zero and offset address is available
Applied to: Calculate Address Offset Method 1
WHEN
System applies address calculation method 1
THEN
System assigns offset address to address-1 and base address to address-2 for final offset computation
Context: Base address is not greater than zero and offset address is available
GIVEN
Base address is not greater than zero and offset address is available
Applied to: Calculate Address Offset Method 2
WHEN
System applies address calculation method 2
THEN
System assigns base address to address-1 and offset address to address-2 for final offset computation
Context: Address-1 and address-2 have been assigned based on selected calculation method
GIVEN
Address-1 and address-2 have been assigned based on selected calculation method
Applied to: Compute Final Address Offset
WHEN
System performs final address offset calculation
THEN
System computes address offset as the difference between address-1 and address-2
R-CCISCOM-cbl-00035 (+2) File: CCISCOM.cbl Database Name Matching Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Name Matching':
  • Context - a cccom database entry at position i and an iscom database entry at position j are being compared:
    For Do Database Names Match?:
    When the database name in cccom entry matches the database name in iscom entry, then the system identifies this as a matching database pair and proceeds with pcb number increment and address mapping operations.
  • Context - database names between cccom and iscom entries have been confirmed as matching:
    For Names Match - Proceed with Processing:
    When the matching database names are identified, then the iscom pcb number is incremented by 1 to maintain proper sequencing.
  • Context - database names match and iscom pcb number has been incremented:
    For Names Match - Proceed with Processing:
    When the current iscom pcb number equals the cccom pcb number for the matched database, then the pcb address from cccom entry is assigned to the corresponding iscom entry.
👨‍💻 Technical ACs (Gherkin)
Context: A CCCOM database entry at position I and an ISCOM database entry at position J are being compared
GIVEN
A CCCOM database entry at position I and an ISCOM database entry at position J are being compared
Applied to: Do Database Names Match?
WHEN
The database name in CCCOM entry matches the database name in ISCOM entry
THEN
The system identifies this as a matching database pair and proceeds with PCB number increment and address mapping operations
Context: Database names between CCCOM and ISCOM entries have been confirmed as matching
GIVEN
Database names between CCCOM and ISCOM entries have been confirmed as matching
Applied to: Names Match - Proceed with Processing
WHEN
The matching database names are identified
THEN
The ISCOM PCB number is incremented by 1 to maintain proper sequencing
Context: Database names match and ISCOM PCB number has been incremented
GIVEN
Database names match and ISCOM PCB number has been incremented
Applied to: Names Match - Proceed with Processing
WHEN
The current ISCOM PCB number equals the CCCOM PCB number for the matched database
THEN
The PCB address from CCCOM entry is assigned to the corresponding ISCOM entry
R-GCCTBIO-cbl-00037 (+2) File: GCCTBIO.cbl Initialize Dependent Segment SSA Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Dependent Segment SSA':
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is set to qualified ssa and the unqualified ssa flag is not set (equals space):
    For Set Root Segment Key Value Set Dependent Segment Key Value:
    When the system initializes the ssa structure for dependent segment access, then the system sets the root segment key value from gcstbrt-key and sets the dependent segment key value from gcstbdp-key.
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is set to qualified ssa and the unqualified ssa flag is set (not equal to space):
    For Set Root Segment Key Value Change SSA Type to Unqualified:
    When the system initializes the ssa structure for dependent segment access, then the system sets the root segment key value from gcstbrt-key and changes the ssa flag to unqualified ssa.
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is not set to qualified ssa:
    For Set Root Segment Key Value Change SSA Type to Unqualified:
    When the system initializes the ssa structure for dependent segment access, then the system sets the root segment key value from gcstbrt-key and ensures the ssa flag is set to unqualified ssa.
👨‍💻 Technical ACs (Gherkin)
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is set to qualified SSA and the unqualified SSA flag is not set (equals space)
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is set to qualified SSA and the unqualified SSA flag is not set (equals space)
Applied to: Set Root Segment Key Value Set Dependent Segment Key Value
WHEN
The system initializes the SSA structure for dependent segment access
THEN
The system sets the root segment key value from GCSTBRT-KEY and sets the dependent segment key value from GCSTBDP-KEY
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is set to qualified SSA and the unqualified SSA flag is set (not equal to space)
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is set to qualified SSA and the unqualified SSA flag is set (not equal to space)
Applied to: Set Root Segment Key Value Change SSA Type to Unqualified
WHEN
The system initializes the SSA structure for dependent segment access
THEN
The system sets the root segment key value from GCSTBRT-KEY and changes the SSA flag to unqualified SSA
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is not set to qualified SSA
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is not set to qualified SSA
Applied to: Set Root Segment Key Value Change SSA Type to Unqualified
WHEN
The system initializes the SSA structure for dependent segment access
THEN
The system sets the root segment key value from GCSTBRT-KEY and ensures the SSA flag is set to unqualified SSA
R-GCX126-cbl-00037 (+17) File: GCX126R.cbl Initialize Program Configuration Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Program Configuration':
  • Context - the program gcx126 is starting execution:
    For Set Program Name and Module Name:
    When the program initialization begins, then the current program name from cccom is saved to prog-name-saved and module-name is moved to cc-prog in cccom.
  • Context - the program is starting initialization:
    For Initialize Working Storage Fields:
    When working storage initialization is performed, then log-indx is set to 1, ws-k1-remark-ndx is set to zeroes, log-array is set to spaces, ws-prev-crn is set to spaces, ws-mqs-len-header is set to length of mqs-message-header, ws-mqs-len-of-1-entry is set to length of mqs-table-entry(1), mrln-line is set to 1, ws-ctr-new is set to 1, and mrln-350-report is set to spaces.
  • Context - the program is initializing for message processing:
    For Initialize Segment Flags:
    When segment flags are being initialized, then ws-no-header-found, ws-no-trailer-found, ws-no-m10-seg-found, ws-no-p4-seg-found, ws-no-n7-seg-found, ws-no-x4-seg-found, ws-no-k1-seg-found, ws-no-v9-seg-found, ws-no-end-found, and ws-cargo-not-found are all set to true.
  • Context - the program is initializing merlin notification settings:
    For Set Merlin Report User Code:
    When the merlin sender code is being set, then emi-from-usercode is set to 'om01247'.
  • Context - the program needs to access database tables:
    For Initialize Working Storage Fields:
    When database access parameters are initialized, then cc-accept-status in cccom is set to 'ge', gcctbio-func-code is set to gu, gcstbrt-key-value is set to spaces, gcstbdp-key-value is set to spaces, gcctbio-return-flag is set to spaces, gcstbrt-ad-segment is set to spaces, second-pcb-flag is set to spaces, and unqual-ssa-flag is set to spaces.
  • Context - the program is preparing to process a new edi 350 message:
    For Initialize Working Storage Fields:
    When message segment structures are initialized, then m10-segment, p4-segment, v9-segment, k1-segment, x4-segment, and n7-segment are all initialized to their default values.
  • Context - the program needs to determine merlin notification recipients:
    For Retrieve Admin Configuration from GCSTBRT Table:
    When admin configuration is retrieved with table-id 'ad' and seqid 'adminid', then gcctbio is called with function gu to retrieve gcstbrt segment.
  • Context - admin configuration has been retrieved from gcstbrt table:
    For Extract Merlin User Code from Admin Config:
    When gcctbio-return-flag equals '0', then 88-ad-segment-found is set to true, ws-table-segment is moved to gcstbrt-ad-segment, and gcstbrt-ad-dc-p-merlin-1 is moved to ws-emi-to-usercode.
  • Context - the program needs the current system date for processing:
    For Format Machine Date - YYYYMMDD:
    When machine date is being formatted, then cc-machine-year from cccom is moved to ws-fmt-machine-year, cc-machine-month from cccom is moved to ws-fmt-machine-month, and cc-machine-day from cccom is moved to ws-fmt-machine-day.
  • Context - the program needs the current system time for processing:
    For Format Machine Time - HHMMSS:
    When machine time is being formatted, then cc-machine-hour from cccom is moved to ws-fmt-machine-hour, cc-machine-min from cccom is moved to ws-fmt-machine-min, cc-machine-sec from cccom is moved to ws-fmt-machine-sec, and 01 is moved to ws-fmt-machine-seq.
  • Context - machine date and time have been formatted:
    For Save Formatted Date/Time for Processing:
    When formatted values are being saved, then ws-fmt-machine-date is moved to ws-save-fmt-machine-date and ws-x4-fmt-machine-date, and ws-fmt-machine-time is moved to ws-save-fmt-machine-time and ws-x4-fmt-machine-time.
  • Context - the current machine date is available in gregorian format:
    For Convert Gregorian Date to Julian Date:
    When date conversion is performed, then datcv-parameter-list is initialized, cc-machine-century and cc-machine-date-x from cccom are concatenated into input-date-gregorian, in-func-code is set to 2, out-func-code is set to 1, iscdatcv is called with datcv-parameter-list, and output-1 is moved to ws-date.
  • Context - date conversion has been attempted using iscdatcv:
    For Convert Gregorian Date to Julian Date:
    When datcv-parm-error is true, then cc-error-message in cccom is set to 'module iscdatcv said cccom contain invalid date' and the program aborts by performing z900-abend.
  • Context - the program needs to check the ims message queue:
    For Read Initial Message from IMS Queue:
    When initial queue read is performed, then ws-ioarea is set to spaces, cc-accept-status in cccom is set to 'qcqd', and cims is called with cccom, gu function, io-pcb from cccom, and ws-ioarea.
  • Context - the program needs to access mq messages:
    For Establish MQ Connection to Queue Manager:
    When mq connection is established, then mqconnc is called with w03-mqmanager, w03-hconn, w03-compcode, and w03-reason.
  • Context - mq connection has been attempted:
    For Establish MQ Connection to Queue Manager:
    When w03-compcode is not equal to mqcc-ok, then w03-reason is moved to w03-reason-code, output-message-text is initialized, gccmqerr is called with w03-reason-code and output-message-text, w03-reason-code and output-message-text are concatenated into mq-error-text, '355' is moved to mq-trans-set, 'conn failed' is moved to pgm-error-text, error-message2 is moved to cc-error-message in cccom, and the program aborts by performing z900-abend.
  • Context - mq connection has been established successfully:
    For Open MQ Queue for Input:
    When mq queue is being opened, then mqot-q is moved to mqod-objecttype, mqtmc-qname is moved to mqod-objectname, w03-options is computed as mqoo-input-as-q-def, and mqopen is called with w03-hconn, mqod, w03-options, w03-hobj-response, w03-compcode, and w03-reason.
  • Context - mq queue open has been attempted:
    For Open MQ Queue for Input:
    When w03-compcode is not equal to mqcc-ok, then w03-reason is moved to w03-reason-code, output-message-text is initialized, gccmqerr is called with w03-reason-code and output-message-text, w03-reason-code and output-message-text are concatenated into mq-error-text, '355' is moved to mq-trans-set, 'open failed' is moved to pgm-error-text, error-message2 is moved to cc-error-message in cccom, and the program aborts by performing z900-abend.
👨‍💻 Technical ACs (Gherkin)
Context: The program GCX126 is starting execution
GIVEN
The program GCX126 is starting execution
Applied to: Set Program Name and Module Name
WHEN
The program initialization begins
THEN
The current program name from CCCOM is saved to PROG-NAME-SAVED and MODULE-NAME is moved to CC-PROG in CCCOM
Context: The program is starting initialization
GIVEN
The program is starting initialization
Applied to: Initialize Working Storage Fields
WHEN
Working storage initialization is performed
THEN
LOG-INDX is set to 1, WS-K1-REMARK-NDX is set to ZEROES, LOG-ARRAY is set to SPACES, WS-PREV-CRN is set to SPACES, WS-MQS-LEN-HEADER is set to LENGTH OF MQS-MESSAGE-HEADER, WS-MQS-LEN-OF-1-ENTRY is set to LENGTH OF MQS-TABLE-ENTRY(1), MRLN-LINE is set to 1, WS-CTR-NEW is set to 1, and MRLN-350-REPORT is set to SPACES
Context: The program is initializing for message processing
GIVEN
The program is initializing for message processing
Applied to: Initialize Segment Flags
WHEN
Segment flags are being initialized
THEN
WS-NO-HEADER-FOUND, WS-NO-TRAILER-FOUND, WS-NO-M10-SEG-FOUND, WS-NO-P4-SEG-FOUND, WS-NO-N7-SEG-FOUND, WS-NO-X4-SEG-FOUND, WS-NO-K1-SEG-FOUND, WS-NO-V9-SEG-FOUND, WS-NO-END-FOUND, and WS-CARGO-NOT-FOUND are all set to TRUE
Context: The program is initializing Merlin notification settings
GIVEN
The program is initializing Merlin notification settings
Applied to: Set Merlin Report User Code
WHEN
The Merlin sender code is being set
THEN
EMI-FROM-USERCODE is set to 'OM01247'
Context: The program needs to access database tables
GIVEN
The program needs to access database tables
Applied to: Initialize Working Storage Fields
WHEN
Database access parameters are initialized
THEN
CC-ACCEPT-STATUS in CCCOM is set to 'GE', GCCTBIO-FUNC-CODE is set to GU, GCSTBRT-KEY-VALUE is set to SPACES, GCSTBDP-KEY-VALUE is set to SPACES, GCCTBIO-RETURN-FLAG is set to SPACES, GCSTBRT-AD-SEGMENT is set to SPACES, SECOND-PCB-FLAG is set to SPACES, and UNQUAL-SSA-FLAG is set to SPACES
Context: The program is preparing to process a new EDI 350 message
GIVEN
The program is preparing to process a new EDI 350 message
Applied to: Initialize Working Storage Fields
WHEN
Message segment structures are initialized
THEN
M10-SEGMENT, P4-SEGMENT, V9-SEGMENT, K1-SEGMENT, X4-SEGMENT, and N7-SEGMENT are all initialized to their default values
Context: The program needs to determine Merlin notification recipients
GIVEN
The program needs to determine Merlin notification recipients
Applied to: Retrieve Admin Configuration from GCSTBRT Table
WHEN
Admin configuration is retrieved with TABLE-ID 'AD' and SEQID 'ADMINID'
THEN
GCCTBIO is called with function GU to retrieve GCSTBRT segment
Context: Admin configuration has been retrieved from GCSTBRT table
GIVEN
Admin configuration has been retrieved from GCSTBRT table
Applied to: Extract Merlin User Code from Admin Config
WHEN
GCCTBIO-RETURN-FLAG equals '0'
THEN
88-AD-SEGMENT-FOUND is set to TRUE, WS-TABLE-SEGMENT is moved to GCSTBRT-AD-SEGMENT, and GCSTBRT-AD-DC-P-MERLIN-1 is moved to WS-EMI-TO-USERCODE
Context: The program needs the current system date for processing
GIVEN
The program needs the current system date for processing
Applied to: Format Machine Date - YYYYMMDD
WHEN
Machine date is being formatted
THEN
CC-MACHINE-YEAR from CCCOM is moved to WS-FMT-MACHINE-YEAR, CC-MACHINE-MONTH from CCCOM is moved to WS-FMT-MACHINE-MONTH, and CC-MACHINE-DAY from CCCOM is moved to WS-FMT-MACHINE-DAY
Context: The program needs the current system time for processing
GIVEN
The program needs the current system time for processing
Applied to: Format Machine Time - HHMMSS
WHEN
Machine time is being formatted
THEN
CC-MACHINE-HOUR from CCCOM is moved to WS-FMT-MACHINE-HOUR, CC-MACHINE-MIN from CCCOM is moved to WS-FMT-MACHINE-MIN, CC-MACHINE-SEC from CCCOM is moved to WS-FMT-MACHINE-SEC, and 01 is moved to WS-FMT-MACHINE-SEQ
Context: Machine date and time have been formatted
GIVEN
Machine date and time have been formatted
Applied to: Save Formatted Date/Time for Processing
WHEN
Formatted values are being saved
THEN
WS-FMT-MACHINE-DATE is moved to WS-SAVE-FMT-MACHINE-DATE and WS-X4-FMT-MACHINE-DATE, and WS-FMT-MACHINE-TIME is moved to WS-SAVE-FMT-MACHINE-TIME and WS-X4-FMT-MACHINE-TIME
Context: The current machine date is available in Gregorian format
GIVEN
The current machine date is available in Gregorian format
Applied to: Convert Gregorian Date to Julian Date
WHEN
Date conversion is performed
THEN
DATCV-PARAMETER-LIST is initialized, CC-MACHINE-CENTURY and CC-MACHINE-DATE-X from CCCOM are concatenated into INPUT-DATE-GREGORIAN, IN-FUNC-CODE is set to 2, OUT-FUNC-CODE is set to 1, ISCDATCV is called with DATCV-PARAMETER-LIST, and OUTPUT-1 is moved to WS-DATE
Context: Date conversion has been attempted using ISCDATCV
GIVEN
Date conversion has been attempted using ISCDATCV
Applied to: Convert Gregorian Date to Julian Date
WHEN
DATCV-PARM-ERROR is TRUE
THEN
CC-ERROR-MESSAGE in CCCOM is set to 'MODULE ISCDATCV SAID CCCOM CONTAIN INVALID DATE' and the program aborts by performing Z900-ABEND
Context: The program needs to check the IMS message queue
GIVEN
The program needs to check the IMS message queue
Applied to: Read Initial Message from IMS Queue
WHEN
Initial queue read is performed
THEN
WS-IOAREA is set to SPACES, CC-ACCEPT-STATUS in CCCOM is set to 'QCQD', and CIMS is called with CCCOM, GU function, IO-PCB from CCCOM, and WS-IOAREA
Context: The program needs to access MQ messages
GIVEN
The program needs to access MQ messages
Applied to: Establish MQ Connection to Queue Manager
WHEN
MQ connection is established
THEN
MQCONNC is called with W03-MQMANAGER, W03-HCONN, W03-COMPCODE, and W03-REASON
Context: MQ connection has been attempted
GIVEN
MQ connection has been attempted
Applied to: Establish MQ Connection to Queue Manager
WHEN
W03-COMPCODE is not equal to MQCC-OK
THEN
W03-REASON is moved to W03-REASON-CODE, OUTPUT-MESSAGE-TEXT is initialized, GCCMQERR is called with W03-REASON-CODE and OUTPUT-MESSAGE-TEXT, W03-REASON-CODE and OUTPUT-MESSAGE-TEXT are concatenated into MQ-ERROR-TEXT, '355' is moved to MQ-TRANS-SET, 'CONN FAILED' is moved to PGM-ERROR-TEXT, ERROR-MESSAGE2 is moved to CC-ERROR-MESSAGE in CCCOM, and the program aborts by performing Z900-ABEND
Context: MQ connection has been established successfully
GIVEN
MQ connection has been established successfully
Applied to: Open MQ Queue for Input
WHEN
MQ queue is being opened
THEN
MQOT-Q is moved to MQOD-OBJECTTYPE, MQTMC-QNAME is moved to MQOD-OBJECTNAME, W03-OPTIONS is computed as MQOO-INPUT-AS-Q-DEF, and MQOPEN is called with W03-HCONN, MQOD, W03-OPTIONS, W03-HOBJ-RESPONSE, W03-COMPCODE, and W03-REASON
Context: MQ queue open has been attempted
GIVEN
MQ queue open has been attempted
Applied to: Open MQ Queue for Input
WHEN
W03-COMPCODE is not equal to MQCC-OK
THEN
W03-REASON is moved to W03-REASON-CODE, OUTPUT-MESSAGE-TEXT is initialized, GCCMQERR is called with W03-REASON-CODE and OUTPUT-MESSAGE-TEXT, W03-REASON-CODE and OUTPUT-MESSAGE-TEXT are concatenated into MQ-ERROR-TEXT, '355' is moved to MQ-TRANS-SET, 'OPEN FAILED' is moved to PGM-ERROR-TEXT, ERROR-MESSAGE2 is moved to CC-ERROR-MESSAGE in CCCOM, and the program aborts by performing Z900-ABEND
R-CCISCOM-cbl-00038 (+2) File: CCISCOM.cbl PCB Counter Management Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Counter Management':
  • Context - a database name from cccom entry (i) and a database name from iscom entry (j) are being compared:
    For Increment PCB Counter by 1:
    When the database name from cccom matches the database name from iscom, then the iscom pcb number counter is incremented by 1.
  • Context - a database name from cccom entry at position i and a database name from iscom entry at position j:
    For Database Names Match?:
    When the system compares the two database names, then if the names are identical, proceed to increment pcb counter; otherwise continue to next database entry.
  • Context - two iscom database entries at positions i and k are being compared during reverse processing:
    For Increment PCB Counter by 1:
    When the database name at position i matches the database name at position k, then the iscom pcb number counter is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: A database name from CCCOM entry (I) and a database name from ISCOM entry (J) are being compared
GIVEN
A database name from CCCOM entry (I) and a database name from ISCOM entry (J) are being compared
Applied to: Increment PCB Counter by 1
WHEN
The database name from CCCOM matches the database name from ISCOM
THEN
The ISCOM PCB number counter is incremented by 1
Context: A database name from CCCOM entry at position I and a database name from ISCOM entry at position J
GIVEN
A database name from CCCOM entry at position I and a database name from ISCOM entry at position J
Applied to: Database Names Match?
WHEN
The system compares the two database names
THEN
If the names are identical, proceed to increment PCB counter; otherwise continue to next database entry
Context: Two ISCOM database entries at positions I and K are being compared during reverse processing
GIVEN
Two ISCOM database entries at positions I and K are being compared during reverse processing
Applied to: Increment PCB Counter by 1
WHEN
The database name at position I matches the database name at position K
THEN
The ISCOM PCB number counter is incremented by 1
R-GCCTBIO-cbl-00040 (+7) File: GCCTBIO.cbl Handle Dependent Segment Unqualified Access Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Dependent Segment Unqualified Access':
  • Context - a segment name is provided for processing:
    For Is Segment GCSTBDP?:
    When the system checks the segment type, then the system identifies whether it is a dependent segment (gcstbdp-key-name) or not.
  • Context - a dependent segment is being processed:
    For Is SSA Type Qualified?:
    When the system evaluates the ssa flag type, then the system determines if the ssa type is qualified or not.
  • Context - a dependent segment with qualified ssa type is being processed:
    For Is Unqualified Flag Set?:
    When the system checks the unqualified ssa flag status, then the system determines if the unqualified flag is set (not space) or not set (space).
  • Context - a dependent segment with qualified ssa type and unqualified flag not set:
    For Set Root Key Value, Set Dependent Key Value, Keep Qualified SSA Type:
    When the system configures the ssa parameters, then the system sets both root key value and dependent key value while maintaining qualified ssa type.
  • Context - a dependent segment with qualified ssa type and unqualified flag set:
    For Set Root Key Value Only, Change to Unqualified SSA Type:
    When the system configures the ssa parameters, then the system sets only the root key value and changes the ssa type to unqualified.
  • Context - a dependent segment is being processed and ssa type is not qualified:
    For Is SSA Type Unqualified?:
    When the system evaluates the ssa flag type, then the system determines if the ssa type is unqualified.
  • Context - a dependent segment with unqualified ssa type:
    For Set Root Key Value, Force Unqualified SSA Type:
    When the system configures the ssa parameters, then the system sets the root key value and forces the ssa type to unqualified.
  • Context - a segment name that is not a recognized segment type:
    For Invalid Segment - Set Error Flag:
    When the system processes the segment, then the system sets the return flag to indicate an invalid segment error.
👨‍💻 Technical ACs (Gherkin)
Context: A segment name is provided for processing
GIVEN
A segment name is provided for processing
Applied to: Is Segment GCSTBDP?
WHEN
The system checks the segment type
THEN
The system identifies whether it is a dependent segment (GCSTBDP-KEY-NAME) or not
Context: A dependent segment is being processed
GIVEN
A dependent segment is being processed
Applied to: Is SSA Type Qualified?
WHEN
The system evaluates the SSA flag type
THEN
The system determines if the SSA type is qualified or not
Context: A dependent segment with qualified SSA type is being processed
GIVEN
A dependent segment with qualified SSA type is being processed
Applied to: Is Unqualified Flag Set?
WHEN
The system checks the unqualified SSA flag status
THEN
The system determines if the unqualified flag is set (not space) or not set (space)
Context: A dependent segment with qualified SSA type and unqualified flag not set
GIVEN
A dependent segment with qualified SSA type and unqualified flag not set
Applied to: Set Root Key Value, Set Dependent Key Value, Keep Qualified SSA Type
WHEN
The system configures the SSA parameters
THEN
The system sets both root key value and dependent key value while maintaining qualified SSA type
Context: A dependent segment with qualified SSA type and unqualified flag set
GIVEN
A dependent segment with qualified SSA type and unqualified flag set
Applied to: Set Root Key Value Only, Change to Unqualified SSA Type
WHEN
The system configures the SSA parameters
THEN
The system sets only the root key value and changes the SSA type to unqualified
Context: A dependent segment is being processed and SSA type is not qualified
GIVEN
A dependent segment is being processed and SSA type is not qualified
Applied to: Is SSA Type Unqualified?
WHEN
The system evaluates the SSA flag type
THEN
The system determines if the SSA type is unqualified
Context: A dependent segment with unqualified SSA type
GIVEN
A dependent segment with unqualified SSA type
Applied to: Set Root Key Value, Force Unqualified SSA Type
WHEN
The system configures the SSA parameters
THEN
The system sets the root key value and forces the SSA type to unqualified
Context: A segment name that is not a recognized segment type
GIVEN
A segment name that is not a recognized segment type
Applied to: Invalid Segment - Set Error Flag
WHEN
The system processes the segment
THEN
The system sets the return flag to indicate an invalid segment error
R-CCISCOM-cbl-00041 (+3) File: CCISCOM.cbl PCB Address Mapping Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Address Mapping':
  • Context - a cccom entry at position i and an iscom entry at position j both contain database names:
    For Database Names Match Between CCCOM and ISCOM?:
    When the system compares the database name from cccom entry i with the database name from iscom entry j, then if the database names are identical, the system proceeds with pcb counter increment; otherwise, it continues to the next entry.
  • Context - database names match between cccom entry i and iscom entry j:
    For Increment ISCOM PCB Counter:
    When the system processes the matching database entries, then the iscom pcb number counter is incremented by 1.
  • Context - the iscom pcb number has been incremented and the cccom pcb number is available:
    For PCB Numbers Match?:
    When the system compares the iscom pcb number with the cccom pcb number, then if the pcb numbers are equal, the system proceeds with pcb address mapping; otherwise, it continues processing.
  • Context - database names match and pcb numbers are equal between cccom entry i and iscom entry j:
    For Map PCB Address from CCCOM to ISCOM:
    When the system performs pcb address mapping, then the pcb address from cccom entry i is assigned to iscom entry j.
👨‍💻 Technical ACs (Gherkin)
Context: A CCCOM entry at position I and an ISCOM entry at position J both contain database names
GIVEN
A CCCOM entry at position I and an ISCOM entry at position J both contain database names
Applied to: Database Names Match Between CCCOM and ISCOM?
WHEN
The system compares the database name from CCCOM entry I with the database name from ISCOM entry J
THEN
If the database names are identical, the system proceeds with PCB counter increment; otherwise, it continues to the next entry
Context: Database names match between CCCOM entry I and ISCOM entry J
GIVEN
Database names match between CCCOM entry I and ISCOM entry J
Applied to: Increment ISCOM PCB Counter
WHEN
The system processes the matching database entries
THEN
The ISCOM PCB number counter is incremented by 1
Context: The ISCOM PCB number has been incremented and the CCCOM PCB number is available
GIVEN
The ISCOM PCB number has been incremented and the CCCOM PCB number is available
Applied to: PCB Numbers Match?
WHEN
The system compares the ISCOM PCB number with the CCCOM PCB number
THEN
If the PCB numbers are equal, the system proceeds with PCB address mapping; otherwise, it continues processing
Context: Database names match and PCB numbers are equal between CCCOM entry I and ISCOM entry J
GIVEN
Database names match and PCB numbers are equal between CCCOM entry I and ISCOM entry J
Applied to: Map PCB Address from CCCOM to ISCOM
WHEN
The system performs PCB address mapping
THEN
The PCB address from CCCOM entry I is assigned to ISCOM entry J
R-CIMS-cbl-00042 (+7) File: CIMS.cbl PCB Address Reset Logic Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Address Reset Logic':
  • Context - a pcb address reset operation is initiated:
    For Check Address Area Availability:
    When the system checks if the address area is not null, then the system proceeds with pcb address validation if address area is available, otherwise uses default csi address area.
  • Context - an address area is available for processing:
    For PCB Address Valid and Not Blank?:
    When the system evaluates if pcb address is not null and not blank pointer, then the system continues with version compatibility check if pcb address is valid, otherwise skips pcb reset logic.
  • Context - a valid pcb address exists:
    For CCCOM Version Compatible?:
    When the system compares cc-sit-version of cccom with ws-cccom-version, then the system proceeds with pcb copy address setup if versions match, otherwise skips pcb reset processing.
  • Context - cccom version is compatible with system version:
    For Set PCB Copy Address:
    When the system sets the address of lk-copy-of-pcb to pcb-addr, then the pcb copy address is established for subsequent segment level validation.
  • Context - pcb copy address is established:
    For Segment Level Valid?:
    When the system checks if lk-seg-level is not equal to '98' and not equal to '99', then the system identifies invalid segment level requiring address reset if condition is true, otherwise checks for force reset requirement.
  • Context - segment level is valid (98 or 99):
    For Force Reset Required?:
    When the system evaluates the force-reset flag, then the system proceeds with address reset if force reset is required, otherwise continues normal processing.
  • Context - either segment level is invalid or force reset is required:
    For Reset PCB Address Area to Spaces:
    When the system executes the address area reset operation, then the first 8 positions of the address area are set to spaces to clear the pcb address.
  • Context - the address area is null or not available:
    For Continue Processing:
    When the system needs to continue processing without a valid address area, then the system sets the address area to csi-addr-area and generates a zero pcb address error message.
👨‍💻 Technical ACs (Gherkin)
Context: A PCB address reset operation is initiated
GIVEN
A PCB address reset operation is initiated
Applied to: Check Address Area Availability
WHEN
The system checks if the address area is not null
THEN
The system proceeds with PCB address validation if address area is available, otherwise uses default CSI address area
Context: An address area is available for processing
GIVEN
An address area is available for processing
Applied to: PCB Address Valid and Not Blank?
WHEN
The system evaluates if PCB address is not null and not blank pointer
THEN
The system continues with version compatibility check if PCB address is valid, otherwise skips PCB reset logic
Context: A valid PCB address exists
GIVEN
A valid PCB address exists
Applied to: CCCOM Version Compatible?
WHEN
The system compares CC-SIT-VERSION of CCCOM with WS-CCCOM-VERSION
THEN
The system proceeds with PCB copy address setup if versions match, otherwise skips PCB reset processing
Context: CCCOM version is compatible with system version
GIVEN
CCCOM version is compatible with system version
Applied to: Set PCB Copy Address
WHEN
The system sets the address of LK-COPY-OF-PCB to PCB-ADDR
THEN
The PCB copy address is established for subsequent segment level validation
Context: PCB copy address is established
GIVEN
PCB copy address is established
Applied to: Segment Level Valid?
WHEN
The system checks if LK-SEG-LEVEL is not equal to '98' and not equal to '99'
THEN
The system identifies invalid segment level requiring address reset if condition is true, otherwise checks for force reset requirement
Context: Segment level is valid (98 or 99)
GIVEN
Segment level is valid (98 or 99)
Applied to: Force Reset Required?
WHEN
The system evaluates the FORCE-RESET flag
THEN
The system proceeds with address reset if force reset is required, otherwise continues normal processing
Context: Either segment level is invalid or force reset is required
GIVEN
Either segment level is invalid or force reset is required
Applied to: Reset PCB Address Area to Spaces
WHEN
The system executes the address area reset operation
THEN
The first 8 positions of the address area are set to spaces to clear the PCB address
Context: The address area is null or not available
GIVEN
The address area is null or not available
Applied to: Continue Processing
WHEN
The system needs to continue processing without a valid address area
THEN
The system sets the address area to CSI-ADDR-AREA and generates a zero PCB address error message
R-CCISCOM-cbl-00045 (+3) File: CCISCOM.cbl Reverse Conversion Version Check Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Reverse Conversion Version Check':
  • Context - a reverse conversion process is initiated with iscom and cccom communication areas:
    For Reverse Conversion Version Check - Check if CCCOM version is already set for reverse conversion from ISCOM to CCCOM:
    When the system checks the cccom sit version against the expected cccom version, then if versions match, only common area data is transferred and cccom version is updated; if versions don't match, full initialization including common area, version update, lt-pcbs transfer, cross-references setup, and database scanning is performed.
  • Context - cccom sit version equals the working storage cccom version:
    For Version Already Set - Transfer Common Area Data Only:
    When reverse conversion is performed, then common area data is copied from iscom to cccom and cccom sit version is set to working storage cccom version.
  • Context - cccom sit version does not equal the working storage cccom version:
    For Version Not Set - Proceed with Full Initialization:
    When reverse conversion is performed, then common area is copied from iscom to cccom, cccom sit version is updated, lt-pcbs are transferred from iscom to cccom, cross-reference addresses are established, and database address scanning is initiated.
  • Context - reverse conversion process is in progress:
    For Set CCCOM Version to Expected Value:
    When version update is required, then cccom sit version is set to the working storage cccom version value.
👨‍💻 Technical ACs (Gherkin)
Context: A reverse conversion process is initiated with ISCOM and CCCOM communication areas
GIVEN
A reverse conversion process is initiated with ISCOM and CCCOM communication areas
Applied to: Reverse Conversion Version Check - Check if CCCOM version is already set for reverse conversion from ISCOM to CCCOM
WHEN
The system checks the CCCOM SIT version against the expected CCCOM version
THEN
If versions match, only common area data is transferred and CCCOM version is updated; if versions don't match, full initialization including common area, version update, LT-PCBS transfer, cross-references setup, and database scanning is performed
Context: CCCOM SIT version equals the working storage CCCOM version
GIVEN
CCCOM SIT version equals the working storage CCCOM version
Applied to: Version Already Set - Transfer Common Area Data Only
WHEN
Reverse conversion is performed
THEN
Common area data is copied from ISCOM to CCCOM and CCCOM SIT version is set to working storage CCCOM version
Context: CCCOM SIT version does not equal the working storage CCCOM version
GIVEN
CCCOM SIT version does not equal the working storage CCCOM version
Applied to: Version Not Set - Proceed with Full Initialization
WHEN
Reverse conversion is performed
THEN
Common area is copied from ISCOM to CCCOM, CCCOM SIT version is updated, LT-PCBS are transferred from ISCOM to CCCOM, cross-reference addresses are established, and database address scanning is initiated
Context: Reverse conversion process is in progress
GIVEN
Reverse conversion process is in progress
Applied to: Set CCCOM Version to Expected Value
WHEN
Version update is required
THEN
CCCOM SIT version is set to the working storage CCCOM version value
R-GCCTBIO-cbl-00048 (+1) File: GCCTBIO.cbl Route Root Segment Access Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Route Root Segment Access':
  • Context - a root segment access request is being processed:
    For Route to Primary PCB:
    When the second pcb flag is spaces (not set), then the system routes the request to primary pcb processing (b310-access-root-pcb1).
    For Route to Secondary PCB:
    When the second pcb flag is not spaces (is set), then the system routes the request to secondary pcb processing (b320-access-root-pcb2).
👨‍💻 Technical ACs (Gherkin)
Context: A root segment access request is being processed
GIVEN
A root segment access request is being processed
Applied to: Route to Primary PCB
WHEN
The second PCB flag is spaces (not set)
THEN
The system routes the request to primary PCB processing (B310-ACCESS-ROOT-PCB1)
Applied to: Route to Secondary PCB
WHEN
The second PCB flag is not spaces (is set)
THEN
The system routes the request to secondary PCB processing (B320-ACCESS-ROOT-PCB2)
R-CCISCOM-cbl-00049 (+1) File: CCISCOM.cbl Reverse Data Transfer Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Reverse Data Transfer':
  • Context - iscom structure contains common area data and cccom structure is available for data transfer:
    For Transfer Common Area Data from ISCOM to CCCOM:
    When reverse conversion process is initiated from iscom to cccom, then common area data from iscom is copied to cccom structure.
  • Context - cccom structure is being updated during reverse conversion and working storage contains cccom version number:
    For Set CCCOM Version Number:
    When common area data transfer is completed, then cccom sit version is set to the working storage cccom version number.
👨‍💻 Technical ACs (Gherkin)
Context: ISCOM structure contains common area data and CCCOM structure is available for data transfer
GIVEN
ISCOM structure contains common area data and CCCOM structure is available for data transfer
Applied to: Transfer Common Area Data from ISCOM to CCCOM
WHEN
Reverse conversion process is initiated from ISCOM to CCCOM
THEN
Common area data from ISCOM is copied to CCCOM structure
Context: CCCOM structure is being updated during reverse conversion and working storage contains CCCOM version number
GIVEN
CCCOM structure is being updated during reverse conversion and working storage contains CCCOM version number
Applied to: Set CCCOM Version Number
WHEN
Common area data transfer is completed
THEN
CCCOM SIT version is set to the working storage CCCOM version number
R-GCCUSIO-cbl-00049 (+19) File: GCCUSIO.cbl Primary Cargo Record Update Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Cargo Record Update':
  • Context - a cargo record update operation is requested:
    For Retrieve Current Cargo Record:
    When the system needs to retrieve the current cargo record, then the system performs a get hold unique operation to retrieve and lock the current cargo record.
  • Context - a cargo record is being updated:
    For Save Current Iron Highway Status & Save Current Waybill Number & Save Current Car Number:
    When the current cargo record is retrieved, then the system saves the us cargo short description to track status changes and the system saves the first 15 characters of the waybill number index for notification purposes and the system saves the car id number index for notification purposes.
  • Context - the current cargo record has been retrieved and saved data exists:
    For Restore Updated Cargo Data:
    When the system needs to apply updates to the cargo record, then the system restores the updated cargo data from the saved working area.
  • Context - a cargo record is being processed for index field updates:
    For Populate Index Fields:
    When the cargo record is marked as deleted, then the system skips all index field population and exits the process.
  • Context - a cargo record is being updated and is not marked as deleted:
    For Populate Index Fields:
    When index fields need to be populated, then the system copies the us ccn key to rt071, rt072, and rt073 index fields.
  • Context - a cargo record is being updated with index fields:
    For Populate Index Fields:
    When the destination index field is not empty, then the system copies the us ccn key to the rt076 destination index field.
    For Set Car ID Index:
    When car identification information is available, then the system copies the equipment car number to both rt071 and rt073 car id index fields.
    For Set Waybill Index Fields:
    When waybill information is available in the cargo record, then the system populates rt072 index with road number, station number, waybill number and waybill date, and copies waybill number to rt073 index.
    For Set Manifest Index:
    When index field population is in progress, then the system copies the us ccn key to the rt075 manifest index field.
  • Context - a cargo record is being updated with bond index information:
    For Set Bond Number Index:
    When the in-bond control number is not empty, then the system uses the in-bond control number to populate the rt074 bond number index.
    For Set Entry Number as Bond Index:
    When both in-bond control number and entry number are empty, then the system sets the rt074 bond number index to spaces.
  • Context - a cargo record is being updated with bond index information and in-bond control number is empty:
    For Set Entry Number as Bond Index:
    When the entry number is not empty, then the system uses the entry number to populate the rt074 bond number index.
  • Context - a cargo record is being replaced:
    For Update Last Modification Timestamp & Set Last Modification User ID & Set Last Modification Terminal:
    When the record modification tracking needs to be updated, then the system sets the last modify date to current machine date and last modify time to current machine time and the system sets the last modify user id to the current acf2 user id and the system sets the last modify terminal to the current originating terminal.
  • Context - a cargo record has been prepared with updated data and timestamps:
    For Replace Cargo Record in Database:
    When the record is ready to be saved to the database, then the system performs a replace operation using unqualified ssa to update the cargo record.
  • Context - a cargo record has been successfully replaced in the primary database:
    For Update Index Database Records:
    When index database synchronization is required, then the system updates the gcsb1rt index database records to reflect the cargo status changes.
  • Context - a cargo record has been updated and index databases have been synchronized:
    For Process Iron Highway Notification:
    When status change notification is required, then the system processes iron highway notification using saved status information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record update operation is requested
GIVEN
A cargo record update operation is requested
Applied to: Retrieve Current Cargo Record
WHEN
The system needs to retrieve the current cargo record
THEN
The system performs a Get Hold Unique operation to retrieve and lock the current cargo record
Context: A cargo record is being updated
GIVEN
A cargo record is being updated
Applied to: Save Current Iron Highway Status & Save Current Waybill Number & Save Current Car Number
WHEN
The current cargo record is retrieved
THEN
The system saves the US cargo short description to track status changes AND The system saves the first 15 characters of the waybill number index for notification purposes AND The system saves the car ID number index for notification purposes
Context: The current cargo record has been retrieved and saved data exists
GIVEN
The current cargo record has been retrieved and saved data exists
Applied to: Restore Updated Cargo Data
WHEN
The system needs to apply updates to the cargo record
THEN
The system restores the updated cargo data from the saved working area
Context: A cargo record is being processed for index field updates
GIVEN
A cargo record is being processed for index field updates
Applied to: Populate Index Fields
WHEN
The cargo record is marked as deleted
THEN
The system skips all index field population and exits the process
Context: A cargo record is being updated and is not marked as deleted
GIVEN
A cargo record is being updated and is not marked as deleted
Applied to: Populate Index Fields
WHEN
Index fields need to be populated
THEN
The system copies the US CCN key to RT071, RT072, and RT073 index fields
Context: A cargo record is being updated with index fields
GIVEN
A cargo record is being updated with index fields
Applied to: Populate Index Fields
WHEN
The destination index field is not empty
THEN
The system copies the US CCN key to the RT076 destination index field
Applied to: Set Car ID Index
WHEN
Car identification information is available
THEN
The system copies the equipment car number to both RT071 and RT073 car ID index fields
Applied to: Set Waybill Index Fields
WHEN
Waybill information is available in the cargo record
THEN
The system populates RT072 index with road number, station number, waybill number and waybill date, and copies waybill number to RT073 index
Applied to: Set Manifest Index
WHEN
Index field population is in progress
THEN
The system copies the US CCN key to the RT075 manifest index field
Context: A cargo record is being updated with bond index information
GIVEN
A cargo record is being updated with bond index information
Applied to: Set Bond Number Index
WHEN
The in-bond control number is not empty
THEN
The system uses the in-bond control number to populate the RT074 bond number index
Applied to: Set Entry Number as Bond Index
WHEN
Both in-bond control number and entry number are empty
THEN
The system sets the RT074 bond number index to spaces
Context: A cargo record is being updated with bond index information and in-bond control number is empty
GIVEN
A cargo record is being updated with bond index information and in-bond control number is empty
Applied to: Set Entry Number as Bond Index
WHEN
The entry number is not empty
THEN
The system uses the entry number to populate the RT074 bond number index
Context: A cargo record is being replaced
GIVEN
A cargo record is being replaced
Applied to: Update Last Modification Timestamp & Set Last Modification User ID & Set Last Modification Terminal
WHEN
The record modification tracking needs to be updated
THEN
The system sets the last modify date to current machine date and last modify time to current machine time AND The system sets the last modify user ID to the current ACF2 user ID AND The system sets the last modify terminal to the current originating terminal
Context: A cargo record has been prepared with updated data and timestamps
GIVEN
A cargo record has been prepared with updated data and timestamps
Applied to: Replace Cargo Record in Database
WHEN
The record is ready to be saved to the database
THEN
The system performs a replace operation using unqualified SSA to update the cargo record
Context: A cargo record has been successfully replaced in the primary database
GIVEN
A cargo record has been successfully replaced in the primary database
Applied to: Update Index Database Records
WHEN
Index database synchronization is required
THEN
The system updates the GCSB1RT index database records to reflect the cargo status changes
Context: A cargo record has been updated and index databases have been synchronized
GIVEN
A cargo record has been updated and index databases have been synchronized
Applied to: Process Iron Highway Notification
WHEN
Status change notification is required
THEN
The system processes Iron Highway notification using saved status information
R-GCCTBIO-cbl-00050 (+3) File: GCCTBIO.cbl Execute Root Segment Database Call with Primary PCB Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Root Segment Database Call with Primary PCB':
  • Context - the system is processing a root segment access request and the ssa flag indicates qualified ssa is required:
    For Execute Database Call with Qualified SSA:
    When the database call is executed for root segment using primary pcb, then the system calls the database interface with qualified root segment search arguments to retrieve specific records.
  • Context - the system is processing a root segment access request and the ssa flag indicates unqualified ssa is required:
    For Execute Database Call with Unqualified SSA:
    When the database call is executed for root segment using primary pcb, then the system calls the database interface with unqualified root segment search arguments to retrieve records without specific criteria.
  • Context - the system is processing a root segment access request and no ssa is required for the operation:
    For Execute Database Call without SSA:
    When the database call is executed for root segment using primary pcb, then the system calls the database interface without any segment search arguments.
  • Context - the system is preparing to execute a database call for root segment access using primary pcb:
    For SSA Type Check:
    When the ssa type needs to be determined for the database operation, then the system checks the ws-ssa-flag to determine whether to use qualified ssa, unqualified ssa, or no ssa for the database call.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing a root segment access request and the SSA flag indicates qualified SSA is required
GIVEN
The system is processing a root segment access request and the SSA flag indicates qualified SSA is required
Applied to: Execute Database Call with Qualified SSA
WHEN
The database call is executed for root segment using primary PCB
THEN
The system calls the database interface with qualified root segment search arguments to retrieve specific records
Context: The system is processing a root segment access request and the SSA flag indicates unqualified SSA is required
GIVEN
The system is processing a root segment access request and the SSA flag indicates unqualified SSA is required
Applied to: Execute Database Call with Unqualified SSA
WHEN
The database call is executed for root segment using primary PCB
THEN
The system calls the database interface with unqualified root segment search arguments to retrieve records without specific criteria
Context: The system is processing a root segment access request and no SSA is required for the operation
GIVEN
The system is processing a root segment access request and no SSA is required for the operation
Applied to: Execute Database Call without SSA
WHEN
The database call is executed for root segment using primary PCB
THEN
The system calls the database interface without any segment search arguments
Context: The system is preparing to execute a database call for root segment access using primary PCB
GIVEN
The system is preparing to execute a database call for root segment access using primary PCB
Applied to: SSA Type Check
WHEN
The SSA type needs to be determined for the database operation
THEN
The system checks the WS-SSA-FLAG to determine whether to use qualified SSA, unqualified SSA, or no SSA for the database call
R-CIMS-cbl-00050 (+12) File: CIMS.cbl PCB Address Resolution Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Address Resolution':
  • Context - a pcb address value exists in the system:
    For PCB Address is Null or Blank:
    When the pcb address equals null or blank pointer, then the system identifies that pcb address resolution is required.
  • Context - pcb address resolution process is initiated:
    For Reset PCB Address to Null:
    When the system prepares to search for valid pcb address, then the pcb address is set to null value.
  • Context - pcb address table search is about to begin:
    For Initialize Table Search Counter to 1:
    When the system initializes the search process, then the table counter is set to 1 to start from first entry.
  • Context - a table counter value during pcb address search:
    For Counter <= 249?:
    When the counter is evaluated against the maximum table size, then if counter is less than or equal to 249, continue search; otherwise terminate search.
  • Context - a pcb name value during address resolution:
    For PCB Name Equals '1'?:
    When the pcb name equals '1', then the system identifies this as a special case requiring name clearing.
  • Context - pcb name has value '1':
    For Clear PCB Name to Spaces:
    When special case processing is applied, then the pcb name is set to spaces.
  • Context - a pcb name and current table entry during search:
    For PCB Name Matches Table Entry?:
    When the pcb name is compared with the database name table entry, then if names match, proceed to address assignment; otherwise continue search.
  • Context - a matching pcb name found in database name table:
    For Set PCB Address from Table Entry:
    When the system locates the corresponding table entry, then the pcb address is set to the address value from the matching table entry.
  • Context - pcb address after table lookup attempt:
    For PCB Address Found?:
    When the system checks if address resolution was successful, then if pcb address is not null, resolution is complete; otherwise continue search.
  • Context - current database name table entry during search:
    For Table Entry Empty?:
    When the table entry is evaluated for content, then if entry contains spaces, terminate search; otherwise increment counter and continue.
  • Context - current search counter value during table iteration:
    For Increment Counter:
    When no match found and table entry is not empty, then the counter is incremented by 1 to move to next table entry.
  • Context - valid pcb address located through table search:
    For PCB Address Resolution Complete:
    When address resolution process concludes successfully, then the system has valid pcb address available for database operations.
  • Context - completed search through all available table entries:
    For Search Failed - No More Entries:
    When no matching pcb name found or table boundary exceeded, then the system recognizes pcb address resolution has failed.
👨‍💻 Technical ACs (Gherkin)
Context: A PCB address value exists in the system
GIVEN
A PCB address value exists in the system
Applied to: PCB Address is Null or Blank
WHEN
The PCB address equals null or blank pointer
THEN
The system identifies that PCB address resolution is required
Context: PCB address resolution process is initiated
GIVEN
PCB address resolution process is initiated
Applied to: Reset PCB Address to Null
WHEN
The system prepares to search for valid PCB address
THEN
The PCB address is set to null value
Context: PCB address table search is about to begin
GIVEN
PCB address table search is about to begin
Applied to: Initialize Table Search Counter to 1
WHEN
The system initializes the search process
THEN
The table counter is set to 1 to start from first entry
Context: A table counter value during PCB address search
GIVEN
A table counter value during PCB address search
Applied to: Counter <= 249?
WHEN
The counter is evaluated against the maximum table size
THEN
If counter is less than or equal to 249, continue search; otherwise terminate search
Context: A PCB name value during address resolution
GIVEN
A PCB name value during address resolution
Applied to: PCB Name Equals '1'?
WHEN
The PCB name equals '1'
THEN
The system identifies this as a special case requiring name clearing
Context: PCB name has value '1'
GIVEN
PCB name has value '1'
Applied to: Clear PCB Name to Spaces
WHEN
Special case processing is applied
THEN
The PCB name is set to spaces
Context: A PCB name and current table entry during search
GIVEN
A PCB name and current table entry during search
Applied to: PCB Name Matches Table Entry?
WHEN
The PCB name is compared with the database name table entry
THEN
If names match, proceed to address assignment; otherwise continue search
Context: A matching PCB name found in database name table
GIVEN
A matching PCB name found in database name table
Applied to: Set PCB Address from Table Entry
WHEN
The system locates the corresponding table entry
THEN
The PCB address is set to the address value from the matching table entry
Context: PCB address after table lookup attempt
GIVEN
PCB address after table lookup attempt
Applied to: PCB Address Found?
WHEN
The system checks if address resolution was successful
THEN
If PCB address is not null, resolution is complete; otherwise continue search
Context: Current database name table entry during search
GIVEN
Current database name table entry during search
Applied to: Table Entry Empty?
WHEN
The table entry is evaluated for content
THEN
If entry contains spaces, terminate search; otherwise increment counter and continue
Context: Current search counter value during table iteration
GIVEN
Current search counter value during table iteration
Applied to: Increment Counter
WHEN
No match found and table entry is not empty
THEN
The counter is incremented by 1 to move to next table entry
Context: Valid PCB address located through table search
GIVEN
Valid PCB address located through table search
Applied to: PCB Address Resolution Complete
WHEN
Address resolution process concludes successfully
THEN
The system has valid PCB address available for database operations
Context: Completed search through all available table entries
GIVEN
Completed search through all available table entries
Applied to: Search Failed - No More Entries
WHEN
No matching PCB name found or table boundary exceeded
THEN
The system recognizes PCB address resolution has failed
R-CCISCOM-cbl-00051 File: CCISCOM.cbl Reverse PCB Transfer
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Reverse PCB Transfer':
  • Context - iscom structure contains pcb information in cc-lt-pcbs field and cccom structure is available for data transfer:
    For Transfer PCB Data to CCCOM Structure:
    When reverse conversion process is initiated and version compatibility requires pcb data synchronization, then pcb information from iscom cc-lt-pcbs field is copied to cccom cc-lt-pcbs field.
👨‍💻 Technical ACs (Gherkin)
Context: ISCOM structure contains PCB information in CC-LT-PCBS field and CCCOM structure is available for data transfer
GIVEN
ISCOM structure contains PCB information in CC-LT-PCBS field and CCCOM structure is available for data transfer
Applied to: Transfer PCB Data to CCCOM Structure
WHEN
reverse conversion process is initiated and version compatibility requires PCB data synchronization
THEN
PCB information from ISCOM CC-LT-PCBS field is copied to CCCOM CC-LT-PCBS field
R-CCISCOM-cbl-00052 (+5) File: CCISCOM.cbl Active PCB Identification Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Active PCB Identification':
  • Context - an iscom entry with a pcb address field:
    For PCB Address ≠ Zero?:
    When the system evaluates the pcb address value, then if pcb address is not equal to zero, the entry is identified as active and processing continues; if pcb address equals zero, the entry is skipped as inactive.
  • Context - an active iscom entry with non-zero pcb address:
    For Mark as Active PCB Entry:
    When the system begins processing the active entry, then iscom pcb number is set to 1 to start the numbering sequence.
  • Context - an active iscom entry and a target cccom entry position:
    For Continue Processing Active Entry:
    When the system processes the active pcb entry, then the database name from iscom entry is copied to the cccom entry at the current position.
  • Context - an active iscom entry with non-zero pcb address and a target cccom entry:
    For Continue Processing Active Entry:
    When the system processes the active pcb entry, then the pcb address from iscom entry is set in the corresponding cccom entry.
  • Context - a calculated iscom pcb number and a target cccom entry:
    For Continue Processing Active Entry:
    When the system determines the pcb number assignment, then if iscom pcb number equals '1', cccom database number is set to spaces; otherwise iscom pcb number is copied to cccom database number.
  • Context - a processed active iscom entry:
    For Continue Processing Active Entry:
    When the system completes processing of the active entry, then the cccom entry counter (j) is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: An ISCOM entry with a PCB address field
GIVEN
An ISCOM entry with a PCB address field
Applied to: PCB Address ≠ Zero?
WHEN
The system evaluates the PCB address value
THEN
If PCB address is not equal to zero, the entry is identified as active and processing continues; if PCB address equals zero, the entry is skipped as inactive
Context: An active ISCOM entry with non-zero PCB address
GIVEN
An active ISCOM entry with non-zero PCB address
Applied to: Mark as Active PCB Entry
WHEN
The system begins processing the active entry
THEN
ISCOM PCB number is set to 1 to start the numbering sequence
Context: An active ISCOM entry and a target CCCOM entry position
GIVEN
An active ISCOM entry and a target CCCOM entry position
Applied to: Continue Processing Active Entry
WHEN
The system processes the active PCB entry
THEN
The database name from ISCOM entry is copied to the CCCOM entry at the current position
Context: An active ISCOM entry with non-zero PCB address and a target CCCOM entry
GIVEN
An active ISCOM entry with non-zero PCB address and a target CCCOM entry
Applied to: Continue Processing Active Entry
WHEN
The system processes the active PCB entry
THEN
The PCB address from ISCOM entry is set in the corresponding CCCOM entry
Context: A calculated ISCOM PCB number and a target CCCOM entry
GIVEN
A calculated ISCOM PCB number and a target CCCOM entry
Applied to: Continue Processing Active Entry
WHEN
The system determines the PCB number assignment
THEN
If ISCOM PCB number equals '1', CCCOM database number is set to spaces; otherwise ISCOM PCB number is copied to CCCOM database number
Context: A processed active ISCOM entry
GIVEN
A processed active ISCOM entry
Applied to: Continue Processing Active Entry
WHEN
The system completes processing of the active entry
THEN
The CCCOM entry counter (J) is incremented by 1
R-GCCTBIO-cbl-00054 (+2) File: GCCTBIO.cbl Execute Root Segment Database Call with Secondary PCB Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Root Segment Database Call with Secondary PCB':
  • Context - the ssa type is qualified ssa and secondary pcb is selected for root segment access:
    For Execute Database Call with Qualified SSA:
    When a database operation is requested on the root segment, then execute database call using secondary pcb with qualified root segment search arguments.
  • Context - the ssa type is unqualified ssa and secondary pcb is selected for root segment access:
    For Execute Database Call with Unqualified SSA:
    When a database operation is requested on the root segment, then execute database call using secondary pcb with unqualified root segment search arguments.
  • Context - no ssa is required and secondary pcb is selected for root segment access:
    For Execute Database Call with No SSA:
    When a database operation is requested on the root segment, then execute database call using secondary pcb without any search arguments.
👨‍💻 Technical ACs (Gherkin)
Context: The SSA type is qualified SSA and secondary PCB is selected for root segment access
GIVEN
The SSA type is qualified SSA and secondary PCB is selected for root segment access
Applied to: Execute Database Call with Qualified SSA
WHEN
A database operation is requested on the root segment
THEN
Execute database call using secondary PCB with qualified root segment search arguments
Context: The SSA type is unqualified SSA and secondary PCB is selected for root segment access
GIVEN
The SSA type is unqualified SSA and secondary PCB is selected for root segment access
Applied to: Execute Database Call with Unqualified SSA
WHEN
A database operation is requested on the root segment
THEN
Execute database call using secondary PCB with unqualified root segment search arguments
Context: No SSA is required and secondary PCB is selected for root segment access
GIVEN
No SSA is required and secondary PCB is selected for root segment access
Applied to: Execute Database Call with No SSA
WHEN
A database operation is requested on the root segment
THEN
Execute database call using secondary PCB without any search arguments
R-GCX126-cbl-00055 (+12) File: GCX126R.cbl Read EDI 350 Message from Queue Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Read EDI 350 Message from Queue':
  • Context - the program needs to process edi 350 messages from the message queue:
    For Connect to MQ Queue Manager:
    When the system attempts to connect to the mq queue manager, then if connection is successful, proceed to open the queue; if connection fails, generate error message with reason code and abort processing with message 'conn failed' for transaction set '355'.
  • Context - connection to mq queue manager is established and queue name is defined:
    For Open MQ Queue for Reading:
    When the system attempts to open the queue with input-as-queue-defined option, then if open is successful, proceed to retrieve messages; if open fails, generate error message with reason code and abort processing with message 'open failed' for transaction set '355'.
  • Context - mq queue is open and ready for message retrieval:
    For Retrieve Message from Queue:
    When the system executes mqget operation with message buffer length set to the size of mqs-message, then the message is retrieved into mqs-message buffer with actual data length returned in w03-datalen, and completion code and reason code are set to indicate operation status.
  • Context - mqget operation has completed and returned completion code in w03-compcode:
    For MQ Operation Successful?:
    When the system evaluates the completion code, then if completion code equals mqcc-ok, proceed to check message status; if completion code equals mqcc-failed and reason equals mqrc-no-msg-available, set message not available flag; for any other completion code, set end of queue flag and prepare error message.
  • Context - mq get operation returned completion code mqcc-failed with reason code mqrc-no-msg-available (2033):
    For Set Message Not Available Flag:
    When the system processes the no message available condition, then set msg-not-available flag to true and exit message retrieval process without error.
  • Context - message was successfully retrieved with completion code mqcc-ok and backout count is available in mqmd-backoutcount:
    For Backout Count > 0?:
    When the system checks if mqmd-backoutcount is not equal to 0, then if backout count is not equal to 0, set skip-msg-found flag to true; if backout count equals 0, proceed to validate message length.
  • Context - message has completion code mqcc-ok and mqmd-backoutcount is not equal to 0:
    For Set Skip Message Flag:
    When the system identifies a previously failed message, then set skip-msg-found flag to true and exit message retrieval process without further processing.
  • Context - message was successfully retrieved with completion code mqcc-ok and backout count equals 0:
    For Message Length Valid?:
    When the system calculates ws-max-mqs-entries by subtracting header length from total data length and dividing by entry length, and checks if result is less than 1, then if ws-max-mqs-entries is less than 1, prepare error message 'user abend 350 message too short' and abort processing; if ws-max-mqs-entries is 1 or greater, set good-msg-found flag to true.
  • Context - message has completion code mqcc-ok, backout count equals 0, and calculated segment count is valid:
    For Set Good Message Found Flag:
    When all message validation checks pass successfully, then set good-msg-found flag to true and proceed to calculate number of edi segments.
  • Context - valid message is retrieved with data length in w03-datalen, header length in ws-mqs-len-header, and entry length in ws-mqs-len-of-1-entry:
    For Calculate Number of EDI Segments:
    When the system computes ws-max-mqs-entries as ((w03-datalen minus ws-mqs-len-header) divided by ws-mqs-len-of-1-entry) rounded, then if calculated ws-max-mqs-entries exceeds cst-max-mqs-entries, set ws-max-mqs-entries to cst-max-mqs-entries; otherwise, use calculated value for segment count.
  • Context - mq get operation returned completion code other than mqcc-ok or returned mqcc-failed with reason other than mqrc-no-msg-available:
    For Set End of Queue Flag:
    When the system encounters an unexpected mq error condition, then set end-of-mqueue flag to true and proceed to prepare error message with reason code.
  • Context - mq operation failed with reason code in w03-reason:
    For Prepare Error Message:
    When the system needs to report the mq failure, then move w03-reason to w03-reason-code, call gccmqerr to get error description into output-message-text, move error text to mq-error-text, set mq-trans-set to '350' or '355', set pgm-error-text to 'open failed', 'close failed', 'disc failed', or 'conn failed' as appropriate, and move complete error message to cc-error-message.
  • Context - error message has been prepared for mq failure condition:
    For Abort Processing:
    When the system determines processing cannot continue, then call cerr program with cccom to abort processing and terminate program execution.
👨‍💻 Technical ACs (Gherkin)
Context: The program needs to process EDI 350 messages from the message queue
GIVEN
The program needs to process EDI 350 messages from the message queue
Applied to: Connect to MQ Queue Manager
WHEN
The system attempts to connect to the MQ Queue Manager
THEN
If connection is successful, proceed to open the queue; If connection fails, generate error message with reason code and abort processing with message 'CONN FAILED' for transaction set '355'
Context: Connection to MQ Queue Manager is established and queue name is defined
GIVEN
Connection to MQ Queue Manager is established and queue name is defined
Applied to: Open MQ Queue for Reading
WHEN
The system attempts to open the queue with input-as-queue-defined option
THEN
If open is successful, proceed to retrieve messages; If open fails, generate error message with reason code and abort processing with message 'OPEN FAILED' for transaction set '355'
Context: MQ queue is open and ready for message retrieval
GIVEN
MQ queue is open and ready for message retrieval
Applied to: Retrieve Message from Queue
WHEN
The system executes MQGET operation with message buffer length set to the size of MQS-MESSAGE
THEN
The message is retrieved into MQS-MESSAGE buffer with actual data length returned in W03-DATALEN, and completion code and reason code are set to indicate operation status
Context: MQGET operation has completed and returned completion code in W03-COMPCODE
GIVEN
MQGET operation has completed and returned completion code in W03-COMPCODE
Applied to: MQ Operation Successful?
WHEN
The system evaluates the completion code
THEN
If completion code equals MQCC-OK, proceed to check message status; If completion code equals MQCC-FAILED and reason equals MQRC-NO-MSG-AVAILABLE, set message not available flag; For any other completion code, set end of queue flag and prepare error message
Context: MQ GET operation returned completion code MQCC-FAILED with reason code MQRC-NO-MSG-AVAILABLE (2033)
GIVEN
MQ GET operation returned completion code MQCC-FAILED with reason code MQRC-NO-MSG-AVAILABLE (2033)
Applied to: Set Message Not Available Flag
WHEN
The system processes the no message available condition
THEN
Set MSG-NOT-AVAILABLE flag to TRUE and exit message retrieval process without error
Context: Message was successfully retrieved with completion code MQCC-OK and backout count is available in MQMD-BACKOUTCOUNT
GIVEN
Message was successfully retrieved with completion code MQCC-OK and backout count is available in MQMD-BACKOUTCOUNT
Applied to: Backout Count > 0?
WHEN
The system checks if MQMD-BACKOUTCOUNT is not equal to 0
THEN
If backout count is not equal to 0, set SKIP-MSG-FOUND flag to TRUE; If backout count equals 0, proceed to validate message length
Context: Message has completion code MQCC-OK and MQMD-BACKOUTCOUNT is not equal to 0
GIVEN
Message has completion code MQCC-OK and MQMD-BACKOUTCOUNT is not equal to 0
Applied to: Set Skip Message Flag
WHEN
The system identifies a previously failed message
THEN
Set SKIP-MSG-FOUND flag to TRUE and exit message retrieval process without further processing
Context: Message was successfully retrieved with completion code MQCC-OK and backout count equals 0
GIVEN
Message was successfully retrieved with completion code MQCC-OK and backout count equals 0
Applied to: Message Length Valid?
WHEN
The system calculates WS-MAX-MQS-ENTRIES by subtracting header length from total data length and dividing by entry length, and checks if result is less than 1
THEN
If WS-MAX-MQS-ENTRIES is less than 1, prepare error message 'USER ABEND 350 MESSAGE TOO SHORT' and abort processing; If WS-MAX-MQS-ENTRIES is 1 or greater, set GOOD-MSG-FOUND flag to TRUE
Context: Message has completion code MQCC-OK, backout count equals 0, and calculated segment count is valid
GIVEN
Message has completion code MQCC-OK, backout count equals 0, and calculated segment count is valid
Applied to: Set Good Message Found Flag
WHEN
All message validation checks pass successfully
THEN
Set GOOD-MSG-FOUND flag to TRUE and proceed to calculate number of EDI segments
Context: Valid message is retrieved with data length in W03-DATALEN, header length in WS-MQS-LEN-HEADER, and entry length in WS-MQS-LEN-OF-1-ENTRY
GIVEN
Valid message is retrieved with data length in W03-DATALEN, header length in WS-MQS-LEN-HEADER, and entry length in WS-MQS-LEN-OF-1-ENTRY
Applied to: Calculate Number of EDI Segments
WHEN
The system computes WS-MAX-MQS-ENTRIES as ((W03-DATALEN minus WS-MQS-LEN-HEADER) divided by WS-MQS-LEN-OF-1-ENTRY) rounded
THEN
If calculated WS-MAX-MQS-ENTRIES exceeds CST-MAX-MQS-ENTRIES, set WS-MAX-MQS-ENTRIES to CST-MAX-MQS-ENTRIES; Otherwise, use calculated value for segment count
Context: MQ GET operation returned completion code other than MQCC-OK or returned MQCC-FAILED with reason other than MQRC-NO-MSG-AVAILABLE
GIVEN
MQ GET operation returned completion code other than MQCC-OK or returned MQCC-FAILED with reason other than MQRC-NO-MSG-AVAILABLE
Applied to: Set End of Queue Flag
WHEN
The system encounters an unexpected MQ error condition
THEN
Set END-OF-MQUEUE flag to TRUE and proceed to prepare error message with reason code
Context: MQ operation failed with reason code in W03-REASON
GIVEN
MQ operation failed with reason code in W03-REASON
Applied to: Prepare Error Message
WHEN
The system needs to report the MQ failure
THEN
Move W03-REASON to W03-REASON-CODE, call GCCMQERR to get error description into OUTPUT-MESSAGE-TEXT, move error text to MQ-ERROR-TEXT, set MQ-TRANS-SET to '350' or '355', set PGM-ERROR-TEXT to 'OPEN FAILED', 'CLOSE FAILED', 'DISC FAILED', or 'CONN FAILED' as appropriate, and move complete error message to CC-ERROR-MESSAGE
Context: Error message has been prepared for MQ failure condition
GIVEN
Error message has been prepared for MQ failure condition
Applied to: Abort Processing
WHEN
The system determines processing cannot continue
THEN
Call CERR program with CCCOM to abort processing and terminate program execution
R-GCCTBIO-cbl-00057 (+9) File: GCCTBIO.cbl Route Dependent Segment Access Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Route Dependent Segment Access':
  • Context - a dependent segment access operation is requested:
    For Check PCB Selection Flag:
    When the system checks the second pcb flag status, then if the second pcb flag is spaces (not set), route to primary pcb processing, otherwise route to secondary pcb processing.
  • Context - a dependent segment access operation is requested and the second pcb flag is spaces:
    For Route to Primary PCB:
    When the system routes the operation, then the operation is directed to the primary pcb dependent segment processing routine.
  • Context - a dependent segment access operation is requested and the second pcb flag is not spaces:
    For Route to Secondary PCB:
    When the system routes the operation, then the operation is directed to the secondary pcb dependent segment processing routine.
  • Context - a dependent segment operation is routed to primary pcb and the ssa flag indicates qualified ssa:
    For Execute Dependent Segment Operation via Primary PCB:
    When the system executes the database operation, then call the database interface with primary pcb, function code, segment data, qualified root ssa, and qualified dependent ssa.
  • Context - a dependent segment operation is routed to primary pcb and the ssa flag indicates unqualified ssa:
    For Execute Dependent Segment Operation via Primary PCB:
    When the system executes the database operation, then call the database interface with primary pcb, function code, segment data, qualified root ssa, and unqualified dependent ssa.
  • Context - a dependent segment operation is routed to primary pcb and the ssa flag indicates no ssa:
    For Execute Dependent Segment Operation via Primary PCB:
    When the system executes the database operation, then call the database interface with primary pcb, function code, and segment data only.
  • Context - a dependent segment operation is routed to secondary pcb and the ssa flag indicates qualified ssa:
    For Execute Dependent Segment Operation via Secondary PCB:
    When the system executes the database operation, then call the database interface with secondary pcb, function code, segment data, qualified root ssa, and qualified dependent ssa.
  • Context - a dependent segment operation is routed to secondary pcb and the ssa flag indicates unqualified ssa:
    For Execute Dependent Segment Operation via Secondary PCB:
    When the system executes the database operation, then call the database interface with secondary pcb, function code, segment data, qualified root ssa, and unqualified dependent ssa.
  • Context - a dependent segment operation is routed to secondary pcb and the ssa flag indicates no ssa:
    For Execute Dependent Segment Operation via Secondary PCB:
    When the system executes the database operation, then call the database interface with secondary pcb, function code, and segment data only.
  • Context - a dependent segment database operation has been executed:
    For Check Operation Status:
    When the system checks the operation status code, then if the status code is spaces, set return flag to successful, otherwise set return flag to unsuccessful.
👨‍💻 Technical ACs (Gherkin)
Context: A dependent segment access operation is requested
GIVEN
A dependent segment access operation is requested
Applied to: Check PCB Selection Flag
WHEN
The system checks the second PCB flag status
THEN
If the second PCB flag is spaces (not set), route to primary PCB processing, otherwise route to secondary PCB processing
Context: A dependent segment access operation is requested and the second PCB flag is spaces
GIVEN
A dependent segment access operation is requested and the second PCB flag is spaces
Applied to: Route to Primary PCB
WHEN
The system routes the operation
THEN
The operation is directed to the primary PCB dependent segment processing routine
Context: A dependent segment access operation is requested and the second PCB flag is not spaces
GIVEN
A dependent segment access operation is requested and the second PCB flag is not spaces
Applied to: Route to Secondary PCB
WHEN
The system routes the operation
THEN
The operation is directed to the secondary PCB dependent segment processing routine
Context: A dependent segment operation is routed to primary PCB and the SSA flag indicates qualified SSA
GIVEN
A dependent segment operation is routed to primary PCB and the SSA flag indicates qualified SSA
Applied to: Execute Dependent Segment Operation via Primary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with primary PCB, function code, segment data, qualified root SSA, and qualified dependent SSA
Context: A dependent segment operation is routed to primary PCB and the SSA flag indicates unqualified SSA
GIVEN
A dependent segment operation is routed to primary PCB and the SSA flag indicates unqualified SSA
Applied to: Execute Dependent Segment Operation via Primary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with primary PCB, function code, segment data, qualified root SSA, and unqualified dependent SSA
Context: A dependent segment operation is routed to primary PCB and the SSA flag indicates no SSA
GIVEN
A dependent segment operation is routed to primary PCB and the SSA flag indicates no SSA
Applied to: Execute Dependent Segment Operation via Primary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with primary PCB, function code, and segment data only
Context: A dependent segment operation is routed to secondary PCB and the SSA flag indicates qualified SSA
GIVEN
A dependent segment operation is routed to secondary PCB and the SSA flag indicates qualified SSA
Applied to: Execute Dependent Segment Operation via Secondary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with secondary PCB, function code, segment data, qualified root SSA, and qualified dependent SSA
Context: A dependent segment operation is routed to secondary PCB and the SSA flag indicates unqualified SSA
GIVEN
A dependent segment operation is routed to secondary PCB and the SSA flag indicates unqualified SSA
Applied to: Execute Dependent Segment Operation via Secondary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with secondary PCB, function code, segment data, qualified root SSA, and unqualified dependent SSA
Context: A dependent segment operation is routed to secondary PCB and the SSA flag indicates no SSA
GIVEN
A dependent segment operation is routed to secondary PCB and the SSA flag indicates no SSA
Applied to: Execute Dependent Segment Operation via Secondary PCB
WHEN
The system executes the database operation
THEN
Call the database interface with secondary PCB, function code, and segment data only
Context: A dependent segment database operation has been executed
GIVEN
A dependent segment database operation has been executed
Applied to: Check Operation Status
WHEN
The system checks the operation status code
THEN
If the status code is spaces, set return flag to successful, otherwise set return flag to unsuccessful
R-CCISCOM-cbl-00058 File: CCISCOM.cbl PCB Sequence Numbering
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Sequence Numbering':
  • Context - an iscom table with database entries and a current database entry at position i with a specific database name:
    For PCB Sequence Numbering - Calculate sequential PCB numbers for active database entries:
    When the system needs to determine the sequential pcb number for the current database entry, then the system counts all previous occurrences of the same database name in positions 1 through i-1 and increments the pcb number for each match found, starting from an initial value of 1.
👨‍💻 Technical ACs (Gherkin)
Context: An ISCOM table with database entries and a current database entry at position I with a specific database name
GIVEN
An ISCOM table with database entries and a current database entry at position I with a specific database name
Applied to: PCB Sequence Numbering - Calculate sequential PCB numbers for active database entries
WHEN
The system needs to determine the sequential PCB number for the current database entry
THEN
The system counts all previous occurrences of the same database name in positions 1 through I-1 and increments the PCB number for each match found, starting from an initial value of 1
R-CCISCOM-cbl-00059 (+4) File: CCISCOM.cbl Database Entry Creation Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Entry Creation':
  • Context - the database entry creation process is starting:
    For Initialize CCCOM Entry Counter to 0:
    When the system begins processing iscom entries for conversion to cccom, then the cccom entry counter (j) is set to zero to track new entries.
  • Context - an iscom database entry is being evaluated for conversion:
    For ISCOM Entry Has Active PCB Address?:
    When the system checks the pcb address of the iscom entry, then if pcb address is not zero, the entry is considered active and eligible for processing, otherwise it is skipped.
  • Context - an active iscom database entry needs to be converted to cccom format:
    For Create New CCCOM Database Entry:
    When the system processes the iscom entry with non-zero pcb address, then the system increments the cccom entry counter, copies the database name from iscom to cccom, sets the pcb address, and assigns the database number (spaces if pcb number is '1', otherwise the actual pcb number).
  • Context - a database entry is being processed and needs a pcb sequence number:
    For Create New CCCOM Database Entry:
    When the system encounters a database name that may have multiple instances, then the system counts how many times the same database name appears in iscom entries up to the current position to determine the correct pcb sequence number.
  • Context - a pcb sequence number has been calculated for a database entry:
    For Create New CCCOM Database Entry:
    When the system needs to assign the database number in cccom structure, then if the pcb sequence number is '1', the database number is set to spaces, otherwise the actual pcb sequence number is assigned as the database number.
👨‍💻 Technical ACs (Gherkin)
Context: The database entry creation process is starting
GIVEN
The database entry creation process is starting
Applied to: Initialize CCCOM Entry Counter to 0
WHEN
The system begins processing ISCOM entries for conversion to CCCOM
THEN
The CCCOM entry counter (J) is set to zero to track new entries
Context: An ISCOM database entry is being evaluated for conversion
GIVEN
An ISCOM database entry is being evaluated for conversion
Applied to: ISCOM Entry Has Active PCB Address?
WHEN
The system checks the PCB address of the ISCOM entry
THEN
If PCB address is not zero, the entry is considered active and eligible for processing, otherwise it is skipped
Context: An active ISCOM database entry needs to be converted to CCCOM format
GIVEN
An active ISCOM database entry needs to be converted to CCCOM format
Applied to: Create New CCCOM Database Entry
WHEN
The system processes the ISCOM entry with non-zero PCB address
THEN
The system increments the CCCOM entry counter, copies the database name from ISCOM to CCCOM, sets the PCB address, and assigns the database number (spaces if PCB number is '1', otherwise the actual PCB number)
Context: A database entry is being processed and needs a PCB sequence number
GIVEN
A database entry is being processed and needs a PCB sequence number
Applied to: Create New CCCOM Database Entry
WHEN
The system encounters a database name that may have multiple instances
THEN
The system counts how many times the same database name appears in ISCOM entries up to the current position to determine the correct PCB sequence number
Context: A PCB sequence number has been calculated for a database entry
GIVEN
A PCB sequence number has been calculated for a database entry
Applied to: Create New CCCOM Database Entry
WHEN
The system needs to assign the database number in CCCOM structure
THEN
If the PCB sequence number is '1', the database number is set to spaces, otherwise the actual PCB sequence number is assigned as the database number
R-CIMS-cbl-00063 (+4) File: CIMS.cbl PCB Address Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Address Validation':
  • Context - a database operation request is being processed:
    For Check PCB Address Status:
    When the system checks the pcb address availability, then the system determines if the pcb address is null or blank pointer to decide next processing step.
  • Context - pcb address validation has failed:
    For Set PCB Name to ZERO-PCB-NAME:
    When the system needs to generate error information, then the system sets the pcb name from pcb-mne to zero-pcb-name for error reporting.
  • Context - pcb address validation has failed and pcb name has been captured:
    For Set PCB Number to ZERO-PCB-NUM:
    When the system continues error information collection, then the system sets the pcb number from pcb-num to zero-pcb-num for error reporting.
  • Context - pcb address validation has failed and error information has been collected:
    For Generate Zero PCB Address Error Message:
    When the system needs to create an error message, then the system moves zero-pcb-addr-error-message to cc-error-message of cccom.
  • Context - pcb address validation has failed and error message has been generated:
    For Call Error Handler CERR:
    When the system needs to handle the error condition, then the system calls 'cerr' program using cccom to process the error.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation request is being processed
GIVEN
A database operation request is being processed
Applied to: Check PCB Address Status
WHEN
The system checks the PCB address availability
THEN
The system determines if the PCB address is null or blank pointer to decide next processing step
Context: PCB address validation has failed
GIVEN
PCB address validation has failed
Applied to: Set PCB Name to ZERO-PCB-NAME
WHEN
The system needs to generate error information
THEN
The system sets the PCB name from PCB-MNE to ZERO-PCB-NAME for error reporting
Context: PCB address validation has failed and PCB name has been captured
GIVEN
PCB address validation has failed and PCB name has been captured
Applied to: Set PCB Number to ZERO-PCB-NUM
WHEN
The system continues error information collection
THEN
The system sets the PCB number from PCB-NUM to ZERO-PCB-NUM for error reporting
Context: PCB address validation has failed and error information has been collected
GIVEN
PCB address validation has failed and error information has been collected
Applied to: Generate Zero PCB Address Error Message
WHEN
The system needs to create an error message
THEN
The system moves ZERO-PCB-ADDR-ERROR-MESSAGE to CC-ERROR-MESSAGE of CCCOM
Context: PCB address validation has failed and error message has been generated
GIVEN
PCB address validation has failed and error message has been generated
Applied to: Call Error Handler CERR
WHEN
The system needs to handle the error condition
THEN
The system calls 'CERR' program using CCCOM to process the error
R-CCISCOM-cbl-00064 File: CCISCOM.cbl Reverse PCB Address Mapping
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Reverse PCB Address Mapping':
  • Context - an iscom entry at position i contains a valid pcb address and a corresponding cccom entry exists at position j:
    For Copy PCB Address from ISCOM Entry I to CCCOM Entry J:
    When the system performs reverse conversion from iscom to cccom format, then the pcb address from iscom entry i is copied to cccom entry j to establish the database access reference.
👨‍💻 Technical ACs (Gherkin)
Context: An ISCOM entry at position I contains a valid PCB address and a corresponding CCCOM entry exists at position J
GIVEN
An ISCOM entry at position I contains a valid PCB address and a corresponding CCCOM entry exists at position J
Applied to: Copy PCB Address from ISCOM Entry I to CCCOM Entry J
WHEN
The system performs reverse conversion from ISCOM to CCCOM format
THEN
The PCB address from ISCOM entry I is copied to CCCOM entry J to establish the database access reference
R-CCISCOM-cbl-00065 (+1) File: CCISCOM.cbl Database Number Assignment Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Number Assignment':
  • Context - a database entry is being processed during iscom to cccom conversion and the iscom pcb number has been determined:
    For Assign SPACES to Database Number - First Occurrence:
    When the iscom pcb number equals '1' indicating this is the first occurrence of this database name, then the database number field in the cccom entry should be set to spaces to mark it as the primary database reference.
    For Assign PCB Number to Database Number - Subsequent Occurrence:
    When the iscom pcb number is not equal to '1' indicating this is a subsequent occurrence of this database name, then the database number field in the cccom entry should be set to the actual iscom pcb number to maintain proper sequencing.
👨‍💻 Technical ACs (Gherkin)
Context: A database entry is being processed during ISCOM to CCCOM conversion and the ISCOM PCB number has been determined
GIVEN
A database entry is being processed during ISCOM to CCCOM conversion and the ISCOM PCB number has been determined
Applied to: Assign SPACES to Database Number - First Occurrence
WHEN
The ISCOM PCB number equals '1' indicating this is the first occurrence of this database name
THEN
The database number field in the CCCOM entry should be set to spaces to mark it as the primary database reference
Applied to: Assign PCB Number to Database Number - Subsequent Occurrence
WHEN
The ISCOM PCB number is not equal to '1' indicating this is a subsequent occurrence of this database name
THEN
The database number field in the CCCOM entry should be set to the actual ISCOM PCB number to maintain proper sequencing
R-CCISCOM-cbl-00067 (+2) File: CCISCOM.cbl Process Current Database Entry Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Current Database Entry':
  • Context - a database entry is being processed:
    For Initialize PCB Counter to Zero:
    When the pcb counter initialization is performed, then the iscom pcb number is set to zero.
  • Context - a database entry with index i is being processed:
    For Extract PCB Number from Database Entry:
    When pcb number extraction is performed, then the pcb number from cccom database entry at index i is moved to cccom-pcb-number.
  • Context - a database entry is being processed and the cccom-pcb-number is empty or contains spaces:
    For Set PCB Number to Default '1':
    When the pcb number validation is performed, then the cccom-pcb-number is set to '1'.
👨‍💻 Technical ACs (Gherkin)
Context: A database entry is being processed
GIVEN
A database entry is being processed
Applied to: Initialize PCB Counter to Zero
WHEN
The PCB counter initialization is performed
THEN
The ISCOM PCB number is set to zero
Context: A database entry with index I is being processed
GIVEN
A database entry with index I is being processed
Applied to: Extract PCB Number from Database Entry
WHEN
PCB number extraction is performed
THEN
The PCB number from CCCOM database entry at index I is moved to CCCOM-PCB-NUMBER
Context: A database entry is being processed and the CCCOM-PCB-NUMBER is empty or contains spaces
GIVEN
A database entry is being processed and the CCCOM-PCB-NUMBER is empty or contains spaces
Applied to: Set PCB Number to Default '1'
WHEN
The PCB number validation is performed
THEN
The CCCOM-PCB-NUMBER is set to '1'
R-GCCTBIO-cbl-00067 (+3) File: GCCTBIO.cbl Execute Dependent Segment Database Call with Primary PCB Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Dependent Segment Database Call with Primary PCB':
  • Context - a dependent segment database operation is requested using primary pcb and the ssa flag is set to qualified ssa:
    For Execute Database Call with Qualified SSA - Root Segment SSA - Dependent Segment SSA:
    When the database call is executed, then the system calls the database interface with the function code, primary pcb, segment data, root segment qualified ssa, and dependent segment qualified ssa.
  • Context - a dependent segment database operation is requested using primary pcb and the ssa flag is set to unqualified ssa:
    For Execute Database Call with Unqualified SSA - Root Segment SSA - Unqualified Dependent SSA:
    When the database call is executed, then the system calls the database interface with the function code, primary pcb, segment data, root segment qualified ssa, and dependent segment unqualified ssa.
  • Context - a dependent segment database operation is requested using primary pcb and the ssa flag is set to no ssa:
    For Execute Database Call with No SSA - No SSA Parameters:
    When the database call is executed, then the system calls the database interface with only the function code, primary pcb, and segment data without any ssa parameters.
  • Context - a dependent segment database operation is being processed with primary pcb:
    For SSA Type?:
    When the system checks the ssa flag value, then the system routes to qualified ssa call if flag equals qualified ssa, routes to unqualified ssa call if flag equals unqualified ssa, or routes to no ssa call for any other value.
👨‍💻 Technical ACs (Gherkin)
Context: A dependent segment database operation is requested using primary PCB and the SSA flag is set to qualified SSA
GIVEN
A dependent segment database operation is requested using primary PCB and the SSA flag is set to qualified SSA
Applied to: Execute Database Call with Qualified SSA - Root Segment SSA - Dependent Segment SSA
WHEN
The database call is executed
THEN
The system calls the database interface with the function code, primary PCB, segment data, root segment qualified SSA, and dependent segment qualified SSA
Context: A dependent segment database operation is requested using primary PCB and the SSA flag is set to unqualified SSA
GIVEN
A dependent segment database operation is requested using primary PCB and the SSA flag is set to unqualified SSA
Applied to: Execute Database Call with Unqualified SSA - Root Segment SSA - Unqualified Dependent SSA
WHEN
The database call is executed
THEN
The system calls the database interface with the function code, primary PCB, segment data, root segment qualified SSA, and dependent segment unqualified SSA
Context: A dependent segment database operation is requested using primary PCB and the SSA flag is set to no SSA
GIVEN
A dependent segment database operation is requested using primary PCB and the SSA flag is set to no SSA
Applied to: Execute Database Call with No SSA - No SSA Parameters
WHEN
The database call is executed
THEN
The system calls the database interface with only the function code, primary PCB, and segment data without any SSA parameters
Context: A dependent segment database operation is being processed with primary PCB
GIVEN
A dependent segment database operation is being processed with primary PCB
Applied to: SSA Type?
WHEN
The system checks the SSA flag value
THEN
The system routes to qualified SSA call if flag equals qualified SSA, routes to unqualified SSA call if flag equals unqualified SSA, or routes to no SSA call for any other value
R-CIMS-cbl-00068 (+8) File: CIMS.cbl IMS Function Call Execution Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IMS Function Call Execution':
  • Context - function code, pcb address, io area and ssa parameters are available:
    For Prepare IMS Call Parameters:
    When system prepares ims call parameters, then all parameters are set up for database call execution.
  • Context - pcb address is available and valid:
    For Set PCB Address to Copy Structure:
    When system sets pcb address to copy structure, then lk-copy-of-pcb is assigned the pcb address for database call.
  • Context - all call parameters are prepared and pcb copy structure is set:
    For Execute CBLTDLI Call:
    When system executes cbltdli call with function, pcb copy, io area and ssa parameters, then ims database operation is performed and control returns to program.
  • Context - function code is available in func parameter:
    For Pass Function Code:
    When system passes function code to ims database call, then function code is included as parameter in cbltdli call.
  • Context - lk-copy-of-pcb is set with pcb address:
    For Pass PCB Copy:
    When system passes pcb copy to ims database call, then pcb copy is included as parameter in cbltdli call.
  • Context - io-area is available for data transfer:
    For Pass IO Area:
    When system passes io area to ims database call, then io area is included as parameter in cbltdli call.
  • Context - ssa1 through ssa6 parameters are available based on argument count:
    For Pass SSA Parameters 1-6:
    When system passes ssa parameters to ims database call, then all available ssa parameters are included in cbltdli call.
  • Context - all parameters are passed to cbltdli call:
    For IMS Database Processing:
    When ims processes the database operation, then database operation is executed and results are returned in pcb and io area.
  • Context - ims database processing is completed:
    For Return Control to Program:
    When control returns to the program, then program continues with post-database call processing.
👨‍💻 Technical ACs (Gherkin)
Context: Function code, PCB address, IO area and SSA parameters are available
GIVEN
Function code, PCB address, IO area and SSA parameters are available
Applied to: Prepare IMS Call Parameters
WHEN
System prepares IMS call parameters
THEN
All parameters are set up for database call execution
Context: PCB address is available and valid
GIVEN
PCB address is available and valid
Applied to: Set PCB Address to Copy Structure
WHEN
System sets PCB address to copy structure
THEN
LK-COPY-OF-PCB is assigned the PCB address for database call
Context: All call parameters are prepared and PCB copy structure is set
GIVEN
All call parameters are prepared and PCB copy structure is set
Applied to: Execute CBLTDLI Call
WHEN
System executes CBLTDLI call with function, PCB copy, IO area and SSA parameters
THEN
IMS database operation is performed and control returns to program
Context: Function code is available in FUNC parameter
GIVEN
Function code is available in FUNC parameter
Applied to: Pass Function Code
WHEN
System passes function code to IMS database call
THEN
Function code is included as parameter in CBLTDLI call
Context: LK-COPY-OF-PCB is set with PCB address
GIVEN
LK-COPY-OF-PCB is set with PCB address
Applied to: Pass PCB Copy
WHEN
System passes PCB copy to IMS database call
THEN
PCB copy is included as parameter in CBLTDLI call
Context: IO-AREA is available for data transfer
GIVEN
IO-AREA is available for data transfer
Applied to: Pass IO Area
WHEN
System passes IO area to IMS database call
THEN
IO area is included as parameter in CBLTDLI call
Context: SSA1 through SSA6 parameters are available based on argument count
GIVEN
SSA1 through SSA6 parameters are available based on argument count
Applied to: Pass SSA Parameters 1-6
WHEN
System passes SSA parameters to IMS database call
THEN
All available SSA parameters are included in CBLTDLI call
Context: All parameters are passed to CBLTDLI call
GIVEN
All parameters are passed to CBLTDLI call
Applied to: IMS Database Processing
WHEN
IMS processes the database operation
THEN
Database operation is executed and results are returned in PCB and IO area
Context: IMS database processing is completed
GIVEN
IMS database processing is completed
Applied to: Return Control to Program
WHEN
Control returns to the program
THEN
Program continues with post-database call processing
R-GCX126-cbl-00068 (+1) File: GCX126R.cbl Determine Message Type Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Message Type':
  • Context - an edi 350 message has been retrieved from the mq queue with a message header field mqs-xway-hdr:
    For First 10 Characters = '+++3505040'?:
    When the first 10 characters of mqs-xway-hdr equal '+++3505040', then set the message type indicator ws-conv-350 to true to identify this as a conveyance edi 350 message.
    For First 10 Characters = '+++3505040'?:
    When the first 10 characters of mqs-xway-hdr do not equal '+++3505040', then set the message type indicator ws-cargo-350 to true to identify this as a cargo edi 350 message.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been retrieved from the MQ queue with a message header field MQS-XWAY-HDR
GIVEN
An EDI 350 message has been retrieved from the MQ queue with a message header field MQS-XWAY-HDR
Applied to: First 10 Characters = '+++3505040'?
WHEN
The first 10 characters of MQS-XWAY-HDR equal '+++3505040'
THEN
Set the message type indicator WS-CONV-350 to TRUE to identify this as a Conveyance EDI 350 message
Applied to: First 10 Characters = '+++3505040'?
WHEN
The first 10 characters of MQS-XWAY-HDR do NOT equal '+++3505040'
THEN
Set the message type indicator WS-CARGO-350 to TRUE to identify this as a Cargo EDI 350 message
R-GCCUSIO-cbl-00069 (+11) File: GCCUSIO.cbl Primary Cargo Record Delete Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Cargo Record Delete':
  • Context - a cargo record exists in the system and delete operation is requested:
    For Retrieve Current Cargo Record:
    When the system needs to retrieve the current cargo record for deletion, then the system performs a get hold unique operation to retrieve and lock the cargo record.
  • Context - a cargo record is being processed for deletion:
    For Save Iron Highway Status Information:
    When the system retrieves the current cargo record, then the system saves the rt21 us cargo short description to the iron highway status field.
    For Set Cargo Status to DELETED:
    When the system completes index field clearing, then the system sets the rt10 cp cargo status to deleted.
  • Context - a cargo record contains waybill and car identification information:
    For Save Waybill and Car Numbers:
    When the system processes the cargo record for deletion, then the system saves the first 15 characters of the waybill number index and the car identification number index for notification purposes.
  • Context - a cargo record is being logically deleted:
    For Clear Waybill Index & Clear Car-Waybill Index & Clear Bond Number Index & Clear Destination Index:
    When the system processes index field clearing, then the system sets the rt072 waybill index field to spaces and the system sets the rt073 car-waybill index field to spaces and the system sets the rt074 bond index field to spaces and the system sets the rt076 destination index field to spaces.
  • Context - a cargo record has been marked as deleted:
    For Set Cargo Status to DELETED:
    When the system processes status description updates, then the system sets the rt10b cp cargo status description to the corresponding deleted status description.
  • Context - a cargo record has been marked as deleted with cleared index fields:
    For Update Cargo Record with Deleted Status:
    When the system needs to persist the deletion changes, then the system performs a replace operation to update the cargo record with the deleted status.
  • Context - a cargo record has been successfully marked as deleted:
    For Process Iron Highway Notification:
    When the system completes the cargo record update, then the system processes iron highway notification using the saved status, waybill number, and car identification information.
  • Context - a cargo record has been successfully deleted:
    For Delete GCSB1RT Index Records:
    When the system needs to clean up related index records, then the system deletes the corresponding gcsb1rt status index record using the cargo ccn key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system and delete operation is requested
GIVEN
A cargo record exists in the system and delete operation is requested
Applied to: Retrieve Current Cargo Record
WHEN
The system needs to retrieve the current cargo record for deletion
THEN
The system performs a Get Hold Unique operation to retrieve and lock the cargo record
Context: A cargo record is being processed for deletion
GIVEN
A cargo record is being processed for deletion
Applied to: Save Iron Highway Status Information
WHEN
The system retrieves the current cargo record
THEN
The system saves the RT21 US cargo short description to the Iron Highway status field
Applied to: Set Cargo Status to DELETED
WHEN
The system completes index field clearing
THEN
The system sets the RT10 CP cargo status to DELETED
Context: A cargo record contains waybill and car identification information
GIVEN
A cargo record contains waybill and car identification information
Applied to: Save Waybill and Car Numbers
WHEN
The system processes the cargo record for deletion
THEN
The system saves the first 15 characters of the waybill number index and the car identification number index for notification purposes
Context: A cargo record is being logically deleted
GIVEN
A cargo record is being logically deleted
Applied to: Clear Waybill Index & Clear Car-Waybill Index & Clear Bond Number Index & Clear Destination Index
WHEN
The system processes index field clearing
THEN
The system sets the RT072 waybill index field to spaces AND The system sets the RT073 car-waybill index field to spaces AND The system sets the RT074 bond index field to spaces AND The system sets the RT076 destination index field to spaces
Context: A cargo record has been marked as deleted
GIVEN
A cargo record has been marked as deleted
Applied to: Set Cargo Status to DELETED
WHEN
The system processes status description updates
THEN
The system sets the RT10B CP cargo status description to the corresponding deleted status description
Context: A cargo record has been marked as deleted with cleared index fields
GIVEN
A cargo record has been marked as deleted with cleared index fields
Applied to: Update Cargo Record with Deleted Status
WHEN
The system needs to persist the deletion changes
THEN
The system performs a replace operation to update the cargo record with the deleted status
Context: A cargo record has been successfully marked as deleted
GIVEN
A cargo record has been successfully marked as deleted
Applied to: Process Iron Highway Notification
WHEN
The system completes the cargo record update
THEN
The system processes Iron Highway notification using the saved status, waybill number, and car identification information
Context: A cargo record has been successfully deleted
GIVEN
A cargo record has been successfully deleted
Applied to: Delete GCSB1RT Index Records
WHEN
The system needs to clean up related index records
THEN
The system deletes the corresponding GCSB1RT status index record using the cargo CCN key
R-CCISCOM-cbl-00070 (+5) File: CCISCOM.cbl Continue Processing Active Entry Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Continue Processing Active Entry':
  • Context - an active pcb entry has been identified for processing:
    For Initialize PCB Sequence Number to 1:
    When the system begins processing the active entry, then the pcb sequence number is initialized to 1.
  • Context - a database entry is being processed and pcb sequence number is initialized to 1:
    For Calculate Sequential PCB Number for Current Database:
    When the system needs to determine the sequential number for the current database, then the system performs pcb number calculation by iterating through previous entries and incrementing the sequence number for each matching database name.
  • Context - an active pcb entry is being processed:
    For Increment CCCOM Entry Counter:
    When the system is ready to create a new cccom entry, then the cccom entry counter (j) is incremented by 1.
  • Context - an active pcb entry is being processed and cccom counter has been incremented:
    For Copy Database Name from ISCOM to CCCOM:
    When the system needs to populate the cccom entry with database information, then the database name from the current iscom entry is copied to the corresponding cccom entry.
  • Context - database name has been copied from iscom to cccom:
    For Map PCB Address from ISCOM to CCCOM:
    When the system needs to establish address mapping, then the pcb address from the current iscom entry is mapped to the corresponding cccom entry.
  • Context - pcb address has been mapped and pcb sequence number has been calculated:
    For Set Database Number to Spaces or PCB Sequence Number:
    When the system needs to set the database number field, then if the pcb sequence number equals 1, the database number is set to spaces indicating first occurrence, otherwise the database number is set to the calculated pcb sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: An active PCB entry has been identified for processing
GIVEN
An active PCB entry has been identified for processing
Applied to: Initialize PCB Sequence Number to 1
WHEN
The system begins processing the active entry
THEN
The PCB sequence number is initialized to 1
Context: A database entry is being processed and PCB sequence number is initialized to 1
GIVEN
A database entry is being processed and PCB sequence number is initialized to 1
Applied to: Calculate Sequential PCB Number for Current Database
WHEN
The system needs to determine the sequential number for the current database
THEN
The system performs PCB number calculation by iterating through previous entries and incrementing the sequence number for each matching database name
Context: An active PCB entry is being processed
GIVEN
An active PCB entry is being processed
Applied to: Increment CCCOM Entry Counter
WHEN
The system is ready to create a new CCCOM entry
THEN
The CCCOM entry counter (J) is incremented by 1
Context: An active PCB entry is being processed and CCCOM counter has been incremented
GIVEN
An active PCB entry is being processed and CCCOM counter has been incremented
Applied to: Copy Database Name from ISCOM to CCCOM
WHEN
The system needs to populate the CCCOM entry with database information
THEN
The database name from the current ISCOM entry is copied to the corresponding CCCOM entry
Context: Database name has been copied from ISCOM to CCCOM
GIVEN
Database name has been copied from ISCOM to CCCOM
Applied to: Map PCB Address from ISCOM to CCCOM
WHEN
The system needs to establish address mapping
THEN
The PCB address from the current ISCOM entry is mapped to the corresponding CCCOM entry
Context: PCB address has been mapped and PCB sequence number has been calculated
GIVEN
PCB address has been mapped and PCB sequence number has been calculated
Applied to: Set Database Number to Spaces or PCB Sequence Number
WHEN
The system needs to set the database number field
THEN
If the PCB sequence number equals 1, the database number is set to spaces indicating first occurrence, otherwise the database number is set to the calculated PCB sequence number
R-GCX126-cbl-00070 (+16) File: GCX126R.cbl Parse EDI Segments Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parse EDI Segments':
  • Context - an edi 350 message is being parsed segment by segment:
    For ST - Transaction Set Header Set Header Found Flag:
    When the current segment table id equals 'st ', then set the header found flag to true and set the first x4 segment flag to true to indicate the start of a new transaction set.
  • Context - an edi 350 message is being parsed and an m10 segment is encountered:
    For M10 - Notice/Reference Extract CCN and Notice Info:
    When the current segment table id equals 'm10', then set the m10 segment found flag to true, initialize the m10 segment structure, and move the entire m10 table entry data into the m10 segment structure for subsequent processing.
  • Context - an edi 350 message is being parsed and a p4 segment is encountered:
    For P4 - Port/Location Extract Port Code and Sub-Location:
    When the current segment table id equals 'p4 ', then set the p4 segment found flag to true, initialize the p4 segment structure, and move the entire p4 table entry data into the p4 segment structure for subsequent processing.
  • Context - an edi 350 message is being parsed and a v9 segment is encountered:
    For V9 - Notice Reason Extract Notice Reason Code:
    When the current segment table id equals 'v9 ', then set the v9 segment found flag to true, initialize the v9 segment structure, and move the entire v9 table entry data into the v9 segment structure for subsequent processing.
  • Context - an edi 350 message is being parsed and a vid segment is encountered:
    For VID - Vehicle ID Skip Processing:
    When the current segment table id equals 'vid', then continue to the next segment without performing any processing or data extraction.
  • Context - an edi 350 message is being parsed and a k1 segment is encountered:
    For K1 - Remarks Store Free-Form Message Increment Remark Index:
    When the current segment table id equals 'k1 ' and the remark index is less than or equal to the maximum of 50, then set the k1 segment found flag to true, initialize the k1 segment structure, move the k1 table entry data into the k1 segment structure, increment the remark index by 1, and store the k1 segment in the remark array at the current index position. if the remark index exceeds 50, set it to 50 and overwrite the last remark.
  • Context - an edi 350 message is being parsed and an x4 segment is encountered:
    For X4 - Release/Disposition Extract Release Reference Extract Date and Time:
    When the current segment table id equals 'x4 ', then initialize the k1 comments structure, initialize the x4 segment structure, move the x4 table entry data into the x4 segment structure, and set the x4 segment found flag to true for subsequent processing.
  • Context - an edi 350 message is being parsed and an n7 segment is encountered:
    For N7 - Equipment Extract Equipment Number Store in Log Array:
    When the current segment table id equals 'n7 ' and the equipment number field is not spaces, then set the n7 segment found flag to true, initialize the n7 segment structure, move the n7 table entry data into the n7 segment structure, move the equipment number to the log data array at the current log index position with log type 'edi 350 eqp#:', and increment the log index by 1.
  • Context - an edi 350 message is being parsed and an se segment is encountered:
    For SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag:
    When the current segment table id equals 'se ', then set the trailer found flag to true, set the end found flag to true, and perform the rest of message processing which includes logging all k1 remarks and n7 equipment numbers to the cargo information message log.
  • Context - edi segments are being parsed and both x4 and v9 segments have been successfully processed:
    For Trigger 350 Message Processing:
    When the x4 segment found flag is true and the v9 segment found flag is true and the first x4 flag is true, then set the first x4 flag to false (not first x4) and perform the 350 message processing routine which evaluates the v9 notice reason code and updates cargo records based on the customs action type.
  • Context - edi segments are being parsed and the v9 segment has been processed and the se segment has been encountered:
    For Trigger 350 Message Processing:
    When the v9 segment found flag is true and the first x4 flag is true and the end found flag is true, then set the first x4 flag to false (not first x4) and perform the 350 message processing routine which evaluates the v9 notice reason code and updates cargo records based on the customs action type.
  • Context - a segment has been processed in the edi 350 message:
    For Move to Next Segment:
    When the current segment processing is complete, then increment the line counter by 1 and continue the segment processing loop until the line counter exceeds the maximum number of message queue entries or the end found flag is set to true.
  • Context - an x4 segment is being processed with entry type code equal to '992' and the message type is conventional 350:
    For X4 - Release/Disposition Extract Release Reference Extract Date and Time:
    When the related document id (crn) in positions 1-25 is different from the previous crn, then move the related document id to the train key value and the previous crn field, perform train lookup by crn. if train is not found, prepare an unknown train notification message with the crn and send it. if train is found, log the arrival acknowledgment at border message, create a log entry with action code 'zzz', train crn, and message '350 ack - arrival ack at border', and spawn the log entry. then move the cbsa release reference id to the cargo key value and perform cargo border update processing. if the cargo is a master manifest, retrieve all follower manifests (maximum 100) linked to the master and update each follower with border arrival acknowledgment.
    For X4 - Release/Disposition Extract Release Reference Extract Date and Time:
    When the related document id (crn) in positions 1-25 equals the previous crn, then continue to the next segment without performing any train or cargo processing.
  • Context - an x4 segment is being processed:
    For X4 - Release/Disposition Extract Release Reference Extract Date and Time:
    When the entry type code is not equal to '992' or the message type is not conventional 350, then set the segment previous x4 flag to true and set the x4 segment found flag to true.
  • Context - the se segment is being processed and the k1 segment found flag is true:
    For SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag:
    When the remark index is greater than 0 and there are k1 remarks stored in the remark array, then for each remark from index 1 to the remark index, if the remark is not spaces, initialize the k1 segment structure, move the remark to the k1 segment, initialize the information message field, concatenate 'edi 350 k1: ' with the first free-form message field and move to the information message field, and log the cargo information message. if the second free-form message field is not spaces, initialize the information message field, concatenate 'edi 350 k1: ' with the second free-form message field and move to the information message field, and log the cargo information message.
  • Context - the se segment is being processed and the n7 segment found flag is true:
    For SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag:
    When there are log entries in the log array from index 1 to 50, then for each log line from index 1 until the log line is spaces or index exceeds 50, initialize the information message field, move the log line to the information message field, and log the cargo information message.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message is being parsed segment by segment
GIVEN
An EDI 350 message is being parsed segment by segment
Applied to: ST - Transaction Set Header Set Header Found Flag
WHEN
The current segment table ID equals 'ST '
THEN
Set the header found flag to TRUE and set the first X4 segment flag to TRUE to indicate the start of a new transaction set
Context: An EDI 350 message is being parsed and an M10 segment is encountered
GIVEN
An EDI 350 message is being parsed and an M10 segment is encountered
Applied to: M10 - Notice/Reference Extract CCN and Notice Info
WHEN
The current segment table ID equals 'M10'
THEN
Set the M10 segment found flag to TRUE, initialize the M10 segment structure, and move the entire M10 table entry data into the M10 segment structure for subsequent processing
Context: An EDI 350 message is being parsed and a P4 segment is encountered
GIVEN
An EDI 350 message is being parsed and a P4 segment is encountered
Applied to: P4 - Port/Location Extract Port Code and Sub-Location
WHEN
The current segment table ID equals 'P4 '
THEN
Set the P4 segment found flag to TRUE, initialize the P4 segment structure, and move the entire P4 table entry data into the P4 segment structure for subsequent processing
Context: An EDI 350 message is being parsed and a V9 segment is encountered
GIVEN
An EDI 350 message is being parsed and a V9 segment is encountered
Applied to: V9 - Notice Reason Extract Notice Reason Code
WHEN
The current segment table ID equals 'V9 '
THEN
Set the V9 segment found flag to TRUE, initialize the V9 segment structure, and move the entire V9 table entry data into the V9 segment structure for subsequent processing
Context: An EDI 350 message is being parsed and a VID segment is encountered
GIVEN
An EDI 350 message is being parsed and a VID segment is encountered
Applied to: VID - Vehicle ID Skip Processing
WHEN
The current segment table ID equals 'VID'
THEN
Continue to the next segment without performing any processing or data extraction
Context: An EDI 350 message is being parsed and a K1 segment is encountered
GIVEN
An EDI 350 message is being parsed and a K1 segment is encountered
Applied to: K1 - Remarks Store Free-Form Message Increment Remark Index
WHEN
The current segment table ID equals 'K1 ' and the remark index is less than or equal to the maximum of 50
THEN
Set the K1 segment found flag to TRUE, initialize the K1 segment structure, move the K1 table entry data into the K1 segment structure, increment the remark index by 1, and store the K1 segment in the remark array at the current index position. If the remark index exceeds 50, set it to 50 and overwrite the last remark
Context: An EDI 350 message is being parsed and an X4 segment is encountered
GIVEN
An EDI 350 message is being parsed and an X4 segment is encountered
Applied to: X4 - Release/Disposition Extract Release Reference Extract Date and Time
WHEN
The current segment table ID equals 'X4 '
THEN
Initialize the K1 comments structure, initialize the X4 segment structure, move the X4 table entry data into the X4 segment structure, and set the X4 segment found flag to TRUE for subsequent processing
Context: An EDI 350 message is being parsed and an N7 segment is encountered
GIVEN
An EDI 350 message is being parsed and an N7 segment is encountered
Applied to: N7 - Equipment Extract Equipment Number Store in Log Array
WHEN
The current segment table ID equals 'N7 ' and the equipment number field is not spaces
THEN
Set the N7 segment found flag to TRUE, initialize the N7 segment structure, move the N7 table entry data into the N7 segment structure, move the equipment number to the log data array at the current log index position with log type 'EDI 350 EQP#:', and increment the log index by 1
Context: An EDI 350 message is being parsed and an SE segment is encountered
GIVEN
An EDI 350 message is being parsed and an SE segment is encountered
Applied to: SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag
WHEN
The current segment table ID equals 'SE '
THEN
Set the trailer found flag to TRUE, set the end found flag to TRUE, and perform the rest of message processing which includes logging all K1 remarks and N7 equipment numbers to the cargo information message log
Context: EDI segments are being parsed and both X4 and V9 segments have been successfully processed
GIVEN
EDI segments are being parsed and both X4 and V9 segments have been successfully processed
Applied to: Trigger 350 Message Processing
WHEN
The X4 segment found flag is TRUE and the V9 segment found flag is TRUE and the first X4 flag is TRUE
THEN
Set the first X4 flag to FALSE (not first X4) and perform the 350 message processing routine which evaluates the V9 notice reason code and updates cargo records based on the customs action type
Context: EDI segments are being parsed and the V9 segment has been processed and the SE segment has been encountered
GIVEN
EDI segments are being parsed and the V9 segment has been processed and the SE segment has been encountered
Applied to: Trigger 350 Message Processing
WHEN
The V9 segment found flag is TRUE and the first X4 flag is TRUE and the end found flag is TRUE
THEN
Set the first X4 flag to FALSE (not first X4) and perform the 350 message processing routine which evaluates the V9 notice reason code and updates cargo records based on the customs action type
Context: A segment has been processed in the EDI 350 message
GIVEN
A segment has been processed in the EDI 350 message
Applied to: Move to Next Segment
WHEN
The current segment processing is complete
THEN
Increment the line counter by 1 and continue the segment processing loop until the line counter exceeds the maximum number of message queue entries or the end found flag is set to TRUE
Context: An X4 segment is being processed with entry type code equal to '992' and the message type is conventional 350
GIVEN
An X4 segment is being processed with entry type code equal to '992' and the message type is conventional 350
Applied to: X4 - Release/Disposition Extract Release Reference Extract Date and Time
WHEN
The related document ID (CRN) in positions 1-25 is different from the previous CRN
THEN
Move the related document ID to the train key value and the previous CRN field, perform train lookup by CRN. If train is not found, prepare an unknown train notification message with the CRN and send it. If train is found, log the arrival acknowledgment at border message, create a log entry with action code 'ZZZ', train CRN, and message '350 ACK - ARRIVAL ACK AT BORDER', and spawn the log entry. Then move the CBSA release reference ID to the cargo key value and perform cargo border update processing. If the cargo is a master manifest, retrieve all follower manifests (maximum 100) linked to the master and update each follower with border arrival acknowledgment
Applied to: X4 - Release/Disposition Extract Release Reference Extract Date and Time
WHEN
The related document ID (CRN) in positions 1-25 equals the previous CRN
THEN
Continue to the next segment without performing any train or cargo processing
Context: An X4 segment is being processed
GIVEN
An X4 segment is being processed
Applied to: X4 - Release/Disposition Extract Release Reference Extract Date and Time
WHEN
The entry type code is not equal to '992' OR the message type is not conventional 350
THEN
Set the segment previous X4 flag to TRUE and set the X4 segment found flag to TRUE
Context: The SE segment is being processed and the K1 segment found flag is TRUE
GIVEN
The SE segment is being processed and the K1 segment found flag is TRUE
Applied to: SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag
WHEN
The remark index is greater than 0 and there are K1 remarks stored in the remark array
THEN
For each remark from index 1 to the remark index, if the remark is not spaces, initialize the K1 segment structure, move the remark to the K1 segment, initialize the information message field, concatenate 'EDI 350 K1: ' with the first free-form message field and move to the information message field, and log the cargo information message. If the second free-form message field is not spaces, initialize the information message field, concatenate 'EDI 350 K1: ' with the second free-form message field and move to the information message field, and log the cargo information message
Context: The SE segment is being processed and the N7 segment found flag is TRUE
GIVEN
The SE segment is being processed and the N7 segment found flag is TRUE
Applied to: SE - Transaction Set Trailer Set Trailer Found Flag Set End Found Flag
WHEN
There are log entries in the log array from index 1 to 50
THEN
For each log line from index 1 until the log line is spaces or index exceeds 50, initialize the information message field, move the log line to the information message field, and log the cargo information message
R-GCCTBIO-cbl-00071 (+2) File: GCCTBIO.cbl Execute Dependent Segment Database Call with Secondary PCB Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Dependent Segment Database Call with Secondary PCB':
  • Context - the system is processing a dependent segment access request and the ssa flag is set to qualified ssa and the second pcb flag is set:
    For Execute Database Call with Qualified SSA:
    When the database call is executed for dependent segment access, then the system calls the database interface with secondary pcb, function code, segment data, root segment ssa, and dependent segment ssa.
  • Context - the system is processing a dependent segment access request and the ssa flag is set to unqualified ssa and the second pcb flag is set:
    For Execute Database Call with Unqualified SSA:
    When the database call is executed for dependent segment access, then the system calls the database interface with secondary pcb, function code, segment data, root segment ssa, and dependent segment unqualified ssa.
  • Context - the system is processing a dependent segment access request and the ssa flag is set to no ssa and the second pcb flag is set:
    For Execute Database Call with No SSA:
    When the database call is executed for dependent segment access, then the system calls the database interface with secondary pcb, function code, and segment data only.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing a dependent segment access request AND the SSA flag is set to qualified SSA AND the second PCB flag is set
GIVEN
The system is processing a dependent segment access request AND the SSA flag is set to qualified SSA AND the second PCB flag is set
Applied to: Execute Database Call with Qualified SSA
WHEN
The database call is executed for dependent segment access
THEN
The system calls the database interface with secondary PCB, function code, segment data, root segment SSA, and dependent segment SSA
Context: The system is processing a dependent segment access request AND the SSA flag is set to unqualified SSA AND the second PCB flag is set
GIVEN
The system is processing a dependent segment access request AND the SSA flag is set to unqualified SSA AND the second PCB flag is set
Applied to: Execute Database Call with Unqualified SSA
WHEN
The database call is executed for dependent segment access
THEN
The system calls the database interface with secondary PCB, function code, segment data, root segment SSA, and dependent segment unqualified SSA
Context: The system is processing a dependent segment access request AND the SSA flag is set to no SSA AND the second PCB flag is set
GIVEN
The system is processing a dependent segment access request AND the SSA flag is set to no SSA AND the second PCB flag is set
Applied to: Execute Database Call with No SSA
WHEN
The database call is executed for dependent segment access
THEN
The system calls the database interface with secondary PCB, function code, and segment data only
R-GCCTBIO-cbl-00074 (+2) File: GCCTBIO.cbl Evaluate Operation Success Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Operation Success':
  • Context - a database operation has been completed and cc-status-code contains the operation result status:
    For Check CC-STATUS-CODE:
    When the system checks the cc-status-code value, then if cc-status-code is spaces (empty), set return-flag to successful, otherwise set return-flag to unsuccessful.
  • Context - a database operation has completed and cc-status-code equals spaces (indicating success):
    For Set RETURN-FLAG to SUCCESSFUL:
    When the system processes the successful operation status, then set return-flag to successful to indicate the operation completed successfully.
  • Context - a database operation has completed and cc-status-code is not spaces (indicating failure or error):
    For Set RETURN-FLAG to UNSUCCESSFUL:
    When the system processes the failed operation status, then set return-flag to unsuccessful to indicate the operation failed.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation has been completed and CC-STATUS-CODE contains the operation result status
GIVEN
A database operation has been completed and CC-STATUS-CODE contains the operation result status
Applied to: Check CC-STATUS-CODE
WHEN
The system checks the CC-STATUS-CODE value
THEN
If CC-STATUS-CODE is spaces (empty), set RETURN-FLAG to SUCCESSFUL, otherwise set RETURN-FLAG to UNSUCCESSFUL
Context: A database operation has completed and CC-STATUS-CODE equals spaces (indicating success)
GIVEN
A database operation has completed and CC-STATUS-CODE equals spaces (indicating success)
Applied to: Set RETURN-FLAG to SUCCESSFUL
WHEN
The system processes the successful operation status
THEN
Set RETURN-FLAG to SUCCESSFUL to indicate the operation completed successfully
Context: A database operation has completed and CC-STATUS-CODE is not spaces (indicating failure or error)
GIVEN
A database operation has completed and CC-STATUS-CODE is not spaces (indicating failure or error)
Applied to: Set RETURN-FLAG to UNSUCCESSFUL
WHEN
The system processes the failed operation status
THEN
Set RETURN-FLAG to UNSUCCESSFUL to indicate the operation failed
R-CCISCOM-cbl-00076 (+2) File: CCISCOM.cbl Start Loop: K = 1 to Current Position I Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Start Loop: K = 1 to Current Position I':
  • Context - an iscom table with database entries and a current position i being processed:
    For Start Loop: K = 1 to Current Position I-1 - Iterate through previous database entries to count matching database names for sequence calculation:
    When the system needs to determine the pcb sequence number for the database at position i by examining all previous positions from 1 to i-1, then the system increments the pcb sequence number for each previous entry that has the same database name as the current entry.
  • Context - two database entries in the iscom table at positions k and i:
    For Compare Database Names: ISCOM K vs ISCOM I:
    When the system compares the database names at these positions, then if the database names match exactly, the system identifies them as the same database requiring sequential pcb numbering.
  • Context - a pcb sequence number counter (iscom-pcb-num) and two database entries with matching names:
    For Increment PCB Sequence Number:
    When the system finds that the database name at position k matches the database name at position i, then the system adds 1 to the pcb sequence number counter to reflect the sequential occurrence of this database.
👨‍💻 Technical ACs (Gherkin)
Context: An ISCOM table with database entries and a current position I being processed
GIVEN
An ISCOM table with database entries and a current position I being processed
Applied to: Start Loop: K = 1 to Current Position I-1 - Iterate through previous database entries to count matching database names for sequence calculation
WHEN
The system needs to determine the PCB sequence number for the database at position I by examining all previous positions from 1 to I-1
THEN
The system increments the PCB sequence number for each previous entry that has the same database name as the current entry
Context: Two database entries in the ISCOM table at positions K and I
GIVEN
Two database entries in the ISCOM table at positions K and I
Applied to: Compare Database Names: ISCOM K vs ISCOM I
WHEN
The system compares the database names at these positions
THEN
If the database names match exactly, the system identifies them as the same database requiring sequential PCB numbering
Context: A PCB sequence number counter (ISCOM-PCB-NUM) and two database entries with matching names
GIVEN
A PCB sequence number counter (ISCOM-PCB-NUM) and two database entries with matching names
Applied to: Increment PCB Sequence Number
WHEN
The system finds that the database name at position K matches the database name at position I
THEN
The system adds 1 to the PCB sequence number counter to reflect the sequential occurrence of this database
R-GCCTBIO-cbl-00077 File: GCCTBIO.cbl Restore Calling Program Context
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Restore Calling Program Context':
  • Context - a database access operation has been completed and the original program name was previously saved:
    For Restore Calling Program Context - Restore original program name before returning control to caller:
    When the database access module finishes processing, then the system restores the original program name from the saved value and returns control to the calling program.
👨‍💻 Technical ACs (Gherkin)
Context: A database access operation has been completed and the original program name was previously saved
GIVEN
A database access operation has been completed and the original program name was previously saved
Applied to: Restore Calling Program Context - Restore original program name before returning control to caller
WHEN
The database access module finishes processing
THEN
The system restores the original program name from the saved value and returns control to the calling program
R-CIMS-cbl-00077 (+5) File: CIMS.cbl IO PCB Date Time Refresh Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IO PCB Date Time Refresh':
  • Context - a database function call is being processed with a specific function type and pcb address:
    For Check Function Type and PCB:
    When the function is 'gu' (get unique) and the pcb address matches the io pcb address in cccom, then the system should proceed to refresh date and time information.
  • Context - a gu function is being executed on the io pcb:
    For Reset IMS Call Counter to Zero:
    When the date and time refresh process is initiated, then the ims call counter in cccom should be reset to zero.
  • Context - date and time refresh is required for io pcb operation:
    For Get Current System Date:
    When the system needs to update machine date information, then the current system date should be retrieved in ccyymmdd format.
  • Context - current system date has been retrieved in ccyymmdd format:
    For Update Machine Century in CCCOM & Update Machine Date in CCCOM:
    When machine date information needs to be updated in cccom, then the century portion (cc) should be moved to the machine century field in cccom and the date portion (yymmdd) should be moved to the machine date field in cccom.
  • Context - machine date has been updated in cccom:
    For Get Current System Time:
    When machine time information needs to be updated, then the current system time should be retrieved and stored in the machine time field of cccom.
👨‍💻 Technical ACs (Gherkin)
Context: A database function call is being processed with a specific function type and PCB address
GIVEN
A database function call is being processed with a specific function type and PCB address
Applied to: Check Function Type and PCB
WHEN
The function is 'GU' (Get Unique) AND the PCB address matches the IO PCB address in CCCOM
THEN
The system should proceed to refresh date and time information
Context: A GU function is being executed on the IO PCB
GIVEN
A GU function is being executed on the IO PCB
Applied to: Reset IMS Call Counter to Zero
WHEN
The date and time refresh process is initiated
THEN
The IMS call counter in CCCOM should be reset to zero
Context: Date and time refresh is required for IO PCB operation
GIVEN
Date and time refresh is required for IO PCB operation
Applied to: Get Current System Date
WHEN
The system needs to update machine date information
THEN
The current system date should be retrieved in CCYYMMDD format
Context: Current system date has been retrieved in CCYYMMDD format
GIVEN
Current system date has been retrieved in CCYYMMDD format
Applied to: Update Machine Century in CCCOM & Update Machine Date in CCCOM
WHEN
Machine date information needs to be updated in CCCOM
THEN
The century portion (CC) should be moved to the machine century field in CCCOM AND The date portion (YYMMDD) should be moved to the machine date field in CCCOM
Context: Machine date has been updated in CCCOM
GIVEN
Machine date has been updated in CCCOM
Applied to: Get Current System Time
WHEN
Machine time information needs to be updated
THEN
The current system time should be retrieved and stored in the machine time field of CCCOM
R-GCCTBIO-cbl-00078 (+2) File: GCCTBIO.cbl Validate GET Operations Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate GET Operations':
  • Context - a function code is provided for database operation:
    For Check Function Code:
    When the function code is ghu (get hold unique) or the function code is gu (get unique), then set the accept status to ge and set the ssa type to qualified ssa for precise record retrieval.
  • Context - the function code has been validated as either ghu or gu:
    For Set Accept Status to GE:
    When the system processes the validated get operation, then set the accept status to ge to indicate the operation type.
    For Set SSA Type to Qualified:
    When the system configures the search parameters, then set the ssa type to qualified ssa to enable specific record targeting.
👨‍💻 Technical ACs (Gherkin)
Context: A function code is provided for database operation
GIVEN
A function code is provided for database operation
Applied to: Check Function Code
WHEN
The function code is GHU (Get Hold Unique) OR the function code is GU (Get Unique)
THEN
Set the accept status to GE AND set the SSA type to qualified SSA for precise record retrieval
Context: The function code has been validated as either GHU or GU
GIVEN
The function code has been validated as either GHU or GU
Applied to: Set Accept Status to GE
WHEN
The system processes the validated GET operation
THEN
Set the accept status to GE to indicate the operation type
Applied to: Set SSA Type to Qualified
WHEN
The system configures the search parameters
THEN
Set the SSA type to qualified SSA to enable specific record targeting
R-CCISCOM-cbl-00079 File: CCISCOM.cbl Compare Database Names: ISCOM K vs ISCOM I
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Compare Database Names: ISCOM K vs ISCOM I':
  • Context - two iscom table entries with positions k and i are being compared, where k represents the comparison entry and i represents the current processing entry:
    For Compare Database Names: ISCOM K vs ISCOM I:
    When the database name in iscom entry at position k equals the database name in iscom entry at position i, then the iscom pcb number counter is incremented by 1 to track the occurrence of matching database names.
👨‍💻 Technical ACs (Gherkin)
Context: Two ISCOM table entries with positions K and I are being compared, where K represents the comparison entry and I represents the current processing entry
GIVEN
Two ISCOM table entries with positions K and I are being compared, where K represents the comparison entry and I represents the current processing entry
Applied to: Compare Database Names: ISCOM K vs ISCOM I
WHEN
The database name in ISCOM entry at position K equals the database name in ISCOM entry at position I
THEN
The ISCOM PCB number counter is incremented by 1 to track the occurrence of matching database names
R-GCCTBIO-cbl-00081 (+3) File: GCCTBIO.cbl Validate NEXT Operations Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate NEXT Operations':
  • Context - a user function code is provided for database operation:
    For Check Function Code for NEXT Operations:
    When the function code is ghn (get hold next), ghnp (get hold next in parent), gn (get next), or gnp (get next in parent), then the system recognizes it as a valid next operation and proceeds with next operation configuration.
  • Context - the function code has been validated as a next operation (ghn, ghnp, gn, or gnp):
    For Set Accept Status for NEXT Operations:
    When the system processes the next operation configuration, then the accept status is set to gagbgegk to indicate next operation acceptance.
  • Context - a next operation has been validated and accept status is configured:
    For Unqualified SSA Flag Set?:
    When the unqualified ssa flag is checked and found to be space (not set), then the system configures qualified ssa type for the database search.
  • Context - a next operation has been validated and the unqualified ssa flag is set (not space):
    For Configure Unqualified SSA Type:
    When the system determines ssa type configuration, then the system configures unqualified ssa type for the database search.
👨‍💻 Technical ACs (Gherkin)
Context: A user function code is provided for database operation
GIVEN
A user function code is provided for database operation
Applied to: Check Function Code for NEXT Operations
WHEN
The function code is GHN (Get Hold Next), GHNP (Get Hold Next in Parent), GN (Get Next), or GNP (Get Next in Parent)
THEN
The system recognizes it as a valid NEXT operation and proceeds with NEXT operation configuration
Context: The function code has been validated as a NEXT operation (GHN, GHNP, GN, or GNP)
GIVEN
The function code has been validated as a NEXT operation (GHN, GHNP, GN, or GNP)
Applied to: Set Accept Status for NEXT Operations
WHEN
The system processes the NEXT operation configuration
THEN
The accept status is set to GAGBGEGK to indicate NEXT operation acceptance
Context: A NEXT operation has been validated and accept status is configured
GIVEN
A NEXT operation has been validated and accept status is configured
Applied to: Unqualified SSA Flag Set?
WHEN
The unqualified SSA flag is checked and found to be space (not set)
THEN
The system configures qualified SSA type for the database search
Context: A NEXT operation has been validated and the unqualified SSA flag is set (not space)
GIVEN
A NEXT operation has been validated and the unqualified SSA flag is set (not space)
Applied to: Configure Unqualified SSA Type
WHEN
The system determines SSA type configuration
THEN
The system configures unqualified SSA type for the database search
R-GCCUSIO-cbl-00081 (+12) File: GCCUSIO.cbl Primary Cargo Record Retrieval Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Cargo Record Retrieval':
  • Context - a cargo record retrieval request is received with function code gu or gn:
    For Build Primary SSA with CCN Key:
    When the ccn key field is not empty, then build qualified ssa with ccn key value and execute qualified search.
    For Build Unqualified SSA:
    When the ccn key field is empty or spaces, then build unqualified ssa and execute unqualified search.
  • Context - a cargo record retrieval request is received with function code other than isrt, repl, dlet, or zap:
    For Secondary Index Specified?:
    When the secondary index field is not empty or spaces, then route to secondary index processing instead of primary ssa building.
  • Context - a secondary index search request is received:
    For Car ID Index Search:
    When the index type is car-id, then use car id index structure with car identification value and operator to search cargo records.
    For Waybill Index Search:
    When the index type is waybill, then use waybill index structure with waybill number value and operator to search cargo records.
    For Car-Waybill Index Search:
    When the index type is car-wb and car-waybill index is not empty, then use qualified ssa with car-waybill index value, otherwise use unqualified ssa.
    For Bond Number Index Search:
    When the index type is bond and bond index is not empty, then use qualified ssa with bond index value, otherwise use unqualified ssa.
    For Lead CCN Index Search:
    When the index type is lead-ccn and lead manifest ccn is not empty, then use qualified ssa with lead ccn value, otherwise use unqualified ssa.
    For Held Destination Index Search:
    When the index type is held-dest, then search status table by held destination key, then retrieve primary cargo record using the cargo key from status record.
    For Held Border Index Search:
    When the index type is held-border, then search status table by held border key, then retrieve primary cargo record using the cargo key from status record.
    For Error Origin Index Search:
    When the index type is err-orig, then search status table by error origin key, then retrieve primary cargo record using the cargo key from status record.
    For Error Border Index Search:
    When the index type is err-border, then search status table by error border key, then retrieve primary cargo record using the cargo key from status record.
    For Error Destination Index Search:
    When the index type is err-dest, then search status table by error destination key, then retrieve primary cargo record using the cargo key from status record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record retrieval request is received with function code GU or GN
GIVEN
A cargo record retrieval request is received with function code GU or GN
Applied to: Build Primary SSA with CCN Key
WHEN
The CCN key field is not empty
THEN
Build qualified SSA with CCN key value and execute qualified search
Applied to: Build Unqualified SSA
WHEN
The CCN key field is empty or spaces
THEN
Build unqualified SSA and execute unqualified search
Context: A cargo record retrieval request is received with function code other than ISRT, REPL, DLET, or ZAP
GIVEN
A cargo record retrieval request is received with function code other than ISRT, REPL, DLET, or ZAP
Applied to: Secondary Index Specified?
WHEN
The secondary index field is not empty or spaces
THEN
Route to secondary index processing instead of primary SSA building
Context: A secondary index search request is received
GIVEN
A secondary index search request is received
Applied to: Car ID Index Search
WHEN
The index type is CAR-ID
THEN
Use car ID index structure with car identification value and operator to search cargo records
Applied to: Waybill Index Search
WHEN
The index type is WAYBILL
THEN
Use waybill index structure with waybill number value and operator to search cargo records
Applied to: Car-Waybill Index Search
WHEN
The index type is CAR-WB and car-waybill index is not empty
THEN
Use qualified SSA with car-waybill index value, otherwise use unqualified SSA
Applied to: Bond Number Index Search
WHEN
The index type is BOND and bond index is not empty
THEN
Use qualified SSA with bond index value, otherwise use unqualified SSA
Applied to: Lead CCN Index Search
WHEN
The index type is LEAD-CCN and lead manifest CCN is not empty
THEN
Use qualified SSA with lead CCN value, otherwise use unqualified SSA
Applied to: Held Destination Index Search
WHEN
The index type is HELD-DEST
THEN
Search status table by held destination key, then retrieve primary cargo record using the cargo key from status record
Applied to: Held Border Index Search
WHEN
The index type is HELD-BORDER
THEN
Search status table by held border key, then retrieve primary cargo record using the cargo key from status record
Applied to: Error Origin Index Search
WHEN
The index type is ERR-ORIG
THEN
Search status table by error origin key, then retrieve primary cargo record using the cargo key from status record
Applied to: Error Border Index Search
WHEN
The index type is ERR-BORDER
THEN
Search status table by error border key, then retrieve primary cargo record using the cargo key from status record
Applied to: Error Destination Index Search
WHEN
The index type is ERR-DEST
THEN
Search status table by error destination key, then retrieve primary cargo record using the cargo key from status record
R-CIMS-cbl-00083 (+1) File: CIMS.cbl IMS Call Counter Management Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IMS Call Counter Management':
  • Context - an ims database function has been executed:
    For Reset IMS Call Counter to Zero:
    When the function is 'gu' (get unique) and the pcb address equals the io pcb address, then the ims call counter is reset to zero.
  • Context - an ims database function call has been completed:
    For Increment IMS Call Counter by 1:
    When any ims database operation is executed, then the ims call counter is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: An IMS database function has been executed
GIVEN
An IMS database function has been executed
Applied to: Reset IMS Call Counter to Zero
WHEN
The function is 'GU' (Get Unique) AND the PCB address equals the IO PCB address
THEN
The IMS call counter is reset to zero
Context: An IMS database function call has been completed
GIVEN
An IMS database function call has been completed
Applied to: Increment IMS Call Counter by 1
WHEN
Any IMS database operation is executed
THEN
The IMS call counter is incremented by 1
R-GCCTBIO-cbl-00085 (+2) File: GCCTBIO.cbl Validate INSERT Operations Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate INSERT Operations':
  • Context - a function code is provided for database operation:
    For Function Code = ISRT?:
    When the function code equals isrt (insert), then the system should set the accept status to insert indicator (ii) and configure unqualified ssa for the insert operation.
  • Context - the function code has been validated as isrt (insert):
    For Set Accept Status to Insert Indicator:
    When the system processes the insert operation configuration, then the accept status should be set to ii (insert indicator).
  • Context - the function code is isrt and accept status is configured for insert:
    For Configure Unqualified SSA for Insert:
    When the system configures the segment search argument, then the ssa flag should be set to unqualified ssa type for insert processing.
👨‍💻 Technical ACs (Gherkin)
Context: A function code is provided for database operation
GIVEN
A function code is provided for database operation
Applied to: Function Code = ISRT?
WHEN
The function code equals ISRT (Insert)
THEN
The system should set the accept status to insert indicator (II) and configure unqualified SSA for the insert operation
Context: The function code has been validated as ISRT (Insert)
GIVEN
The function code has been validated as ISRT (Insert)
Applied to: Set Accept Status to Insert Indicator
WHEN
The system processes the insert operation configuration
THEN
The accept status should be set to II (Insert Indicator)
Context: The function code is ISRT and accept status is configured for insert
GIVEN
The function code is ISRT and accept status is configured for insert
Applied to: Configure Unqualified SSA for Insert
WHEN
The system configures the segment search argument
THEN
The SSA flag should be set to unqualified SSA type for insert processing
R-CIMS-cbl-00085 (+2) File: CIMS.cbl PCB Status Information Update Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Status Information Update':
  • Context - a database operation has been completed and pcb status information is available in lk-copy-of-pcb:
    For Copy PCB Status Information to CCCOM:
    When the system processes the pcb status information update, then the complete pcb status information is copied from lk-copy-of-pcb to cc-copy-of-pcb in cccom structure.
  • Context - pcb status information contains a segment level code in lk-seg-level:
    For Segment Level Valid?:
    When the segment level is not equal to '98' and not equal to '99', then the system proceeds to copy the feedback key length information.
  • Context - segment level validation has passed (segment level is not '98' or '99'):
    For Copy Feedback Key Length to CCCOM:
    When the system processes feedback key length information, then the feedback key length is copied from lk-length-fb-key to cc-length-fb-key in cccom structure.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation has been completed and PCB status information is available in LK-COPY-OF-PCB
GIVEN
A database operation has been completed and PCB status information is available in LK-COPY-OF-PCB
Applied to: Copy PCB Status Information to CCCOM
WHEN
The system processes the PCB status information update
THEN
The complete PCB status information is copied from LK-COPY-OF-PCB to CC-COPY-OF-PCB in CCCOM structure
Context: PCB status information contains a segment level code in LK-SEG-LEVEL
GIVEN
PCB status information contains a segment level code in LK-SEG-LEVEL
Applied to: Segment Level Valid?
WHEN
The segment level is not equal to '98' and not equal to '99'
THEN
The system proceeds to copy the feedback key length information
Context: Segment level validation has passed (segment level is not '98' or '99')
GIVEN
Segment level validation has passed (segment level is not '98' or '99')
Applied to: Copy Feedback Key Length to CCCOM
WHEN
The system processes feedback key length information
THEN
The feedback key length is copied from LK-LENGTH-FB-KEY to CC-LENGTH-FB-KEY in CCCOM structure
R-GCX126-cbl-00087 (+4) File: GCX126R.cbl Process M10 Notice Segment Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process M10 Notice Segment':
  • Context - an m10 segment is being processed from the edi 350 message:
    For Set M10 Segment Found Flag:
    When the m10 segment processing begins, then the m10 segment found indicator is set to true.
  • Context - the m10 segment found flag has been set:
    For Initialize M10 Segment Structure:
    When preparing to load m10 segment data, then the m10 segment data structure is initialized to spaces/zeros.
  • Context - the m10 segment structure has been initialized and the current line in the message queue table contains an m10 segment:
    For Move MQS Table Entry to M10 Segment:
    When loading m10 segment data, then the message queue table entry at the current line position is moved to the m10 segment structure.
  • Context - the m10 segment has been loaded with data from the message queue:
    For Extract Notice Document Type Code:
    When extracting customs notice information, then the notice document type code (m10-05-notice-doc-typ-cde) is available from the m10 segment for business processing.
    For Extract CBSA Reference/CCN:
    When extracting cargo identification information, then the ccn reference (m10-07-ccn) containing up to 25 characters is available from the m10 segment for cargo lookup and processing.
👨‍💻 Technical ACs (Gherkin)
Context: An M10 segment is being processed from the EDI 350 message
GIVEN
An M10 segment is being processed from the EDI 350 message
Applied to: Set M10 Segment Found Flag
WHEN
The M10 segment processing begins
THEN
The M10 segment found indicator is set to true
Context: The M10 segment found flag has been set
GIVEN
The M10 segment found flag has been set
Applied to: Initialize M10 Segment Structure
WHEN
Preparing to load M10 segment data
THEN
The M10 segment data structure is initialized to spaces/zeros
Context: The M10 segment structure has been initialized and the current line in the message queue table contains an M10 segment
GIVEN
The M10 segment structure has been initialized and the current line in the message queue table contains an M10 segment
Applied to: Move MQS Table Entry to M10 Segment
WHEN
Loading M10 segment data
THEN
The message queue table entry at the current line position is moved to the M10 segment structure
Context: The M10 segment has been loaded with data from the message queue
GIVEN
The M10 segment has been loaded with data from the message queue
Applied to: Extract Notice Document Type Code
WHEN
Extracting customs notice information
THEN
The notice document type code (M10-05-NOTICE-DOC-TYP-CDE) is available from the M10 segment for business processing
Applied to: Extract CBSA Reference/CCN
WHEN
Extracting cargo identification information
THEN
The CCN reference (M10-07-CCN) containing up to 25 characters is available from the M10 segment for cargo lookup and processing
R-GCCTBIO-cbl-00088 (+2) File: GCCTBIO.cbl Validate UPDATE/DELETE Operations Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate UPDATE/DELETE Operations':
  • Context - a function code is being validated for database operation:
    For Function Code = DLET?:
    When the function code is dlet (delete), then the system sets the ssa flag to no-ssa indicating no search argument is required.
  • Context - a function code is being validated for database operation and it is not a delete operation:
    For Function Code = REPL?:
    When the function code is repl (replace), then the system sets the ssa flag to no-ssa indicating no search argument is required.
  • Context - a function code is being validated for database operation and it is neither dlet nor repl:
    For Continue to Next Validation:
    When the function code does not match any supported update/delete operations, then the system sets the return flag to not-valid indicating an unsupported operation.
👨‍💻 Technical ACs (Gherkin)
Context: A function code is being validated for database operation
GIVEN
A function code is being validated for database operation
Applied to: Function Code = DLET?
WHEN
The function code is DLET (Delete)
THEN
The system sets the SSA flag to NO-SSA indicating no search argument is required
Context: A function code is being validated for database operation and it is not a delete operation
GIVEN
A function code is being validated for database operation and it is not a delete operation
Applied to: Function Code = REPL?
WHEN
The function code is REPL (Replace)
THEN
The system sets the SSA flag to NO-SSA indicating no search argument is required
Context: A function code is being validated for database operation and it is neither DLET nor REPL
GIVEN
A function code is being validated for database operation and it is neither DLET nor REPL
Applied to: Continue to Next Validation
WHEN
The function code does not match any supported update/delete operations
THEN
The system sets the return flag to NOT-VALID indicating an unsupported operation
R-CIMS-cbl-00088 File: CIMS.cbl Terminal and User Information Capture
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Terminal and User Information Capture':
  • Context - a database function is being executed with a specific pcb address:
    For Terminal and User Information Capture - Captures original terminal name and user ID for GU and CHKP functions on IO PCB:
    When the function is either 'gu' (get unique) or 'chkp' (checkpoint) and the pcb address matches the io pcb address in the common control area, then the system captures the original terminal name from the common control area to the original terminal field and captures the user id from the common control area to the acf2 user id field.
👨‍💻 Technical ACs (Gherkin)
Context: A database function is being executed with a specific PCB address
GIVEN
A database function is being executed with a specific PCB address
Applied to: Terminal and User Information Capture - Captures original terminal name and user ID for GU and CHKP functions on IO PCB
WHEN
The function is either 'GU' (Get Unique) or 'CHKP' (Checkpoint) AND the PCB address matches the IO PCB address in the common control area
THEN
The system captures the original terminal name from the common control area to the original terminal field AND captures the user ID from the common control area to the ACF2 user ID field
R-CIMS-cbl-00089 (+4) File: CIMS.cbl Status Code Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Status Code Validation':
  • Context - an ims database operation has been executed and returned a status code:
    For Status Code = Spaces?:
    When the status code is evaluated for success condition, then if the status code equals spaces, the operation is considered successful and processing continues with common area updates.
  • Context - an ims operation has returned a non-blank status code and validation against acceptable status table is required:
    For I <= 12?:
    When the system iterates through the acceptable status code table, then the validation loop continues while the counter is less than or equal to 12 entries in the acceptable status table.
  • Context - an ims status code needs validation and the system is checking against acceptable status table entries:
    For Status Code Matches Entry?:
    When the current status code is compared with the current table entry, then if the status code matches the acceptable status table entry, the operation is validated successfully and processing continues.
  • Context - the current ims status code does not match the current acceptable status table entry:
    For Increment Counter I:
    When the system needs to check the next entry in the acceptable status table, then the counter is incremented by 1 to move to the next table entry for comparison.
  • Context - an ims operation has returned a status code that has been checked against all entries in the acceptable status table:
    For Generate Error Message: Status Code Not in Acceptable List:
    When the status code is not found in any of the acceptable status table entries, then an error message is generated indicating the ims return code is not in the acceptable list and error processing is invoked.
👨‍💻 Technical ACs (Gherkin)
Context: An IMS database operation has been executed and returned a status code
GIVEN
An IMS database operation has been executed and returned a status code
Applied to: Status Code = Spaces?
WHEN
The status code is evaluated for success condition
THEN
If the status code equals spaces, the operation is considered successful and processing continues with common area updates
Context: An IMS operation has returned a non-blank status code and validation against acceptable status table is required
GIVEN
An IMS operation has returned a non-blank status code and validation against acceptable status table is required
Applied to: I <= 12?
WHEN
The system iterates through the acceptable status code table
THEN
The validation loop continues while the counter is less than or equal to 12 entries in the acceptable status table
Context: An IMS status code needs validation and the system is checking against acceptable status table entries
GIVEN
An IMS status code needs validation and the system is checking against acceptable status table entries
Applied to: Status Code Matches Entry?
WHEN
The current status code is compared with the current table entry
THEN
If the status code matches the acceptable status table entry, the operation is validated successfully and processing continues
Context: The current IMS status code does not match the current acceptable status table entry
GIVEN
The current IMS status code does not match the current acceptable status table entry
Applied to: Increment Counter I
WHEN
The system needs to check the next entry in the acceptable status table
THEN
The counter is incremented by 1 to move to the next table entry for comparison
Context: An IMS operation has returned a status code that has been checked against all entries in the acceptable status table
GIVEN
An IMS operation has returned a status code that has been checked against all entries in the acceptable status table
Applied to: Generate Error Message: Status Code Not in Acceptable List
WHEN
The status code is not found in any of the acceptable status table entries
THEN
An error message is generated indicating the IMS return code is not in the acceptable list and error processing is invoked
R-GCCTBIO-cbl-00091 (+2) File: GCCTBIO.cbl Configure Qualified SSA for Dependent Segment Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Configure Qualified SSA for Dependent Segment':
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is qualified and the unqualified ssa flag is not set (space):
    For Set Root Segment Key Value:
    When the system initializes the ssa configuration, then the system sets both the root segment key value from gcstbrt-key and the dependent segment key value from gcstbdp-key.
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is qualified and the unqualified ssa flag is set (not space):
    For Use Alternative SSA Configuration:
    When the system initializes the ssa configuration, then the system sets only the root segment key value from gcstbrt-key and changes the ssa flag to unqualified.
  • Context - the segment name is a dependent segment (gcstbdp-key-name) and the ssa flag is not qualified:
    For Use Alternative SSA Configuration:
    When the system initializes the ssa configuration, then the system sets the root segment key value from gcstbrt-key and ensures the ssa flag is set to unqualified.
👨‍💻 Technical ACs (Gherkin)
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is qualified and the unqualified SSA flag is not set (space)
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is qualified and the unqualified SSA flag is not set (space)
Applied to: Set Root Segment Key Value
WHEN
The system initializes the SSA configuration
THEN
The system sets both the root segment key value from GCSTBRT-KEY and the dependent segment key value from GCSTBDP-KEY
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is qualified and the unqualified SSA flag is set (not space)
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is qualified and the unqualified SSA flag is set (not space)
Applied to: Use Alternative SSA Configuration
WHEN
The system initializes the SSA configuration
THEN
The system sets only the root segment key value from GCSTBRT-KEY and changes the SSA flag to unqualified
Context: The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is not qualified
GIVEN
The segment name is a dependent segment (GCSTBDP-KEY-NAME) and the SSA flag is not qualified
Applied to: Use Alternative SSA Configuration
WHEN
The system initializes the SSA configuration
THEN
The system sets the root segment key value from GCSTBRT-KEY and ensures the SSA flag is set to unqualified
R-GCX126-cbl-00092 (+3) File: GCX126R.cbl Process P4 Port Segment Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process P4 Port Segment':
  • Context - an edi 350 message is being processed and a p4 segment type is identified in the message queue table entry:
    For Set P4 Segment Found Flag to TRUE:
    When the p4 segment processing routine is invoked, then the system sets the p4 segment found indicator to true to track that port information has been received.
  • Context - a p4 segment is ready to be processed from the edi 350 message:
    For Initialize P4 Segment Structure:
    When the p4 segment processing begins, then the system initializes the p4 segment data structure by clearing all fields to spaces or zeros.
  • Context - the p4 segment structure has been initialized and the message queue table contains the p4 segment data at the current line position:
    For Move MQ Table Entry to P4 Segment:
    When the system processes the p4 segment entry, then the system moves the complete message queue table entry data to the p4 segment structure, making port code (p4-01-port-cde) and sub-location code (p4-02-sub-loc-cde) available for use.
  • Context - the p4 segment data has been successfully moved from the message queue table entry to the p4 segment structure:
    For P4 Segment Ready for Processing:
    When the p4 segment processing completes, then the system has the port code (4-character identifier) and sub-location code available in the p4 segment structure for use in cargo processing, release operations, and notification messages.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message is being processed and a P4 segment type is identified in the message queue table entry
GIVEN
An EDI 350 message is being processed and a P4 segment type is identified in the message queue table entry
Applied to: Set P4 Segment Found Flag to TRUE
WHEN
The P4 segment processing routine is invoked
THEN
The system sets the P4 segment found indicator to TRUE to track that port information has been received
Context: A P4 segment is ready to be processed from the EDI 350 message
GIVEN
A P4 segment is ready to be processed from the EDI 350 message
Applied to: Initialize P4 Segment Structure
WHEN
The P4 segment processing begins
THEN
The system initializes the P4 segment data structure by clearing all fields to spaces or zeros
Context: The P4 segment structure has been initialized and the message queue table contains the P4 segment data at the current line position
GIVEN
The P4 segment structure has been initialized and the message queue table contains the P4 segment data at the current line position
Applied to: Move MQ Table Entry to P4 Segment
WHEN
The system processes the P4 segment entry
THEN
The system moves the complete message queue table entry data to the P4 segment structure, making port code (P4-01-PORT-CDE) and sub-location code (P4-02-SUB-LOC-CDE) available for use
Context: The P4 segment data has been successfully moved from the message queue table entry to the P4 segment structure
GIVEN
The P4 segment data has been successfully moved from the message queue table entry to the P4 segment structure
Applied to: P4 Segment Ready for Processing
WHEN
The P4 segment processing completes
THEN
The system has the port code (4-character identifier) and sub-location code available in the P4 segment structure for use in cargo processing, release operations, and notification messages
R-GCCTBIO-cbl-00094 (+2) File: GCCTBIO.cbl Configure Unqualified SSA for Dependent Segment Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Configure Unqualified SSA for Dependent Segment':
  • Context - segment name is gcstbdp dependent segment and ssa type is qualified and unqualified ssa flag is not set (space):
    For Set Root Key Value:
    When ssa initialization is performed, then root key value is set from gcstbrt-key and dependent key value is set from gcstbdp-key.
  • Context - segment name is gcstbdp dependent segment and ssa type is qualified and unqualified ssa flag is set:
    For Set Root Key Value Only:
    When ssa initialization is performed, then root key value is set from gcstbrt-key and ssa type is changed to unqualified.
  • Context - segment name is gcstbdp dependent segment and ssa type is unqualified:
    For Set Root Key Value:
    When ssa initialization is performed, then root key value is set from gcstbrt-key and ssa type is set to unqualified.
👨‍💻 Technical ACs (Gherkin)
Context: Segment name is GCSTBDP dependent segment AND SSA type is qualified AND unqualified SSA flag is not set (space)
GIVEN
Segment name is GCSTBDP dependent segment AND SSA type is qualified AND unqualified SSA flag is not set (space)
Applied to: Set Root Key Value
WHEN
SSA initialization is performed
THEN
Root key value is set from GCSTBRT-KEY AND dependent key value is set from GCSTBDP-KEY
Context: Segment name is GCSTBDP dependent segment AND SSA type is qualified AND unqualified SSA flag is set
GIVEN
Segment name is GCSTBDP dependent segment AND SSA type is qualified AND unqualified SSA flag is set
Applied to: Set Root Key Value Only
WHEN
SSA initialization is performed
THEN
Root key value is set from GCSTBRT-KEY AND SSA type is changed to unqualified
Context: Segment name is GCSTBDP dependent segment AND SSA type is unqualified
GIVEN
Segment name is GCSTBDP dependent segment AND SSA type is unqualified
Applied to: Set Root Key Value
WHEN
SSA initialization is performed
THEN
Root key value is set from GCSTBRT-KEY AND SSA type is set to unqualified
R-GCCUSIO-cbl-00094 (+6) File: GCCUSIO.cbl Index Field Management Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Index Field Management':
  • Context - a cargo record is being processed for index field updates:
    For Is Cargo Deleted?:
    When the cargo status indicates it is deleted (88-gcusrt-rt10-cpcargo-deleted is true), then the system should skip all index field population and exit the index management process.
  • Context - a cargo record is active (not deleted):
    For Set CCN Key Index Fields:
    When index fields are being updated, then the system should copy the us ccn key to rt071, rt072, and rt073 index fields, and if destination index is not empty, also copy to rt076 index field.
  • Context - a cargo record has equipment car information:
    For Populate Car ID Index:
    When index fields are being populated, then the system should copy the equipment car number to the car id index field (rt071-car-id-num-index).
  • Context - a cargo record contains waybill information:
    For Populate Waybill Index Fields:
    When index fields are being updated, then the system should populate rt072 index with road number, station number, waybill number, and waybill date from the rt082 fields.
  • Context - a cargo record has both car and waybill information:
    For Populate Car-Waybill Combined Index:
    When index fields are being populated, then the system should copy the waybill number from rt072 to rt073 waybill index and copy the equipment car number to rt073 car id index.
  • Context - a cargo record may have bond-related numbers:
    For Bond Control Number Available?:
    When the bond index field is being populated, then if in-bond control number is not empty, use it for bond index; otherwise if entry number is not empty, use entry number; otherwise clear the bond index.
  • Context - a cargo record is being processed for index updates:
    For Set Manifest Index:
    When all other index fields have been populated, then the system should copy the us ccn key to the manifest index field (rt075-manif-index).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index field updates
GIVEN
A cargo record is being processed for index field updates
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it is deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The system should skip all index field population and exit the index management process
Context: A cargo record is active (not deleted)
GIVEN
A cargo record is active (not deleted)
Applied to: Set CCN Key Index Fields
WHEN
Index fields are being updated
THEN
The system should copy the US CCN key to RT071, RT072, and RT073 index fields, and if destination index is not empty, also copy to RT076 index field
Context: A cargo record has equipment car information
GIVEN
A cargo record has equipment car information
Applied to: Populate Car ID Index
WHEN
Index fields are being populated
THEN
The system should copy the equipment car number to the car ID index field (RT071-CAR-ID-NUM-INDEX)
Context: A cargo record contains waybill information
GIVEN
A cargo record contains waybill information
Applied to: Populate Waybill Index Fields
WHEN
Index fields are being updated
THEN
The system should populate RT072 index with road number, station number, waybill number, and waybill date from the RT082 fields
Context: A cargo record has both car and waybill information
GIVEN
A cargo record has both car and waybill information
Applied to: Populate Car-Waybill Combined Index
WHEN
Index fields are being populated
THEN
The system should copy the waybill number from RT072 to RT073 waybill index and copy the equipment car number to RT073 car ID index
Context: A cargo record may have bond-related numbers
GIVEN
A cargo record may have bond-related numbers
Applied to: Bond Control Number Available?
WHEN
The bond index field is being populated
THEN
If in-bond control number is not empty, use it for bond index; otherwise if entry number is not empty, use entry number; otherwise clear the bond index
Context: A cargo record is being processed for index updates
GIVEN
A cargo record is being processed for index updates
Applied to: Set Manifest Index
WHEN
All other index fields have been populated
THEN
The system should copy the US CCN key to the manifest index field (RT075-MANIF-INDEX)
R-CIMS-cbl-00094 File: CIMS.cbl Error Message Generation
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Generation':
  • Context - an ims database operation has completed and returned a status code that is not found in the acceptable status code table after checking all 12 entries:
    For Error Message Generation - Generates error message for unacceptable IMS status codes:
    When the system needs to handle the unacceptable status code, then the system constructs an error message by concatenating the status code with the text ': ims rc code not in acceptable list', stores this message in the cccom error message field, and calls the error handler 'cerr' with the cccom control block.
👨‍💻 Technical ACs (Gherkin)
Context: An IMS database operation has completed and returned a status code that is not found in the acceptable status code table after checking all 12 entries
GIVEN
An IMS database operation has completed and returned a status code that is not found in the acceptable status code table after checking all 12 entries
Applied to: Error Message Generation - Generates error message for unacceptable IMS status codes
WHEN
The system needs to handle the unacceptable status code
THEN
The system constructs an error message by concatenating the status code with the text ': IMS RC CODE NOT IN ACCEPTABLE LIST', stores this message in the CCCOM error message field, and calls the error handler 'CERR' with the CCCOM control block
R-CIMS-cbl-00095 (+8) File: CIMS.cbl ISCOM to CCCOM Conversion Detection Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ISCOM to CCCOM Conversion Detection':
  • Context - the system needs to detect iscom format usage:
    For Set Base Address to CCCOM DB PCBs:
    When iscom detection process begins, then the base address pointer is set to the cccom database pcb control blocks area.
  • Context - the base address has been established for iscom detection:
    For Set Offset Address to Current PCB Area:
    When setting up address comparison parameters, then the offset address pointer is set to the current pcb address area.
  • Context - iscom detection addresses are established:
    For Calculate ISCOM Table Size:
    When calculating table boundaries for validation, then the iscom table size is computed based on the length of cccom database pcbs.
  • Context - base and offset addresses are established for iscom detection:
    For Base Address > Zero?:
    When the base address value is evaluated, then if base address is greater than zero, use offset minus base calculation method, otherwise use base minus offset calculation method.
  • Context - base address is greater than zero:
    For Calculate Address Difference Method 1: Offset - Base:
    When computing address difference for iscom detection, then address difference is calculated as offset address minus base address.
  • Context - base address is not greater than zero:
    For Calculate Address Difference Method 2: Base - Offset:
    When computing address difference for iscom detection, then address difference is calculated as base address minus offset address.
  • Context - address offset has been determined and is within iscom range:
    For PCB Table Index Calculation:
    When converting iscom pcb to cccom format, then table index is calculated as (address offset + 8) divided by 12.
  • Context - table index has been calculated for pcb conversion:
    For ISCOM PCB Conversion:
    When iscom format pcb needs to be converted to cccom format, then external conversion service cimsconv is invoked with iscom pcb data, pcb pointer, and table index to perform the conversion.
  • Context - iscom pcb has been successfully converted to cccom format:
    For Set New PCB Address:
    When finalizing the conversion process, then the address area is updated to point to the converted iscom pcb pointer.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to detect ISCOM format usage
GIVEN
The system needs to detect ISCOM format usage
Applied to: Set Base Address to CCCOM DB PCBs
WHEN
ISCOM detection process begins
THEN
The base address pointer is set to the CCCOM database PCB control blocks area
Context: The base address has been established for ISCOM detection
GIVEN
The base address has been established for ISCOM detection
Applied to: Set Offset Address to Current PCB Area
WHEN
Setting up address comparison parameters
THEN
The offset address pointer is set to the current PCB address area
Context: ISCOM detection addresses are established
GIVEN
ISCOM detection addresses are established
Applied to: Calculate ISCOM Table Size
WHEN
Calculating table boundaries for validation
THEN
The ISCOM table size is computed based on the length of CCCOM database PCBs
Context: Base and offset addresses are established for ISCOM detection
GIVEN
Base and offset addresses are established for ISCOM detection
Applied to: Base Address > Zero?
WHEN
The base address value is evaluated
THEN
If base address is greater than zero, use offset minus base calculation method, otherwise use base minus offset calculation method
Context: Base address is greater than zero
GIVEN
Base address is greater than zero
Applied to: Calculate Address Difference Method 1: Offset - Base
WHEN
Computing address difference for ISCOM detection
THEN
Address difference is calculated as offset address minus base address
Context: Base address is not greater than zero
GIVEN
Base address is not greater than zero
Applied to: Calculate Address Difference Method 2: Base - Offset
WHEN
Computing address difference for ISCOM detection
THEN
Address difference is calculated as base address minus offset address
Context: Address offset has been determined and is within ISCOM range
GIVEN
Address offset has been determined and is within ISCOM range
Applied to: PCB Table Index Calculation
WHEN
Converting ISCOM PCB to CCCOM format
THEN
Table index is calculated as (address offset + 8) divided by 12
Context: Table index has been calculated for PCB conversion
GIVEN
Table index has been calculated for PCB conversion
Applied to: ISCOM PCB Conversion
WHEN
ISCOM format PCB needs to be converted to CCCOM format
THEN
External conversion service CIMSCONV is invoked with ISCOM PCB data, PCB pointer, and table index to perform the conversion
Context: ISCOM PCB has been successfully converted to CCCOM format
GIVEN
ISCOM PCB has been successfully converted to CCCOM format
Applied to: Set New PCB Address
WHEN
Finalizing the conversion process
THEN
The address area is updated to point to the converted ISCOM PCB pointer
R-GCX126-cbl-00096 (+16) File: GCX126R.cbl Process V9 Notice Reason Segment Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process V9 Notice Reason Segment':
  • Context - an edi 350 message is being processed and a v9 segment has been extracted from the message queue table entry:
    For MATCHED - Document Matched:
    When the v9 notice reason code indicates matched status (v9-02-matched is true), then the system continues processing without updating cargo status or logging additional messages.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system:
    For NOT-MATCHED - Document Not Matched:
    When the v9 notice reason code indicates not-matched status (v9-02-not-matched is true), then the system logs the message 'edi 350: doc not matched' to the cargo information log.
    For CARGO-COMPLETE - Cargo Complete:
    When the v9 notice reason code indicates cargo-complete status (v9-02-cargo-complete is true), then the system logs the message 'edi 350: cargo complete message' to the cargo information log.
    For REPORTED - Cargo Reported:
    When the v9 notice reason code indicates reported status (v9-02-reported is true), then the system logs the message 'edi 350: cargo reported' to the cargo information log.
    For HELD - Goods Held for Examination:
    When the v9 notice reason code indicates held status (v9-02-held is true), then the system logs the message 'edi 350: goods held for examination', sets cargo status to hold, replaces the cargo record in the database, and if the first 4 characters of the cargo ccn equal '6105' then prepares a merlin hold notification containing equipment id, waybill number, ccn, destination station name and state, and manifest upon station name, and sends the notification to the merlin system.
    For Other - Invalid Notice Reason:
    When the v9 notice reason code does not match any of the recognized status codes (matched, not-matched, cargo-complete, doc-pkg-complete, doc-not-on-file, reported, arrived, released, auth-to-deliver, held, or decon), then the system logs the message 'edi 350: invalid notice reason code ' concatenated with the first 4 characters of the v9 notice reason code to the cargo information log.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system and x4 segment contains cbsa release reference id:
    For DOC-PKG-COMPLETE - Document Package Complete:
    When the v9 notice reason code indicates doc-pkg-complete status (v9-02-doc-pkg-complete is true) and either the first 15 characters of x4 cbsa release reference id do not match the broker entry or the first 14 characters do not match the customs transaction number and the x4 cbsa release reference id is not spaces, then the system updates the cargo broker entry with the first 15 characters of x4 cbsa release reference id, updates the customs transaction number with the first 14 characters, sets the broker date to current machine date, sets the broker time to current machine time (first 4 digits), logs the message 'edi 350: doc pkg complete : ' concatenated with the first 15 characters of x4 cbsa release reference id, and replaces the cargo record in the database.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system and x4 segment contains release document type code:
    For DOC-NOT-ON-FILE - Document Not On File:
    When the v9 notice reason code indicates doc-not-on-file status (v9-02-doc-not-on-file is true) and the first character of x4 release document type code equals 'r', then the system logs the message 'edi 350: doc not on file for release ' concatenated with the first 15 characters of x4 cbsa release reference id to the cargo information log.
    For DOC-NOT-ON-FILE - Document Not On File:
    When the v9 notice reason code indicates doc-not-on-file status (v9-02-doc-not-on-file is true) and the first character of x4 release document type code does not equal 'r', then the system logs the message 'edi 350:doc not on file h-bill close ' concatenated with the first 25 characters of x4 cbsa release reference id to the cargo information log.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system and p4 segment contains port code:
    For ARRIVED - Cargo Arrived at Port:
    When the v9 notice reason code indicates arrived status (v9-02-arrived is true), then the system logs the message 'edi 350: cargo arrived at port ' concatenated with the first 4 characters of p4 port code to the cargo information log.
    For DECON - Deconsolidation Release:
    When the v9 notice reason code indicates decon status (v9-02-decon is true), then the system clears destination station numbers, sets release date to current machine date, sets release time to current machine time, sets release by to current user id, sets current status to 'released', sets release status to 'r', sets release type to 'a', clears error or release status index, clears error status, sets release reason to 'deconsolidation at ' concatenated with p4 port code (first 4 characters), logs the message 'edi 350: release via decon at port ' concatenated with p4 port code (first 4 characters), processes associated us manifest records, replaces the cargo record in the database, and if the cargo is a master manifest then processes all follower manifests (up to 100) with the same release information.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system and x4 segment contains cbsa release reference id and p4 segment contains port code:
    For RELEASED - Cargo Released:
    When the v9 notice reason code indicates released status (v9-02-released is true), then the system clears destination station numbers, sets release date to current machine date, sets release time to current machine time, sets release by to current user id, sets current status to 'released', sets release status to 'r', sets release type to 'a', clears error or release status index, clears error status, sets release reason to x4 cbsa release reference id (first 15 characters) concatenated with '/' and p4 port code (first 4 characters), logs the message 'edi 350: release : ' concatenated with x4 cbsa release reference id (first 15 characters) and ' at port ' and p4 port code (first 4 characters), processes associated us manifest records, replaces the cargo record in the database, and if the cargo is a master manifest then processes all follower manifests (up to 100) with the same release information.
  • Context - an edi 350 message is being processed and a v9 segment has been extracted with cargo found in the system and the cargo csa indicator is on:
    For AUTH-TO-DELIVER - Authorized to Deliver:
    When the v9 notice reason code indicates auth-to-deliver status (v9-02-auth-to-deliver is true), then the system logs the message 'edi 350: accepted - csa', sets cargo status to csa delivery, sets csa authorization to deliver received flag to true, replaces the cargo record in the database, and processes associated us manifest records.
  • Context - an edi 350 message is being processing and a v9 segment has been extracted with cargo found in the system and the cargo csa indicator is off:
    For AUTH-TO-DELIVER - Authorized to Deliver:
    When the v9 notice reason code indicates auth-to-deliver status (v9-02-auth-to-deliver is true), then the system logs the message 'edi 350: not accepted - non-csa' and processes associated us manifest records without updating the cargo record.
  • Context - an edi 350 message is being processed and a v9 segment table id has been identified in the message queue table entry:
    For Initialize V9 Segment:
    When the system begins processing the v9 segment, then the system initializes the v9 segment data structure to spaces or zeros.
  • Context - an edi 350 message is being processed and the v9 segment structure has been initialized and the current line in the message queue table contains a v9 segment:
    For Move MQS Table Entry to V9 Segment:
    When the system processes the v9 segment table entry, then the system moves the message queue table entry at the current line position to the v9 segment data structure.
  • Context - an edi 350 message is being processed and the v9 segment data has been extracted from the message queue table entry:
    For Set V9 Segment Found Flag:
    When the v9 segment extraction is complete, then the system sets the v9 segment found flag to true.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message is being processed and a V9 segment has been extracted from the message queue table entry
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted from the message queue table entry
Applied to: MATCHED - Document Matched
WHEN
The V9 notice reason code indicates MATCHED status (V9-02-MATCHED is true)
THEN
The system continues processing without updating cargo status or logging additional messages
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system
Applied to: NOT-MATCHED - Document Not Matched
WHEN
The V9 notice reason code indicates NOT-MATCHED status (V9-02-NOT-MATCHED is true)
THEN
The system logs the message 'EDI 350: DOC NOT MATCHED' to the cargo information log
Applied to: CARGO-COMPLETE - Cargo Complete
WHEN
The V9 notice reason code indicates CARGO-COMPLETE status (V9-02-CARGO-COMPLETE is true)
THEN
The system logs the message 'EDI 350: CARGO COMPLETE MESSAGE' to the cargo information log
Applied to: REPORTED - Cargo Reported
WHEN
The V9 notice reason code indicates REPORTED status (V9-02-REPORTED is true)
THEN
The system logs the message 'EDI 350: CARGO REPORTED' to the cargo information log
Applied to: HELD - Goods Held for Examination
WHEN
The V9 notice reason code indicates HELD status (V9-02-HELD is true)
THEN
The system logs the message 'EDI 350: GOODS HELD FOR EXAMINATION', sets cargo status to HOLD, replaces the cargo record in the database, and if the first 4 characters of the cargo CCN equal '6105' then prepares a Merlin hold notification containing equipment ID, waybill number, CCN, destination station name and state, and manifest upon station name, and sends the notification to the Merlin system
Applied to: Other - Invalid Notice Reason
WHEN
The V9 notice reason code does not match any of the recognized status codes (MATCHED, NOT-MATCHED, CARGO-COMPLETE, DOC-PKG-COMPLETE, DOC-NOT-ON-FILE, REPORTED, ARRIVED, RELEASED, AUTH-TO-DELIVER, HELD, or DECON)
THEN
The system logs the message 'EDI 350: INVALID NOTICE REASON CODE ' concatenated with the first 4 characters of the V9 notice reason code to the cargo information log
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains CBSA release reference ID
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains CBSA release reference ID
Applied to: DOC-PKG-COMPLETE - Document Package Complete
WHEN
The V9 notice reason code indicates DOC-PKG-COMPLETE status (V9-02-DOC-PKG-COMPLETE is true) and either the first 15 characters of X4 CBSA release reference ID do not match the broker entry OR the first 14 characters do not match the customs transaction number AND the X4 CBSA release reference ID is not spaces
THEN
The system updates the cargo broker entry with the first 15 characters of X4 CBSA release reference ID, updates the customs transaction number with the first 14 characters, sets the broker date to current machine date, sets the broker time to current machine time (first 4 digits), logs the message 'EDI 350: DOC PKG COMPLETE : ' concatenated with the first 15 characters of X4 CBSA release reference ID, and replaces the cargo record in the database
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains release document type code
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains release document type code
Applied to: DOC-NOT-ON-FILE - Document Not On File
WHEN
The V9 notice reason code indicates DOC-NOT-ON-FILE status (V9-02-DOC-NOT-ON-FILE is true) and the first character of X4 release document type code equals 'R'
THEN
The system logs the message 'EDI 350: DOC NOT ON FILE FOR RELEASE ' concatenated with the first 15 characters of X4 CBSA release reference ID to the cargo information log
Applied to: DOC-NOT-ON-FILE - Document Not On File
WHEN
The V9 notice reason code indicates DOC-NOT-ON-FILE status (V9-02-DOC-NOT-ON-FILE is true) and the first character of X4 release document type code does not equal 'R'
THEN
The system logs the message 'EDI 350:DOC NOT ON FILE H-BILL CLOSE ' concatenated with the first 25 characters of X4 CBSA release reference ID to the cargo information log
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and P4 segment contains port code
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and P4 segment contains port code
Applied to: ARRIVED - Cargo Arrived at Port
WHEN
The V9 notice reason code indicates ARRIVED status (V9-02-ARRIVED is true)
THEN
The system logs the message 'EDI 350: CARGO ARRIVED AT PORT ' concatenated with the first 4 characters of P4 port code to the cargo information log
Applied to: DECON - Deconsolidation Release
WHEN
The V9 notice reason code indicates DECON status (V9-02-DECON is true)
THEN
The system clears destination station numbers, sets release date to current machine date, sets release time to current machine time, sets release by to current user ID, sets current status to 'RELEASED', sets release status to 'R', sets release type to 'A', clears error or release status index, clears error status, sets release reason to 'DECONSOLIDATION AT ' concatenated with P4 port code (first 4 characters), logs the message 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with P4 port code (first 4 characters), processes associated US manifest records, replaces the cargo record in the database, and if the cargo is a master manifest then processes all follower manifests (up to 100) with the same release information
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains CBSA release reference ID and P4 segment contains port code
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and X4 segment contains CBSA release reference ID and P4 segment contains port code
Applied to: RELEASED - Cargo Released
WHEN
The V9 notice reason code indicates RELEASED status (V9-02-RELEASED is true)
THEN
The system clears destination station numbers, sets release date to current machine date, sets release time to current machine time, sets release by to current user ID, sets current status to 'RELEASED', sets release status to 'R', sets release type to 'A', clears error or release status index, clears error status, sets release reason to X4 CBSA release reference ID (first 15 characters) concatenated with '/' and P4 port code (first 4 characters), logs the message 'EDI 350: RELEASE : ' concatenated with X4 CBSA release reference ID (first 15 characters) and ' AT PORT ' and P4 port code (first 4 characters), processes associated US manifest records, replaces the cargo record in the database, and if the cargo is a master manifest then processes all follower manifests (up to 100) with the same release information
Context: An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and the cargo CSA indicator is ON
GIVEN
An EDI 350 message is being processed and a V9 segment has been extracted with cargo found in the system and the cargo CSA indicator is ON
Applied to: AUTH-TO-DELIVER - Authorized to Deliver
WHEN
The V9 notice reason code indicates AUTH-TO-DELIVER status (V9-02-AUTH-TO-DELIVER is true)
THEN
The system logs the message 'EDI 350: ACCEPTED - CSA', sets cargo status to CSA delivery, sets CSA authorization to deliver received flag to true, replaces the cargo record in the database, and processes associated US manifest records
Context: An EDI 350 message is being processing and a V9 segment has been extracted with cargo found in the system and the cargo CSA indicator is OFF
GIVEN
An EDI 350 message is being processing and a V9 segment has been extracted with cargo found in the system and the cargo CSA indicator is OFF
Applied to: AUTH-TO-DELIVER - Authorized to Deliver
WHEN
The V9 notice reason code indicates AUTH-TO-DELIVER status (V9-02-AUTH-TO-DELIVER is true)
THEN
The system logs the message 'EDI 350: NOT ACCEPTED - NON-CSA' and processes associated US manifest records without updating the cargo record
Context: An EDI 350 message is being processed and a V9 segment table ID has been identified in the message queue table entry
GIVEN
An EDI 350 message is being processed and a V9 segment table ID has been identified in the message queue table entry
Applied to: Initialize V9 Segment
WHEN
The system begins processing the V9 segment
THEN
The system initializes the V9 segment data structure to spaces or zeros
Context: An EDI 350 message is being processed and the V9 segment structure has been initialized and the current line in the message queue table contains a V9 segment
GIVEN
An EDI 350 message is being processed and the V9 segment structure has been initialized and the current line in the message queue table contains a V9 segment
Applied to: Move MQS Table Entry to V9 Segment
WHEN
The system processes the V9 segment table entry
THEN
The system moves the message queue table entry at the current line position to the V9 segment data structure
Context: An EDI 350 message is being processed and the V9 segment data has been extracted from the message queue table entry
GIVEN
An EDI 350 message is being processed and the V9 segment data has been extracted from the message queue table entry
Applied to: Set V9 Segment Found Flag
WHEN
The V9 segment extraction is complete
THEN
The system sets the V9 segment found flag to true
R-GCCTBIO-cbl-00097 (+11) File: GCCTBIO.cbl Execute Database Call Based on SSA Type Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Database Call Based on SSA Type':
  • Context - a database call request is received and the ssa flag is set to qualified-ssa:
    For Execute Database Call with Qualified SSA:
    When the system determines the ssa type for the database operation, then the system executes the database call using qualified ssa parameters.
  • Context - a database call request is received and the ssa flag is set to unqualified-ssa:
    For Execute Database Call with Unqualified SSA:
    When the system determines the ssa type for the database operation, then the system executes the database call using unqualified ssa parameters.
  • Context - a database call request is received and the ssa flag is set to no-ssa or neither qualified-ssa nor unqualified-ssa:
    For Execute Database Call with No SSA:
    When the system determines the ssa type for the database operation, then the system executes the database call without ssa parameters.
  • Context - the ssa flag is set to qualified ssa and the system is configured to use the secondary pcb:
    For Execute Database Call with Qualified SSA:
    When a database operation is requested for dependent segment access, then the system calls the database interface with the secondary pcb, user function code, segment data, and both qualified root and dependent ssa parameters.
  • Context - the ssa flag is set to unqualified ssa and the system is configured to use the secondary pcb:
    For Execute Database Call with Unqualified SSA:
    When a database operation is requested for dependent segment access, then the system calls the database interface with the secondary pcb, user function code, segment data, qualified root ssa, and unqualified dependent ssa parameters.
  • Context - the ssa flag indicates no ssa is required and the system is configured to use the secondary pcb:
    For Execute Database Call with No SSA:
    When a database operation is requested for dependent segment access, then the system calls the database interface with only the secondary pcb, user function code, and segment data parameters.
  • Context - a dependent segment access request is being processed using primary pcb and the ssa flag is set to qualified ssa:
    For Execute Database Call with Qualified SSA:
    When the system determines the ssa type for database call execution, then the system calls the database interface with both root segment qualified ssa and dependent segment qualified ssa parameters.
  • Context - a dependent segment access request is being processed using primary pcb and the ssa flag is set to unqualified ssa:
    For Execute Database Call with Unqualified SSA:
    When the system determines the ssa type for database call execution, then the system calls the database interface with root segment qualified ssa and dependent segment unqualified ssa parameters.
  • Context - a dependent segment access request is being processed using primary pcb and the ssa flag is set to no ssa:
    For Execute Database Call with No SSA:
    When the system determines the ssa type for database call execution, then the system calls the database interface without any ssa parameters, using only basic operation parameters.
  • Context - ssa type is qualified ssa and secondary pcb is being used for dependent segment access:
    For Execute Database Call with Qualified SSA:
    When database call is executed for dependent segment operation, then system calls cims with user function code, secondary pcb, segment data, root qualified ssa, and dependent qualified ssa.
  • Context - ssa type is unqualified ssa and secondary pcb is being used for dependent segment access:
    For Execute Database Call with Unqualified SSA:
    When database call is executed for dependent segment operation, then system calls cims with user function code, secondary pcb, segment data, root qualified ssa, and dependent unqualified ssa.
  • Context - ssa type requires no ssa parameters and secondary pcb is being used for dependent segment access:
    For Execute Database Call with No SSA:
    When database call is executed for dependent segment operation, then system calls cims with user function code, secondary pcb, and segment data only.
👨‍💻 Technical ACs (Gherkin)
Context: A database call request is received and the SSA flag is set to QUALIFIED-SSA
GIVEN
A database call request is received and the SSA flag is set to QUALIFIED-SSA
Applied to: Execute Database Call with Qualified SSA
WHEN
The system determines the SSA type for the database operation
THEN
The system executes the database call using qualified SSA parameters
Context: A database call request is received and the SSA flag is set to UNQUALIFIED-SSA
GIVEN
A database call request is received and the SSA flag is set to UNQUALIFIED-SSA
Applied to: Execute Database Call with Unqualified SSA
WHEN
The system determines the SSA type for the database operation
THEN
The system executes the database call using unqualified SSA parameters
Context: A database call request is received and the SSA flag is set to NO-SSA or neither QUALIFIED-SSA nor UNQUALIFIED-SSA
GIVEN
A database call request is received and the SSA flag is set to NO-SSA or neither QUALIFIED-SSA nor UNQUALIFIED-SSA
Applied to: Execute Database Call with No SSA
WHEN
The system determines the SSA type for the database operation
THEN
The system executes the database call without SSA parameters
Context: The SSA flag is set to qualified SSA and the system is configured to use the secondary PCB
GIVEN
The SSA flag is set to qualified SSA and the system is configured to use the secondary PCB
Applied to: Execute Database Call with Qualified SSA
WHEN
A database operation is requested for dependent segment access
THEN
The system calls the database interface with the secondary PCB, user function code, segment data, and both qualified root and dependent SSA parameters
Context: The SSA flag is set to unqualified SSA and the system is configured to use the secondary PCB
GIVEN
The SSA flag is set to unqualified SSA and the system is configured to use the secondary PCB
Applied to: Execute Database Call with Unqualified SSA
WHEN
A database operation is requested for dependent segment access
THEN
The system calls the database interface with the secondary PCB, user function code, segment data, qualified root SSA, and unqualified dependent SSA parameters
Context: The SSA flag indicates no SSA is required and the system is configured to use the secondary PCB
GIVEN
The SSA flag indicates no SSA is required and the system is configured to use the secondary PCB
Applied to: Execute Database Call with No SSA
WHEN
A database operation is requested for dependent segment access
THEN
The system calls the database interface with only the secondary PCB, user function code, and segment data parameters
Context: A dependent segment access request is being processed using primary PCB and the SSA flag is set to qualified SSA
GIVEN
A dependent segment access request is being processed using primary PCB and the SSA flag is set to qualified SSA
Applied to: Execute Database Call with Qualified SSA
WHEN
The system determines the SSA type for database call execution
THEN
The system calls the database interface with both root segment qualified SSA and dependent segment qualified SSA parameters
Context: A dependent segment access request is being processed using primary PCB and the SSA flag is set to unqualified SSA
GIVEN
A dependent segment access request is being processed using primary PCB and the SSA flag is set to unqualified SSA
Applied to: Execute Database Call with Unqualified SSA
WHEN
The system determines the SSA type for database call execution
THEN
The system calls the database interface with root segment qualified SSA and dependent segment unqualified SSA parameters
Context: A dependent segment access request is being processed using primary PCB and the SSA flag is set to no SSA
GIVEN
A dependent segment access request is being processed using primary PCB and the SSA flag is set to no SSA
Applied to: Execute Database Call with No SSA
WHEN
The system determines the SSA type for database call execution
THEN
The system calls the database interface without any SSA parameters, using only basic operation parameters
Context: SSA type is qualified SSA and secondary PCB is being used for dependent segment access
GIVEN
SSA type is qualified SSA and secondary PCB is being used for dependent segment access
Applied to: Execute Database Call with Qualified SSA
WHEN
database call is executed for dependent segment operation
THEN
system calls CIMS with user function code, secondary PCB, segment data, root qualified SSA, and dependent qualified SSA
Context: SSA type is unqualified SSA and secondary PCB is being used for dependent segment access
GIVEN
SSA type is unqualified SSA and secondary PCB is being used for dependent segment access
Applied to: Execute Database Call with Unqualified SSA
WHEN
database call is executed for dependent segment operation
THEN
system calls CIMS with user function code, secondary PCB, segment data, root qualified SSA, and dependent unqualified SSA
Context: SSA type requires no SSA parameters and secondary PCB is being used for dependent segment access
GIVEN
SSA type requires no SSA parameters and secondary PCB is being used for dependent segment access
Applied to: Execute Database Call with No SSA
WHEN
database call is executed for dependent segment operation
THEN
system calls CIMS with user function code, secondary PCB, and segment data only
R-GCCUSIO-cbl-00101 (+14) File: GCCUSIO.cbl Cargo Status Description Setting Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Description Setting':
  • Context - a cargo record exists with cp cargo status code indicating ok status:
    For Set Status Description to 'OK':
    When the system processes cargo status description setting, then the cargo status description field is set to 'ok'.
  • Context - a cargo record exists with cp cargo status code indicating pending status:
    For Set Status Description to 'PENDING':
    When the system processes cargo status description setting, then the cargo status description field is set to 'pending'.
  • Context - a cargo record exists with cp cargo status code indicating acknowledged status:
    For Set Status Description to 'ACKNOWLEDGED':
    When the system processes cargo status description setting, then the cargo status description field is set to 'ack'.
  • Context - a cargo record exists with cp cargo status code indicating error status:
    For Set Status Description to 'ERROR':
    When the system processes cargo status description setting, then the cargo status description field is set to 'error'.
  • Context - a cargo record exists with cp cargo status code indicating sent status:
    For Set Status Description to 'SENT':
    When the system processes cargo status description setting, then the cargo status description field is set to 'sent'.
  • Context - a cargo record exists with cp cargo status code indicating deleted status:
    For Set Status Description to 'DELETED':
    When the system processes cargo status description setting, then the cargo status description field is set to 'deleted'.
  • Context - a cargo record exists with cp cargo status code indicating delete pending status:
    For Set Status Description to 'DELETE PENDING':
    When the system processes cargo status description setting, then the cargo status description field is set to 'delpend'.
  • Context - a cargo record exists with cp cargo status code indicating released status:
    For Set Status Description to 'RELEASED':
    When the system processes cargo status description setting, then the cargo status description field is set to 'released'.
  • Context - a cargo record exists with cp cargo status code indicating arrival status:
    For Set Status Description to 'MANUAL ARRIVAL':
    When the system processes cargo status description setting, then the cargo status description field is set to 'mnl-arrv'.
  • Context - a cargo record exists with cp cargo status code indicating auto arrival status:
    For Set Status Description to 'AUTO ARRIVAL':
    When the system processes cargo status description setting, then the cargo status description field is set to 'aut-arrv'.
  • Context - a cargo record exists with cp cargo status code indicating export status:
    For Set Status Description to 'MANUAL EXPORT':
    When the system processes cargo status description setting, then the cargo status description field is set to 'mnl-exp'.
  • Context - a cargo record exists with cp cargo status code indicating auto export status:
    For Set Status Description to 'AUTO EXPORT':
    When the system processes cargo status description setting, then the cargo status description field is set to 'aut-exp'.
  • Context - a cargo record exists with cp cargo status code indicating immediate export status:
    For Set Status Description to 'IMMEDIATE EXPORT':
    When the system processes cargo status description setting, then the cargo status description field is set to 'imed-exp'.
  • Context - a cargo record exists with cp cargo status code indicating transferred status:
    For Set Status Description to 'TRANSFERRED':
    When the system processes cargo status description setting, then the cargo status description field is set to 'xfered'.
  • Context - a cargo record exists with cp cargo status code that does not match any predefined status values:
    For Use Original Status Code as Description:
    When the system processes cargo status description setting, then the cargo status description field is set to the original cp cargo status code value.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with CP cargo status code indicating OK status
GIVEN
A cargo record exists with CP cargo status code indicating OK status
Applied to: Set Status Description to 'OK'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'OK'
Context: A cargo record exists with CP cargo status code indicating PENDING status
GIVEN
A cargo record exists with CP cargo status code indicating PENDING status
Applied to: Set Status Description to 'PENDING'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'PENDING'
Context: A cargo record exists with CP cargo status code indicating ACKNOWLEDGED status
GIVEN
A cargo record exists with CP cargo status code indicating ACKNOWLEDGED status
Applied to: Set Status Description to 'ACKNOWLEDGED'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'ACK'
Context: A cargo record exists with CP cargo status code indicating ERROR status
GIVEN
A cargo record exists with CP cargo status code indicating ERROR status
Applied to: Set Status Description to 'ERROR'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'ERROR'
Context: A cargo record exists with CP cargo status code indicating SENT status
GIVEN
A cargo record exists with CP cargo status code indicating SENT status
Applied to: Set Status Description to 'SENT'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'SENT'
Context: A cargo record exists with CP cargo status code indicating DELETED status
GIVEN
A cargo record exists with CP cargo status code indicating DELETED status
Applied to: Set Status Description to 'DELETED'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'DELETED'
Context: A cargo record exists with CP cargo status code indicating DELETE PENDING status
GIVEN
A cargo record exists with CP cargo status code indicating DELETE PENDING status
Applied to: Set Status Description to 'DELETE PENDING'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'DELPEND'
Context: A cargo record exists with CP cargo status code indicating RELEASED status
GIVEN
A cargo record exists with CP cargo status code indicating RELEASED status
Applied to: Set Status Description to 'RELEASED'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'RELEASED'
Context: A cargo record exists with CP cargo status code indicating ARRIVAL status
GIVEN
A cargo record exists with CP cargo status code indicating ARRIVAL status
Applied to: Set Status Description to 'MANUAL ARRIVAL'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'MNL-ARRV'
Context: A cargo record exists with CP cargo status code indicating AUTO ARRIVAL status
GIVEN
A cargo record exists with CP cargo status code indicating AUTO ARRIVAL status
Applied to: Set Status Description to 'AUTO ARRIVAL'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'AUT-ARRV'
Context: A cargo record exists with CP cargo status code indicating EXPORT status
GIVEN
A cargo record exists with CP cargo status code indicating EXPORT status
Applied to: Set Status Description to 'MANUAL EXPORT'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'MNL-EXP'
Context: A cargo record exists with CP cargo status code indicating AUTO EXPORT status
GIVEN
A cargo record exists with CP cargo status code indicating AUTO EXPORT status
Applied to: Set Status Description to 'AUTO EXPORT'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'AUT-EXP'
Context: A cargo record exists with CP cargo status code indicating IMMEDIATE EXPORT status
GIVEN
A cargo record exists with CP cargo status code indicating IMMEDIATE EXPORT status
Applied to: Set Status Description to 'IMMEDIATE EXPORT'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'IMED-EXP'
Context: A cargo record exists with CP cargo status code indicating TRANSFERRED status
GIVEN
A cargo record exists with CP cargo status code indicating TRANSFERRED status
Applied to: Set Status Description to 'TRANSFERRED'
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to 'XFERED'
Context: A cargo record exists with CP cargo status code that does not match any predefined status values
GIVEN
A cargo record exists with CP cargo status code that does not match any predefined status values
Applied to: Use Original Status Code as Description
WHEN
The system processes cargo status description setting
THEN
The cargo status description field is set to the original CP cargo status code value
R-CIMS-cbl-00104 (+2) File: CIMS.cbl PCB Table Index Calculation Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Table Index Calculation':
  • Context - an address offset value exists from the difference between base and offset addresses:
    For PCB Table Index Calculation - Calculates table index for ISCOM to CCCOM PCB conversion based on address offset:
    When the system needs to determine the table index for pcb conversion, then add 8 to the address offset, divide the result by 12, and store as the table index.
  • Context - a table index has been calculated for pcb conversion and iscom pcb data exists:
    For Call CIMSCONV with Table Index:
    When the system needs to convert iscom pcb structure to cccom format, then call the cimsconv service with the iscom pcb data, pcb pointer, and calculated table index.
  • Context - the cimsconv service has successfully converted iscom pcb data and returned a pcb pointer:
    For Set PCB Address Area:
    When the conversion process is complete, then set the address area to point to the converted pcb pointer location.
👨‍💻 Technical ACs (Gherkin)
Context: An address offset value exists from the difference between base and offset addresses
GIVEN
An address offset value exists from the difference between base and offset addresses
Applied to: PCB Table Index Calculation - Calculates table index for ISCOM to CCCOM PCB conversion based on address offset
WHEN
The system needs to determine the table index for PCB conversion
THEN
Add 8 to the address offset, divide the result by 12, and store as the table index
Context: A table index has been calculated for PCB conversion and ISCOM PCB data exists
GIVEN
A table index has been calculated for PCB conversion and ISCOM PCB data exists
Applied to: Call CIMSCONV with Table Index
WHEN
The system needs to convert ISCOM PCB structure to CCCOM format
THEN
Call the CIMSCONV service with the ISCOM PCB data, PCB pointer, and calculated table index
Context: The CIMSCONV service has successfully converted ISCOM PCB data and returned a PCB pointer
GIVEN
The CIMSCONV service has successfully converted ISCOM PCB data and returned a PCB pointer
Applied to: Set PCB Address Area
WHEN
The conversion process is complete
THEN
Set the address area to point to the converted PCB pointer location
R-CIMS-cbl-00107 (+2) File: CIMS.cbl ISCOM PCB Conversion Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ISCOM PCB Conversion':
  • Context - an address offset value is available from iscom pcb processing:
    For Calculate Table Index from Address Offset:
    When the system needs to determine the table index for pcb conversion, then the table index is calculated by adding 8 to the address offset and dividing by 12.
  • Context - iscom pcb data exists and table index has been calculated:
    For Call CIMSCONV Utility with ISCOM PCB Parameters:
    When pcb format conversion is required from iscom to cccom, then the cimsconv utility is called with iscom pcb parameters and calculated table index to perform the conversion.
  • Context - cimsconv utility has successfully converted iscom pcb to cccom format:
    For Set Address Area to Converted PCB Pointer:
    When the conversion process is complete, then the address area is updated to point to the converted pcb pointer location.
👨‍💻 Technical ACs (Gherkin)
Context: An address offset value is available from ISCOM PCB processing
GIVEN
An address offset value is available from ISCOM PCB processing
Applied to: Calculate Table Index from Address Offset
WHEN
The system needs to determine the table index for PCB conversion
THEN
The table index is calculated by adding 8 to the address offset and dividing by 12
Context: ISCOM PCB data exists and table index has been calculated
GIVEN
ISCOM PCB data exists and table index has been calculated
Applied to: Call CIMSCONV Utility with ISCOM PCB Parameters
WHEN
PCB format conversion is required from ISCOM to CCCOM
THEN
The CIMSCONV utility is called with ISCOM PCB parameters and calculated table index to perform the conversion
Context: CIMSCONV utility has successfully converted ISCOM PCB to CCCOM format
GIVEN
CIMSCONV utility has successfully converted ISCOM PCB to CCCOM format
Applied to: Set Address Area to Converted PCB Pointer
WHEN
The conversion process is complete
THEN
The address area is updated to point to the converted PCB pointer location
R-CIMS-cbl-00110 File: CIMS.cbl Common Area Synchronization
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Common Area Synchronization':
  • Context - the system has both cccom and iscom control structures available and the iscom address is valid and not blank:
    For Copy Common Area Data from CCCOM to ISCOM:
    When the common area synchronization process is invoked, then the common area data from cccom is copied to iscom to ensure both structures contain identical shared information.
👨‍💻 Technical ACs (Gherkin)
Context: The system has both CCCOM and ISCOM control structures available and the ISCOM address is valid and not blank
GIVEN
The system has both CCCOM and ISCOM control structures available and the ISCOM address is valid and not blank
Applied to: Copy Common Area Data from CCCOM to ISCOM
WHEN
The common area synchronization process is invoked
THEN
The common area data from CCCOM is copied to ISCOM to ensure both structures contain identical shared information
R-CIMS-cbl-00111 (+1) File: CIMS.cbl PCB Name Normalization and Validation Merged 2 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Name Normalization and Validation':
  • Context - a pcb number value is provided:
    For PCB Number = '1'?:
    When the pcb number equals '1', then the pcb number should be converted to spaces.
  • Context - a pcb name is provided and database name table exists with entries:
    For PCB Name Matches Database Name in Table?:
    When the pcb name matches an entry in the database name table at position i, then the pcb address should be set to the corresponding pcb address from the table at position i.
👨‍💻 Technical ACs (Gherkin)
Context: A PCB number value is provided
GIVEN
A PCB number value is provided
Applied to: PCB Number = '1'?
WHEN
The PCB number equals '1'
THEN
The PCB number should be converted to spaces
Context: A PCB name is provided and database name table exists with entries
GIVEN
A PCB name is provided and database name table exists with entries
Applied to: PCB Name Matches Database Name in Table?
WHEN
The PCB name matches an entry in the database name table at position I
THEN
The PCB address should be set to the corresponding PCB address from the table at position I
R-CIMS-cbl-00113 (+3) File: CIMS.cbl PCB Table Search and Matching Logic Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'PCB Table Search and Matching Logic':
  • Context - a pcb number value is provided for table search:
    For PCB Number = '1'?:
    When the pcb number equals '1', then the pcb number should be cleared to spaces to standardize the search criteria.
  • Context - a pcb name and a database name table with multiple entries:
    For PCB Name Matches Table Entry?:
    When the pcb name matches a database name entry in the table at position i, then the system should retrieve the corresponding pcb address from the same table position.
  • Context - a matching pcb name has been found in the database name table at position i:
    For Set PCB Address from Table Entry:
    When the pcb name matches the table entry, then the pcb address should be set to the corresponding address value from the same table position.
  • Context - a pcb table search is in progress with current index i:
    For More Table Entries Available?:
    When the search has not found a matching pcb name and current index i is less than or equal to 249 and the database name at position i is not spaces, then the search should continue to the next table entry by incrementing the index.
👨‍💻 Technical ACs (Gherkin)
Context: A PCB number value is provided for table search
GIVEN
A PCB number value is provided for table search
Applied to: PCB Number = '1'?
WHEN
The PCB number equals '1'
THEN
The PCB number should be cleared to spaces to standardize the search criteria
Context: A PCB name and a database name table with multiple entries
GIVEN
A PCB name and a database name table with multiple entries
Applied to: PCB Name Matches Table Entry?
WHEN
The PCB name matches a database name entry in the table at position I
THEN
The system should retrieve the corresponding PCB address from the same table position
Context: A matching PCB name has been found in the database name table at position I
GIVEN
A matching PCB name has been found in the database name table at position I
Applied to: Set PCB Address from Table Entry
WHEN
The PCB name matches the table entry
THEN
The PCB address should be set to the corresponding address value from the same table position
Context: A PCB table search is in progress with current index I
GIVEN
A PCB table search is in progress with current index I
Applied to: More Table Entries Available?
WHEN
The search has not found a matching PCB name and current index I is less than or equal to 249 and the database name at position I is not spaces
THEN
The search should continue to the next table entry by incrementing the index
R-GCX126-cbl-00113 (+3) File: GCX126R.cbl Process K1 Remarks Segment Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process K1 Remarks Segment':
  • Context - an edi 350 message is being processed and a k1 segment entry is encountered in the message queue table at the current line position:
    For Process K1 Remarks Segment - Store up to 9 free-form message segments in array for later logging:
    When the k1 segment is identified and needs to be stored for later logging, then the system sets the k1 segment found indicator to true, initializes the k1 segment structure, copies the message queue table entry to the k1 segment structure, increments the k1 remark index counter by 1, and stores the k1 segment in the remark array at the current index position.
  • Context - the k1 remark index counter has been incremented after receiving a k1 segment:
    For Index Exceeds Maximum of 9?:
    When the k1 remark index counter exceeds the maximum allowed value of 9, then the system resets the k1 remark index counter to the maximum value of 9, preventing any additional remarks beyond the ninth position from being stored, and the current k1 segment overwrites the remark at position 9.
  • Context - the k1 remark index counter is within the valid range of 1 to 9 after incrementing:
    For Store K1 Segment in Remark Array at Current Index:
    When the k1 segment needs to be stored in the remark array, then the system stores the complete k1 segment structure in the remark array at the position indicated by the current k1 remark index counter value.
  • Context - a k1 segment is identified in the current message queue table entry:
    For Set K1 Segment Found Flag:
    When k1 segment processing begins, then the system sets the k1 segment found indicator flag to true to track that at least one k1 remark segment has been processed in the current transaction.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message is being processed and a K1 segment entry is encountered in the message queue table at the current line position
GIVEN
An EDI 350 message is being processed and a K1 segment entry is encountered in the message queue table at the current line position
Applied to: Process K1 Remarks Segment - Store up to 9 free-form message segments in array for later logging
WHEN
The K1 segment is identified and needs to be stored for later logging
THEN
The system sets the K1 segment found indicator to true, initializes the K1 segment structure, copies the message queue table entry to the K1 segment structure, increments the K1 remark index counter by 1, and stores the K1 segment in the remark array at the current index position
Context: The K1 remark index counter has been incremented after receiving a K1 segment
GIVEN
The K1 remark index counter has been incremented after receiving a K1 segment
Applied to: Index Exceeds Maximum of 9?
WHEN
The K1 remark index counter exceeds the maximum allowed value of 9
THEN
The system resets the K1 remark index counter to the maximum value of 9, preventing any additional remarks beyond the ninth position from being stored, and the current K1 segment overwrites the remark at position 9
Context: The K1 remark index counter is within the valid range of 1 to 9 after incrementing
GIVEN
The K1 remark index counter is within the valid range of 1 to 9 after incrementing
Applied to: Store K1 Segment in Remark Array at Current Index
WHEN
The K1 segment needs to be stored in the remark array
THEN
The system stores the complete K1 segment structure in the remark array at the position indicated by the current K1 remark index counter value
Context: A K1 segment is identified in the current message queue table entry
GIVEN
A K1 segment is identified in the current message queue table entry
Applied to: Set K1 Segment Found Flag
WHEN
K1 segment processing begins
THEN
The system sets the K1 segment found indicator flag to true to track that at least one K1 remark segment has been processed in the current transaction
R-GCCUSIO-cbl-00116 (+9) File: GCCUSIO.cbl Secondary Index Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Index Processing':
  • Context - a cargo search request with car id index type is received:
    For Search Car ID Index:
    When the system processes the car id index search, then the system sets the car id key value from the cargo record car id index field, applies the search operator, and executes the search using the car id secondary index.
  • Context - a cargo search request with waybill index type is received:
    For Search Waybill Index:
    When the system processes the waybill index search, then the system sets the waybill key value from the cargo record waybill index field, applies the search operator, and executes the search using the waybill secondary index.
  • Context - a cargo search request with car-waybill index type is received:
    For Car-Waybill Index Exists?:
    When the system checks if the car-waybill index field contains data, then if the car-waybill index field is not empty, the system uses qualified search with the index value, otherwise it uses unqualified search with empty key value.
  • Context - a cargo search request with bond index type is received:
    For Bond Index Exists?:
    When the system checks if the bond index field contains data, then if the bond index field is not empty, the system uses qualified search with the index value, otherwise it uses unqualified search with empty key value.
  • Context - a cargo search request with lead ccn index type is received:
    For Lead CCN Exists?:
    When the system checks if the lead manifest ccn field contains data, then if the lead manifest ccn field is not empty, the system uses qualified search with the ccn value, otherwise it uses unqualified search with empty key value.
  • Context - a cargo search request with held destination index type is received:
    For Search Held Destination Index:
    When the system processes the held destination index search, then the system retrieves the held destination index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key.
  • Context - a cargo search request with held border index type is received:
    For Search Held Border Index:
    When the system processes the held border index search, then the system retrieves the held border index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key.
  • Context - a cargo search request with error origin index type is received:
    For Search Error Origin Index:
    When the system processes the error origin index search, then the system retrieves the error origin index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key.
  • Context - a cargo search request with error border index type is received:
    For Search Error Border Index:
    When the system processes the error border index search, then the system retrieves the error border index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key.
  • Context - a cargo search request with error destination index type is received:
    For Search Error Destination Index:
    When the system processes the error destination index search, then the system retrieves the error destination index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo search request with car ID index type is received
GIVEN
A cargo search request with car ID index type is received
Applied to: Search Car ID Index
WHEN
The system processes the car ID index search
THEN
The system sets the car ID key value from the cargo record car ID index field, applies the search operator, and executes the search using the car ID secondary index
Context: A cargo search request with waybill index type is received
GIVEN
A cargo search request with waybill index type is received
Applied to: Search Waybill Index
WHEN
The system processes the waybill index search
THEN
The system sets the waybill key value from the cargo record waybill index field, applies the search operator, and executes the search using the waybill secondary index
Context: A cargo search request with car-waybill index type is received
GIVEN
A cargo search request with car-waybill index type is received
Applied to: Car-Waybill Index Exists?
WHEN
The system checks if the car-waybill index field contains data
THEN
If the car-waybill index field is not empty, the system uses qualified search with the index value, otherwise it uses unqualified search with empty key value
Context: A cargo search request with bond index type is received
GIVEN
A cargo search request with bond index type is received
Applied to: Bond Index Exists?
WHEN
The system checks if the bond index field contains data
THEN
If the bond index field is not empty, the system uses qualified search with the index value, otherwise it uses unqualified search with empty key value
Context: A cargo search request with lead CCN index type is received
GIVEN
A cargo search request with lead CCN index type is received
Applied to: Lead CCN Exists?
WHEN
The system checks if the lead manifest CCN field contains data
THEN
If the lead manifest CCN field is not empty, the system uses qualified search with the CCN value, otherwise it uses unqualified search with empty key value
Context: A cargo search request with held destination index type is received
GIVEN
A cargo search request with held destination index type is received
Applied to: Search Held Destination Index
WHEN
The system processes the held destination index search
THEN
The system retrieves the held destination index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key
Context: A cargo search request with held border index type is received
GIVEN
A cargo search request with held border index type is received
Applied to: Search Held Border Index
WHEN
The system processes the held border index search
THEN
The system retrieves the held border index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key
Context: A cargo search request with error origin index type is received
GIVEN
A cargo search request with error origin index type is received
Applied to: Search Error Origin Index
WHEN
The system processes the error origin index search
THEN
The system retrieves the error origin index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key
Context: A cargo search request with error border index type is received
GIVEN
A cargo search request with error border index type is received
Applied to: Search Error Border Index
WHEN
The system processes the error border index search
THEN
The system retrieves the error border index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key
Context: A cargo search request with error destination index type is received
GIVEN
A cargo search request with error destination index type is received
Applied to: Search Error Destination Index
WHEN
The system processes the error destination index search
THEN
The system retrieves the error destination index record using the search criteria, extracts the cargo key from the index record, and retrieves the corresponding primary cargo record using the extracted key
R-CIMS-cbl-00117 (+9) File: CIMS.cbl IMS Call Parameter Assembly and Validation Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'IMS Call Parameter Assembly and Validation':
  • Context - an ims database function code is provided in func parameter:
    For Set Function Parameter from FUNC:
    When the system processes the ims call parameters, then the function code is stored in cc-last-ims-func field of the common control area for tracking purposes.
  • Context - the argument count is 5 or greater:
    For Include SSA1 Parameter:
    When the system assembles ims call parameters, then ssa1 parameter is included in the call and stored in cc-last-ssa1 field of the common control area.
  • Context - the argument count is 6 or greater:
    For Include SSA2 Parameter:
    When the system assembles ims call parameters, then ssa2 parameter is included in the call and stored in cc-last-ssa2 field of the common control area.
  • Context - the argument count is 7 or greater:
    For Include SSA3 Parameter:
    When the system assembles ims call parameters, then ssa3 parameter is included in the call and stored in cc-last-ssa3 field of the common control area.
  • Context - the argument count is 8 or greater:
    For Include SSA4 Parameter:
    When the system assembles ims call parameters, then ssa4 parameter is included in the call and stored in cc-last-ssa4 field of the common control area.
  • Context - the argument count is 9 or greater:
    For Include SSA5 Parameter:
    When the system assembles ims call parameters, then ssa5 parameter is included in the call and stored in cc-last-ssa5 field of the common control area.
  • Context - the argument count is 10 or greater:
    For Include SSA6 Parameter:
    When the system assembles ims call parameters, then ssa6 parameter is included in the call and stored in cc-last-ssa6 field of the common control area.
  • Context - the total argument count has been determined:
    For Calculate Parameter Count:
    When the system prepares for ims call execution, then the parameter count is calculated by subtracting 1 from argument count and stored in cc-numb-of-args field.
  • Context - the system is preparing to execute an ims database call:
    For Initialize Status Code to '**':
    When all parameters have been assembled, then the status code is set to '**' in cc-status-code field to indicate call in progress.
  • Context - all ims call parameters have been validated and assembled:
    For Execute CBLTDLI Call:
    When the system executes the database operation, then the cbltdli program is called with the function, pcb, io area, and all applicable ssa parameters.
👨‍💻 Technical ACs (Gherkin)
Context: An IMS database function code is provided in FUNC parameter
GIVEN
An IMS database function code is provided in FUNC parameter
Applied to: Set Function Parameter from FUNC
WHEN
The system processes the IMS call parameters
THEN
The function code is stored in CC-LAST-IMS-FUNC field of the common control area for tracking purposes
Context: The argument count is 5 or greater
GIVEN
The argument count is 5 or greater
Applied to: Include SSA1 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA1 parameter is included in the call and stored in CC-LAST-SSA1 field of the common control area
Context: The argument count is 6 or greater
GIVEN
The argument count is 6 or greater
Applied to: Include SSA2 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA2 parameter is included in the call and stored in CC-LAST-SSA2 field of the common control area
Context: The argument count is 7 or greater
GIVEN
The argument count is 7 or greater
Applied to: Include SSA3 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA3 parameter is included in the call and stored in CC-LAST-SSA3 field of the common control area
Context: The argument count is 8 or greater
GIVEN
The argument count is 8 or greater
Applied to: Include SSA4 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA4 parameter is included in the call and stored in CC-LAST-SSA4 field of the common control area
Context: The argument count is 9 or greater
GIVEN
The argument count is 9 or greater
Applied to: Include SSA5 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA5 parameter is included in the call and stored in CC-LAST-SSA5 field of the common control area
Context: The argument count is 10 or greater
GIVEN
The argument count is 10 or greater
Applied to: Include SSA6 Parameter
WHEN
The system assembles IMS call parameters
THEN
SSA6 parameter is included in the call and stored in CC-LAST-SSA6 field of the common control area
Context: The total argument count has been determined
GIVEN
The total argument count has been determined
Applied to: Calculate Parameter Count
WHEN
The system prepares for IMS call execution
THEN
The parameter count is calculated by subtracting 1 from argument count and stored in CC-NUMB-OF-ARGS field
Context: The system is preparing to execute an IMS database call
GIVEN
The system is preparing to execute an IMS database call
Applied to: Initialize Status Code to '**'
WHEN
All parameters have been assembled
THEN
The status code is set to '**' in CC-STATUS-CODE field to indicate call in progress
Context: All IMS call parameters have been validated and assembled
GIVEN
All IMS call parameters have been validated and assembled
Applied to: Execute CBLTDLI Call
WHEN
The system executes the database operation
THEN
The CBLTDLI program is called with the function, PCB, IO area, and all applicable SSA parameters
R-GCX126-cbl-00117 (+7) File: GCX126R.cbl Process N7 Equipment Segment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process N7 Equipment Segment':
  • Context - an n7 segment is being processed from the edi 350 message queue:
    For Set N7 Segment Found Flag:
    When the n7 segment processing begins, then the system sets the n7 segment found indicator to true to track that equipment information is present in this transaction.
  • Context - an n7 segment is ready to be processed:
    For Initialize N7 Segment Structure:
    When the n7 segment found flag has been set, then the system initializes the n7 segment structure to spaces to clear any previous data.
  • Context - the n7 segment structure has been initialized:
    For Move MQ Table Entry to N7 Segment:
    When the current line in the message queue table contains an n7 segment, then the system moves the message queue table entry data to the n7 segment structure for further processing.
  • Context - the n7 segment data has been loaded into the working structure:
    For Equipment Number Present?:
    When the system evaluates the equipment number field in the n7 segment, then if the equipment number field contains spaces, skip equipment logging; otherwise, proceed to log the equipment number.
  • Context - the n7 segment contains a non-blank equipment number:
    For Store Equipment Number in Log Array:
    When the equipment number validation passes, then the system stores the equipment number value from the n7 segment into the log data array at the current log index position.
  • Context - the equipment number has been stored in the log data array:
    For Set Log Type as 'EDI 350 EQP#:':
    When the log entry is being prepared, then the system sets the log type field to 'edi 350 eqp#:' to identify this entry as equipment information from an edi 350 message.
  • Context - the equipment number and log type have been recorded in the log array:
    For Increment Log Index Counter:
    When the equipment logging is complete, then the system increments the log index counter by 1 to point to the next available log entry position.
  • Context - the n7 segment has been loaded and the equipment number field contains only spaces:
    For Skip Logging:
    When the equipment number validation determines the field is blank, then the system skips all equipment logging steps and proceeds to end the n7 segment processing.
👨‍💻 Technical ACs (Gherkin)
Context: An N7 segment is being processed from the EDI 350 message queue
GIVEN
An N7 segment is being processed from the EDI 350 message queue
Applied to: Set N7 Segment Found Flag
WHEN
The N7 segment processing begins
THEN
The system sets the N7 segment found indicator to TRUE to track that equipment information is present in this transaction
Context: An N7 segment is ready to be processed
GIVEN
An N7 segment is ready to be processed
Applied to: Initialize N7 Segment Structure
WHEN
The N7 segment found flag has been set
THEN
The system initializes the N7 segment structure to spaces to clear any previous data
Context: The N7 segment structure has been initialized
GIVEN
The N7 segment structure has been initialized
Applied to: Move MQ Table Entry to N7 Segment
WHEN
The current line in the message queue table contains an N7 segment
THEN
The system moves the message queue table entry data to the N7 segment structure for further processing
Context: The N7 segment data has been loaded into the working structure
GIVEN
The N7 segment data has been loaded into the working structure
Applied to: Equipment Number Present?
WHEN
The system evaluates the equipment number field in the N7 segment
THEN
If the equipment number field contains spaces, skip equipment logging; otherwise, proceed to log the equipment number
Context: The N7 segment contains a non-blank equipment number
GIVEN
The N7 segment contains a non-blank equipment number
Applied to: Store Equipment Number in Log Array
WHEN
The equipment number validation passes
THEN
The system stores the equipment number value from the N7 segment into the log data array at the current log index position
Context: The equipment number has been stored in the log data array
GIVEN
The equipment number has been stored in the log data array
Applied to: Set Log Type as 'EDI 350 EQP#:'
WHEN
The log entry is being prepared
THEN
The system sets the log type field to 'EDI 350 EQP#:' to identify this entry as equipment information from an EDI 350 message
Context: The equipment number and log type have been recorded in the log array
GIVEN
The equipment number and log type have been recorded in the log array
Applied to: Increment Log Index Counter
WHEN
The equipment logging is complete
THEN
The system increments the log index counter by 1 to point to the next available log entry position
Context: The N7 segment has been loaded and the equipment number field contains only spaces
GIVEN
The N7 segment has been loaded and the equipment number field contains only spaces
Applied to: Skip Logging
WHEN
The equipment number validation determines the field is blank
THEN
The system skips all equipment logging steps and proceeds to end the N7 segment processing
R-GCX126-cbl-00125 (+10) File: GCX126R.cbl Process Conveyance 350 Train Arrival Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Conveyance 350 Train Arrival':
  • Context - an x4 segment is being processed from the edi 350 message:
    For Is X4 Segment Entry Type = '992' AND Conveyance 350?:
    When the x4-03-entry-typ-cde equals '992' and the message type indicator ws-conv-350 is true, then proceed with train arrival processing for conveyance 350.
  • Context - a conveyance 350 message with entry type '992' is being processed and a train id exists in x4-04-rel-doc-id (first 25 characters):
    For Is Train ID Same as Previous?:
    When the first 25 characters of x4-04-rel-doc-id equal the value stored in ws-prev-crn, then skip processing and continue to the next segment without any updates.
  • Context - a conveyance 350 message with entry type '992' is being processed and the train id is different from the previous one:
    For Extract Train ID from X4-04-REL-DOC-ID First 25 Characters:
    When the first 25 characters of x4-04-rel-doc-id are extracted, then store the extracted train id in b4-key-value for database lookup and store in ws-prev-crn for duplicate checking.
  • Context - a train id has been extracted from x4-04-rel-doc-id (first 25 characters) and stored in b4-key-value:
    For Verify Train Exists in System Database:
    When the system performs a database lookup using the train id, then return the train record if found or return a not-found status code in cc-status-code.
  • Context - a train id from x4-04-rel-doc-id (first 25 characters) has been looked up in the database and the train was not found (cc-status-code is not spaces):
    For Prepare Error Report: 'UNKNOWN TRAIN ENTRY IN EDI 350' Include Train ID 'THIS CRN WAS NOT FOUND':
    When the train verification fails, then prepare error report with message 'unknown train entry in edi 350' concatenated with the train id in mrln-dtl-line(01) and add message 'this crn was not found.' in mrln-dtl-line(03) and set mrln-line to 4 and set message type indicator to unknown (88-z110-mrln-type-is-unknown).
  • Context - an error report has been prepared for an unknown train entry with message type set to unknown:
    For Send Error Report to Merlin:
    When the error notification is ready to be sent, then invoke the merlin notification preparation process (z110-prep-emcsend) to send the error report.
  • Context - a train has been successfully verified in the system database (cc-status-code equals spaces) and the train id is available from x4-04-rel-doc-id (first 25 characters):
    For Log Arrival Acknowledgment: Date: Current Machine Date, Time: Current Machine Time, Action Code: 'ZZZ', Train ID: From X4 Segment, Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the arrival acknowledgment needs to be logged, then move log information to gcx105 structure and set gcx105-date to current machine century and date (cc-machine-century concatenated with cc-machine-date-x) and set gcx105-time to current machine time (cc-machine-time-x) and set gcx105-action-code to 'zzz' and set gcx105-train-or-us-ccn to the train id from x4-04-rel-doc-id (first 25 characters) and set gcx105-ca-train indicator to true and set gcx105-message to '350 ack - arrival ack at border'.
  • Context - the arrival acknowledgment log information has been prepared in the gcx105 structure with all required fields populated:
    For Spawn GCT1051E Transaction to Create Log Entry:
    When the log entry is ready to be persisted, then invoke the z300-spawn-gct1051e process to create the log entry in the system.
  • Context - a train arrival has been logged successfully and the cargo control number is available in x4-01-cbsa-rel-ref-id (first 25 characters):
    For Update Cargo Border Arrival Status:
    When the cargo border arrival status needs to be updated, then set key-value of ccrt-ssaq to x4-01-cbsa-rel-ref-id (first 25 characters) and set key-value of a2rt-ssaq to x4-01-cbsa-rel-ref-id (first 25 characters) and perform a351-update-cargo-border process to retrieve cargo, set border arrival acknowledgment flag, and replace the cargo record.
  • Context - a cargo record has been retrieved and updated with border arrival acknowledgment:
    For Is Master Manifest?:
    When the system checks the manifest type, then if gccc-master-mfst indicator is true, proceed to update follower manifests, otherwise continue to next segment.
  • Context - the current cargo is a master manifest (gccc-master-mfst is true) and the master manifest ccn is available in gccc-ccn-key:
    For Update Border Arrival for All Follower Manifests Up to 100 Followers:
    When follower manifests need to be updated with border arrival status, then set gcb0rt-ccn-key to the master manifest ccn and initialize follower manifest array (ws-follower-mani-array) to spaces and set ws-follower-not-end-of-db indicator and set counter i to 1 and perform loop until ws-follower-end-of-db or i exceeds 100: retrieve next cargo record using gn function with ccrt-b0rt-ssaq, if status is blank and master manifest ccn matches x4-01-cbsa-rel-ref-id (first 25 characters) and cargo is a follower manifest, store follower ccn in ws-follower-mani(i) and increment i, otherwise set ws-follower-end-of-db and after loop, subtract 1 from i and if i is greater than 0, perform loop varying j from 1 to i: set key-value of ccrt-ssaq and a2rt-ssaq to ws-follower-mani(j) and perform a351-update-cargo-border to update each follower manifest.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed from the EDI 350 message
GIVEN
An X4 segment is being processed from the EDI 350 message
Applied to: Is X4 Segment Entry Type = '992' AND Conveyance 350?
WHEN
The X4-03-ENTRY-TYP-CDE equals '992' AND the message type indicator WS-CONV-350 is true
THEN
Proceed with train arrival processing for conveyance 350
Context: A conveyance 350 message with entry type '992' is being processed AND a train ID exists in X4-04-REL-DOC-ID (first 25 characters)
GIVEN
A conveyance 350 message with entry type '992' is being processed AND a train ID exists in X4-04-REL-DOC-ID (first 25 characters)
Applied to: Is Train ID Same as Previous?
WHEN
The first 25 characters of X4-04-REL-DOC-ID equal the value stored in WS-PREV-CRN
THEN
Skip processing and continue to the next segment without any updates
Context: A conveyance 350 message with entry type '992' is being processed AND the train ID is different from the previous one
GIVEN
A conveyance 350 message with entry type '992' is being processed AND the train ID is different from the previous one
Applied to: Extract Train ID from X4-04-REL-DOC-ID First 25 Characters
WHEN
The first 25 characters of X4-04-REL-DOC-ID are extracted
THEN
Store the extracted train ID in B4-KEY-VALUE for database lookup AND store in WS-PREV-CRN for duplicate checking
Context: A train ID has been extracted from X4-04-REL-DOC-ID (first 25 characters) AND stored in B4-KEY-VALUE
GIVEN
A train ID has been extracted from X4-04-REL-DOC-ID (first 25 characters) AND stored in B4-KEY-VALUE
Applied to: Verify Train Exists in System Database
WHEN
The system performs a database lookup using the train ID
THEN
Return the train record if found OR return a not-found status code in CC-STATUS-CODE
Context: A train ID from X4-04-REL-DOC-ID (first 25 characters) has been looked up in the database AND the train was not found (CC-STATUS-CODE is not SPACES)
GIVEN
A train ID from X4-04-REL-DOC-ID (first 25 characters) has been looked up in the database AND the train was not found (CC-STATUS-CODE is not SPACES)
Applied to: Prepare Error Report: 'UNKNOWN TRAIN ENTRY IN EDI 350' Include Train ID 'THIS CRN WAS NOT FOUND'
WHEN
The train verification fails
THEN
Prepare error report with message 'UNKNOWN TRAIN ENTRY IN EDI 350' concatenated with the train ID in MRLN-DTL-LINE(01) AND add message 'THIS CRN WAS NOT FOUND.' in MRLN-DTL-LINE(03) AND set MRLN-LINE to 4 AND set message type indicator to unknown (88-Z110-MRLN-TYPE-IS-UNKNOWN)
Context: An error report has been prepared for an unknown train entry with message type set to unknown
GIVEN
An error report has been prepared for an unknown train entry with message type set to unknown
Applied to: Send Error Report to Merlin
WHEN
The error notification is ready to be sent
THEN
Invoke the Merlin notification preparation process (Z110-PREP-EMCSEND) to send the error report
Context: A train has been successfully verified in the system database (CC-STATUS-CODE equals SPACES) AND the train ID is available from X4-04-REL-DOC-ID (first 25 characters)
GIVEN
A train has been successfully verified in the system database (CC-STATUS-CODE equals SPACES) AND the train ID is available from X4-04-REL-DOC-ID (first 25 characters)
Applied to: Log Arrival Acknowledgment: Date: Current Machine Date, Time: Current Machine Time, Action Code: 'ZZZ', Train ID: From X4 Segment, Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The arrival acknowledgment needs to be logged
THEN
Move log information to GCX105 structure AND set GCX105-DATE to current machine century and date (CC-MACHINE-CENTURY concatenated with CC-MACHINE-DATE-X) AND set GCX105-TIME to current machine time (CC-MACHINE-TIME-X) AND set GCX105-ACTION-CODE to 'ZZZ' AND set GCX105-TRAIN-OR-US-CCN to the train ID from X4-04-REL-DOC-ID (first 25 characters) AND set GCX105-CA-TRAIN indicator to true AND set GCX105-MESSAGE to '350 ACK - ARRIVAL ACK AT BORDER'
Context: The arrival acknowledgment log information has been prepared in the GCX105 structure with all required fields populated
GIVEN
The arrival acknowledgment log information has been prepared in the GCX105 structure with all required fields populated
Applied to: Spawn GCT1051E Transaction to Create Log Entry
WHEN
The log entry is ready to be persisted
THEN
Invoke the Z300-SPAWN-GCT1051E process to create the log entry in the system
Context: A train arrival has been logged successfully AND the cargo control number is available in X4-01-CBSA-REL-REF-ID (first 25 characters)
GIVEN
A train arrival has been logged successfully AND the cargo control number is available in X4-01-CBSA-REL-REF-ID (first 25 characters)
Applied to: Update Cargo Border Arrival Status
WHEN
The cargo border arrival status needs to be updated
THEN
Set KEY-VALUE of CCRT-SSAQ to X4-01-CBSA-REL-REF-ID (first 25 characters) AND set KEY-VALUE of A2RT-SSAQ to X4-01-CBSA-REL-REF-ID (first 25 characters) AND perform A351-UPDATE-CARGO-BORDER process to retrieve cargo, set border arrival acknowledgment flag, and replace the cargo record
Context: A cargo record has been retrieved and updated with border arrival acknowledgment
GIVEN
A cargo record has been retrieved and updated with border arrival acknowledgment
Applied to: Is Master Manifest?
WHEN
The system checks the manifest type
THEN
If GCCC-MASTER-MFST indicator is true, proceed to update follower manifests, otherwise continue to next segment
Context: The current cargo is a master manifest (GCCC-MASTER-MFST is true) AND the master manifest CCN is available in GCCC-CCN-KEY
GIVEN
The current cargo is a master manifest (GCCC-MASTER-MFST is true) AND the master manifest CCN is available in GCCC-CCN-KEY
Applied to: Update Border Arrival for All Follower Manifests Up to 100 Followers
WHEN
Follower manifests need to be updated with border arrival status
THEN
Set GCB0RT-CCN-KEY to the master manifest CCN AND initialize follower manifest array (WS-FOLLOWER-MANI-ARRAY) to spaces AND set WS-FOLLOWER-NOT-END-OF-DB indicator AND set counter I to 1 AND perform loop until WS-FOLLOWER-END-OF-DB or I exceeds 100: retrieve next cargo record using GN function with CCRT-B0RT-SSAQ, if status is blank AND master manifest CCN matches X4-01-CBSA-REL-REF-ID (first 25 characters) AND cargo is a follower manifest, store follower CCN in WS-FOLLOWER-MANI(I) and increment I, otherwise set WS-FOLLOWER-END-OF-DB AND after loop, subtract 1 from I AND if I is greater than 0, perform loop varying J from 1 to I: set KEY-VALUE of CCRT-SSAQ and A2RT-SSAQ to WS-FOLLOWER-MANI(J) AND perform A351-UPDATE-CARGO-BORDER to update each follower manifest
R-GCCUSIO-cbl-00126 (+15) File: GCCUSIO.cbl Error Index Management Merged 16 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Index Management':
  • Context - a cargo record with status indicators:
    For Cargo Has Error Status?:
    When the system checks for error conditions, then error index management is triggered if cargo has cpcargo-error, cpcargo-pending, or uscargo-error status.
  • Context - a cargo record with error status:
    For Populate Origin Error Index:
    When the system processes error index fields, then origin error index is populated with error code 'e', origin station number, and cargo ccn key.
    For Populate Destination Error Index:
    When the system processes destination error index, then destination error index is populated with error code 'e', destination station number, and cargo ccn key.
  • Context - a cargo record requiring border error index and location id:
    For Get Border Station from MC Table:
    When the system looks up border station information, then mc table is queried using location id to retrieve border station number.
  • Context - a cargo record with error status and successful border station lookup:
    For Populate Border Error Index:
    When the system processes border error index, then border error index is populated with error code 'e', border station number from mc table, and cargo ccn key.
  • Context - error index fields populated for a cargo record:
    For GCSB1RT Index Record Exists?:
    When the system checks for existing gcsb1rt index record, then existing record is updated if found, otherwise new record is created.
  • Context - a cargo record with error status and no existing gcsb1rt record:
    For Create New Index Record:
    When the system processes error index record creation, then new gcsb1rt record is inserted with populated error index fields.
  • Context - a cargo record with error status and existing gcsb1rt record:
    For Update Existing Index Record:
    When the system processes error index record update, then existing gcsb1rt record is updated with current error index fields.
  • Context - a cargo record without error status but with existing error index fields:
    For Remove Error Index Fields:
    When the system processes error index cleanup, then error origin, destination, and border index fields are cleared to spaces.
  • Context - a gcsb1rt record with error fields cleared:
    For All Error Fields Empty?:
    When the system checks if all error and hold fields are empty, then record is deleted if all fields are empty, otherwise record is updated.
  • Context - a gcsb1rt record with all error and hold index fields empty:
    For Delete Index Record:
    When the system processes index record cleanup, then gcsb1rt record is deleted from the database.
  • Context - a gcsb1rt record with some error fields cleared but hold fields still populated:
    For Update Index Record:
    When the system processes partial index cleanup, then gcsb1rt record is updated with remaining non-empty index fields.
  • Context - a search request for origin error index:
    For Search Origin Error Index:
    When the system processes origin error search, then gcsb1rt is queried using origin error station and cargo key to find matching records.
  • Context - a search request for border error index:
    For Search Border Error Index:
    When the system processes border error search, then gcsb1rt is queried using border error station and cargo key to find matching records.
  • Context - a search request for destination error index:
    For Search Destination Error Index:
    When the system processes destination error search, then gcsb1rt is queried using destination error station and cargo key to find matching records.
  • Context - successful error index search results from gcsb1rt:
    For Retrieve Matching Cargo Records:
    When the system processes search results, then primary cargo records are retrieved from gcsusrt using cargo keys found in index search.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with status indicators
GIVEN
A cargo record with status indicators
Applied to: Cargo Has Error Status?
WHEN
The system checks for error conditions
THEN
Error index management is triggered if cargo has CPCARGO-ERROR, CPCARGO-PENDING, or USCARGO-ERROR status
Context: A cargo record with error status
GIVEN
A cargo record with error status
Applied to: Populate Origin Error Index
WHEN
The system processes error index fields
THEN
Origin error index is populated with error code 'E', origin station number, and cargo CCN key
Applied to: Populate Destination Error Index
WHEN
The system processes destination error index
THEN
Destination error index is populated with error code 'E', destination station number, and cargo CCN key
Context: A cargo record requiring border error index and location ID
GIVEN
A cargo record requiring border error index and location ID
Applied to: Get Border Station from MC Table
WHEN
The system looks up border station information
THEN
MC table is queried using location ID to retrieve border station number
Context: A cargo record with error status and successful border station lookup
GIVEN
A cargo record with error status and successful border station lookup
Applied to: Populate Border Error Index
WHEN
The system processes border error index
THEN
Border error index is populated with error code 'E', border station number from MC table, and cargo CCN key
Context: Error index fields populated for a cargo record
GIVEN
Error index fields populated for a cargo record
Applied to: GCSB1RT Index Record Exists?
WHEN
The system checks for existing GCSB1RT index record
THEN
Existing record is updated if found, otherwise new record is created
Context: A cargo record with error status and no existing GCSB1RT record
GIVEN
A cargo record with error status and no existing GCSB1RT record
Applied to: Create New Index Record
WHEN
The system processes error index record creation
THEN
New GCSB1RT record is inserted with populated error index fields
Context: A cargo record with error status and existing GCSB1RT record
GIVEN
A cargo record with error status and existing GCSB1RT record
Applied to: Update Existing Index Record
WHEN
The system processes error index record update
THEN
Existing GCSB1RT record is updated with current error index fields
Context: A cargo record without error status but with existing error index fields
GIVEN
A cargo record without error status but with existing error index fields
Applied to: Remove Error Index Fields
WHEN
The system processes error index cleanup
THEN
Error origin, destination, and border index fields are cleared to spaces
Context: A GCSB1RT record with error fields cleared
GIVEN
A GCSB1RT record with error fields cleared
Applied to: All Error Fields Empty?
WHEN
The system checks if all error and hold fields are empty
THEN
Record is deleted if all fields are empty, otherwise record is updated
Context: A GCSB1RT record with all error and hold index fields empty
GIVEN
A GCSB1RT record with all error and hold index fields empty
Applied to: Delete Index Record
WHEN
The system processes index record cleanup
THEN
GCSB1RT record is deleted from the database
Context: A GCSB1RT record with some error fields cleared but hold fields still populated
GIVEN
A GCSB1RT record with some error fields cleared but hold fields still populated
Applied to: Update Index Record
WHEN
The system processes partial index cleanup
THEN
GCSB1RT record is updated with remaining non-empty index fields
Context: A search request for origin error index
GIVEN
A search request for origin error index
Applied to: Search Origin Error Index
WHEN
The system processes origin error search
THEN
GCSB1RT is queried using origin error station and cargo key to find matching records
Context: A search request for border error index
GIVEN
A search request for border error index
Applied to: Search Border Error Index
WHEN
The system processes border error search
THEN
GCSB1RT is queried using border error station and cargo key to find matching records
Context: A search request for destination error index
GIVEN
A search request for destination error index
Applied to: Search Destination Error Index
WHEN
The system processes destination error search
THEN
GCSB1RT is queried using destination error station and cargo key to find matching records
Context: Successful error index search results from GCSB1RT
GIVEN
Successful error index search results from GCSB1RT
Applied to: Retrieve Matching Cargo Records
WHEN
The system processes search results
THEN
Primary cargo records are retrieved from GCSUSRT using cargo keys found in index search
R-CIMS-cbl-00127 (+3) File: CIMS.cbl Acceptable Status Code Table Lookup Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Acceptable Status Code Table Lookup':
  • Context - a database operation has completed and returned a status code, and there exists a table of acceptable status codes with up to 12 entries:
    For Acceptable Status Code Table Lookup - Searches through the acceptable status code table to validate IMS return codes:
    When the system performs status code validation by iterating through the acceptable status code table, then if the status code matches any entry in the acceptable status table, the operation is considered valid and processing continues with common area updates, otherwise the status code is deemed unacceptable.
  • Context - a status code from a database operation and a specific entry from the acceptable status code table at index position i:
    For Current Status Code = Table Entry?:
    When the system compares the current status code with the table entry at the current index, then if the status code equals the table entry, the status is validated as acceptable and common area updates are performed, otherwise the comparison continues with the next table entry.
  • Context - the system is iterating through the acceptable status code table with a current index value i:
    For Index I > 12?:
    When the system checks if the current index i exceeds the maximum table size of 12 entries, then if the index is greater than 12, all table entries have been checked and the status code is considered unacceptable, otherwise the iteration continues to the next table entry.
  • Context - a database operation status code that has been compared against all entries in the acceptable status code table without finding a match:
    For All Table Entries Checked - Invalid Status:
    When all 12 entries in the acceptable status code table have been checked and no match was found, then an error message is constructed containing the status code and the text 'ims rc code not in acceptable list' and error processing is invoked.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation has completed and returned a status code, and there exists a table of acceptable status codes with up to 12 entries
GIVEN
A database operation has completed and returned a status code, and there exists a table of acceptable status codes with up to 12 entries
Applied to: Acceptable Status Code Table Lookup - Searches through the acceptable status code table to validate IMS return codes
WHEN
The system performs status code validation by iterating through the acceptable status code table
THEN
If the status code matches any entry in the acceptable status table, the operation is considered valid and processing continues with common area updates, otherwise the status code is deemed unacceptable
Context: A status code from a database operation and a specific entry from the acceptable status code table at index position I
GIVEN
A status code from a database operation and a specific entry from the acceptable status code table at index position I
Applied to: Current Status Code = Table Entry?
WHEN
The system compares the current status code with the table entry at the current index
THEN
If the status code equals the table entry, the status is validated as acceptable and common area updates are performed, otherwise the comparison continues with the next table entry
Context: The system is iterating through the acceptable status code table with a current index value I
GIVEN
The system is iterating through the acceptable status code table with a current index value I
Applied to: Index I > 12?
WHEN
The system checks if the current index I exceeds the maximum table size of 12 entries
THEN
If the index is greater than 12, all table entries have been checked and the status code is considered unacceptable, otherwise the iteration continues to the next table entry
Context: A database operation status code that has been compared against all entries in the acceptable status code table without finding a match
GIVEN
A database operation status code that has been compared against all entries in the acceptable status code table without finding a match
Applied to: All Table Entries Checked - Invalid Status
WHEN
All 12 entries in the acceptable status code table have been checked and no match was found
THEN
An error message is constructed containing the status code and the text 'IMS RC CODE NOT IN ACCEPTABLE LIST' and error processing is invoked
R-CIMS-cbl-00131 (+3) File: CIMS.cbl Address Offset Calculation Logic Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Address Offset Calculation Logic':
  • Context - base address is set to cccom db-pcbs address and offset address is set to addr-area address:
    For Base Address > Zero?:
    When base address value is greater than zero, then address-1 is set to offset address value and address-2 is set to base address value.
    For Set Address-1 = Base Address Set Address-2 = Offset Address:
    When base address value is not greater than zero, then address-1 is set to base address value and address-2 is set to offset address value.
  • Context - address-1 and address-2 values have been determined based on base address evaluation:
    For Calculate Final Offset Offset = Address-1 - Address-2:
    When final offset calculation is performed, then address offset equals address-1 minus address-2.
  • Context - cccom and iscom structures are available:
    For Calculate CIMS Table Size:
    When cims table size calculation is required, then table size is set to the length of cc-db-pcbs structure in iscom.
👨‍💻 Technical ACs (Gherkin)
Context: Base address is set to CCCOM DB-PCBS address and offset address is set to ADDR-AREA address
GIVEN
Base address is set to CCCOM DB-PCBS address and offset address is set to ADDR-AREA address
Applied to: Base Address > Zero?
WHEN
Base address value is greater than zero
THEN
Address-1 is set to offset address value and Address-2 is set to base address value
Applied to: Set Address-1 = Base Address Set Address-2 = Offset Address
WHEN
Base address value is not greater than zero
THEN
Address-1 is set to base address value and Address-2 is set to offset address value
Context: Address-1 and Address-2 values have been determined based on base address evaluation
GIVEN
Address-1 and Address-2 values have been determined based on base address evaluation
Applied to: Calculate Final Offset Offset = Address-1 - Address-2
WHEN
Final offset calculation is performed
THEN
Address offset equals Address-1 minus Address-2
Context: CCCOM and ISCOM structures are available
GIVEN
CCCOM and ISCOM structures are available
Applied to: Calculate CIMS Table Size
WHEN
CIMS table size calculation is required
THEN
Table size is set to the length of CC-DB-PCBS structure in ISCOM
R-CIMS-cbl-00135 (+5) File: CIMS.cbl ISCOM Range Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ISCOM Range Validation':
  • Context - the cccom structure contains pcb control block information:
    For Get CCCOM PCB Base Address:
    When the system needs to validate iscom table range, then the base address of cc-db-pcbs is retrieved and stored for address calculation.
  • Context - the address area contains valid offset information:
    For Get Address Area Offset Address:
    When the system performs iscom range validation, then the offset address is retrieved and stored for comparison with the base address.
  • Context - the iscom structure cc-db-pcbs is available:
    For Calculate ISCOM Table Size:
    When the system needs to validate address offset ranges, then the table size is calculated using the length of cc-db-pcbs and stored in ws-cims-table-size.
  • Context - base address and offset address are available for calculation:
    For Base Address > Zero?:
    When the base address is greater than zero, then address 1 is set to offset address and address 2 is set to base address, otherwise address 1 is set to base address and address 2 is set to offset address.
  • Context - address 1 and address 2 are properly ordered based on base address sign:
    For Calculate Final Address Offset:
    When the system calculates the final offset, then the address offset is computed as address 1 minus address 2 and stored in ws-addr-offset.
  • Context - the address offset has been calculated and iscom table size is known:
    For Offset Within ISCOM Table Range?:
    When the system validates the offset against table boundaries, then if the offset is within the valid iscom table range, iscom conversion processing is initiated, otherwise standard pcb processing is used.
👨‍💻 Technical ACs (Gherkin)
Context: The CCCOM structure contains PCB control block information
GIVEN
The CCCOM structure contains PCB control block information
Applied to: Get CCCOM PCB Base Address
WHEN
The system needs to validate ISCOM table range
THEN
The base address of CC-DB-PCBS is retrieved and stored for address calculation
Context: The address area contains valid offset information
GIVEN
The address area contains valid offset information
Applied to: Get Address Area Offset Address
WHEN
The system performs ISCOM range validation
THEN
The offset address is retrieved and stored for comparison with the base address
Context: The ISCOM structure CC-DB-PCBS is available
GIVEN
The ISCOM structure CC-DB-PCBS is available
Applied to: Calculate ISCOM Table Size
WHEN
The system needs to validate address offset ranges
THEN
The table size is calculated using the length of CC-DB-PCBS and stored in WS-CIMS-TABLE-SIZE
Context: Base address and offset address are available for calculation
GIVEN
Base address and offset address are available for calculation
Applied to: Base Address > Zero?
WHEN
The base address is greater than zero
THEN
Address 1 is set to offset address and Address 2 is set to base address, otherwise Address 1 is set to base address and Address 2 is set to offset address
Context: Address 1 and Address 2 are properly ordered based on base address sign
GIVEN
Address 1 and Address 2 are properly ordered based on base address sign
Applied to: Calculate Final Address Offset
WHEN
The system calculates the final offset
THEN
The address offset is computed as Address 1 minus Address 2 and stored in WS-ADDR-OFFSET
Context: The address offset has been calculated and ISCOM table size is known
GIVEN
The address offset has been calculated and ISCOM table size is known
Applied to: Offset Within ISCOM Table Range?
WHEN
The system validates the offset against table boundaries
THEN
If the offset is within the valid ISCOM table range, ISCOM conversion processing is initiated, otherwise standard PCB processing is used
R-GCX126-cbl-00141 (+18) File: GCX126R.cbl Process Master Manifest Border Arrival Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Master Manifest Border Arrival':
  • Context - a cargo record has been retrieved with release reference id from x4 segment entry type '992':
    For Is Cargo a Master Manifest?:
    When the system checks if the cargo is a master manifest, then if cargo is not a master manifest, skip follower processing and exit; if cargo is a master manifest, proceed to initialize follower manifest array and retrieve all associated follower manifests.
  • Context - the cargo is confirmed as a master manifest:
    For Initialize Follower Manifest Array, Set Index I = 1:
    When the system begins the process of collecting follower manifests, then initialize follower manifest array to spaces, set array index i to 1, and set end-of-database flag to false.
  • Context - the follower manifest array has been initialized and the cargo is a master manifest:
    For Set Search Key to Master CCN:
    When the system prepares to search for follower manifests, then set the database search key (gcb0rt-ccn-key) to the master manifest's ccn key (gccc-ccn-key).
  • Context - the search key has been set to the master ccn and the system is ready to retrieve cargo records:
    For Get Next Cargo Record from Database:
    When the system executes a get next database call, then retrieve the next cargo report segment from the database using pcb7 with qualified ssa for b0rt segment.
  • Context - a get next database call has been executed to retrieve a cargo record:
    For Database Status OK?:
    When the system checks the database status code, then if status code is not blank (spaces), set end-of-database flag to true and stop retrieval; if status code is blank (spaces), proceed to validate the retrieved record.
  • Context - a cargo record has been successfully retrieved from the database:
    For Master CCN Matches?:
    When the system compares the retrieved cargo's master manifest ccn (gccc-master-mfst-ccn) with the original release reference id (x4-01-cbsa-rel-ref-id first 25 characters), then if master ccns do not match, set end-of-database flag to true and stop retrieval; if master ccns match, proceed to check if the record is a follower manifest.
  • Context - a cargo record has been retrieved and its master ccn matches the search criteria:
    For Is Follower Manifest?:
    When the system checks if the cargo is a follower manifest (gccc-follower-mfst), then if cargo is a follower manifest, store its ccn in the follower array; if cargo is the master manifest itself, skip storage and continue to next record.
  • Context - a cargo record has been identified as a follower manifest:
    For Store Follower CCN in Array Position I, Increment I:
    When the system stores the follower information, then move the follower's ccn key (gccc-ccn-key) to the follower manifest array at position i (ws-follower-mani(i)) and add 1 to index i.
  • Context - a follower ccn has been stored in the array and the index has been incremented:
    For I > 100?:
    When the system checks if index i is greater than 100, then if i is greater than 100, set end-of-database flag to true and stop collecting followers; if i is 100 or less, continue retrieving next cargo record.
  • Context - one of the following conditions is met: database status is not ok, master ccn does not match, or follower count exceeds 100:
    For Set End of Database Flag:
    When the system needs to stop the retrieval loop, then set the end-of-database flag (ws-follower-end-of-db) to true.
  • Context - the database retrieval loop has completed and end-of-database flag is set:
    For Calculate Total Followers Count = I - 1:
    When the system calculates the total number of followers collected, then subtract 1 from index i to get the actual count of follower manifests stored in the array.
  • Context - the total follower count has been calculated:
    For Count > 0?:
    When the system checks if the count is greater than 0, then if count is 0 or less, exit the process without updating any followers; if count is greater than 0, proceed to loop through each follower for updates.
  • Context - at least one follower manifest exists in the array:
    For Loop Through Each Follower in Array J = 1 to Count:
    When the system begins processing followers, then loop through the follower array starting at j=1, incrementing by 1 each iteration, until j exceeds the count or the follower ccn at position i is spaces or low-values or j exceeds i.
  • Context - the system is processing follower at array position j:
    For Set Cargo Key to Follower CCN J:
    When the system prepares to retrieve the follower cargo record, then move the follower ccn from array position j (ws-follower-mani(j)) to both ccrt-ssaq key value and a2rt-ssaq key value.
  • Context - the follower ccn has been set as the database key:
    For Retrieve Follower Cargo Record:
    When the system retrieves the follower cargo record, then execute get hold unique (ghu) call to retrieve the cargo report segment from the database using the follower's ccn key.
  • Context - the follower cargo record has been successfully retrieved:
    For Set Border Arrival Acknowledgment Flag = TRUE:
    When the system updates the border arrival status, then set the border arrival acknowledgment flag (gccc-border-arrival-ack) to true in the cargo report segment.
  • Context - the border arrival acknowledgment flag has been set for the follower:
    For Log Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the system logs the border arrival event, then create a log entry with message '350 ack - arrival ack at border', current ccn key, current date and time, and action code 'zzz' for canadian cargo type.
  • Context - the follower cargo record has been updated with border arrival acknowledgment and logged:
    For Update Follower Cargo Record in Database:
    When the system saves the changes to the database, then execute replace (repl) call to update the cargo report segment in the database, clear status code and set accept status to blank.
  • Context - a follower manifest has been updated in the database:
    For More Followers?:
    When the system checks if more followers exist, then if loop counter j has not exceeded the total count and the next array position does not contain spaces or low-values, continue to next follower; otherwise, exit the follower processing loop.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been retrieved with release reference ID from X4 segment entry type '992'
GIVEN
A cargo record has been retrieved with release reference ID from X4 segment entry type '992'
Applied to: Is Cargo a Master Manifest?
WHEN
The system checks if the cargo is a master manifest
THEN
If cargo is NOT a master manifest, skip follower processing and exit; If cargo IS a master manifest, proceed to initialize follower manifest array and retrieve all associated follower manifests
Context: The cargo is confirmed as a master manifest
GIVEN
The cargo is confirmed as a master manifest
Applied to: Initialize Follower Manifest Array, Set Index I = 1
WHEN
The system begins the process of collecting follower manifests
THEN
Initialize follower manifest array to spaces, set array index I to 1, and set end-of-database flag to false
Context: The follower manifest array has been initialized and the cargo is a master manifest
GIVEN
The follower manifest array has been initialized and the cargo is a master manifest
Applied to: Set Search Key to Master CCN
WHEN
The system prepares to search for follower manifests
THEN
Set the database search key (GCB0RT-CCN-KEY) to the master manifest's CCN key (GCCC-CCN-KEY)
Context: The search key has been set to the master CCN and the system is ready to retrieve cargo records
GIVEN
The search key has been set to the master CCN and the system is ready to retrieve cargo records
Applied to: Get Next Cargo Record from Database
WHEN
The system executes a Get Next database call
THEN
Retrieve the next cargo report segment from the database using PCB7 with qualified SSA for B0RT segment
Context: A Get Next database call has been executed to retrieve a cargo record
GIVEN
A Get Next database call has been executed to retrieve a cargo record
Applied to: Database Status OK?
WHEN
The system checks the database status code
THEN
If status code is not blank (spaces), set end-of-database flag to true and stop retrieval; If status code is blank (spaces), proceed to validate the retrieved record
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Master CCN Matches?
WHEN
The system compares the retrieved cargo's master manifest CCN (GCCC-MASTER-MFST-CCN) with the original release reference ID (X4-01-CBSA-REL-REF-ID first 25 characters)
THEN
If master CCNs do NOT match, set end-of-database flag to true and stop retrieval; If master CCNs match, proceed to check if the record is a follower manifest
Context: A cargo record has been retrieved and its master CCN matches the search criteria
GIVEN
A cargo record has been retrieved and its master CCN matches the search criteria
Applied to: Is Follower Manifest?
WHEN
The system checks if the cargo is a follower manifest (GCCC-FOLLOWER-MFST)
THEN
If cargo is a follower manifest, store its CCN in the follower array; If cargo is the master manifest itself, skip storage and continue to next record
Context: A cargo record has been identified as a follower manifest
GIVEN
A cargo record has been identified as a follower manifest
Applied to: Store Follower CCN in Array Position I, Increment I
WHEN
The system stores the follower information
THEN
Move the follower's CCN key (GCCC-CCN-KEY) to the follower manifest array at position I (WS-FOLLOWER-MANI(I)) and add 1 to index I
Context: A follower CCN has been stored in the array and the index has been incremented
GIVEN
A follower CCN has been stored in the array and the index has been incremented
Applied to: I > 100?
WHEN
The system checks if index I is greater than 100
THEN
If I is greater than 100, set end-of-database flag to true and stop collecting followers; If I is 100 or less, continue retrieving next cargo record
Context: One of the following conditions is met: database status is not OK, master CCN does not match, or follower count exceeds 100
GIVEN
One of the following conditions is met: database status is not OK, master CCN does not match, or follower count exceeds 100
Applied to: Set End of Database Flag
WHEN
The system needs to stop the retrieval loop
THEN
Set the end-of-database flag (WS-FOLLOWER-END-OF-DB) to true
Context: The database retrieval loop has completed and end-of-database flag is set
GIVEN
The database retrieval loop has completed and end-of-database flag is set
Applied to: Calculate Total Followers Count = I - 1
WHEN
The system calculates the total number of followers collected
THEN
Subtract 1 from index I to get the actual count of follower manifests stored in the array
Context: The total follower count has been calculated
GIVEN
The total follower count has been calculated
Applied to: Count > 0?
WHEN
The system checks if the count is greater than 0
THEN
If count is 0 or less, exit the process without updating any followers; If count is greater than 0, proceed to loop through each follower for updates
Context: At least one follower manifest exists in the array
GIVEN
At least one follower manifest exists in the array
Applied to: Loop Through Each Follower in Array J = 1 to Count
WHEN
The system begins processing followers
THEN
Loop through the follower array starting at J=1, incrementing by 1 each iteration, until J exceeds the count OR the follower CCN at position I is spaces or low-values OR J exceeds I
Context: The system is processing follower at array position J
GIVEN
The system is processing follower at array position J
Applied to: Set Cargo Key to Follower CCN J
WHEN
The system prepares to retrieve the follower cargo record
THEN
Move the follower CCN from array position J (WS-FOLLOWER-MANI(J)) to both CCRT-SSAQ key value and A2RT-SSAQ key value
Context: The follower CCN has been set as the database key
GIVEN
The follower CCN has been set as the database key
Applied to: Retrieve Follower Cargo Record
WHEN
The system retrieves the follower cargo record
THEN
Execute Get Hold Unique (GHU) call to retrieve the cargo report segment from the database using the follower's CCN key
Context: The follower cargo record has been successfully retrieved
GIVEN
The follower cargo record has been successfully retrieved
Applied to: Set Border Arrival Acknowledgment Flag = TRUE
WHEN
The system updates the border arrival status
THEN
Set the border arrival acknowledgment flag (GCCC-BORDER-ARRIVAL-ACK) to true in the cargo report segment
Context: The border arrival acknowledgment flag has been set for the follower
GIVEN
The border arrival acknowledgment flag has been set for the follower
Applied to: Log Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The system logs the border arrival event
THEN
Create a log entry with message '350 ACK - ARRIVAL ACK AT BORDER', current CCN key, current date and time, and action code 'ZZZ' for Canadian cargo type
Context: The follower cargo record has been updated with border arrival acknowledgment and logged
GIVEN
The follower cargo record has been updated with border arrival acknowledgment and logged
Applied to: Update Follower Cargo Record in Database
WHEN
The system saves the changes to the database
THEN
Execute Replace (REPL) call to update the cargo report segment in the database, clear status code and set accept status to blank
Context: A follower manifest has been updated in the database
GIVEN
A follower manifest has been updated in the database
Applied to: More Followers?
WHEN
The system checks if more followers exist
THEN
If loop counter J has not exceeded the total count AND the next array position does not contain spaces or low-values, continue to next follower; Otherwise, exit the follower processing loop
R-GCCUSIO-cbl-00142 (+10) File: GCCUSIO.cbl Hold Index Management Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hold Index Management':
  • Context - a cargo record with various status indicators:
    For Check Cargo Hold Status:
    When the system checks for hold status conditions, then the system identifies if cargo is in any hold status (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, hold-d, pr-h-de, holdfda) or has no hold status.
  • Context - cargo is confirmed to be in hold status:
    For Determine Hold Type:
    When the system analyzes the specific hold status codes, then the system determines if the hold is destination-related (hold, holdpcs, pr-hpcs, hold-d, pr-h-de, holdfda) or border-related (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, holdfda).
  • Context - cargo has destination hold status (hold, holdpcs, pr-hpcs, hold-d, pr-h-de, holdfda):
    For Set Destination Hold Index:
    When the system processes hold index fields, then the system sets destination station number to held-dest field and cargo ccn key to held-dest-cargo field.
  • Context - cargo has border hold status (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, holdfda):
    For Set Border Hold Index:
    When the system processes hold index fields, then the system retrieves border station from mc table lookup and sets held-border field to border station number and held-border-cargo field to cargo ccn key.
  • Context - cargo requires border hold index and has location id:
    For Lookup Border Station from MC Table:
    When the system needs border station information, then the system calls table lookup service with mc table id and location id to retrieve station number.
  • Context - a gcsb1rt index record exists for the cargo and hold index fields are populated:
    For Update Existing Index Record:
    When the system processes hold index management, then the system replaces the existing index record with updated hold field information.
  • Context - no gcsb1rt index record exists for the cargo and hold index fields are populated:
    For Create New Index Record:
    When the system processes hold index management, then the system inserts a new index record with cargo key and hold field information.
  • Context - cargo is not in any hold status (not hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, hold-d, pr-h-de, holdfda):
    For Clear Hold Index Fields:
    When the system processes hold index management, then the system clears held-dest-index and held-border-index fields to spaces.
  • Context - hold index fields have been cleared and an existing index record is found:
    For Any Other Index Types Active?:
    When the system checks for other active index types, then the system determines if error indexes (error-dest-index, error-orig-index, error-border-index) contain data to decide record retention.
  • Context - hold index fields are cleared and no error index fields contain data:
    For Delete Index Record:
    When the system determines index record is no longer needed, then the system deletes the gcsb1rt index record completely.
  • Context - hold index fields are cleared but error index fields contain data:
    For Update Index Record:
    When the system processes index record maintenance, then the system replaces the index record with cleared hold fields but preserved error field information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with various status indicators
GIVEN
A cargo record with various status indicators
Applied to: Check Cargo Hold Status
WHEN
The system checks for hold status conditions
THEN
The system identifies if cargo is in any hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA) or has no hold status
Context: Cargo is confirmed to be in hold status
GIVEN
Cargo is confirmed to be in hold status
Applied to: Determine Hold Type
WHEN
The system analyzes the specific hold status codes
THEN
The system determines if the hold is destination-related (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, HOLDFDA) or border-related (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLDFDA)
Context: Cargo has destination hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, HOLDFDA)
GIVEN
Cargo has destination hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, HOLDFDA)
Applied to: Set Destination Hold Index
WHEN
The system processes hold index fields
THEN
The system sets destination station number to held-dest field and cargo CCN key to held-dest-cargo field
Context: Cargo has border hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLDFDA)
GIVEN
Cargo has border hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLDFDA)
Applied to: Set Border Hold Index
WHEN
The system processes hold index fields
THEN
The system retrieves border station from MC table lookup and sets held-border field to border station number and held-border-cargo field to cargo CCN key
Context: Cargo requires border hold index and has location ID
GIVEN
Cargo requires border hold index and has location ID
Applied to: Lookup Border Station from MC Table
WHEN
The system needs border station information
THEN
The system calls table lookup service with MC table ID and location ID to retrieve station number
Context: A GCSB1RT index record exists for the cargo and hold index fields are populated
GIVEN
A GCSB1RT index record exists for the cargo and hold index fields are populated
Applied to: Update Existing Index Record
WHEN
The system processes hold index management
THEN
The system replaces the existing index record with updated hold field information
Context: No GCSB1RT index record exists for the cargo and hold index fields are populated
GIVEN
No GCSB1RT index record exists for the cargo and hold index fields are populated
Applied to: Create New Index Record
WHEN
The system processes hold index management
THEN
The system inserts a new index record with cargo key and hold field information
Context: Cargo is not in any hold status (not HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA)
GIVEN
Cargo is not in any hold status (not HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA)
Applied to: Clear Hold Index Fields
WHEN
The system processes hold index management
THEN
The system clears held-dest-index and held-border-index fields to spaces
Context: Hold index fields have been cleared and an existing index record is found
GIVEN
Hold index fields have been cleared and an existing index record is found
Applied to: Any Other Index Types Active?
WHEN
The system checks for other active index types
THEN
The system determines if error indexes (error-dest-index, error-orig-index, error-border-index) contain data to decide record retention
Context: Hold index fields are cleared and no error index fields contain data
GIVEN
Hold index fields are cleared and no error index fields contain data
Applied to: Delete Index Record
WHEN
The system determines index record is no longer needed
THEN
The system deletes the GCSB1RT index record completely
Context: Hold index fields are cleared but error index fields contain data
GIVEN
Hold index fields are cleared but error index fields contain data
Applied to: Update Index Record
WHEN
The system processes index record maintenance
THEN
The system replaces the index record with cleared hold fields but preserved error field information
R-GCCUSIO-cbl-00153 (+5) File: GCCUSIO.cbl Secondary Database Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Database Processing':
  • Context - a secondary cargo data segment (gcsa2rt) replace operation is requested:
    For New Data Empty?:
    When the system retrieves the existing record and evaluates the new cargo data content, then if the new data contains only spaces, low-values, or underscores, the system should delete the existing record; otherwise it should insert or replace the record based on whether it exists.
  • Context - a secondary cargo data segment (gcsa2rt) insert operation is requested:
    For Insert Data Valid?:
    When the system evaluates the cargo data content for insertion, then the system should only proceed with insertion if the data is not all spaces, not all low-values, and not all underscores.
  • Context - a secondary cargo data segment (gcsa2rt) delete operation is requested:
    For Delete Secondary Record:
    When the system attempts to retrieve the existing record using ghu function, then if the record exists (status code is not 'ge'), the system should proceed with deletion; if not found, the operation should continue without error.
  • Context - a secondary cargo data retrieval operation is requested:
    For Index Type?:
    When the system evaluates the index type specified in the request, then if secn-key index is specified, use secondary key search; otherwise use primary key search with built secondary ssa.
  • Context - a secondary cargo data replace operation is in progress:
    For Record Found?:
    When the system attempts to retrieve the existing record using ghu function with 'ge' accept status, then if the status code equals 'ge', the record is not found and requires insertion; if status code is spaces, the record exists and can be replaced or deleted based on data content.
  • Context - a secondary cargo data delete operation is requested:
    For Record Exists?:
    When the system retrieves the record using ghu function with 'ge' accept status, then if the status code is spaces, the record exists and should be deleted; if status code is 'ge', the record does not exist and no deletion is needed.
👨‍💻 Technical ACs (Gherkin)
Context: A secondary cargo data segment (GCSA2RT) replace operation is requested
GIVEN
A secondary cargo data segment (GCSA2RT) replace operation is requested
Applied to: New Data Empty?
WHEN
The system retrieves the existing record and evaluates the new cargo data content
THEN
If the new data contains only spaces, low-values, or underscores, the system should delete the existing record; otherwise it should insert or replace the record based on whether it exists
Context: A secondary cargo data segment (GCSA2RT) insert operation is requested
GIVEN
A secondary cargo data segment (GCSA2RT) insert operation is requested
Applied to: Insert Data Valid?
WHEN
The system evaluates the cargo data content for insertion
THEN
The system should only proceed with insertion if the data is not all spaces, not all low-values, and not all underscores
Context: A secondary cargo data segment (GCSA2RT) delete operation is requested
GIVEN
A secondary cargo data segment (GCSA2RT) delete operation is requested
Applied to: Delete Secondary Record
WHEN
The system attempts to retrieve the existing record using GHU function
THEN
If the record exists (status code is not 'GE'), the system should proceed with deletion; if not found, the operation should continue without error
Context: A secondary cargo data retrieval operation is requested
GIVEN
A secondary cargo data retrieval operation is requested
Applied to: Index Type?
WHEN
The system evaluates the index type specified in the request
THEN
If SECN-KEY index is specified, use secondary key search; otherwise use primary key search with built secondary SSA
Context: A secondary cargo data replace operation is in progress
GIVEN
A secondary cargo data replace operation is in progress
Applied to: Record Found?
WHEN
The system attempts to retrieve the existing record using GHU function with 'GE' accept status
THEN
If the status code equals 'GE', the record is not found and requires insertion; if status code is spaces, the record exists and can be replaced or deleted based on data content
Context: A secondary cargo data delete operation is requested
GIVEN
A secondary cargo data delete operation is requested
Applied to: Record Exists?
WHEN
The system retrieves the record using GHU function with 'GE' accept status
THEN
If the status code is spaces, the record exists and should be deleted; if status code is 'GE', the record does not exist and no deletion is needed
R-GCCUSIO-cbl-00159 (+7) File: GCCUSIO.cbl GCSA8RT Message Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCSA8RT Message Processing':
  • Context - a gcsa8rt message processing request with function code gu or gn:
    For Message Key Valid?:
    When the gcsa8rt key field is empty or contains only spaces, then return error code '0012' with message 'gcsa8rt-key equal spaces'.
  • Context - a gcsa8rt message delete request:
    For Check if Message Exists:
    When the delete function is initiated, then first perform a ghu (get hold unique) operation to check if the message exists.
  • Context - a gcsa8rt message delete request has been processed:
    For Message Found?:
    When the message exists in the system (status code is spaces), then proceed with the delete operation using dlet function code.
  • Context - a gcsa8rt message insert request:
    For Check if Message Exists:
    When the insert function is initiated, then first perform a ghu operation to check if the message already exists.
  • Context - a gcsa8rt message insert request has checked for existing message:
    For Message Found?:
    When the message already exists in the system (status code is spaces), then use repl function code to replace the existing message, otherwise use isrt function code to insert new message.
  • Context - a gcsa8rt message insert or replace operation:
    For Format Message Data:
    When the message data needs to be stored, then combine the gcsa8rt key with the saved io area data to create the complete message segment.
  • Context - a gcsa8rt message retrieval request with function code gu:
    For Retrieve Message Segment:
    When the retrieval operation is initiated, then build qualified ssa with the message key and perform the database call.
  • Context - a gcsa8rt message has been successfully retrieved:
    For Separate Key from Data:
    When the message data needs to be returned to the caller, then extract the data portion from the complete message segment and move it to the io area, excluding the key portion.
👨‍💻 Technical ACs (Gherkin)
Context: A GCSA8RT message processing request with function code GU or GN
GIVEN
A GCSA8RT message processing request with function code GU or GN
Applied to: Message Key Valid?
WHEN
The GCSA8RT key field is empty or contains only spaces
THEN
Return error code '0012' with message 'GCSA8RT-KEY EQUAL SPACES'
Context: A GCSA8RT message delete request
GIVEN
A GCSA8RT message delete request
Applied to: Check if Message Exists
WHEN
The delete function is initiated
THEN
First perform a GHU (Get Hold Unique) operation to check if the message exists
Context: A GCSA8RT message delete request has been processed
GIVEN
A GCSA8RT message delete request has been processed
Applied to: Message Found?
WHEN
The message exists in the system (status code is spaces)
THEN
Proceed with the delete operation using DLET function code
Context: A GCSA8RT message insert request
GIVEN
A GCSA8RT message insert request
Applied to: Check if Message Exists
WHEN
The insert function is initiated
THEN
First perform a GHU operation to check if the message already exists
Context: A GCSA8RT message insert request has checked for existing message
GIVEN
A GCSA8RT message insert request has checked for existing message
Applied to: Message Found?
WHEN
The message already exists in the system (status code is spaces)
THEN
Use REPL function code to replace the existing message, otherwise use ISRT function code to insert new message
Context: A GCSA8RT message insert or replace operation
GIVEN
A GCSA8RT message insert or replace operation
Applied to: Format Message Data
WHEN
The message data needs to be stored
THEN
Combine the GCSA8RT key with the saved IO area data to create the complete message segment
Context: A GCSA8RT message retrieval request with function code GU
GIVEN
A GCSA8RT message retrieval request with function code GU
Applied to: Retrieve Message Segment
WHEN
The retrieval operation is initiated
THEN
Build qualified SSA with the message key and perform the database call
Context: A GCSA8RT message has been successfully retrieved
GIVEN
A GCSA8RT message has been successfully retrieved
Applied to: Separate Key from Data
WHEN
The message data needs to be returned to the caller
THEN
Extract the data portion from the complete message segment and move it to the IO area, excluding the key portion
R-GCX126-cbl-00160 (+8) File: GCX126R.cbl Send Train Not Found Error Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Train Not Found Error':
  • Context - a conveyance 350 message is being processed with x4 segment entry type code equal to '992' and the x4 related document id (first 25 characters) is available:
    For Train ID Same as Previous CRN?:
    When the x4 related document id (first 25 characters) matches the previously processed train id stored in memory, then the system skips all processing for this train id and continues to the next segment without performing train lookup, validation, or border arrival acknowledgment.
  • Context - a conveyance 350 message with x4 segment entry type code equal to '992' and the x4 related document id (first 25 characters) is different from the previously processed train id:
    For Lookup Train in System Using Train ID:
    When the system needs to validate the train entry, then the system stores the x4 related document id (first 25 characters) as the current train id in memory and performs a database lookup using this train id as the key value to retrieve the train root segment.
  • Context - a database lookup has been performed for a train id from the x4 segment related document id:
    For Train Exists in System?:
    When the database operation completes, then if the database status code is not blank (spaces), the train does not exist and error processing is triggered; if the database status code is blank (spaces), the train exists and normal processing continues.
  • Context - a train id lookup has failed and the train does not exist in the system:
    For Set Message: 'UNKNOWN TRAIN ENTRY IN EDI 350':
    When the error report preparation begins, then the system clears the first detail line of the report and sets the message to 'unknown train entry in edi 350 ' concatenated with the train id (first 25 characters of x4 related document id).
  • Context - the error report header message is being prepared for an unknown train:
    For Add Train ID to Report:
    When the train id needs to be added to the report, then the system appends the x4 related document id (first 25 characters) to the error message 'unknown train entry in edi 350 ' in the first detail line of the report.
  • Context - the error report is being prepared for an unknown train id:
    For Add Message: 'THIS CRN WAS NOT FOUND':
    When additional explanation is needed in the report, then the system sets the third detail line of the report to the message 'this crn was not found.'.
  • Context - an error report has been prepared for a train id that was not found in the system:
    For Set Report Type: UNKNOWN:
    When the report type needs to be set for routing purposes, then the system sets the report line count to 4 and marks the report type indicator as 'unknown' type.
  • Context - an error report has been fully prepared with message 'unknown train entry in edi 350' followed by the train id, message 'this crn was not found.', report line count set to 4, and report type marked as 'unknown':
    For Send Error Report to Merlin:
    When the error report is ready to be sent, then the system invokes the merlin notification preparation process to send the error report to the configured recipients.
  • Context - either the train id matches the previously processed train id or the train id was successfully found in the system database:
    For Continue Processing:
    When train validation is complete, then the system proceeds to log the train arrival information, create a log entry with action code 'zzz', message '350 ack - arrival ack at border', and spawns the logging transaction for the train.
👨‍💻 Technical ACs (Gherkin)
Context: A conveyance 350 message is being processed with X4 segment entry type code equal to '992' and the X4 related document ID (first 25 characters) is available
GIVEN
A conveyance 350 message is being processed with X4 segment entry type code equal to '992' and the X4 related document ID (first 25 characters) is available
Applied to: Train ID Same as Previous CRN?
WHEN
The X4 related document ID (first 25 characters) matches the previously processed train ID stored in memory
THEN
The system skips all processing for this train ID and continues to the next segment without performing train lookup, validation, or border arrival acknowledgment
Context: A conveyance 350 message with X4 segment entry type code equal to '992' and the X4 related document ID (first 25 characters) is different from the previously processed train ID
GIVEN
A conveyance 350 message with X4 segment entry type code equal to '992' and the X4 related document ID (first 25 characters) is different from the previously processed train ID
Applied to: Lookup Train in System Using Train ID
WHEN
The system needs to validate the train entry
THEN
The system stores the X4 related document ID (first 25 characters) as the current train ID in memory and performs a database lookup using this train ID as the key value to retrieve the train root segment
Context: A database lookup has been performed for a train ID from the X4 segment related document ID
GIVEN
A database lookup has been performed for a train ID from the X4 segment related document ID
Applied to: Train Exists in System?
WHEN
The database operation completes
THEN
If the database status code is not blank (spaces), the train does not exist and error processing is triggered; if the database status code is blank (spaces), the train exists and normal processing continues
Context: A train ID lookup has failed and the train does not exist in the system
GIVEN
A train ID lookup has failed and the train does not exist in the system
Applied to: Set Message: 'UNKNOWN TRAIN ENTRY IN EDI 350'
WHEN
The error report preparation begins
THEN
The system clears the first detail line of the report and sets the message to 'UNKNOWN TRAIN ENTRY IN EDI 350 ' concatenated with the train ID (first 25 characters of X4 related document ID)
Context: The error report header message is being prepared for an unknown train
GIVEN
The error report header message is being prepared for an unknown train
Applied to: Add Train ID to Report
WHEN
The train ID needs to be added to the report
THEN
The system appends the X4 related document ID (first 25 characters) to the error message 'UNKNOWN TRAIN ENTRY IN EDI 350 ' in the first detail line of the report
Context: The error report is being prepared for an unknown train ID
GIVEN
The error report is being prepared for an unknown train ID
Applied to: Add Message: 'THIS CRN WAS NOT FOUND'
WHEN
Additional explanation is needed in the report
THEN
The system sets the third detail line of the report to the message 'THIS CRN WAS NOT FOUND.'
Context: An error report has been prepared for a train ID that was not found in the system
GIVEN
An error report has been prepared for a train ID that was not found in the system
Applied to: Set Report Type: UNKNOWN
WHEN
The report type needs to be set for routing purposes
THEN
The system sets the report line count to 4 and marks the report type indicator as 'UNKNOWN' type
Context: An error report has been fully prepared with message 'UNKNOWN TRAIN ENTRY IN EDI 350' followed by the train ID, message 'THIS CRN WAS NOT FOUND.', report line count set to 4, and report type marked as 'UNKNOWN'
GIVEN
An error report has been fully prepared with message 'UNKNOWN TRAIN ENTRY IN EDI 350' followed by the train ID, message 'THIS CRN WAS NOT FOUND.', report line count set to 4, and report type marked as 'UNKNOWN'
Applied to: Send Error Report to Merlin
WHEN
The error report is ready to be sent
THEN
The system invokes the Merlin notification preparation process to send the error report to the configured recipients
Context: Either the train ID matches the previously processed train ID OR the train ID was successfully found in the system database
GIVEN
Either the train ID matches the previously processed train ID OR the train ID was successfully found in the system database
Applied to: Continue Processing
WHEN
Train validation is complete
THEN
The system proceeds to log the train arrival information, create a log entry with action code 'ZZZ', message '350 ACK - ARRIVAL ACK AT BORDER', and spawns the logging transaction for the train
R-GCCUSIO-cbl-00167 (+6) File: GCCUSIO.cbl Table Lookup Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Table Lookup Processing':
  • Context - a table lookup request is initiated:
    For Initialize Table Parameters:
    When the system prepares for table lookup operation, then all table parameters are cleared including second pcb flag, unqualified ssa flag, table key values, and return flag.
  • Context - a station information lookup is required:
    For Set Table ID to 'MC':
    When the system needs to identify the correct table type, then the table id is set to 'mc' and function code is set to 'gu' for station table lookup.
  • Context - a cargo record contains a location id name:
    For Set Station Key from Location ID:
    When the system performs station table lookup, then the location id name from the cargo record is used as the station sequence id key for table lookup.
  • Context - table parameters are initialized with mc table id and station key:
    For Call Table Lookup Service:
    When the system needs to retrieve station information, then the gcctbio table lookup service is called with the prepared parameters to access table segments.
  • Context - a table lookup operation has been performed:
    For Table Record Found?:
    When the system checks the lookup result, then if return flag equals '0' then station record is found, otherwise station record is not found.
  • Context - a station record is found in the mc table:
    For Extract Station Number:
    When the system needs to extract station information, then the table segment data is moved to mc segment structure and the mc station number is extracted for use.
  • Context - a station number has been successfully extracted from mc table:
    For Use Station Number for Border Processing:
    When the system processes border-related cargo operations, then the mc station number is used as the border station identifier in cargo status processing.
👨‍💻 Technical ACs (Gherkin)
Context: A table lookup request is initiated
GIVEN
A table lookup request is initiated
Applied to: Initialize Table Parameters
WHEN
The system prepares for table lookup operation
THEN
All table parameters are cleared including second PCB flag, unqualified SSA flag, table key values, and return flag
Context: A station information lookup is required
GIVEN
A station information lookup is required
Applied to: Set Table ID to 'MC'
WHEN
The system needs to identify the correct table type
THEN
The table ID is set to 'MC' and function code is set to 'GU' for station table lookup
Context: A cargo record contains a location ID name
GIVEN
A cargo record contains a location ID name
Applied to: Set Station Key from Location ID
WHEN
The system performs station table lookup
THEN
The location ID name from the cargo record is used as the station sequence ID key for table lookup
Context: Table parameters are initialized with MC table ID and station key
GIVEN
Table parameters are initialized with MC table ID and station key
Applied to: Call Table Lookup Service
WHEN
The system needs to retrieve station information
THEN
The GCCTBIO table lookup service is called with the prepared parameters to access table segments
Context: A table lookup operation has been performed
GIVEN
A table lookup operation has been performed
Applied to: Table Record Found?
WHEN
The system checks the lookup result
THEN
If return flag equals '0' then station record is found, otherwise station record is not found
Context: A station record is found in the MC table
GIVEN
A station record is found in the MC table
Applied to: Extract Station Number
WHEN
The system needs to extract station information
THEN
The table segment data is moved to MC segment structure and the MC station number is extracted for use
Context: A station number has been successfully extracted from MC table
GIVEN
A station number has been successfully extracted from MC table
Applied to: Use Station Number for Border Processing
WHEN
The system processes border-related cargo operations
THEN
The MC station number is used as the border station identifier in cargo status processing
R-GCX126-cbl-00169 (+5) File: GCX126R.cbl Log K1 Remarks Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log K1 Remarks':
  • Context - edi 350 message segments have been processed and k1 segment found indicator is set to true:
    For Check if K1 Segments Were Found:
    When the system begins the k1 remarks logging process, then the system initiates the loop to process all stored k1 remarks from index 1 to the maximum k1 remark index.
  • Context - k1 segments were found and the loop counter is within the valid range (counter <= k1 remark index):
    For Check if K1 Segments Were Found, More K1 Remarks to Process?, K1 Remark Empty?:
    When the current k1 remark entry in the array equals spaces, then the system increments the loop counter and continues to check the next k1 remark without logging.
  • Context - a non-empty k1 remark exists at the current loop index position:
    For Get K1 Remark from Array, Build Log Message: 'EDI 350 K1:' + First Free-Form Message, Log Cargo Information Message:
    When the system retrieves the k1 segment from the remark array, then the system initializes the k1 segment structure, moves the remark data to k1 segment, clears the information message work area, concatenates 'edi 350 k1: ' with the first free-form message field (k1-01-free-form-message), stores the result in the information message work area, and invokes the cargo information message logging process.
  • Context - the first free-form message from the k1 segment has been logged and the k1 segment contains a second free-form message field:
    For Check Second Free-Form Message Exists?, Build Log Message: 'EDI 350 K1:' + Second Free-Form Message, Log Cargo Information Message:
    When the second free-form message field (k1-02-free-form-message) is not equal to spaces, then the system clears the information message work area, concatenates 'edi 350 k1: ' with the second free-form message field, stores the result in the information message work area, and invokes the cargo information message logging process.
  • Context - a k1 remark has been processed (logged or skipped due to being empty):
    For Increment Loop Counter, More K1 Remarks to Process?:
    When the system increments the loop counter by 1, then the system checks if the loop counter is less than or equal to the k1 remark index and if true, continues to process the next k1 remark, otherwise exits the k1 remarks logging process.
  • Context - edi 350 message segments have been processed:
    For Check if K1 Segments Were Found:
    When the k1 segment found indicator is set to false (no k1 segments were found), then the system skips the k1 remarks logging process entirely and proceeds to the next processing step.
👨‍💻 Technical ACs (Gherkin)
Context: EDI 350 message segments have been processed and K1 segment found indicator is set to true
GIVEN
EDI 350 message segments have been processed and K1 segment found indicator is set to true
Applied to: Check if K1 Segments Were Found
WHEN
The system begins the K1 remarks logging process
THEN
The system initiates the loop to process all stored K1 remarks from index 1 to the maximum K1 remark index
Context: K1 segments were found and the loop counter is within the valid range (counter <= K1 remark index)
GIVEN
K1 segments were found and the loop counter is within the valid range (counter <= K1 remark index)
Applied to: Check if K1 Segments Were Found, More K1 Remarks to Process?, K1 Remark Empty?
WHEN
The current K1 remark entry in the array equals spaces
THEN
The system increments the loop counter and continues to check the next K1 remark without logging
Context: A non-empty K1 remark exists at the current loop index position
GIVEN
A non-empty K1 remark exists at the current loop index position
Applied to: Get K1 Remark from Array, Build Log Message: 'EDI 350 K1:' + First Free-Form Message, Log Cargo Information Message
WHEN
The system retrieves the K1 segment from the remark array
THEN
The system initializes the K1 segment structure, moves the remark data to K1 segment, clears the information message work area, concatenates 'EDI 350 K1: ' with the first free-form message field (K1-01-FREE-FORM-MESSAGE), stores the result in the information message work area, and invokes the cargo information message logging process
Context: The first free-form message from the K1 segment has been logged and the K1 segment contains a second free-form message field
GIVEN
The first free-form message from the K1 segment has been logged and the K1 segment contains a second free-form message field
Applied to: Check Second Free-Form Message Exists?, Build Log Message: 'EDI 350 K1:' + Second Free-Form Message, Log Cargo Information Message
WHEN
The second free-form message field (K1-02-FREE-FORM-MESSAGE) is not equal to spaces
THEN
The system clears the information message work area, concatenates 'EDI 350 K1: ' with the second free-form message field, stores the result in the information message work area, and invokes the cargo information message logging process
Context: A K1 remark has been processed (logged or skipped due to being empty)
GIVEN
A K1 remark has been processed (logged or skipped due to being empty)
Applied to: Increment Loop Counter, More K1 Remarks to Process?
WHEN
The system increments the loop counter by 1
THEN
The system checks if the loop counter is less than or equal to the K1 remark index and if true, continues to process the next K1 remark, otherwise exits the K1 remarks logging process
Context: EDI 350 message segments have been processed
GIVEN
EDI 350 message segments have been processed
Applied to: Check if K1 Segments Were Found
WHEN
The K1 segment found indicator is set to false (no K1 segments were found)
THEN
The system skips the K1 remarks logging process entirely and proceeds to the next processing step
R-GCCUSIO-cbl-00174 (+11) File: GCCUSIO.cbl GCSB1RT Index Database Management Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCSB1RT Index Database Management':
  • Context - a cargo record exists in the system:
    For No Index Processing Required - Delete Record:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status and no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then delete the cargo record from gcsb1rt index database and complete index management.
  • Context - a cargo record exists in gcsb1rt index database:
    For Clear Error Index Fields:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status, then clear the error origin index field and clear the error destination index field and clear the error border index field in the gcsb1rt record.
    For Clear Hold Index Fields:
    When the cargo has no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then clear the held destination index field and clear the held border index field in the gcsb1rt record.
  • Context - error and hold index fields have been cleared from a gcsb1rt record:
    For Any Index Fields Remaining?:
    When the error destination index field is empty and the error origin index field is empty and the error border index field is empty, then delete the gcsb1rt record from the index database.
    For Any Index Fields Remaining?:
    When at least one of the following fields is not empty: error destination index field or error origin index field or error border index field, then replace the existing gcsb1rt record with the updated field values.
  • Context - a cargo record has error or pending status conditions:
    For Populate Error Index Fields:
    When the cargo has cp cargo error status or cp cargo pending status or us cargo error status, then set error code origin to 'e' and set error origin station to cargo origin station number and set cargo ccn key to error origin cargo field and set error code border to 'e' and set error code destination to 'e' and set cargo destination station number to error destination field and set cargo ccn key to error destination cargo field.
  • Context - error index fields are being populated for a cargo record:
    For Set Border Station Code via MC Table Lookup:
    When the mc table lookup is performed using cargo location id name, then if mc table lookup returns success flag '0', set the mc station number from table segment to error border index field and set cargo ccn key to error border cargo field.
  • Context - a cargo record has hold status conditions:
    For Set Destination Hold Index:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold destination status or us cargo pre-hold destination status or us cargo hold fda status, then set cargo destination station number to held destination index field and set cargo ccn key to held destination cargo field.
    For Set Border Hold Index via MC Table Lookup:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold border status or us cargo pre-hold border status or us cargo hold fda status, then perform mc table lookup using cargo location id name and if lookup returns success flag '0', set mc station number from table segment to held border index field and set cargo ccn key to held border cargo field.
  • Context - a cargo record has error or hold conditions and no existing gcsb1rt record is found:
    For Insert New GCSB1RT Record:
    When error or hold index fields have been populated, then set cargo ccn key to gcsb1rt key cargo field and insert new gcsb1rt record with populated index fields.
  • Context - a cargo record has error or hold conditions and an existing gcsb1rt record is found:
    For Replace Existing GCSB1RT Record:
    When error or hold index fields have been populated or cleared, then replace the existing gcsb1rt record with the updated field values.
  • Context - a cargo record requires gcsb1rt index management:
    For Retrieve Existing GCSB1RT Record:
    When gcsb1rt record retrieval is attempted using cargo ccn key, then if record is found, set found indicator to true and if record is not found, set found indicator to false.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: No Index Processing Required - Delete Record
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status AND no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
Delete the cargo record from GCSB1RT index database and complete index management
Context: A cargo record exists in GCSB1RT index database
GIVEN
A cargo record exists in GCSB1RT index database
Applied to: Clear Error Index Fields
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status
THEN
Clear the error origin index field AND clear the error destination index field AND clear the error border index field in the GCSB1RT record
Applied to: Clear Hold Index Fields
WHEN
The cargo has no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
Clear the held destination index field AND clear the held border index field in the GCSB1RT record
Context: Error and hold index fields have been cleared from a GCSB1RT record
GIVEN
Error and hold index fields have been cleared from a GCSB1RT record
Applied to: Any Index Fields Remaining?
WHEN
The error destination index field is empty AND the error origin index field is empty AND the error border index field is empty
THEN
Delete the GCSB1RT record from the index database
Applied to: Any Index Fields Remaining?
WHEN
At least one of the following fields is not empty: error destination index field OR error origin index field OR error border index field
THEN
Replace the existing GCSB1RT record with the updated field values
Context: A cargo record has error or pending status conditions
GIVEN
A cargo record has error or pending status conditions
Applied to: Populate Error Index Fields
WHEN
The cargo has CP cargo error status OR CP cargo pending status OR US cargo error status
THEN
Set error code origin to 'E' AND set error origin station to cargo origin station number AND set cargo CCN key to error origin cargo field AND set error code border to 'E' AND set error code destination to 'E' AND set cargo destination station number to error destination field AND set cargo CCN key to error destination cargo field
Context: Error index fields are being populated for a cargo record
GIVEN
Error index fields are being populated for a cargo record
Applied to: Set Border Station Code via MC Table Lookup
WHEN
The MC table lookup is performed using cargo location ID name
THEN
If MC table lookup returns success flag '0', set the MC station number from table segment to error border index field AND set cargo CCN key to error border cargo field
Context: A cargo record has hold status conditions
GIVEN
A cargo record has hold status conditions
Applied to: Set Destination Hold Index
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold destination status OR US cargo pre-hold destination status OR US cargo hold FDA status
THEN
Set cargo destination station number to held destination index field AND set cargo CCN key to held destination cargo field
Applied to: Set Border Hold Index via MC Table Lookup
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold border status OR US cargo pre-hold border status OR US cargo hold FDA status
THEN
Perform MC table lookup using cargo location ID name AND if lookup returns success flag '0', set MC station number from table segment to held border index field AND set cargo CCN key to held border cargo field
Context: A cargo record has error or hold conditions AND no existing GCSB1RT record is found
GIVEN
A cargo record has error or hold conditions AND no existing GCSB1RT record is found
Applied to: Insert New GCSB1RT Record
WHEN
Error or hold index fields have been populated
THEN
Set cargo CCN key to GCSB1RT key cargo field AND insert new GCSB1RT record with populated index fields
Context: A cargo record has error or hold conditions AND an existing GCSB1RT record is found
GIVEN
A cargo record has error or hold conditions AND an existing GCSB1RT record is found
Applied to: Replace Existing GCSB1RT Record
WHEN
Error or hold index fields have been populated or cleared
THEN
Replace the existing GCSB1RT record with the updated field values
Context: A cargo record requires GCSB1RT index management
GIVEN
A cargo record requires GCSB1RT index management
Applied to: Retrieve Existing GCSB1RT Record
WHEN
GCSB1RT record retrieval is attempted using cargo CCN key
THEN
If record is found, set found indicator to true AND if record is not found, set found indicator to false
R-GCX126-cbl-00175 (+11) File: GCX126R.cbl Log N7 Equipment Information Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log N7 Equipment Information':
  • Context - an edi 350 message has been processed and all segments have been parsed:
    For N7 Segment Found?:
    When the n7 segment found indicator is set to false (ws-no-n7-seg-found), then the system skips all n7 equipment logging operations and proceeds to the end of the logging process.
  • Context - an edi 350 message has been processed and n7 equipment segments were found:
    For N7 Segment Found?:
    When the n7 segment found indicator is set to true (ws-n7-segment-found), then the system initiates the loop to process and log all equipment information from the log-line array starting at index 1.
  • Context - n7 equipment segments were found in the edi 350 message:
    For Initialize Loop Counter to 1:
    When the system begins the equipment logging process, then the loop counter (log-indx) is set to 1 to start processing from the first log-line entry.
  • Context - the system is iterating through log-line entries to log equipment information:
    For LOG-LINE Entry Empty?:
    When a log-line entry at the current loop index contains only spaces, then the system terminates the equipment logging loop and proceeds to completion.
    For LOG-LINE Entry Empty?:
    When a log-line entry at the current loop index contains data (not spaces), then the system proceeds to check the loop counter limit before retrieving the entry.
  • Context - the system is iterating through log-line entries with a non-empty entry at the current index:
    For Counter > 50?:
    When the loop counter (log-indx) is greater than 50, then the system terminates the equipment logging loop and proceeds to completion.
    For Counter > 50?:
    When the loop counter (log-indx) is less than or equal to 50, then the system proceeds to retrieve the log-line entry for logging.
  • Context - the loop counter is within valid range (1-50) and the log-line entry at current index is not empty:
    For Retrieve LOG-LINE Entry:
    When the system retrieves the log-line entry at the current loop index position, then the log-line entry containing equipment information is available for logging.
  • Context - a log-line entry has been retrieved from the array at the current loop index:
    For Move LOG-LINE to Message Field:
    When the system prepares the equipment information for logging, then the log-line entry content is moved to the ws-gcx105-info-msg field, clearing any previous content in that field.
  • Context - equipment information from log-line has been moved to ws-gcx105-info-msg field:
    For 42: Log Cargo Information Message:
    When the system invokes the z150-log-cargo-info-msg procedure, then the equipment information is logged to cargo history with current date, time, ccn, cargo type indicator, and action code.
  • Context - an equipment information entry has been successfully logged to cargo history:
    For Increment Loop Counter:
    When the system prepares to process the next log-line entry, then the loop counter (log-indx) is incremented by 1 to point to the next log-line entry in the array.
  • Context - the loop counter has been incremented to the next position:
    For LOG-LINE Entry Empty?:
    When the system continues the equipment logging loop, then the system evaluates whether the log-line entry at the new counter position is empty or contains data to determine if processing should continue.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been processed and all segments have been parsed
GIVEN
An EDI 350 message has been processed and all segments have been parsed
Applied to: N7 Segment Found?
WHEN
The N7 segment found indicator is set to false (WS-NO-N7-SEG-FOUND)
THEN
The system skips all N7 equipment logging operations and proceeds to the end of the logging process
Context: An EDI 350 message has been processed and N7 equipment segments were found
GIVEN
An EDI 350 message has been processed and N7 equipment segments were found
Applied to: N7 Segment Found?
WHEN
The N7 segment found indicator is set to true (WS-N7-SEGMENT-FOUND)
THEN
The system initiates the loop to process and log all equipment information from the LOG-LINE array starting at index 1
Context: N7 equipment segments were found in the EDI 350 message
GIVEN
N7 equipment segments were found in the EDI 350 message
Applied to: Initialize Loop Counter to 1
WHEN
The system begins the equipment logging process
THEN
The loop counter (LOG-INDX) is set to 1 to start processing from the first LOG-LINE entry
Context: The system is iterating through LOG-LINE entries to log equipment information
GIVEN
The system is iterating through LOG-LINE entries to log equipment information
Applied to: LOG-LINE Entry Empty?
WHEN
A LOG-LINE entry at the current loop index contains only spaces
THEN
The system terminates the equipment logging loop and proceeds to completion
Applied to: LOG-LINE Entry Empty?
WHEN
A LOG-LINE entry at the current loop index contains data (not spaces)
THEN
The system proceeds to check the loop counter limit before retrieving the entry
Context: The system is iterating through LOG-LINE entries with a non-empty entry at the current index
GIVEN
The system is iterating through LOG-LINE entries with a non-empty entry at the current index
Applied to: Counter > 50?
WHEN
The loop counter (LOG-INDX) is greater than 50
THEN
The system terminates the equipment logging loop and proceeds to completion
Applied to: Counter > 50?
WHEN
The loop counter (LOG-INDX) is less than or equal to 50
THEN
The system proceeds to retrieve the LOG-LINE entry for logging
Context: The loop counter is within valid range (1-50) and the LOG-LINE entry at current index is not empty
GIVEN
The loop counter is within valid range (1-50) and the LOG-LINE entry at current index is not empty
Applied to: Retrieve LOG-LINE Entry
WHEN
The system retrieves the LOG-LINE entry at the current loop index position
THEN
The LOG-LINE entry containing equipment information is available for logging
Context: A LOG-LINE entry has been retrieved from the array at the current loop index
GIVEN
A LOG-LINE entry has been retrieved from the array at the current loop index
Applied to: Move LOG-LINE to Message Field
WHEN
The system prepares the equipment information for logging
THEN
The LOG-LINE entry content is moved to the WS-GCX105-INFO-MSG field, clearing any previous content in that field
Context: Equipment information from LOG-LINE has been moved to WS-GCX105-INFO-MSG field
GIVEN
Equipment information from LOG-LINE has been moved to WS-GCX105-INFO-MSG field
Applied to: 42: Log Cargo Information Message
WHEN
The system invokes the Z150-LOG-CARGO-INFO-MSG procedure
THEN
The equipment information is logged to cargo history with current date, time, CCN, cargo type indicator, and action code
Context: An equipment information entry has been successfully logged to cargo history
GIVEN
An equipment information entry has been successfully logged to cargo history
Applied to: Increment Loop Counter
WHEN
The system prepares to process the next LOG-LINE entry
THEN
The loop counter (LOG-INDX) is incremented by 1 to point to the next LOG-LINE entry in the array
Context: The loop counter has been incremented to the next position
GIVEN
The loop counter has been incremented to the next position
Applied to: LOG-LINE Entry Empty?
WHEN
The system continues the equipment logging loop
THEN
The system evaluates whether the LOG-LINE entry at the new counter position is empty or contains data to determine if processing should continue
R-GCCUSIO-cbl-00186 (+10) File: GCCUSIO.cbl Iron Highway Notification Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Iron Highway Notification Processing':
  • Context - a cargo record is being processed for iron highway notification:
    For Status Change Required?:
    When both us cargo short description and cp cargo status description are empty or spaces, then skip the iron highway notification process entirely.
    For Station Configuration Found?:
    When the iron highway station configuration table lookup returns no matching record, then skip the iron highway notification process.
    For Determine Notification Status:
    When the cp cargo status description equals 'deleted', then set the iron highway notification status to 'deleted'.
    For Determine Notification Status:
    When the cp cargo status description equals 'release', then set the iron highway notification status to 'release'.
    For Determine Notification Status:
    When the us cargo short description is empty or spaces and the cp cargo status description equals 'sent ', then set the iron highway notification status to 'sent'.
    For Determine Notification Status:
    When the cargo status is not deleted, release, or the special sent case, then set the iron highway notification status to the us cargo short description value.
  • Context - a cargo record has a us cargo short description status:
    For Status Change Required?:
    When the us cargo short description equals 'release', then skip the iron highway notification process.
  • Context - a cargo record is being processed and has a saved previous status:
    For Status Change Required?:
    When the current cargo status matches the previously saved status and the status is not deleted or release, then skip the iron highway notification process.
  • Context - a cargo record requires iron highway notification processing:
    For Retrieve Iron Highway Station Configuration:
    When the system needs to check iron highway configuration, then retrieve table segment 'ih' using the waybill station number as the sequence id.
  • Context - iron highway station configuration is found and notification should proceed:
    For Extract N9 Reference Numbers:
    When the system processes n9 reference number segments for the cargo, then search through up to 20 n9 reference number qualifiers and extract the reference number where qualifier equals 'cn' as the shipment id.
  • Context - iron highway notification status has been determined and message prepared:
    For Send Notification to Iron Highway System:
    When all required notification data is available including car id, waybill number, ccn, and status, then send notification to iron highway system using record type 'uc' with car identification, waybill number, cargo control number, shipment id, and determined status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for Iron Highway notification
GIVEN
A cargo record is being processed for Iron Highway notification
Applied to: Status Change Required?
WHEN
Both US cargo short description and CP cargo status description are empty or spaces
THEN
Skip the Iron Highway notification process entirely
Applied to: Station Configuration Found?
WHEN
The Iron Highway station configuration table lookup returns no matching record
THEN
Skip the Iron Highway notification process
Applied to: Determine Notification Status
WHEN
The CP cargo status description equals 'DELETED'
THEN
Set the Iron Highway notification status to 'DELETED'
Applied to: Determine Notification Status
WHEN
The CP cargo status description equals 'RELEASE'
THEN
Set the Iron Highway notification status to 'RELEASE'
Applied to: Determine Notification Status
WHEN
The US cargo short description is empty or spaces AND the CP cargo status description equals 'SENT '
THEN
Set the Iron Highway notification status to 'SENT'
Applied to: Determine Notification Status
WHEN
The cargo status is not DELETED, RELEASE, or the special SENT case
THEN
Set the Iron Highway notification status to the US cargo short description value
Context: A cargo record has a US cargo short description status
GIVEN
A cargo record has a US cargo short description status
Applied to: Status Change Required?
WHEN
The US cargo short description equals 'RELEASE'
THEN
Skip the Iron Highway notification process
Context: A cargo record is being processed and has a saved previous status
GIVEN
A cargo record is being processed and has a saved previous status
Applied to: Status Change Required?
WHEN
The current cargo status matches the previously saved status AND the status is not DELETED or RELEASE
THEN
Skip the Iron Highway notification process
Context: A cargo record requires Iron Highway notification processing
GIVEN
A cargo record requires Iron Highway notification processing
Applied to: Retrieve Iron Highway Station Configuration
WHEN
The system needs to check Iron Highway configuration
THEN
Retrieve table segment 'IH' using the waybill station number as the sequence ID
Context: Iron Highway station configuration is found and notification should proceed
GIVEN
Iron Highway station configuration is found and notification should proceed
Applied to: Extract N9 Reference Numbers
WHEN
The system processes N9 reference number segments for the cargo
THEN
Search through up to 20 N9 reference number qualifiers and extract the reference number where qualifier equals 'CN' as the shipment ID
Context: Iron Highway notification status has been determined and message prepared
GIVEN
Iron Highway notification status has been determined and message prepared
Applied to: Send Notification to Iron Highway System
WHEN
All required notification data is available including car ID, waybill number, CCN, and status
THEN
Send notification to Iron Highway system using record type 'UC' with car identification, waybill number, cargo control number, shipment ID, and determined status
R-GCX126-cbl-00187 (+16) File: GCX126R.cbl Lookup Cargo by CCN Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Cargo by CCN':
  • Context - an edi 350 message has been parsed and m10 segment data is available:
    For Extract CCN from M10 Segment M10-07-CCN:
    When the cargo lookup process is initiated, then the ccn value from m10-07-ccn field (positions 1-25) is extracted and prepared for database search.
  • Context - the ccn has been extracted from m10-07-ccn field:
    For Set Search Keys: - CCRT-SSAQ Key = CCN - A2RT-SSAQ Key = CCN:
    When database search keys need to be established, then the ccn value is assigned to both ccrt-ssaq key-value and a2rt-ssaq key-value for qualified segment search.
  • Context - the search keys have been set with the ccn value:
    For Call Database GHU Function to Retrieve Cargo:
    When the cargo record retrieval is executed, then the system calls cims with ghu function code against gccc-pcb using ccrt-ssaq qualified search to retrieve gccc-cargo-report-segment.
  • Context - the ghu database call has been executed:
    For Cargo Record Found?:
    When the database status code is evaluated, then if cc-status-code is not spaces, the cargo is not found; if cc-status-code is spaces, the cargo is found.
  • Context - the database ghu call returned a non-space status code:
    For Set Status: WS-CARGO-NOT-FOUND:
    When the cargo existence check is completed, then the system sets ws-cargo-not-found to true and terminates the lookup process.
  • Context - the primary cargo record has been successfully retrieved:
    For Retrieve Secondary Cargo Segment GCSCCS52:
    When secondary segment retrieval is initiated, then the system calls cims with ghu function code against gca2-pcb using a2rt-ssaq qualified search to retrieve gcsccs52 segment, and if not found (status = 'ge'), initializes gcsccs52 to spaces.
  • Context - the database ghu call returned a space status code:
    For Set Status: WS-CARGO-FOUND:
    When the cargo existence check is completed, then the system sets ws-cargo-found to true and proceeds with additional status checks.
  • Context - the cargo record has been found and retrieved:
    For Cargo Deleted?:
    When the cargo delete status is evaluated, then if gccc-delete-status equals 'd', the cargo is deleted; otherwise, proceed to check returned status.
  • Context - the cargo record gccc-delete-status field equals 'd':
    For Set Status: WS-CARGO-DELETED:
    When the deleted status check is completed, then the system sets ws-cargo-deleted to true and proceeds to save cargo data.
  • Context - the cargo record is not deleted:
    For Cargo Returned?:
    When the cargo return status is evaluated, then if gccc-status-return is true, the cargo is returned; otherwise, proceed to check released status.
    For Cargo Released?:
    When the cargo release status is evaluated, then if gccc-release-status equals 'r', the cargo is released; otherwise, proceed to check if cargo is on a train.
    For Cargo On Train?:
    When the cargo train assignment is evaluated, then if gccc-cp-train-id is not spaces, the cargo is on a train; otherwise, proceed to save cargo data.
  • Context - the cargo record gccc-status-return condition is true:
    For Set Status: WS-CARGO-RETURNED:
    When the returned status check is completed, then the system sets ws-cargo-returned to true and proceeds to check released status.
  • Context - the cargo record gccc-release-status field equals 'r':
    For Set Status: WS-CARGO-RELEASED:
    When the released status check is completed, then the system sets ws-cargo-released to true and proceeds to check if cargo is on a train.
  • Context - the cargo record gccc-cp-train-id field is not spaces:
    For Set Status: WS-CARGO-ON-A-TRAIN:
    When the train assignment check is completed, then the system sets ws-cargo-on-a-train to true and proceeds to save cargo data.
  • Context - the cargo record has been successfully retrieved and status checks completed:
    For Save Cargo Data: - CCN Key - Equipment Car ID - Waybill Index - Release Information:
    When cargo data needs to be preserved for processing, then the system saves gccc-cargo-report-segment to ws-save-gcsccrt, gccc-ccn-key to ws-current-ccn-key and ws-save-ccn, gccc-equipment-car to ws-current-carid-key, gccc-release-information to ws-save-release-information, and gccc-waybill-key-for-index to save-waybill-index.
  • Context - the cargo record has been found and save-waybill-index is not blank:
    For Cargo Record Found?:
    When waybill validation is performed, then if gccc-waybill-key-for-index does not equal save-waybill-index, set ws-cargo-not-wb to true; otherwise, proceed with status checks.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been parsed and M10 segment data is available
GIVEN
An EDI 350 message has been parsed and M10 segment data is available
Applied to: Extract CCN from M10 Segment M10-07-CCN
WHEN
The cargo lookup process is initiated
THEN
The CCN value from M10-07-CCN field (positions 1-25) is extracted and prepared for database search
Context: The CCN has been extracted from M10-07-CCN field
GIVEN
The CCN has been extracted from M10-07-CCN field
Applied to: Set Search Keys: - CCRT-SSAQ Key = CCN - A2RT-SSAQ Key = CCN
WHEN
Database search keys need to be established
THEN
The CCN value is assigned to both CCRT-SSAQ KEY-VALUE and A2RT-SSAQ KEY-VALUE for qualified segment search
Context: The search keys have been set with the CCN value
GIVEN
The search keys have been set with the CCN value
Applied to: Call Database GHU Function to Retrieve Cargo
WHEN
The cargo record retrieval is executed
THEN
The system calls CIMS with GHU function code against GCCC-PCB using CCRT-SSAQ qualified search to retrieve GCCC-CARGO-REPORT-SEGMENT
Context: The GHU database call has been executed
GIVEN
The GHU database call has been executed
Applied to: Cargo Record Found?
WHEN
The database status code is evaluated
THEN
If CC-STATUS-CODE is not SPACES, the cargo is not found; if CC-STATUS-CODE is SPACES, the cargo is found
Context: The database GHU call returned a non-space status code
GIVEN
The database GHU call returned a non-space status code
Applied to: Set Status: WS-CARGO-NOT-FOUND
WHEN
The cargo existence check is completed
THEN
The system sets WS-CARGO-NOT-FOUND to TRUE and terminates the lookup process
Context: The primary cargo record has been successfully retrieved
GIVEN
The primary cargo record has been successfully retrieved
Applied to: Retrieve Secondary Cargo Segment GCSCCS52
WHEN
Secondary segment retrieval is initiated
THEN
The system calls CIMS with GHU function code against GCA2-PCB using A2RT-SSAQ qualified search to retrieve GCSCCS52 segment, and if not found (status = 'GE'), initializes GCSCCS52 to SPACES
Context: The database GHU call returned a space status code
GIVEN
The database GHU call returned a space status code
Applied to: Set Status: WS-CARGO-FOUND
WHEN
The cargo existence check is completed
THEN
The system sets WS-CARGO-FOUND to TRUE and proceeds with additional status checks
Context: The cargo record has been found and retrieved
GIVEN
The cargo record has been found and retrieved
Applied to: Cargo Deleted?
WHEN
The cargo delete status is evaluated
THEN
If GCCC-DELETE-STATUS equals 'D', the cargo is deleted; otherwise, proceed to check returned status
Context: The cargo record GCCC-DELETE-STATUS field equals 'D'
GIVEN
The cargo record GCCC-DELETE-STATUS field equals 'D'
Applied to: Set Status: WS-CARGO-DELETED
WHEN
The deleted status check is completed
THEN
The system sets WS-CARGO-DELETED to TRUE and proceeds to save cargo data
Context: The cargo record is not deleted
GIVEN
The cargo record is not deleted
Applied to: Cargo Returned?
WHEN
The cargo return status is evaluated
THEN
If GCCC-STATUS-RETURN is TRUE, the cargo is returned; otherwise, proceed to check released status
Applied to: Cargo Released?
WHEN
The cargo release status is evaluated
THEN
If GCCC-RELEASE-STATUS equals 'R', the cargo is released; otherwise, proceed to check if cargo is on a train
Applied to: Cargo On Train?
WHEN
The cargo train assignment is evaluated
THEN
If GCCC-CP-TRAIN-ID is not SPACES, the cargo is on a train; otherwise, proceed to save cargo data
Context: The cargo record GCCC-STATUS-RETURN condition is TRUE
GIVEN
The cargo record GCCC-STATUS-RETURN condition is TRUE
Applied to: Set Status: WS-CARGO-RETURNED
WHEN
The returned status check is completed
THEN
The system sets WS-CARGO-RETURNED to TRUE and proceeds to check released status
Context: The cargo record GCCC-RELEASE-STATUS field equals 'R'
GIVEN
The cargo record GCCC-RELEASE-STATUS field equals 'R'
Applied to: Set Status: WS-CARGO-RELEASED
WHEN
The released status check is completed
THEN
The system sets WS-CARGO-RELEASED to TRUE and proceeds to check if cargo is on a train
Context: The cargo record GCCC-CP-TRAIN-ID field is not SPACES
GIVEN
The cargo record GCCC-CP-TRAIN-ID field is not SPACES
Applied to: Set Status: WS-CARGO-ON-A-TRAIN
WHEN
The train assignment check is completed
THEN
The system sets WS-CARGO-ON-A-TRAIN to TRUE and proceeds to save cargo data
Context: The cargo record has been successfully retrieved and status checks completed
GIVEN
The cargo record has been successfully retrieved and status checks completed
Applied to: Save Cargo Data: - CCN Key - Equipment Car ID - Waybill Index - Release Information
WHEN
Cargo data needs to be preserved for processing
THEN
The system saves GCCC-CARGO-REPORT-SEGMENT to WS-SAVE-GCSCCRT, GCCC-CCN-KEY to WS-CURRENT-CCN-KEY and WS-SAVE-CCN, GCCC-EQUIPMENT-CAR to WS-CURRENT-CARID-KEY, GCCC-RELEASE-INFORMATION to WS-SAVE-RELEASE-INFORMATION, and GCCC-WAYBILL-KEY-FOR-INDEX to SAVE-WAYBILL-INDEX
Context: The cargo record has been found and SAVE-WAYBILL-INDEX is not blank
GIVEN
The cargo record has been found and SAVE-WAYBILL-INDEX is not blank
Applied to: Cargo Record Found?
WHEN
Waybill validation is performed
THEN
If GCCC-WAYBILL-KEY-FOR-INDEX does not equal SAVE-WAYBILL-INDEX, set WS-CARGO-NOT-WB to TRUE; otherwise, proceed with status checks
R-GCCUSIO-cbl-00197 (+6) File: GCCUSIO.cbl Reference Number Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Reference Number Processing':
  • Context - a cargo record with a valid us ccn key exists:
    For Build Secondary Data Key - Use Cargo Control Number - Set Record Type '02' - Set Sequence '0001':
    When the system needs to retrieve n9 reference data for the cargo, then the system builds a secondary data key using the cargo's us ccn key, sets record type to '02', and sets sequence number to '0001'.
  • Context - a secondary data key has been constructed with cargo control number, record type '02', and sequence '0001':
    For Retrieve Secondary Cargo Data GCSUSS02 Segment:
    When the system executes a retrieval operation for secondary cargo data, then the system calls the database interface to retrieve the gcsuss02 segment using the qualified key.
  • Context - a retrieval operation for secondary cargo data has been executed:
    For Secondary Data Found?:
    When the system checks the operation result status, then if the status code is spaces (successful), secondary data is available for n9 processing, otherwise no secondary data is available.
  • Context - secondary cargo data has been successfully retrieved:
    For Initialize N9 Counter to Zero:
    When the system prepares to process n9 reference entries, then the system sets the n9 counter to zero to begin iteration from the first entry.
  • Context - the n9 counter has been initialized and secondary data is available:
    For Loop Through 20 N9 Reference Entries:
    When the system processes n9 reference entries, then the system performs 20 iterations, incrementing the n9 counter by 1 each time to access each reference entry.
  • Context - an n9 reference entry is being processed during the iteration:
    For N9 Qualifier = 'CN' 'Shipment ID'?:
    When the system examines the n9 reference number qualifier for the current entry, then if the qualifier equals 'cn', the entry contains shipment id information, otherwise it contains other reference data.
  • Context - an n9 reference entry has qualifier 'cn' indicating shipment id:
    For Extract Reference Number as Shipment ID:
    When the system processes this qualified reference entry, then the system moves the n9 reference number value to the shipment id field for notification purposes.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with a valid US CCN key exists
GIVEN
A cargo record with a valid US CCN key exists
Applied to: Build Secondary Data Key - Use Cargo Control Number - Set Record Type '02' - Set Sequence '0001'
WHEN
The system needs to retrieve N9 reference data for the cargo
THEN
The system builds a secondary data key using the cargo's US CCN key, sets record type to '02', and sets sequence number to '0001'
Context: A secondary data key has been constructed with cargo control number, record type '02', and sequence '0001'
GIVEN
A secondary data key has been constructed with cargo control number, record type '02', and sequence '0001'
Applied to: Retrieve Secondary Cargo Data GCSUSS02 Segment
WHEN
The system executes a retrieval operation for secondary cargo data
THEN
The system calls the database interface to retrieve the GCSUSS02 segment using the qualified key
Context: A retrieval operation for secondary cargo data has been executed
GIVEN
A retrieval operation for secondary cargo data has been executed
Applied to: Secondary Data Found?
WHEN
The system checks the operation result status
THEN
If the status code is spaces (successful), secondary data is available for N9 processing, otherwise no secondary data is available
Context: Secondary cargo data has been successfully retrieved
GIVEN
Secondary cargo data has been successfully retrieved
Applied to: Initialize N9 Counter to Zero
WHEN
The system prepares to process N9 reference entries
THEN
The system sets the N9 counter to zero to begin iteration from the first entry
Context: The N9 counter has been initialized and secondary data is available
GIVEN
The N9 counter has been initialized and secondary data is available
Applied to: Loop Through 20 N9 Reference Entries
WHEN
The system processes N9 reference entries
THEN
The system performs 20 iterations, incrementing the N9 counter by 1 each time to access each reference entry
Context: An N9 reference entry is being processed during the iteration
GIVEN
An N9 reference entry is being processed during the iteration
Applied to: N9 Qualifier = 'CN' 'Shipment ID'?
WHEN
The system examines the N9 reference number qualifier for the current entry
THEN
If the qualifier equals 'CN', the entry contains shipment ID information, otherwise it contains other reference data
Context: An N9 reference entry has qualifier 'CN' indicating shipment ID
GIVEN
An N9 reference entry has qualifier 'CN' indicating shipment ID
Applied to: Extract Reference Number as Shipment ID
WHEN
The system processes this qualified reference entry
THEN
The system moves the N9 reference number value to the shipment ID field for notification purposes
R-GCCUSIO-cbl-00204 (+1) File: GCCUSIO.cbl Audit Trail Management Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Audit Trail Management':
  • Context - a cargo record is being inserted and the creation timestamp field is empty (spaces):
    For Set Creation Audit Fields:
    When the system processes the record creation, then the system sets creation century from machine century, creation date from machine date, creation time from machine time hours and minutes, creation terminal from originating terminal, creation user id from acf2 user id, and copies all creation information to last modification fields.
  • Context - a cargo record is being updated and the creation timestamp field is not empty:
    For Set Last Modification Audit Fields:
    When the system processes the record modification, then the system updates last modification century from machine century, last modification date from machine date, last modification time from machine time hours and minutes, last modification terminal from originating terminal, and last modification user id from acf2 user id while preserving existing creation audit information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being inserted and the creation timestamp field is empty (spaces)
GIVEN
A cargo record is being inserted and the creation timestamp field is empty (spaces)
Applied to: Set Creation Audit Fields
WHEN
The system processes the record creation
THEN
The system sets creation century from machine century, creation date from machine date, creation time from machine time hours and minutes, creation terminal from originating terminal, creation user ID from ACF2 user ID, and copies all creation information to last modification fields
Context: A cargo record is being updated and the creation timestamp field is not empty
GIVEN
A cargo record is being updated and the creation timestamp field is not empty
Applied to: Set Last Modification Audit Fields
WHEN
The system processes the record modification
THEN
The system updates last modification century from machine century, last modification date from machine date, last modification time from machine time hours and minutes, last modification terminal from originating terminal, and last modification user ID from ACF2 user ID while preserving existing creation audit information
R-GCX126-cbl-00204 (+9) File: GCX126R.cbl Handle Unknown Cargo Release Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Unknown Cargo Release':
  • Context - an edi 350 message has been received with a ccn (cargo control number) in the m10 segment:
    For Cargo Found?:
    When the system attempts to retrieve the cargo record using the ccn, then the system determines if the cargo record exists or not found in the database.
  • Context - cargo record is not found in the database:
    For Notice Reason = RELEASED?:
    When the v9 segment notice reason code is evaluated, then the system checks if the notice reason code equals released (v9-02-released).
  • Context - cargo is not found and notice reason is released:
    For Prepare Error Report:
    When the system prepares to send an error notification, then the system initializes the merlin report structure (mrln-350-report) with spaces.
  • Context - the error report structure is initialized:
    For Set Report Line 1: 'UNKNOWN EDI 350 RELEASE FROM CBSA' + CCN:
    When the system constructs the error message, then the system sets mrln-dtl-line(01) to 'unknown edi 350 release from cbsa ' concatenated with the ccn from m10-07-ccn (first 25 characters).
  • Context - the first line of the error message has been set:
    For Set Report Line 3: 'THIS CCN WAS NOT FOUND.':
    When the system continues building the error message, then the system sets mrln-dtl-line(03) to 'this ccn was not found.'.
  • Context - the explanatory text has been added to line 3:
    For Set Report Line 4: 'RELEASE NUMBER:' + Release Reference + 'DONE BY PORT' + Port Code:
    When the system adds release details to the error message, then the system sets mrln-dtl-line(04) by concatenating 'release number: ', x4-01-cbsa-rel-ref-id (first 15 characters), ' done by port ', and p4-01-port-cde (first 4 characters).
  • Context - all error message lines have been populated:
    For Set Report Line Count = 5:
    When the system finalizes the error report structure, then the system sets mrln-line to 5 indicating the total number of report lines.
  • Context - the report line count has been set:
    For Set Report Type = UNKNOWN:
    When the system classifies the error report type, then the system sets the report type indicator to 88-z110-mrln-type-is-unknown (true).
  • Context - the error report type has been set to unknown:
    For Route Email to OM01247:
    When the system prepares to send the email notification, then the system sets emi-destination-filename to 'unknown', clears emi-to-usercode to spaces, and sets emi-to-usercodes(01) to 'om01247'.
  • Context - the email routing has been configured to om01247 with destination unknown:
    For Send Email Notification:
    When the system executes the notification process, then the system performs z115-call-emcsend to send the email notification with the error report details.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received with a CCN (Cargo Control Number) in the M10 segment
GIVEN
An EDI 350 message has been received with a CCN (Cargo Control Number) in the M10 segment
Applied to: Cargo Found?
WHEN
The system attempts to retrieve the cargo record using the CCN
THEN
The system determines if the cargo record exists or not found in the database
Context: Cargo record is not found in the database
GIVEN
Cargo record is not found in the database
Applied to: Notice Reason = RELEASED?
WHEN
The V9 segment notice reason code is evaluated
THEN
The system checks if the notice reason code equals RELEASED (V9-02-RELEASED)
Context: Cargo is not found and notice reason is RELEASED
GIVEN
Cargo is not found and notice reason is RELEASED
Applied to: Prepare Error Report
WHEN
The system prepares to send an error notification
THEN
The system initializes the Merlin report structure (MRLN-350-REPORT) with spaces
Context: The error report structure is initialized
GIVEN
The error report structure is initialized
Applied to: Set Report Line 1: 'UNKNOWN EDI 350 RELEASE FROM CBSA' + CCN
WHEN
The system constructs the error message
THEN
The system sets MRLN-DTL-LINE(01) to 'UNKNOWN EDI 350 RELEASE FROM CBSA ' concatenated with the CCN from M10-07-CCN (first 25 characters)
Context: The first line of the error message has been set
GIVEN
The first line of the error message has been set
Applied to: Set Report Line 3: 'THIS CCN WAS NOT FOUND.'
WHEN
The system continues building the error message
THEN
The system sets MRLN-DTL-LINE(03) to 'THIS CCN WAS NOT FOUND.'
Context: The explanatory text has been added to line 3
GIVEN
The explanatory text has been added to line 3
Applied to: Set Report Line 4: 'RELEASE NUMBER:' + Release Reference + 'DONE BY PORT' + Port Code
WHEN
The system adds release details to the error message
THEN
The system sets MRLN-DTL-LINE(04) by concatenating 'RELEASE NUMBER: ', X4-01-CBSA-REL-REF-ID (first 15 characters), ' DONE BY PORT ', and P4-01-PORT-CDE (first 4 characters)
Context: All error message lines have been populated
GIVEN
All error message lines have been populated
Applied to: Set Report Line Count = 5
WHEN
The system finalizes the error report structure
THEN
The system sets MRLN-LINE to 5 indicating the total number of report lines
Context: The report line count has been set
GIVEN
The report line count has been set
Applied to: Set Report Type = UNKNOWN
WHEN
The system classifies the error report type
THEN
The system sets the report type indicator to 88-Z110-MRLN-TYPE-IS-UNKNOWN (TRUE)
Context: The error report type has been set to UNKNOWN
GIVEN
The error report type has been set to UNKNOWN
Applied to: Route Email to OM01247
WHEN
The system prepares to send the email notification
THEN
The system sets EMI-DESTINATION-FILENAME to 'UNKNOWN', clears EMI-TO-USERCODE to spaces, and sets EMI-TO-USERCODES(01) to 'OM01247'
Context: The email routing has been configured to OM01247 with destination UNKNOWN
GIVEN
The email routing has been configured to OM01247 with destination UNKNOWN
Applied to: Send Email Notification
WHEN
The system executes the notification process
THEN
The system performs Z115-CALL-EMCSEND to send the email notification with the error report details
R-GCCUSIO-cbl-00206 (+3) File: GCCUSIO.cbl Bond Control Number Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Control Number Processing':
  • Context - a cargo record is being processed for bond control number indexing:
    For Is Cargo Deleted?:
    When the cargo status indicates it has been deleted (88-gcusrt-rt10-cpcargo-deleted is true), then bond control number processing is skipped and control exits the procedure.
  • Context - a cargo record requires bond number index population and cargo is not deleted:
    For In-Bond Control Number Available?:
    When the in-bond control number field (gcusrt-m1206-in-bond-ctrl-num) contains a value other than spaces, then the in-bond control number is used to populate the bond number index field (gcusrt-rt074-bond-num-index).
  • Context - a cargo record requires bond number index population, cargo is not deleted, and in-bond control number is not available (spaces):
    For Entry Number Available?:
    When the entry number field (gcusrt-m1202-entry-num) contains a value other than spaces, then the entry number is used to populate the bond number index field (gcusrt-rt074-bond-num-index).
  • Context - a cargo record requires bond number index population, cargo is not deleted, in-bond control number is not available (spaces), and entry number is not available (spaces):
    For Entry Number Not Present:
    When both control number fields are empty, then the bond number index field (gcusrt-rt074-bond-num-index) is set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for bond control number indexing
GIVEN
A cargo record is being processed for bond control number indexing
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it has been deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
Bond control number processing is skipped and control exits the procedure
Context: A cargo record requires bond number index population and cargo is not deleted
GIVEN
A cargo record requires bond number index population and cargo is not deleted
Applied to: In-Bond Control Number Available?
WHEN
The in-bond control number field (GCUSRT-M1206-IN-BOND-CTRL-NUM) contains a value other than spaces
THEN
The in-bond control number is used to populate the bond number index field (GCUSRT-RT074-BOND-NUM-INDEX)
Context: A cargo record requires bond number index population, cargo is not deleted, and in-bond control number is not available (spaces)
GIVEN
A cargo record requires bond number index population, cargo is not deleted, and in-bond control number is not available (spaces)
Applied to: Entry Number Available?
WHEN
The entry number field (GCUSRT-M1202-ENTRY-NUM) contains a value other than spaces
THEN
The entry number is used to populate the bond number index field (GCUSRT-RT074-BOND-NUM-INDEX)
Context: A cargo record requires bond number index population, cargo is not deleted, in-bond control number is not available (spaces), and entry number is not available (spaces)
GIVEN
A cargo record requires bond number index population, cargo is not deleted, in-bond control number is not available (spaces), and entry number is not available (spaces)
Applied to: Entry Number Not Present
WHEN
Both control number fields are empty
THEN
The bond number index field (GCUSRT-RT074-BOND-NUM-INDEX) is set to spaces
R-GCCUSIO-cbl-00210 (+6) File: GCCUSIO.cbl Station Code Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Code Processing':
  • Context - a cargo record exists with origin station information and error conditions are being processed:
    For Extract Origin Station Code:
    When the system processes error field population, then the origin station number from the cargo record is extracted and assigned to the error origin index field with error code 'e'.
  • Context - a cargo record exists with destination station information and error conditions are being processed:
    For Extract Destination Station Code:
    When the system processes error field population, then the destination station number from the cargo record is extracted and assigned to the error destination index field with error code 'e'.
  • Context - a cargo record exists with location id information and error conditions are being processed:
    For Determine Border Station Code:
    When the system needs to determine the border station for error processing, then the system performs a table lookup using 'mc' table id and the cargo's location id as the sequence id to retrieve the border station information.
  • Context - an mc table lookup has been performed and returned successfully with return flag '0':
    For Set Border Station from Table:
    When the system processes the table lookup results for border station determination, then the station number is extracted from the mc table segment and assigned to the error border index field with error code 'e'.
  • Context - a cargo record has error or pending conditions that require error index population:
    For Populate Error Index Fields:
    When the system processes error field population, then the system sets error code 'e' for origin, border, and destination fields, populates origin error index with origin station number, populates destination error index with destination station number, populates border error index with border station number from mc table lookup, and assigns the cargo ccn key to all error cargo index fields.
  • Context - a cargo record has hold conditions including uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-d, uscargo-pr-h-de, or uscargo-holdfda:
    For Populate Hold Index Fields:
    When the system processes hold field population for destination-related holds, then the destination station number from the cargo record is assigned to the held destination index field and the cargo ccn key is assigned to the held destination cargo index field.
  • Context - a cargo record has hold conditions including uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-b, uscargo-pr-h-bo, or uscargo-holdfda:
    For Populate Hold Index Fields:
    When the system processes hold field population for border-related holds, then the system performs mc table lookup using the cargo's location id, and if successful (return flag '0'), extracts the station number from the mc table segment and assigns it to the held border index field, and assigns the cargo ccn key to the held border cargo index field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with origin station information and error conditions are being processed
GIVEN
A cargo record exists with origin station information and error conditions are being processed
Applied to: Extract Origin Station Code
WHEN
The system processes error field population
THEN
The origin station number from the cargo record is extracted and assigned to the error origin index field with error code 'E'
Context: A cargo record exists with destination station information and error conditions are being processed
GIVEN
A cargo record exists with destination station information and error conditions are being processed
Applied to: Extract Destination Station Code
WHEN
The system processes error field population
THEN
The destination station number from the cargo record is extracted and assigned to the error destination index field with error code 'E'
Context: A cargo record exists with location ID information and error conditions are being processed
GIVEN
A cargo record exists with location ID information and error conditions are being processed
Applied to: Determine Border Station Code
WHEN
The system needs to determine the border station for error processing
THEN
The system performs a table lookup using 'MC' table ID and the cargo's location ID as the sequence ID to retrieve the border station information
Context: An MC table lookup has been performed and returned successfully with return flag '0'
GIVEN
An MC table lookup has been performed and returned successfully with return flag '0'
Applied to: Set Border Station from Table
WHEN
The system processes the table lookup results for border station determination
THEN
The station number is extracted from the MC table segment and assigned to the error border index field with error code 'E'
Context: A cargo record has error or pending conditions that require error index population
GIVEN
A cargo record has error or pending conditions that require error index population
Applied to: Populate Error Index Fields
WHEN
The system processes error field population
THEN
The system sets error code 'E' for origin, border, and destination fields, populates origin error index with origin station number, populates destination error index with destination station number, populates border error index with border station number from MC table lookup, and assigns the cargo CCN key to all error cargo index fields
Context: A cargo record has hold conditions including USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-D, USCARGO-PR-H-DE, or USCARGO-HOLDFDA
GIVEN
A cargo record has hold conditions including USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-D, USCARGO-PR-H-DE, or USCARGO-HOLDFDA
Applied to: Populate Hold Index Fields
WHEN
The system processes hold field population for destination-related holds
THEN
The destination station number from the cargo record is assigned to the held destination index field and the cargo CCN key is assigned to the held destination cargo index field
Context: A cargo record has hold conditions including USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, or USCARGO-HOLDFDA
GIVEN
A cargo record has hold conditions including USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, or USCARGO-HOLDFDA
Applied to: Populate Hold Index Fields
WHEN
The system processes hold field population for border-related holds
THEN
The system performs MC table lookup using the cargo's location ID, and if successful (return flag '0'), extracts the station number from the MC table segment and assigns it to the held border index field, and assigns the cargo CCN key to the held border cargo index field
R-GCX126-cbl-00214 (+5) File: GCX126R.cbl Handle Unknown Cargo Deconsolidation Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Unknown Cargo Deconsolidation':
  • Context - an edi 350 message has been received and parsed with v9 segment containing notice reason code indicating decon, and the cargo lookup using the ccn from m10 segment has returned cargo not found status:
    For Check Notice Reason is DECON?:
    When the system evaluates the cargo not found condition and the v9-02-decon notice reason code is true, then the system prepares an error report with subject line 'unknown edi 350 dcon notice' followed by the ccn from m10-07-ccn field (first 25 characters), sets detail line 3 to 'this ccn was not found.', sets detail line 4 with house bill close number from x4-01-cbsa-rel-ref-id (first 25 characters) and port code from p4-01-port-cde (first 4 characters) in format 'house bill close number [value] done by port [value]', sets total lines to 5, marks message type as unknown, routes the notification to user om01247 with filename unknown, and invokes the email notification process.
  • Context - the cargo not found condition exists and v9-02-decon notice reason code is true:
    For Prepare Error Report: Subject, Include CCN, Message:
    When the system begins preparing the error notification, then the system clears mrln-dtl-line array element 1, constructs a string 'unknown edi 350 dcon notice ' concatenated with m10-07-ccn field positions 1 through 25 and stores it in mrln-dtl-line element 1, and sets mrln-dtl-line element 3 to the literal value 'this ccn was not found.'.
  • Context - the error report header has been prepared with subject and primary message:
    For Add House Bill Close Information: House Bill Close Number, Port Code:
    When the system adds detailed information to the error report, then the system constructs a string starting with 'house bill close number' followed by x4-01-cbsa-rel-ref-id field positions 1 through 25, then ' done by port ' followed by p4-01-port-cde field positions 1 through 4, and stores this complete string in mrln-dtl-line array element 4.
  • Context - all detail lines for the deconsolidation error report have been populated:
    For Prepare Error Report: Subject, Include CCN, Message:
    When the system finalizes the error report structure, then the system sets mrln-line to value 5 indicating 5 detail lines are present and sets the 88-level condition 88-z110-mrln-type-is-unknown to true.
  • Context - the error report has been fully prepared with all detail lines and message type set to unknown:
    For Set Email Routing: Route to OM01247, Filename UNKNOWN:
    When the system determines the routing for the error notification, then the system sets emi-destination-filename to 'unknown', clears emi-to-usercode to spaces, and sets emi-to-usercodes array element 1 to 'om01247'.
  • Context - the error report is complete with subject line, detail lines, message type set to unknown, and routing configured to user om01247 with filename unknown:
    For Send Error Email Notification via EMCSEND2:
    When the system is ready to send the notification, then the system invokes the z115-call-emcsend procedure which calls the emcsend2 program passing the from usercode, destination filename, to usercode, copy usercode, subject, keywords, report content, return status flag, segment numbers, and item type parameters.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received and parsed with V9 segment containing notice reason code indicating DECON, and the cargo lookup using the CCN from M10 segment has returned cargo not found status
GIVEN
An EDI 350 message has been received and parsed with V9 segment containing notice reason code indicating DECON, and the cargo lookup using the CCN from M10 segment has returned cargo not found status
Applied to: Check Notice Reason is DECON?
WHEN
The system evaluates the cargo not found condition and the V9-02-DECON notice reason code is true
THEN
The system prepares an error report with subject line 'UNKNOWN EDI 350 DCON NOTICE' followed by the CCN from M10-07-CCN field (first 25 characters), sets detail line 3 to 'THIS CCN WAS NOT FOUND.', sets detail line 4 with house bill close number from X4-01-CBSA-REL-REF-ID (first 25 characters) and port code from P4-01-PORT-CDE (first 4 characters) in format 'HOUSE BILL CLOSE NUMBER [value] DONE BY PORT [value]', sets total lines to 5, marks message type as unknown, routes the notification to user OM01247 with filename UNKNOWN, and invokes the email notification process
Context: The cargo not found condition exists and V9-02-DECON notice reason code is true
GIVEN
The cargo not found condition exists and V9-02-DECON notice reason code is true
Applied to: Prepare Error Report: Subject, Include CCN, Message
WHEN
The system begins preparing the error notification
THEN
The system clears MRLN-DTL-LINE array element 1, constructs a string 'UNKNOWN EDI 350 DCON NOTICE ' concatenated with M10-07-CCN field positions 1 through 25 and stores it in MRLN-DTL-LINE element 1, and sets MRLN-DTL-LINE element 3 to the literal value 'THIS CCN WAS NOT FOUND.'
Context: The error report header has been prepared with subject and primary message
GIVEN
The error report header has been prepared with subject and primary message
Applied to: Add House Bill Close Information: House Bill Close Number, Port Code
WHEN
The system adds detailed information to the error report
THEN
The system constructs a string starting with 'HOUSE BILL CLOSE NUMBER' followed by X4-01-CBSA-REL-REF-ID field positions 1 through 25, then ' DONE BY PORT ' followed by P4-01-PORT-CDE field positions 1 through 4, and stores this complete string in MRLN-DTL-LINE array element 4
Context: All detail lines for the deconsolidation error report have been populated
GIVEN
All detail lines for the deconsolidation error report have been populated
Applied to: Prepare Error Report: Subject, Include CCN, Message
WHEN
The system finalizes the error report structure
THEN
The system sets MRLN-LINE to value 5 indicating 5 detail lines are present and sets the 88-level condition 88-Z110-MRLN-TYPE-IS-UNKNOWN to true
Context: The error report has been fully prepared with all detail lines and message type set to unknown
GIVEN
The error report has been fully prepared with all detail lines and message type set to unknown
Applied to: Set Email Routing: Route to OM01247, Filename UNKNOWN
WHEN
The system determines the routing for the error notification
THEN
The system sets EMI-DESTINATION-FILENAME to 'UNKNOWN', clears EMI-TO-USERCODE to spaces, and sets EMI-TO-USERCODES array element 1 to 'OM01247'
Context: The error report is complete with subject line, detail lines, message type set to unknown, and routing configured to user OM01247 with filename UNKNOWN
GIVEN
The error report is complete with subject line, detail lines, message type set to unknown, and routing configured to user OM01247 with filename UNKNOWN
Applied to: Send Error Email Notification via EMCSEND2
WHEN
The system is ready to send the notification
THEN
The system invokes the Z115-CALL-EMCSEND procedure which calls the EMCSEND2 program passing the from usercode, destination filename, to usercode, copy usercode, subject, keywords, report content, return status flag, segment numbers, and item type parameters
R-GCCUSIO-cbl-00217 (+8) File: GCCUSIO.cbl Cargo Status Transition Management Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Status Transition Management':
  • Context - a cargo record exists with hold conditions but no error conditions (not cpcargo-error, not cpcargo-pending, not uscargo-error):
    For Remove Error Index Entries:
    When the cargo status is being updated, then the system clears error origin index, error destination index, and error border index fields to spaces.
  • Context - a cargo record exists with error conditions but no hold conditions (not uscargo-hold, not uscargo-holdpcs, not uscargo-pr-hpcs, not uscargo-hold-b, not uscargo-pr-h-bo, not uscargo-hold-d, not uscargo-pr-h-de, not uscargo-holdfda):
    For Remove Hold Index Entries:
    When the cargo status is being updated, then the system clears held destination index and held border index fields to spaces.
  • Context - a cargo record has error conditions (cpcargo-error or cpcargo-pending or uscargo-error):
    For Create Error Index Entries:
    When the cargo status is being updated, then the system sets error code to 'e', populates error origin with origin station number, error border with border station number from mc table lookup, error destination with destination station number, and associates all error indexes with the cargo ccn key.
  • Context - a cargo record has hold conditions (uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda or uscargo-hold-b or uscargo-pr-h-bo):
    For Create Hold Index Entries:
    When the cargo status is being updated, then the system populates held destination index with destination station number and cargo ccn for destination holds, and populates held border index with border station number from mc table lookup and cargo ccn for border holds.
  • Context - a cargo record has no error conditions (not cpcargo-error, not cpcargo-pending, not uscargo-error) and no hold conditions (not uscargo-hold, not uscargo-holdpcs, not uscargo-pr-hpcs, not uscargo-hold-b, not uscargo-pr-h-bo, not uscargo-hold-d, not uscargo-pr-h-de, not uscargo-holdfda):
    For Delete GCSB1RT Index Record:
    When the cargo status is being updated, then the system deletes the cargo record from the gcsb1rt status index table.
  • Context - a cargo record exists in the status index table and has either error conditions or hold conditions but not both cleared:
    For Update GCSB1RT Index Record:
    When the cargo status is being updated, then the system updates the existing gcsb1rt record with the current index field values.
  • Context - a cargo record has error conditions (cpcargo-error or cpcargo-pending or uscargo-error) or hold conditions (uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-b or uscargo-pr-h-bo or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda) and no existing status index record exists:
    For Create New GCSB1RT Index Record:
    When the cargo status is being updated, then the system creates a new gcsb1rt record with the cargo ccn key and populated index fields.
  • Context - a cargo record has an internal cp cargo status code:
    For Set Cargo Status Description:
    When the cargo status description needs to be set, then the system maps the internal status code to the corresponding business description: ok to 'ok', pending to 'pending', acknwlg to 'ack', error to 'error', sent to 'sent', deleted to 'deleted', delpend to 'delpend', relsd to 'released', arrival to 'mnl-arrv', aarr to 'aut-arrv', export to 'mnl-exp', aexp to 'aut-exp', imed-ex to 'imed-exp', xfered to 'xfered', or uses the original status code if no mapping exists.
  • Context - a cargo record is being modified with insert, replace, delete, or zap operations:
    For Update Last Modification Timestamp:
    When the cargo status is being updated, then the system updates the last modification fields with current machine century, date, time, originating terminal, and user id.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with hold conditions but no error conditions (not CPCARGO-ERROR, not CPCARGO-PENDING, not USCARGO-ERROR)
GIVEN
A cargo record exists with hold conditions but no error conditions (not CPCARGO-ERROR, not CPCARGO-PENDING, not USCARGO-ERROR)
Applied to: Remove Error Index Entries
WHEN
The cargo status is being updated
THEN
The system clears error origin index, error destination index, and error border index fields to spaces
Context: A cargo record exists with error conditions but no hold conditions (not USCARGO-HOLD, not USCARGO-HOLDPCS, not USCARGO-PR-HPCS, not USCARGO-HOLD-B, not USCARGO-PR-H-BO, not USCARGO-HOLD-D, not USCARGO-PR-H-DE, not USCARGO-HOLDFDA)
GIVEN
A cargo record exists with error conditions but no hold conditions (not USCARGO-HOLD, not USCARGO-HOLDPCS, not USCARGO-PR-HPCS, not USCARGO-HOLD-B, not USCARGO-PR-H-BO, not USCARGO-HOLD-D, not USCARGO-PR-H-DE, not USCARGO-HOLDFDA)
Applied to: Remove Hold Index Entries
WHEN
The cargo status is being updated
THEN
The system clears held destination index and held border index fields to spaces
Context: A cargo record has error conditions (CPCARGO-ERROR or CPCARGO-PENDING or USCARGO-ERROR)
GIVEN
A cargo record has error conditions (CPCARGO-ERROR or CPCARGO-PENDING or USCARGO-ERROR)
Applied to: Create Error Index Entries
WHEN
The cargo status is being updated
THEN
The system sets error code to 'E', populates error origin with origin station number, error border with border station number from MC table lookup, error destination with destination station number, and associates all error indexes with the cargo CCN key
Context: A cargo record has hold conditions (USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA or USCARGO-HOLD-B or USCARGO-PR-H-BO)
GIVEN
A cargo record has hold conditions (USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA or USCARGO-HOLD-B or USCARGO-PR-H-BO)
Applied to: Create Hold Index Entries
WHEN
The cargo status is being updated
THEN
The system populates held destination index with destination station number and cargo CCN for destination holds, and populates held border index with border station number from MC table lookup and cargo CCN for border holds
Context: A cargo record has no error conditions (not CPCARGO-ERROR, not CPCARGO-PENDING, not USCARGO-ERROR) and no hold conditions (not USCARGO-HOLD, not USCARGO-HOLDPCS, not USCARGO-PR-HPCS, not USCARGO-HOLD-B, not USCARGO-PR-H-BO, not USCARGO-HOLD-D, not USCARGO-PR-H-DE, not USCARGO-HOLDFDA)
GIVEN
A cargo record has no error conditions (not CPCARGO-ERROR, not CPCARGO-PENDING, not USCARGO-ERROR) and no hold conditions (not USCARGO-HOLD, not USCARGO-HOLDPCS, not USCARGO-PR-HPCS, not USCARGO-HOLD-B, not USCARGO-PR-H-BO, not USCARGO-HOLD-D, not USCARGO-PR-H-DE, not USCARGO-HOLDFDA)
Applied to: Delete GCSB1RT Index Record
WHEN
The cargo status is being updated
THEN
The system deletes the cargo record from the GCSB1RT status index table
Context: A cargo record exists in the status index table and has either error conditions or hold conditions but not both cleared
GIVEN
A cargo record exists in the status index table and has either error conditions or hold conditions but not both cleared
Applied to: Update GCSB1RT Index Record
WHEN
The cargo status is being updated
THEN
The system updates the existing GCSB1RT record with the current index field values
Context: A cargo record has error conditions (CPCARGO-ERROR or CPCARGO-PENDING or USCARGO-ERROR) or hold conditions (USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-B or USCARGO-PR-H-BO or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA) and no existing status index record exists
GIVEN
A cargo record has error conditions (CPCARGO-ERROR or CPCARGO-PENDING or USCARGO-ERROR) or hold conditions (USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-B or USCARGO-PR-H-BO or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA) and no existing status index record exists
Applied to: Create New GCSB1RT Index Record
WHEN
The cargo status is being updated
THEN
The system creates a new GCSB1RT record with the cargo CCN key and populated index fields
Context: A cargo record has an internal CP cargo status code
GIVEN
A cargo record has an internal CP cargo status code
Applied to: Set Cargo Status Description
WHEN
The cargo status description needs to be set
THEN
The system maps the internal status code to the corresponding business description: OK to 'OK', PENDING to 'PENDING', ACKNWLG to 'ACK', ERROR to 'ERROR', SENT to 'SENT', DELETED to 'DELETED', DELPEND to 'DELPEND', RELSD to 'RELEASED', ARRIVAL to 'MNL-ARRV', AARR to 'AUT-ARRV', EXPORT to 'MNL-EXP', AEXP to 'AUT-EXP', IMED-EX to 'IMED-EXP', XFERED to 'XFERED', or uses the original status code if no mapping exists
Context: A cargo record is being modified with insert, replace, delete, or zap operations
GIVEN
A cargo record is being modified with insert, replace, delete, or zap operations
Applied to: Update Last Modification Timestamp
WHEN
The cargo status is being updated
THEN
The system updates the last modification fields with current machine century, date, time, originating terminal, and user ID
R-GCX126-cbl-00220 (+10) File: GCX126R.cbl Handle Unknown Cargo Entry Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Unknown Cargo Entry':
  • Context - an edi 350 message has been processed with m10 segment containing ccn (cargo control number), v9 segment containing notice document type code and notice reason code, and the cargo lookup returned 'cargo not found' status:
    For Handle Unknown Cargo Entry:
    When the v9 notice reason code is not 'released' and not 'decon', then the system prepares an error email notification with subject 'unknown edi 350 entry from cbsa' followed by the ccn, message line 1 contains 'unknown edi 350 entry from cbsa' with the ccn, message line 3 contains 'this ccn was not found.', message line 4 contains 'notice doc type: ' followed by the notice document type code, ' with reason code ' followed by the first 4 characters of the notice reason code, sets the line count to 5, sets the recipient to 'om01247', sets the email type indicator to 'unknown', and sends the email notification.
  • Context - an edi 350 message has been processed with cargo not found status and v9 segment containing notice reason code:
    For Check Notice Reason Code:
    When the v9 notice reason code indicates 'released', then the system skips the unknown entry notification process and exits without sending the generic unknown cargo entry email.
    For Check Notice Reason Code:
    When the v9 notice reason code indicates 'decon' (deconsolidation), then the system skips the unknown entry notification process and exits without sending the generic unknown cargo entry email.
  • Context - an unknown cargo entry notification needs to be sent with ccn from m10 segment:
    For Set Subject: 'UNKNOWN EDI 350 ENTRY FROM CBSA':
    When the email subject is being prepared, then the system sets the email subject to 'unknown edi 350 entry from cbsa ' concatenated with the 25-character ccn from m10-07-ccn field.
  • Context - an unknown cargo entry notification is being prepared with ccn from m10 segment:
    For Add CCN to Message Line 1:
    When the email message body is being constructed, then the system sets message detail line 1 to 'unknown edi 350 entry from cbsa ' concatenated with the first 25 characters of m10-07-ccn field.
  • Context - an unknown cargo entry notification is being prepared:
    For Add 'THIS CCN WAS NOT FOUND' to Message Line 3:
    When the email message body is being constructed, then the system sets message detail line 3 to 'this ccn was not found.'.
  • Context - an unknown cargo entry notification is being prepared with m10 segment containing notice document type code and v9 segment containing notice reason code:
    For Add Notice Document Type and Reason Code to Line 4:
    When the email message body is being constructed, then the system sets message detail line 4 to 'notice doc type: ' concatenated with m10-05-notice-doc-typ-cde, followed by ' with reason code ' concatenated with the first 4 characters of v9-02-notice-rsn-cde field.
  • Context - an unknown cargo entry notification email has been prepared with 4 message detail lines:
    For Add Notice Document Type and Reason Code to Line 4:
    When the email is ready to be sent, then the system sets the message line count to 5.
  • Context - an unknown cargo entry notification is ready to be sent:
    For Set Recipient: OM01247:
    When the email recipient is being determined, then the system sets the recipient user code to 'om01247'.
    For Set Email Type: UNKNOWN:
    When the email type classification is being set, then the system sets the email type indicator to 'unknown' (88-z110-mrln-type-is-unknown).
  • Context - an unknown cargo entry notification has been fully prepared with subject, message lines, recipient, and email type:
    For Send Email Notification:
    When the notification is ready to be dispatched, then the system performs the email preparation and sending routine (z110-prep-emcsend).
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been processed with M10 segment containing CCN (Cargo Control Number), V9 segment containing notice document type code and notice reason code, and the cargo lookup returned 'cargo not found' status
GIVEN
An EDI 350 message has been processed with M10 segment containing CCN (Cargo Control Number), V9 segment containing notice document type code and notice reason code, and the cargo lookup returned 'cargo not found' status
Applied to: Handle Unknown Cargo Entry
WHEN
The V9 notice reason code is NOT 'RELEASED' AND NOT 'DECON'
THEN
The system prepares an error email notification with subject 'UNKNOWN EDI 350 ENTRY FROM CBSA' followed by the CCN, message line 1 contains 'UNKNOWN EDI 350 ENTRY FROM CBSA' with the CCN, message line 3 contains 'THIS CCN WAS NOT FOUND.', message line 4 contains 'NOTICE DOC TYPE: ' followed by the notice document type code, ' WITH REASON CODE ' followed by the first 4 characters of the notice reason code, sets the line count to 5, sets the recipient to 'OM01247', sets the email type indicator to 'UNKNOWN', and sends the email notification
Context: An EDI 350 message has been processed with cargo not found status and V9 segment containing notice reason code
GIVEN
An EDI 350 message has been processed with cargo not found status and V9 segment containing notice reason code
Applied to: Check Notice Reason Code
WHEN
The V9 notice reason code indicates 'RELEASED'
THEN
The system skips the unknown entry notification process and exits without sending the generic unknown cargo entry email
Applied to: Check Notice Reason Code
WHEN
The V9 notice reason code indicates 'DECON' (deconsolidation)
THEN
The system skips the unknown entry notification process and exits without sending the generic unknown cargo entry email
Context: An unknown cargo entry notification needs to be sent with CCN from M10 segment
GIVEN
An unknown cargo entry notification needs to be sent with CCN from M10 segment
Applied to: Set Subject: 'UNKNOWN EDI 350 ENTRY FROM CBSA'
WHEN
The email subject is being prepared
THEN
The system sets the email subject to 'UNKNOWN EDI 350 ENTRY FROM CBSA ' concatenated with the 25-character CCN from M10-07-CCN field
Context: An unknown cargo entry notification is being prepared with CCN from M10 segment
GIVEN
An unknown cargo entry notification is being prepared with CCN from M10 segment
Applied to: Add CCN to Message Line 1
WHEN
The email message body is being constructed
THEN
The system sets message detail line 1 to 'UNKNOWN EDI 350 ENTRY FROM CBSA ' concatenated with the first 25 characters of M10-07-CCN field
Context: An unknown cargo entry notification is being prepared
GIVEN
An unknown cargo entry notification is being prepared
Applied to: Add 'THIS CCN WAS NOT FOUND' to Message Line 3
WHEN
The email message body is being constructed
THEN
The system sets message detail line 3 to 'THIS CCN WAS NOT FOUND.'
Context: An unknown cargo entry notification is being prepared with M10 segment containing notice document type code and V9 segment containing notice reason code
GIVEN
An unknown cargo entry notification is being prepared with M10 segment containing notice document type code and V9 segment containing notice reason code
Applied to: Add Notice Document Type and Reason Code to Line 4
WHEN
The email message body is being constructed
THEN
The system sets message detail line 4 to 'NOTICE DOC TYPE: ' concatenated with M10-05-NOTICE-DOC-TYP-CDE, followed by ' WITH REASON CODE ' concatenated with the first 4 characters of V9-02-NOTICE-RSN-CDE field
Context: An unknown cargo entry notification email has been prepared with 4 message detail lines
GIVEN
An unknown cargo entry notification email has been prepared with 4 message detail lines
Applied to: Add Notice Document Type and Reason Code to Line 4
WHEN
The email is ready to be sent
THEN
The system sets the message line count to 5
Context: An unknown cargo entry notification is ready to be sent
GIVEN
An unknown cargo entry notification is ready to be sent
Applied to: Set Recipient: OM01247
WHEN
The email recipient is being determined
THEN
The system sets the recipient user code to 'OM01247'
Applied to: Set Email Type: UNKNOWN
WHEN
The email type classification is being set
THEN
The system sets the email type indicator to 'UNKNOWN' (88-Z110-MRLN-TYPE-IS-UNKNOWN)
Context: An unknown cargo entry notification has been fully prepared with subject, message lines, recipient, and email type
GIVEN
An unknown cargo entry notification has been fully prepared with subject, message lines, recipient, and email type
Applied to: Send Email Notification
WHEN
The notification is ready to be dispatched
THEN
The system performs the email preparation and sending routine (Z110-PREP-EMCSEND)
R-GCCUSIO-cbl-00226 (+17) File: GCCUSIO.cbl Populate Index Fields Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Index Fields':
  • Context - a cargo record is being processed for index field population:
    For Is Cargo Deleted?:
    When the cargo status indicates it is deleted (88-gcusrt-rt10-cpcargo-deleted is true), then the system should exit the index population process without setting any index fields.
  • Context - a cargo record with a valid ccn key is being processed:
    For Set CCN Key Index Fields:
    When the cargo is not deleted and index population is required, then the system should copy the ccn key to rt071, rt072, and rt073 index fields.
    For Set CCN Key Index Fields:
    When index fields need to be populated for the cargo record, then the system should copy the ccn key to car id index (rt071), waybill index (rt072), and car-waybill index (rt073) fields.
    For Set Manifest Index with CCN Key:
    When manifest index field needs to be populated, then the system should move the ccn key value to the manifest index field (rt075).
  • Context - a cargo record is being processed for index population:
    For Set Destination CCN Key:
    When the destination index field (gcusrt-rt076-dest-index) is not empty, then the system should copy the ccn key to the destination ccn key index field (gcusrt-rt076-us-ccn-key-index).
    For Set Manifest Index:
    When the manifest index field needs to be populated, then the system should copy the ccn key to the manifest index field (gcusrt-rt075-manif-index).
  • Context - a cargo record contains equipment car information:
    For Populate Car ID Index & Extract Car ID from Equipment Field:
    When index fields are being populated, then the system should copy the equipment car number to the car id index field and the system should move the equipment car value to both the car id number index (rt071) and car-waybill index (rt073) fields.
  • Context - a cargo record contains transportation information including road number, station number, waybill number, and waybill date:
    For Populate Waybill Index Fields:
    When index fields are being populated, then the system should copy road number to road index, station number to station index, waybill number to waybill index, and waybill date to date index.
  • Context - waybill and car information has been populated in their respective index fields:
    For Set Waybill Cross-Reference:
    When cross-reference indexes are being established, then the system should copy the waybill number to the cross-reference waybill index and the equipment car to the cross-reference car id index.
  • Context - a cargo record is being processed for bond index population:
    For Use Bond Control Number:
    When the in-bond control number field (gcusrt-m1206-in-bond-ctrl-num) is not empty, then the system should use the in-bond control number as the bond number index value.
    For Clear Bond Index:
    When both the in-bond control number and entry number fields are empty, then the system should set the bond number index field to spaces.
    For In-Bond Control Number Exists?, Use In-Bond Control Number for Bond Index, Entry Number Exists?, Use Entry Number for Bond Index, Clear Bond Index:
    When the system evaluates available bond-related identifiers, then if in-bond control number exists, use it for bond index; otherwise if entry number exists, use entry number for bond index; otherwise clear the bond index to spaces.
  • Context - a cargo record has no in-bond control number but contains an entry number:
    For Use Entry Number:
    When the in-bond control number is empty and the entry number field (gcusrt-m1202-entry-num) is not empty, then the system should use the entry number as the bond number index value.
  • Context - a cargo record is being processed for index field updates:
    For Is Cargo Deleted?:
    When the cargo status indicates it has been deleted (88-gcusrt-rt10-cpcargo-deleted is true), then the system should skip all index field population and exit the process immediately.
  • Context - a cargo record contains waybill information with road number, station number, waybill number, and waybill date:
    For Extract Road Number from Waybill, Extract Station Number from Waybill, Extract Waybill Number, Extract Waybill Date:
    When index fields are being populated, then the system should extract and populate road index, station index, waybill index, and waybill date index fields from the waybill data.
  • Context - waybill number index has been populated from waybill data:
    For Populate Car-Waybill Index:
    When car-waybill index needs to be created, then the system should copy the waybill number index value to the car-waybill index field (rt073).
  • Context - a cargo record is being processed for destination index population:
    For Update Destination Index if Present:
    When the destination index field (rt076-dest-index) is not equal to spaces, then the system should move the ccn key to the destination index ccn key field (rt076-us-ccn-key-index).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index field population
GIVEN
A cargo record is being processed for index field population
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it is deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The system should exit the index population process without setting any index fields
Context: A cargo record with a valid CCN key is being processed
GIVEN
A cargo record with a valid CCN key is being processed
Applied to: Set CCN Key Index Fields
WHEN
The cargo is not deleted and index population is required
THEN
The system should copy the CCN key to RT071, RT072, and RT073 index fields
Applied to: Set CCN Key Index Fields
WHEN
Index fields need to be populated for the cargo record
THEN
The system should copy the CCN key to car ID index (RT071), waybill index (RT072), and car-waybill index (RT073) fields
Applied to: Set Manifest Index with CCN Key
WHEN
Manifest index field needs to be populated
THEN
The system should move the CCN key value to the manifest index field (RT075)
Context: A cargo record is being processed for index population
GIVEN
A cargo record is being processed for index population
Applied to: Set Destination CCN Key
WHEN
The destination index field (GCUSRT-RT076-DEST-INDEX) is not empty
THEN
The system should copy the CCN key to the destination CCN key index field (GCUSRT-RT076-US-CCN-KEY-INDEX)
Applied to: Set Manifest Index
WHEN
The manifest index field needs to be populated
THEN
The system should copy the CCN key to the manifest index field (GCUSRT-RT075-MANIF-INDEX)
Context: A cargo record contains equipment car information
GIVEN
A cargo record contains equipment car information
Applied to: Populate Car ID Index & Extract Car ID from Equipment Field
WHEN
Index fields are being populated
THEN
The system should copy the equipment car number to the car ID index field AND The system should move the equipment car value to both the car ID number index (RT071) and car-waybill index (RT073) fields
Context: A cargo record contains transportation information including road number, station number, waybill number, and waybill date
GIVEN
A cargo record contains transportation information including road number, station number, waybill number, and waybill date
Applied to: Populate Waybill Index Fields
WHEN
Index fields are being populated
THEN
The system should copy road number to road index, station number to station index, waybill number to waybill index, and waybill date to date index
Context: Waybill and car information has been populated in their respective index fields
GIVEN
Waybill and car information has been populated in their respective index fields
Applied to: Set Waybill Cross-Reference
WHEN
Cross-reference indexes are being established
THEN
The system should copy the waybill number to the cross-reference waybill index and the equipment car to the cross-reference car ID index
Context: A cargo record is being processed for bond index population
GIVEN
A cargo record is being processed for bond index population
Applied to: Use Bond Control Number
WHEN
The in-bond control number field (GCUSRT-M1206-IN-BOND-CTRL-NUM) is not empty
THEN
The system should use the in-bond control number as the bond number index value
Applied to: Clear Bond Index
WHEN
Both the in-bond control number and entry number fields are empty
THEN
The system should set the bond number index field to spaces
Applied to: In-Bond Control Number Exists?, Use In-Bond Control Number for Bond Index, Entry Number Exists?, Use Entry Number for Bond Index, Clear Bond Index
WHEN
The system evaluates available bond-related identifiers
THEN
If in-bond control number exists, use it for bond index; otherwise if entry number exists, use entry number for bond index; otherwise clear the bond index to spaces
Context: A cargo record has no in-bond control number but contains an entry number
GIVEN
A cargo record has no in-bond control number but contains an entry number
Applied to: Use Entry Number
WHEN
The in-bond control number is empty and the entry number field (GCUSRT-M1202-ENTRY-NUM) is not empty
THEN
The system should use the entry number as the bond number index value
Context: A cargo record is being processed for index field updates
GIVEN
A cargo record is being processed for index field updates
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it has been deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The system should skip all index field population and exit the process immediately
Context: A cargo record contains waybill information with road number, station number, waybill number, and waybill date
GIVEN
A cargo record contains waybill information with road number, station number, waybill number, and waybill date
Applied to: Extract Road Number from Waybill, Extract Station Number from Waybill, Extract Waybill Number, Extract Waybill Date
WHEN
Index fields are being populated
THEN
The system should extract and populate road index, station index, waybill index, and waybill date index fields from the waybill data
Context: Waybill number index has been populated from waybill data
GIVEN
Waybill number index has been populated from waybill data
Applied to: Populate Car-Waybill Index
WHEN
Car-waybill index needs to be created
THEN
The system should copy the waybill number index value to the car-waybill index field (RT073)
Context: A cargo record is being processed for destination index population
GIVEN
A cargo record is being processed for destination index population
Applied to: Update Destination Index if Present
WHEN
The destination index field (RT076-DEST-INDEX) is not equal to spaces
THEN
The system should move the CCN key to the destination index CCN key field (RT076-US-CCN-KEY-INDEX)
R-GCX126-cbl-00231 File: GCX126R.cbl Process Document Not Matched
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Document Not Matched':
  • Context - a cargo record exists in the system with a valid ccn (cargo control number) and an edi 350 message has been received and parsed with a v9 segment containing a notice reason code:
    For Process Document Not Matched - Log 'DOC NOT MATCHED' message when V9 notice reason is NOT-MATCHED:
    When the v9 segment notice reason code indicates not-matched status, then the system clears the log information message variable, sets the message text to 'edi 350: doc not matched', moves the message to the log info variable, and invokes the log cargo information message process to record the message with the current ccn, current machine date, current machine time, current user id, action code for input message, and cargo type indicator.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with a valid CCN (Cargo Control Number) and an EDI 350 message has been received and parsed with a V9 segment containing a notice reason code
GIVEN
A cargo record exists in the system with a valid CCN (Cargo Control Number) and an EDI 350 message has been received and parsed with a V9 segment containing a notice reason code
Applied to: Process Document Not Matched - Log 'DOC NOT MATCHED' message when V9 notice reason is NOT-MATCHED
WHEN
The V9 segment notice reason code indicates NOT-MATCHED status
THEN
The system clears the log information message variable, sets the message text to 'EDI 350: DOC NOT MATCHED', moves the message to the log info variable, and invokes the log cargo information message process to record the message with the current CCN, current machine date, current machine time, current user ID, action code for input message, and cargo type indicator
R-GCX126-cbl-00232 File: GCX126R.cbl Process Cargo Complete
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Complete':
  • Context - an edi 350 message has been received and parsed, and a cargo record exists in the system matching the ccn from the m10 segment, and the v9 segment notice reason code indicates cargo-complete status:
    For Process Cargo Complete - Log 'CARGO COMPLETE MESSAGE' when V9 notice reason is CARGO-COMPLETE:
    When the system processes the v9 segment with cargo-complete notice reason code, then the system prepares a log message 'edi 350: cargo complete message', sets the log information with current machine date and time, the cargo ccn key, action code for input message, and cargo type as ca-cargo, and spawns a gct1051e transaction to record the message in the cargo history log.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received and parsed, and a cargo record exists in the system matching the CCN from the M10 segment, and the V9 segment notice reason code indicates CARGO-COMPLETE status
GIVEN
An EDI 350 message has been received and parsed, and a cargo record exists in the system matching the CCN from the M10 segment, and the V9 segment notice reason code indicates CARGO-COMPLETE status
Applied to: Process Cargo Complete - Log 'CARGO COMPLETE MESSAGE' when V9 notice reason is CARGO-COMPLETE
WHEN
The system processes the V9 segment with CARGO-COMPLETE notice reason code
THEN
The system prepares a log message 'EDI 350: CARGO COMPLETE MESSAGE', sets the log information with current machine date and time, the cargo CCN key, action code for input message, and cargo type as CA-CARGO, and spawns a GCT1051E transaction to record the message in the cargo history log
R-GCX126-cbl-00233 (+9) File: GCX126R.cbl Process Document Package Complete Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Document Package Complete':
  • Context - a cargo record exists in the database with current broker entry and customs transaction number, and an edi 350 message with v9 segment indicating document package complete status and x4 segment containing cbsa release reference id:
    For Update broker entry, customs transaction number, broker date/time, log 'DOC PKG COMPLETE' message, and update cargo record:
    When the x4 cbsa release reference id (first 15 characters) is different from the current broker entry or the x4 cbsa release reference id (first 14 characters) is different from the current customs transaction number, and the x4 cbsa release reference id is not spaces, then update the cargo broker entry with x4 release reference id (first 15 characters), update the customs transaction number with x4 release reference id (first 14 characters), update the broker date with current machine date, update the broker time with current machine time (first 4 characters), build and log the message 'edi 350: doc pkg complete : ' concatenated with x4 release reference id (first 15 characters), and replace the cargo record in the database.
  • Context - a cargo record exists with current broker entry and customs transaction number, and an edi 350 message with v9 segment indicating document package complete status and x4 segment containing cbsa release reference id:
    For Skip Update - Values Already Match:
    When the x4 cbsa release reference id (first 15 characters) equals the current broker entry and the x4 cbsa release reference id (first 14 characters) equals the current customs transaction number, then skip all update operations and continue to next processing step without modifying the cargo record.
  • Context - a cargo record exists in the database and an edi 350 message with v9 segment indicating document package complete status and x4 segment:
    For Skip Update - Values Already Match:
    When the x4 cbsa release reference id is spaces (blank), then skip all update operations and continue to next processing step without modifying the cargo record.
  • Context - the decision to update has been made based on differing release reference values and non-blank x4 release reference id:
    For Update Broker Entry with X4 Release Reference First 15 Characters:
    When updating cargo broker information, then set the cargo broker entry field to the first 15 characters of x4 cbsa release reference id (x4-01-cbsa-rel-ref-id positions 1 through 15).
    For Update Customs Transaction Number with X4 Release Reference First 14 Characters:
    When updating cargo customs transaction information, then set the customs transaction number field to the first 14 characters of x4 cbsa release reference id (x4-01-cbsa-rel-ref-id positions 1 through 14).
  • Context - the decision to update has been made and broker entry and customs transaction number have been updated:
    For Update Broker Date with Current Machine Date:
    When recording the timestamp of document package completion, then set the cargo broker date field to the current machine date (cc-machine-date from cccom).
  • Context - the decision to update has been made and broker entry, customs transaction number, and broker date have been updated:
    For Update Broker Time with Current Machine Time First 4 Characters:
    When recording the time of document package completion, then set the cargo broker time field to the first 4 characters of current machine time (cc-machine-time from cccom, representing hours and minutes in hhmm format).
  • Context - the cargo record has been updated with new broker entry, customs transaction number, broker date, and broker time:
    For Build Log Message: 'EDI 350: DOC PKG COMPLETE : ' + X4 Release Reference First 15 Characters:
    When preparing to log the document package completion event, then construct a log message by concatenating the literal text 'edi 350: doc pkg complete : ' with the first 15 characters of x4 cbsa release reference id and store in the log message field.
  • Context - the log message has been constructed with document package complete details:
    For Log Cargo Information Message:
    When recording the document package completion event, then invoke the log cargo information message process (z150-log-cargo-info-msg) to write the message to the cargo audit log with current date, time, user id, ccn, and the constructed message text.
  • Context - the cargo record has been updated with new broker entry, customs transaction number, broker date, broker time, and the completion event has been logged:
    For Update Cargo Record - Replace Cargo in Database:
    When persisting the document package complete changes, then invoke the replace cargo process (z3100-repl-cargo) to update the cargo record in the database with all modified fields.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the database with current broker entry and customs transaction number, and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment containing CBSA Release Reference ID
GIVEN
A cargo record exists in the database with current broker entry and customs transaction number, and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment containing CBSA Release Reference ID
Applied to: Update broker entry, customs transaction number, broker date/time, log 'DOC PKG COMPLETE' message, and update cargo record
WHEN
The X4 CBSA Release Reference ID (first 15 characters) is different from the current broker entry OR the X4 CBSA Release Reference ID (first 14 characters) is different from the current customs transaction number, AND the X4 CBSA Release Reference ID is not spaces
THEN
Update the cargo broker entry with X4 Release Reference ID (first 15 characters), update the customs transaction number with X4 Release Reference ID (first 14 characters), update the broker date with current machine date, update the broker time with current machine time (first 4 characters), build and log the message 'EDI 350: DOC PKG COMPLETE : ' concatenated with X4 Release Reference ID (first 15 characters), and replace the cargo record in the database
Context: A cargo record exists with current broker entry and customs transaction number, and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment containing CBSA Release Reference ID
GIVEN
A cargo record exists with current broker entry and customs transaction number, and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment containing CBSA Release Reference ID
Applied to: Skip Update - Values Already Match
WHEN
The X4 CBSA Release Reference ID (first 15 characters) equals the current broker entry AND the X4 CBSA Release Reference ID (first 14 characters) equals the current customs transaction number
THEN
Skip all update operations and continue to next processing step without modifying the cargo record
Context: A cargo record exists in the database and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment
GIVEN
A cargo record exists in the database and an EDI 350 message with V9 segment indicating Document Package Complete status and X4 segment
Applied to: Skip Update - Values Already Match
WHEN
The X4 CBSA Release Reference ID is spaces (blank)
THEN
Skip all update operations and continue to next processing step without modifying the cargo record
Context: The decision to update has been made based on differing release reference values and non-blank X4 Release Reference ID
GIVEN
The decision to update has been made based on differing release reference values and non-blank X4 Release Reference ID
Applied to: Update Broker Entry with X4 Release Reference First 15 Characters
WHEN
Updating cargo broker information
THEN
Set the cargo broker entry field to the first 15 characters of X4 CBSA Release Reference ID (X4-01-CBSA-REL-REF-ID positions 1 through 15)
Applied to: Update Customs Transaction Number with X4 Release Reference First 14 Characters
WHEN
Updating cargo customs transaction information
THEN
Set the customs transaction number field to the first 14 characters of X4 CBSA Release Reference ID (X4-01-CBSA-REL-REF-ID positions 1 through 14)
Context: The decision to update has been made and broker entry and customs transaction number have been updated
GIVEN
The decision to update has been made and broker entry and customs transaction number have been updated
Applied to: Update Broker Date with Current Machine Date
WHEN
Recording the timestamp of document package completion
THEN
Set the cargo broker date field to the current machine date (CC-MACHINE-DATE from CCCOM)
Context: The decision to update has been made and broker entry, customs transaction number, and broker date have been updated
GIVEN
The decision to update has been made and broker entry, customs transaction number, and broker date have been updated
Applied to: Update Broker Time with Current Machine Time First 4 Characters
WHEN
Recording the time of document package completion
THEN
Set the cargo broker time field to the first 4 characters of current machine time (CC-MACHINE-TIME from CCCOM, representing hours and minutes in HHMM format)
Context: The cargo record has been updated with new broker entry, customs transaction number, broker date, and broker time
GIVEN
The cargo record has been updated with new broker entry, customs transaction number, broker date, and broker time
Applied to: Build Log Message: 'EDI 350: DOC PKG COMPLETE : ' + X4 Release Reference First 15 Characters
WHEN
Preparing to log the document package completion event
THEN
Construct a log message by concatenating the literal text 'EDI 350: DOC PKG COMPLETE : ' with the first 15 characters of X4 CBSA Release Reference ID and store in the log message field
Context: The log message has been constructed with document package complete details
GIVEN
The log message has been constructed with document package complete details
Applied to: Log Cargo Information Message
WHEN
Recording the document package completion event
THEN
Invoke the log cargo information message process (Z150-LOG-CARGO-INFO-MSG) to write the message to the cargo audit log with current date, time, user ID, CCN, and the constructed message text
Context: The cargo record has been updated with new broker entry, customs transaction number, broker date, broker time, and the completion event has been logged
GIVEN
The cargo record has been updated with new broker entry, customs transaction number, broker date, broker time, and the completion event has been logged
Applied to: Update Cargo Record - Replace Cargo in Database
WHEN
Persisting the document package complete changes
THEN
Invoke the replace cargo process (Z3100-REPL-CARGO) to update the cargo record in the database with all modified fields
R-GCCUSIO-cbl-00236 (+1) File: GCCUSIO.cbl Set Creation Audit Trail Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Creation Audit Trail':
  • Context - a cargo record is being inserted and the creation timestamp field is empty (spaces):
    For Creation Timestamp Already Exists?:
    When the system processes the cargo record insertion, then the system sets creation century from current system century, creation date from current system date, creation time from current system time, creation terminal from originating terminal, creation user id from acf2 user id, and copies all creation information to last modify fields.
  • Context - a cargo record is being inserted and the creation timestamp field contains existing data (not spaces):
    For Creation Timestamp Already Exists?:
    When the system processes the cargo record insertion, then the system preserves existing creation information and only updates last modify century from current system century, last modify date from current system date, last modify time from current system time, last modify terminal from originating terminal, and last modify user id from acf2 user id.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being inserted and the creation timestamp field is empty (spaces)
GIVEN
A cargo record is being inserted and the creation timestamp field is empty (spaces)
Applied to: Creation Timestamp Already Exists?
WHEN
The system processes the cargo record insertion
THEN
The system sets creation century from current system century, creation date from current system date, creation time from current system time, creation terminal from originating terminal, creation user ID from ACF2 user ID, and copies all creation information to last modify fields
Context: A cargo record is being inserted and the creation timestamp field contains existing data (not spaces)
GIVEN
A cargo record is being inserted and the creation timestamp field contains existing data (not spaces)
Applied to: Creation Timestamp Already Exists?
WHEN
The system processes the cargo record insertion
THEN
The system preserves existing creation information and only updates last modify century from current system century, last modify date from current system date, last modify time from current system time, last modify terminal from originating terminal, and last modify user ID from ACF2 user ID
R-GCX126-cbl-00243 (+2) File: GCX126R.cbl Process Document Not On File Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Document Not On File':
  • Context - an edi 350 message is being processed with v9 notice reason code indicating 'doc-not-on-file' and x4 segment contains release document type code and cbsa release reference id:
    For Log Message: 'EDI 350: DOC NOT ON FILE FOR RELEASE' with CBSA Release Reference ID:
    When the x4 release document type code (position 1, length 1) starts with 'r' indicating a release type transaction, then the system logs an informational message 'edi 350: doc not on file for release' concatenated with the cbsa release reference id (first 15 characters) to the cargo information log.
    For Log Message: 'EDI 350: DOC NOT ON FILE H-BILL CLOSE' with CBSA Release Reference ID:
    When the x4 release document type code (position 1, length 1) does not start with 'r' indicating a non-release type transaction (house bill close), then the system logs an informational message 'edi 350:doc not on file h-bill close' concatenated with the cbsa release reference id (full 25 characters) to the cargo information log.
  • Context - an edi 350 message is being processed with cargo found in the system:
    For Process Document Not On File:
    When the v9 segment notice reason code equals 'doc-not-on-file', then the system proceeds to check the release document type to determine the appropriate logging message format.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message is being processed with V9 notice reason code indicating 'DOC-NOT-ON-FILE' and X4 segment contains release document type code and CBSA release reference ID
GIVEN
An EDI 350 message is being processed with V9 notice reason code indicating 'DOC-NOT-ON-FILE' and X4 segment contains release document type code and CBSA release reference ID
Applied to: Log Message: 'EDI 350: DOC NOT ON FILE FOR RELEASE' with CBSA Release Reference ID
WHEN
The X4 release document type code (position 1, length 1) starts with 'R' indicating a release type transaction
THEN
The system logs an informational message 'EDI 350: DOC NOT ON FILE FOR RELEASE' concatenated with the CBSA release reference ID (first 15 characters) to the cargo information log
Applied to: Log Message: 'EDI 350: DOC NOT ON FILE H-BILL CLOSE' with CBSA Release Reference ID
WHEN
The X4 release document type code (position 1, length 1) does not start with 'R' indicating a non-release type transaction (house bill close)
THEN
The system logs an informational message 'EDI 350:DOC NOT ON FILE H-BILL CLOSE' concatenated with the CBSA release reference ID (full 25 characters) to the cargo information log
Context: An EDI 350 message is being processed with cargo found in the system
GIVEN
An EDI 350 message is being processed with cargo found in the system
Applied to: Process Document Not On File
WHEN
The V9 segment notice reason code equals 'DOC-NOT-ON-FILE'
THEN
The system proceeds to check the release document type to determine the appropriate logging message format
R-GCCUSIO-cbl-00246 (+3) File: GCCUSIO.cbl Populate Car ID Index Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Car ID Index':
  • Context - a cargo record is being processed for car id index population:
    For Is Cargo Record Deleted?:
    When the cargo record has deletion status flag set to true (88-gcusrt-rt10-cpcargo-deleted), then the system skips all car id index field population and exits the process immediately.
  • Context - a cargo record is active and not marked as deleted:
    For Extract Equipment Car Information:
    When the system processes the record for car id index population, then the system extracts the equipment car information from field gcusrt-rt081-equipment-car for use in index population.
  • Context - equipment car information has been extracted from an active cargo record:
    For Set Car ID Number Index Field:
    When the system populates car id index fields, then the equipment car value is moved to the primary car id number index field gcusrt-rt071-car-id-num-index.
  • Context - the primary car id number index has been populated with equipment car information:
    For Update Car-Waybill Combined Index:
    When the system updates combined index fields, then the equipment car value is also moved to the car-waybill combined index field gcusrt-rt073-car-id-num-index.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for car ID index population
GIVEN
A cargo record is being processed for car ID index population
Applied to: Is Cargo Record Deleted?
WHEN
The cargo record has deletion status flag set to true (88-GCUSRT-RT10-CPCARGO-DELETED)
THEN
The system skips all car ID index field population and exits the process immediately
Context: A cargo record is active and not marked as deleted
GIVEN
A cargo record is active and not marked as deleted
Applied to: Extract Equipment Car Information
WHEN
The system processes the record for car ID index population
THEN
The system extracts the equipment car information from field GCUSRT-RT081-EQUIPMENT-CAR for use in index population
Context: Equipment car information has been extracted from an active cargo record
GIVEN
Equipment car information has been extracted from an active cargo record
Applied to: Set Car ID Number Index Field
WHEN
The system populates car ID index fields
THEN
The equipment car value is moved to the primary car ID number index field GCUSRT-RT071-CAR-ID-NUM-INDEX
Context: The primary car ID number index has been populated with equipment car information
GIVEN
The primary car ID number index has been populated with equipment car information
Applied to: Update Car-Waybill Combined Index
WHEN
The system updates combined index fields
THEN
The equipment car value is also moved to the car-waybill combined index field GCUSRT-RT073-CAR-ID-NUM-INDEX
R-GCX126-cbl-00246 (+3) File: GCX126R.cbl Process Cargo Reported Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Reported':
  • Context - an edi 350 message has been received and parsed with v9 segment containing notice reason code, and cargo record exists in the database with a valid ccn (cargo control number):
    For Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED:
    When the v9 segment notice reason code indicates reported status, then the system clears the message work area (ws-gcx105-info-msg), builds the message string 'edi 350: cargo reported', and invokes the log cargo information message process (z150-log-cargo-info-msg) to record this status change in the cargo history with the current ccn, date, time, and user information.
  • Context - an edi 350 message v9 segment has been processed and the notice reason code field (v9-02-notice-rsn-cde) is available for evaluation:
    For Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED:
    When the system evaluates the v9 notice reason code against the reported condition (v9-02-reported), then if the condition is true, the system proceeds to log the cargo reported message; otherwise, the system continues to evaluate other notice reason code conditions.
  • Context - the v9 notice reason code has been confirmed as reported status and the message work area (ws-gcx105-info-msg) is available:
    For Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED:
    When the system prepares the log message content, then the system clears the message work area (ws-gcx105-info-msg) to spaces and builds the message string 'edi 350: cargo reported' into the work area.
  • Context - the cargo reported message 'edi 350: cargo reported' has been prepared in the message work area (ws-gcx105-info-msg), and the current cargo ccn is available in ws-current-ccn-key:
    For Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED:
    When the system invokes the log cargo information message process (z150-log-cargo-info-msg), then the logging service records the message to cargo history with the current machine date, machine time, user id (acf2-userid), action code (log-use-input-message), cargo ccn, cargo type indicator (gcx105-ca-cargo), and the prepared message text.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received and parsed with V9 segment containing notice reason code, and cargo record exists in the database with a valid CCN (Cargo Control Number)
GIVEN
An EDI 350 message has been received and parsed with V9 segment containing notice reason code, and cargo record exists in the database with a valid CCN (Cargo Control Number)
Applied to: Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED
WHEN
The V9 segment notice reason code indicates REPORTED status
THEN
The system clears the message work area (WS-GCX105-INFO-MSG), builds the message string 'EDI 350: CARGO REPORTED', and invokes the log cargo information message process (Z150-LOG-CARGO-INFO-MSG) to record this status change in the cargo history with the current CCN, date, time, and user information
Context: An EDI 350 message V9 segment has been processed and the notice reason code field (V9-02-NOTICE-RSN-CDE) is available for evaluation
GIVEN
An EDI 350 message V9 segment has been processed and the notice reason code field (V9-02-NOTICE-RSN-CDE) is available for evaluation
Applied to: Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED
WHEN
The system evaluates the V9 notice reason code against the REPORTED condition (V9-02-REPORTED)
THEN
If the condition is true, the system proceeds to log the cargo reported message; otherwise, the system continues to evaluate other notice reason code conditions
Context: The V9 notice reason code has been confirmed as REPORTED status and the message work area (WS-GCX105-INFO-MSG) is available
GIVEN
The V9 notice reason code has been confirmed as REPORTED status and the message work area (WS-GCX105-INFO-MSG) is available
Applied to: Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED
WHEN
The system prepares the log message content
THEN
The system clears the message work area (WS-GCX105-INFO-MSG) to spaces and builds the message string 'EDI 350: CARGO REPORTED' into the work area
Context: The cargo reported message 'EDI 350: CARGO REPORTED' has been prepared in the message work area (WS-GCX105-INFO-MSG), and the current cargo CCN is available in WS-CURRENT-CCN-KEY
GIVEN
The cargo reported message 'EDI 350: CARGO REPORTED' has been prepared in the message work area (WS-GCX105-INFO-MSG), and the current cargo CCN is available in WS-CURRENT-CCN-KEY
Applied to: Process Cargo Reported - Log 'CARGO REPORTED' message when V9 notice reason is REPORTED
WHEN
The system invokes the log cargo information message process (Z150-LOG-CARGO-INFO-MSG)
THEN
The logging service records the message to cargo history with the current machine date, machine time, user ID (ACF2-USERID), action code (LOG-USE-INPUT-MESSAGE), cargo CCN, cargo type indicator (GCX105-CA-CARGO), and the prepared message text
R-GCX126-cbl-00250 (+3) File: GCX126R.cbl Process Cargo Arrived Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Arrived':
  • Context - an edi 350 message has been received and parsed with v9 segment notice reason code indicating arrived status and p4 segment containing a valid port code:
    For Process Cargo Arrived - Log 'CARGO ARRIVED AT PORT' message when V9 notice reason is ARRIVED:
    When the system processes the cargo arrival status, then the system prepares a log message 'edi 350: cargo arrived at port' concatenated with the 4-character port code from p4 segment, sets the current machine date and time, sets the ccn key as the cargo identifier, sets the action code to indicate input message usage, marks the log as canadian cargo type, and writes the log message to the ims message queue via gct1051e transaction.
  • Context - the v9 segment indicates arrived status and the p4 segment contains a port code in positions 1 through 4:
    For Prepare Log Message: 'EDI 350: CARGO ARRIVED AT PORT':
    When the system prepares the arrival log message, then the system initializes the log message field to spaces, concatenates the text 'edi 350: cargo arrived at port ' with the 4-character port code from p4-01-port-cde positions 1 through 4, and stores the result in ws-gcx105-info-msg field.
  • Context - a cargo arrival log message has been prepared with port information and the current ccn key is available in ws-current-ccn-key:
    For Set Log Information: - Current Date/Time - CCN Key - Action Code:
    When the system sets the log information for the arrival event, then the system clears the gcx105 input area to spaces, sets the security byte to high-value, sets the sending transaction to 'gct1261e', sets the acf2 user id from the common control area, concatenates the machine century with the machine date to form gcx105-date, moves the machine time to gcx105-time, moves the current ccn key to gcx105-train-or-us-ccn, sets the cargo type indicator to canadian cargo, sets the action code to log-use-input-message, and moves the prepared arrival message from ws-gcx105-info-msg to gcx105-message.
  • Context - the gcx105 log structure has been populated with arrival event information including date, time, ccn, and message text, and the message field is not spaces or low-values:
    For 42: Log Cargo Information Message to IMS Message Queue:
    When the system writes the log entry to the message queue, then the system replaces all spaces in gcx105-date with zeroes, replaces all spaces in gcx105-time with '1', moves the gcx105-input to gct1051e-msg, sets the accept status to blank, calls cims with chng function for the alternate pcb and gct1051e segment, calls writmsgl with the alternate pcb, message code, message text, message length and module name, and calls cims with purg function for the alternate pcb to commit the message.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received and parsed with V9 segment notice reason code indicating ARRIVED status and P4 segment containing a valid port code
GIVEN
An EDI 350 message has been received and parsed with V9 segment notice reason code indicating ARRIVED status and P4 segment containing a valid port code
Applied to: Process Cargo Arrived - Log 'CARGO ARRIVED AT PORT' message when V9 notice reason is ARRIVED
WHEN
The system processes the cargo arrival status
THEN
The system prepares a log message 'EDI 350: CARGO ARRIVED AT PORT' concatenated with the 4-character port code from P4 segment, sets the current machine date and time, sets the CCN key as the cargo identifier, sets the action code to indicate input message usage, marks the log as Canadian cargo type, and writes the log message to the IMS message queue via GCT1051E transaction
Context: The V9 segment indicates ARRIVED status and the P4 segment contains a port code in positions 1 through 4
GIVEN
The V9 segment indicates ARRIVED status and the P4 segment contains a port code in positions 1 through 4
Applied to: Prepare Log Message: 'EDI 350: CARGO ARRIVED AT PORT'
WHEN
The system prepares the arrival log message
THEN
The system initializes the log message field to spaces, concatenates the text 'EDI 350: CARGO ARRIVED AT PORT ' with the 4-character port code from P4-01-PORT-CDE positions 1 through 4, and stores the result in WS-GCX105-INFO-MSG field
Context: A cargo arrival log message has been prepared with port information and the current CCN key is available in WS-CURRENT-CCN-KEY
GIVEN
A cargo arrival log message has been prepared with port information and the current CCN key is available in WS-CURRENT-CCN-KEY
Applied to: Set Log Information: - Current Date/Time - CCN Key - Action Code
WHEN
The system sets the log information for the arrival event
THEN
The system clears the GCX105 input area to spaces, sets the security byte to high-value, sets the sending transaction to 'GCT1261E', sets the ACF2 user ID from the common control area, concatenates the machine century with the machine date to form GCX105-DATE, moves the machine time to GCX105-TIME, moves the current CCN key to GCX105-TRAIN-OR-US-CCN, sets the cargo type indicator to Canadian cargo, sets the action code to LOG-USE-INPUT-MESSAGE, and moves the prepared arrival message from WS-GCX105-INFO-MSG to GCX105-MESSAGE
Context: The GCX105 log structure has been populated with arrival event information including date, time, CCN, and message text, and the message field is not spaces or low-values
GIVEN
The GCX105 log structure has been populated with arrival event information including date, time, CCN, and message text, and the message field is not spaces or low-values
Applied to: 42: Log Cargo Information Message to IMS Message Queue
WHEN
The system writes the log entry to the message queue
THEN
The system replaces all spaces in GCX105-DATE with zeroes, replaces all spaces in GCX105-TIME with '1', moves the GCX105-INPUT to GCT1051E-MSG, sets the accept status to blank, calls CIMS with CHNG function for the alternate PCB and GCT1051E segment, calls WRITMSGL with the alternate PCB, message code, message text, message length and module name, and calls CIMS with PURG function for the alternate PCB to commit the message
R-GCX126-cbl-00254 (+34) File: GCX126R.cbl Process Cargo Release Merged 35 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Release':
  • Context - a cargo record exists with v9 segment indicating released status:
    For Set Release Information: Clear destination station, Set release date/time from system, Set release by user ID, Set status to RELEASED, Set release status R, Set release type A, Clear error fields:
    When the system processes the release notification, then the cargo destination station number index field is set to spaces and the cargo destination station number for index field is set to spaces and the cargo release date is set to current machine date and the cargo release time is set to current machine time and the cargo release by field is set to the current user id from the system and the cargo current status field is set to 'released' and the cargo release status field is set to 'r' and the cargo release type field is set to 'a' and the cargo release reason field is set to spaces and the cargo error or release status index field is set to spaces and the cargo error status field is set to spaces.
  • Context - a cargo record exists with v9 segment indicating released status and x4 segment contains cbsa release reference id and p4 segment contains port code:
    For Build Log Message: RELEASE: release-ref AT PORT port-code:
    When the system builds the release log message, then the log message is formatted as 'edi 350: release : ' concatenated with the first 15 characters of x4 cbsa release reference id concatenated with ' at port ' concatenated with the first 4 characters of p4 port code.
    For Build Release Reason: release-ref / port-code:
    When the system builds the release reason, then the release reason is formatted as the first 15 characters of x4 cbsa release reference id concatenated with '/' concatenated with the first 4 characters of p4 port code.
  • Context - the release reason has been built with format 'release-ref/port-code':
    For Update Cargo Release Reason Field:
    When the system updates the cargo record, then the cargo release reason field is set to the constructed release reason string.
  • Context - the release log message has been constructed and the cargo ccn is known:
    For Log Release Message to Cargo:
    When the system logs the release information, then a log entry is created with current system date, current system time, cargo ccn as the reference, cargo type indicator set to canadian cargo, action code set to use input message, and the message set to the constructed release log message.
  • Context - a canadian cargo record has been released and the cargo has an equipment car id and waybill number:
    For Search for Associated US Manifest: Match by Car ID, Match by Waybill Number, Verify not deleted, Verify no TR created:
    When the system searches for associated us manifest, then the system retrieves us cargo records where the car id number index matches the first 12 characters of the current car id and the waybill number index matches the saved waybill index and the cargo is not deleted and no train has been created for it.
  • Context - the system has searched for us cargo records matching the car id and waybill number:
    For US Manifest Found?:
    When the system evaluates the search results, then if a us cargo record is found where car id matches and waybill matches and cargo is not deleted and no train created, then us manifest found indicator is set to true, otherwise it is set to false.
  • Context - a us manifest record has been found that matches the canadian cargo's car id and waybill number:
    For Log to US Cargo: CDN CCN RLSED BY EDI 350: canadian-ccn:
    When the system logs the release to us cargo, then a log entry is created with current system date, current system time, us ccn as the reference, cargo type indicator set to us cargo, action code set to use input message, and the message formatted as 'cdn ccn rlsed by edi 350: ' concatenated with the canadian cargo ccn.
  • Context - the cargo release date and time have been set from the system clock:
    For Save Release Date/Time for Later Use:
    When the system prepares to update the cargo record, then the cargo release date is copied to a hold date field and the cargo release time is copied to a hold time field.
  • Context - all release information has been set in the cargo segment including release date, time, user, status, type, and reason:
    For Update Canadian Cargo Record with Release Information:
    When the system updates the cargo record, then the cargo report segment is replaced in the database with the updated release information.
  • Context - a cargo record has been released:
    For Is Master Manifest?:
    When the system checks the cargo type, then if the cargo master manifest indicator is true, then proceed to process follower manifests, otherwise end the release process.
  • Context - a cargo is identified as a master manifest with a specific ccn:
    For Retrieve All Follower Manifests for Master CCN up to 100 records:
    When the system retrieves follower manifests, then the system retrieves all cargo records where the master manifest ccn matches the current cargo ccn and the cargo is a follower manifest (not a master) and stores up to 100 follower ccn keys in an array and stops retrieval when end of database is reached or 100 records are retrieved.
  • Context - follower manifest ccns have been retrieved and stored in an array:
    For For Each Follower Manifest:
    When the system processes follower manifests, then for each follower ccn in the array from position 1 to the count of retrieved followers, the system retrieves the cargo record using the follower ccn and processes it if the ccn is not spaces or low-values.
  • Context - a follower manifest cargo record has been retrieved:
    For Set Release Information for Follower:
    When the system sets release information for the follower, then the follower cargo destination station number fields are cleared and release date is set to current machine date and release time is set to current machine time and release by is set to current user id and current status is set to 'released' and release status is set to 'r' and release type is set to 'a' and error fields are cleared.
  • Context - a follower manifest is being processed and the v9 segment contains a notice reason code:
    For Build Message Based on Type:
    When the system builds the log message for the follower, then if v9 notice reason code indicates released, then format message as release type, otherwise if v9 notice reason code indicates decon, then format message as deconsolidation type.
    For Build Reason Based on Type:
    When the system builds the release reason for the follower, then if v9 notice reason code indicates released, then format reason as standard release type, otherwise if v9 notice reason code indicates decon, then format reason as deconsolidation type.
  • Context - a follower manifest is being processed and v9 segment indicates released status:
    For RELEASE: release-ref AT PORT port-code:
    When the system builds the release message, then the log message is formatted as 'edi 350: release : ' concatenated with the first 15 characters of x4 cbsa release reference id concatenated with ' at port ' concatenated with the first 4 characters of p4 port code.
    For release-ref / port-code:
    When the system builds the release reason, then the release reason is formatted as the first 15 characters of x4 cbsa release reference id concatenated with '/' concatenated with the first 4 characters of p4 port code.
  • Context - a follower manifest is being processed and v9 segment indicates decon status:
    For RELEASE VIA DECON AT PORT port-code:
    When the system builds the release message, then the log message is formatted as 'edi 350: release via decon at port ' concatenated with the first 4 characters of p4 port code.
    For DECONSOLIDATION AT port-code:
    When the system builds the release reason, then the release reason is formatted as 'deconsolidation at ' concatenated with the first 4 characters of p4 port code.
  • Context - the release log message has been constructed for the follower and the follower cargo ccn is known:
    For Log Release Message to Follower Cargo:
    When the system logs the release information, then a log entry is created with current system date, current system time, follower cargo ccn as the reference, cargo type indicator set to canadian cargo, action code set to use input message, and the message set to the constructed release log message.
  • Context - the release reason has been built for the follower manifest:
    For Update Follower Release Reason:
    When the system updates the follower cargo record, then the follower cargo release reason field is set to the constructed release reason string.
  • Context - a follower manifest cargo record has been released and the follower has an equipment car id and waybill number:
    For Find Associated US Manifest for Follower:
    When the system searches for associated us manifest, then the system retrieves us cargo records where the car id number index matches the first 12 characters of the follower's car id and the waybill number index matches the follower's waybill index and the cargo is not deleted and no train has been created for it.
  • Context - the system has searched for us cargo records matching the follower's car id and waybill number:
    For US Manifest Found?:
    When the system evaluates the search results, then if a us cargo record is found where car id matches and waybill matches and cargo is not deleted and no train created, then us manifest found indicator is set to true, otherwise it is set to false.
  • Context - a us manifest record has been found that matches the follower cargo's car id and waybill number:
    For Log to US Cargo: CDN CCN RLSED BY EDI 350:
    When the system logs the release to us cargo, then a log entry is created with current system date, current system time, us ccn as the reference, cargo type indicator set to us cargo, action code set to use input message, and the message formatted as 'cdn ccn rlsed by edi 350: ' concatenated with the follower canadian cargo ccn.
  • Context - all release information has been set in the follower cargo segment including release date, time, user, status, type, and reason:
    For Update Follower Cargo Record:
    When the system updates the follower cargo record, then the follower cargo report segment is replaced in the database with the updated release information.
  • Context - a follower manifest has been processed and there is an array of follower ccns:
    For More Followers?:
    When the system checks for more followers, then if the current position in the follower array is less than the total count of followers and the next follower ccn is not spaces or low-values, then continue processing the next follower, otherwise end follower processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with V9 segment indicating RELEASED status
GIVEN
A cargo record exists with V9 segment indicating RELEASED status
Applied to: Set Release Information: Clear destination station, Set release date/time from system, Set release by user ID, Set status to RELEASED, Set release status R, Set release type A, Clear error fields
WHEN
The system processes the release notification
THEN
The cargo destination station number index field is set to spaces AND the cargo destination station number for index field is set to spaces AND The cargo release date is set to current machine date AND the cargo release time is set to current machine time AND The cargo release by field is set to the current user ID from the system AND The cargo current status field is set to 'RELEASED' AND The cargo release status field is set to 'R' AND The cargo release type field is set to 'A' AND The cargo release reason field is set to spaces AND The cargo error or release status index field is set to spaces AND The cargo error status field is set to spaces
Context: A cargo record exists with V9 segment indicating RELEASED status AND X4 segment contains CBSA release reference ID AND P4 segment contains port code
GIVEN
A cargo record exists with V9 segment indicating RELEASED status AND X4 segment contains CBSA release reference ID AND P4 segment contains port code
Applied to: Build Log Message: RELEASE: release-ref AT PORT port-code
WHEN
The system builds the release log message
THEN
The log message is formatted as 'EDI 350: RELEASE : ' concatenated with the first 15 characters of X4 CBSA release reference ID concatenated with ' AT PORT ' concatenated with the first 4 characters of P4 port code
Applied to: Build Release Reason: release-ref / port-code
WHEN
The system builds the release reason
THEN
The release reason is formatted as the first 15 characters of X4 CBSA release reference ID concatenated with '/' concatenated with the first 4 characters of P4 port code
Context: The release reason has been built with format 'release-ref/port-code'
GIVEN
The release reason has been built with format 'release-ref/port-code'
Applied to: Update Cargo Release Reason Field
WHEN
The system updates the cargo record
THEN
The cargo release reason field is set to the constructed release reason string
Context: The release log message has been constructed AND the cargo CCN is known
GIVEN
The release log message has been constructed AND the cargo CCN is known
Applied to: Log Release Message to Cargo
WHEN
The system logs the release information
THEN
A log entry is created with current system date, current system time, cargo CCN as the reference, cargo type indicator set to Canadian cargo, action code set to use input message, and the message set to the constructed release log message
Context: A Canadian cargo record has been released AND the cargo has an equipment car ID and waybill number
GIVEN
A Canadian cargo record has been released AND the cargo has an equipment car ID and waybill number
Applied to: Search for Associated US Manifest: Match by Car ID, Match by Waybill Number, Verify not deleted, Verify no TR created
WHEN
The system searches for associated US manifest
THEN
The system retrieves US cargo records where the car ID number index matches the first 12 characters of the current car ID AND the waybill number index matches the saved waybill index AND the cargo is not deleted AND no train has been created for it
Context: The system has searched for US cargo records matching the car ID and waybill number
GIVEN
The system has searched for US cargo records matching the car ID and waybill number
Applied to: US Manifest Found?
WHEN
The system evaluates the search results
THEN
If a US cargo record is found where car ID matches AND waybill matches AND cargo is not deleted AND no train created, then US manifest found indicator is set to true, otherwise it is set to false
Context: A US manifest record has been found that matches the Canadian cargo's car ID and waybill number
GIVEN
A US manifest record has been found that matches the Canadian cargo's car ID and waybill number
Applied to: Log to US Cargo: CDN CCN RLSED BY EDI 350: canadian-ccn
WHEN
The system logs the release to US cargo
THEN
A log entry is created with current system date, current system time, US CCN as the reference, cargo type indicator set to US cargo, action code set to use input message, and the message formatted as 'CDN CCN RLSED BY EDI 350: ' concatenated with the Canadian cargo CCN
Context: The cargo release date and time have been set from the system clock
GIVEN
The cargo release date and time have been set from the system clock
Applied to: Save Release Date/Time for Later Use
WHEN
The system prepares to update the cargo record
THEN
The cargo release date is copied to a hold date field AND the cargo release time is copied to a hold time field
Context: All release information has been set in the cargo segment including release date, time, user, status, type, and reason
GIVEN
All release information has been set in the cargo segment including release date, time, user, status, type, and reason
Applied to: Update Canadian Cargo Record with Release Information
WHEN
The system updates the cargo record
THEN
The cargo report segment is replaced in the database with the updated release information
Context: A cargo record has been released
GIVEN
A cargo record has been released
Applied to: Is Master Manifest?
WHEN
The system checks the cargo type
THEN
If the cargo master manifest indicator is true, then proceed to process follower manifests, otherwise end the release process
Context: A cargo is identified as a master manifest with a specific CCN
GIVEN
A cargo is identified as a master manifest with a specific CCN
Applied to: Retrieve All Follower Manifests for Master CCN up to 100 records
WHEN
The system retrieves follower manifests
THEN
The system retrieves all cargo records where the master manifest CCN matches the current cargo CCN AND the cargo is a follower manifest (not a master) AND stores up to 100 follower CCN keys in an array AND stops retrieval when end of database is reached OR 100 records are retrieved
Context: Follower manifest CCNs have been retrieved and stored in an array
GIVEN
Follower manifest CCNs have been retrieved and stored in an array
Applied to: For Each Follower Manifest
WHEN
The system processes follower manifests
THEN
For each follower CCN in the array from position 1 to the count of retrieved followers, the system retrieves the cargo record using the follower CCN AND processes it if the CCN is not spaces or low-values
Context: A follower manifest cargo record has been retrieved
GIVEN
A follower manifest cargo record has been retrieved
Applied to: Set Release Information for Follower
WHEN
The system sets release information for the follower
THEN
The follower cargo destination station number fields are cleared AND release date is set to current machine date AND release time is set to current machine time AND release by is set to current user ID AND current status is set to 'RELEASED' AND release status is set to 'R' AND release type is set to 'A' AND error fields are cleared
Context: A follower manifest is being processed AND the V9 segment contains a notice reason code
GIVEN
A follower manifest is being processed AND the V9 segment contains a notice reason code
Applied to: Build Message Based on Type
WHEN
The system builds the log message for the follower
THEN
If V9 notice reason code indicates RELEASED, then format message as release type, otherwise if V9 notice reason code indicates DECON, then format message as deconsolidation type
Applied to: Build Reason Based on Type
WHEN
The system builds the release reason for the follower
THEN
If V9 notice reason code indicates RELEASED, then format reason as standard release type, otherwise if V9 notice reason code indicates DECON, then format reason as deconsolidation type
Context: A follower manifest is being processed AND V9 segment indicates RELEASED status
GIVEN
A follower manifest is being processed AND V9 segment indicates RELEASED status
Applied to: RELEASE: release-ref AT PORT port-code
WHEN
The system builds the release message
THEN
The log message is formatted as 'EDI 350: RELEASE : ' concatenated with the first 15 characters of X4 CBSA release reference ID concatenated with ' AT PORT ' concatenated with the first 4 characters of P4 port code
Applied to: release-ref / port-code
WHEN
The system builds the release reason
THEN
The release reason is formatted as the first 15 characters of X4 CBSA release reference ID concatenated with '/' concatenated with the first 4 characters of P4 port code
Context: A follower manifest is being processed AND V9 segment indicates DECON status
GIVEN
A follower manifest is being processed AND V9 segment indicates DECON status
Applied to: RELEASE VIA DECON AT PORT port-code
WHEN
The system builds the release message
THEN
The log message is formatted as 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with the first 4 characters of P4 port code
Applied to: DECONSOLIDATION AT port-code
WHEN
The system builds the release reason
THEN
The release reason is formatted as 'DECONSOLIDATION AT ' concatenated with the first 4 characters of P4 port code
Context: The release log message has been constructed for the follower AND the follower cargo CCN is known
GIVEN
The release log message has been constructed for the follower AND the follower cargo CCN is known
Applied to: Log Release Message to Follower Cargo
WHEN
The system logs the release information
THEN
A log entry is created with current system date, current system time, follower cargo CCN as the reference, cargo type indicator set to Canadian cargo, action code set to use input message, and the message set to the constructed release log message
Context: The release reason has been built for the follower manifest
GIVEN
The release reason has been built for the follower manifest
Applied to: Update Follower Release Reason
WHEN
The system updates the follower cargo record
THEN
The follower cargo release reason field is set to the constructed release reason string
Context: A follower manifest cargo record has been released AND the follower has an equipment car ID and waybill number
GIVEN
A follower manifest cargo record has been released AND the follower has an equipment car ID and waybill number
Applied to: Find Associated US Manifest for Follower
WHEN
The system searches for associated US manifest
THEN
The system retrieves US cargo records where the car ID number index matches the first 12 characters of the follower's car ID AND the waybill number index matches the follower's waybill index AND the cargo is not deleted AND no train has been created for it
Context: The system has searched for US cargo records matching the follower's car ID and waybill number
GIVEN
The system has searched for US cargo records matching the follower's car ID and waybill number
Applied to: US Manifest Found?
WHEN
The system evaluates the search results
THEN
If a US cargo record is found where car ID matches AND waybill matches AND cargo is not deleted AND no train created, then US manifest found indicator is set to true, otherwise it is set to false
Context: A US manifest record has been found that matches the follower cargo's car ID and waybill number
GIVEN
A US manifest record has been found that matches the follower cargo's car ID and waybill number
Applied to: Log to US Cargo: CDN CCN RLSED BY EDI 350
WHEN
The system logs the release to US cargo
THEN
A log entry is created with current system date, current system time, US CCN as the reference, cargo type indicator set to US cargo, action code set to use input message, and the message formatted as 'CDN CCN RLSED BY EDI 350: ' concatenated with the follower Canadian cargo CCN
Context: All release information has been set in the follower cargo segment including release date, time, user, status, type, and reason
GIVEN
All release information has been set in the follower cargo segment including release date, time, user, status, type, and reason
Applied to: Update Follower Cargo Record
WHEN
The system updates the follower cargo record
THEN
The follower cargo report segment is replaced in the database with the updated release information
Context: A follower manifest has been processed AND there is an array of follower CCNs
GIVEN
A follower manifest has been processed AND there is an array of follower CCNs
Applied to: More Followers?
WHEN
The system checks for more followers
THEN
If the current position in the follower array is less than the total count of followers AND the next follower CCN is not spaces or low-values, then continue processing the next follower, otherwise end follower processing
R-GCCUSIO-cbl-00255 (+3) File: GCCUSIO.cbl Populate Bond Index Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Bond Index':
  • Context - a cargo record is being processed for bond index population:
    For Is Cargo Deleted?:
    When the cargo status indicates it has been deleted (88-gcusrt-rt10-cpcargo-deleted is true), then the bond index population process should be skipped and control should exit immediately.
  • Context - a cargo record requires bond index population and the cargo is not deleted:
    For In-Bond Control Number Available?:
    When the in-bond control number field (gcusrt-m1206-in-bond-ctrl-num) contains a value other than spaces, then the in-bond control number should be used to populate the bond number index field (gcusrt-rt074-bond-num-index).
  • Context - a cargo record requires bond index population, the cargo is not deleted, and the in-bond control number is spaces:
    For Entry Number Available?:
    When the entry number field (gcusrt-m1202-entry-num) contains a value other than spaces, then the entry number should be used to populate the bond number index field (gcusrt-rt074-bond-num-index).
  • Context - a cargo record requires bond index population, the cargo is not deleted, the in-bond control number is spaces, and the entry number is spaces:
    For Set Bond Index to Spaces:
    When no valid bond identification numbers are available, then the bond number index field (gcusrt-rt074-bond-num-index) should be set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for bond index population
GIVEN
A cargo record is being processed for bond index population
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it has been deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The bond index population process should be skipped and control should exit immediately
Context: A cargo record requires bond index population and the cargo is not deleted
GIVEN
A cargo record requires bond index population and the cargo is not deleted
Applied to: In-Bond Control Number Available?
WHEN
The in-bond control number field (GCUSRT-M1206-IN-BOND-CTRL-NUM) contains a value other than spaces
THEN
The in-bond control number should be used to populate the bond number index field (GCUSRT-RT074-BOND-NUM-INDEX)
Context: A cargo record requires bond index population, the cargo is not deleted, and the in-bond control number is spaces
GIVEN
A cargo record requires bond index population, the cargo is not deleted, and the in-bond control number is spaces
Applied to: Entry Number Available?
WHEN
The entry number field (GCUSRT-M1202-ENTRY-NUM) contains a value other than spaces
THEN
The entry number should be used to populate the bond number index field (GCUSRT-RT074-BOND-NUM-INDEX)
Context: A cargo record requires bond index population, the cargo is not deleted, the in-bond control number is spaces, and the entry number is spaces
GIVEN
A cargo record requires bond index population, the cargo is not deleted, the in-bond control number is spaces, and the entry number is spaces
Applied to: Set Bond Index to Spaces
WHEN
No valid bond identification numbers are available
THEN
The bond number index field (GCUSRT-RT074-BOND-NUM-INDEX) should be set to spaces
R-GCCUSIO-cbl-00259 (+4) File: GCCUSIO.cbl Execute Car ID Search Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Car ID Search':
  • Context - a cargo record exists with car identification number in the car id index field:
    For Set Car ID Index Value:
    When car id search is initiated, then the car identification number from the cargo record is mapped to the search key value.
  • Context - a search operator is specified in the input parameters:
    For Set Search Operator:
    When car id search is being configured, then the input search operator is applied to the car id search criteria.
  • Context - car id index search is being performed:
    For Configure Car ID PCB:
    When database path needs to be configured, then the secondary pcb for car id index is selected as the working database path.
  • Context - car id search key and operator are configured:
    For Build Qualified SSA:
    When database search statement needs to be built, then a qualified ssa is constructed using the car id search criteria.
  • Context - car id search statement and database path are configured:
    For Execute Database Call:
    When car id search is executed, then database call is performed using the configured function code, pcb, data area, and search statement.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with car identification number in the car ID index field
GIVEN
A cargo record exists with car identification number in the car ID index field
Applied to: Set Car ID Index Value
WHEN
Car ID search is initiated
THEN
The car identification number from the cargo record is mapped to the search key value
Context: A search operator is specified in the input parameters
GIVEN
A search operator is specified in the input parameters
Applied to: Set Search Operator
WHEN
Car ID search is being configured
THEN
The input search operator is applied to the car ID search criteria
Context: Car ID index search is being performed
GIVEN
Car ID index search is being performed
Applied to: Configure Car ID PCB
WHEN
Database path needs to be configured
THEN
The secondary PCB for car ID index is selected as the working database path
Context: Car ID search key and operator are configured
GIVEN
Car ID search key and operator are configured
Applied to: Build Qualified SSA
WHEN
Database search statement needs to be built
THEN
A qualified SSA is constructed using the car ID search criteria
Context: Car ID search statement and database path are configured
GIVEN
Car ID search statement and database path are configured
Applied to: Execute Database Call
WHEN
Car ID search is executed
THEN
Database call is performed using the configured function code, PCB, data area, and search statement
R-GCCUSIO-cbl-00264 (+3) File: GCCUSIO.cbl Execute Waybill Search Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Waybill Search':
  • Context - a waybill search request is initiated with gcwusio-index-waybill condition:
    For Set Waybill Search Parameters:
    When the system processes the waybill index search request, then the system sets pcb3 as the database control block and extracts waybill index value from gcusrt-rt072-waybill-index to gcuw-key-value for search processing.
  • Context - a waybill search is being configured with search parameters:
    For Set Search Operator:
    When the system assigns the search operator, then the system copies the operator from gcwusio-operator to gcuw-operator for waybill comparison logic.
  • Context - waybill search parameters including key value and operator are configured:
    For Build Qualified Search Statement:
    When the system constructs the database search statement, then the system assigns gcuw-ssa-qual to ws-ssa-1 to create a qualified search statement for waybill-based cargo lookup.
  • Context - a qualified search statement is constructed with waybill parameters and pcb3 is set as the database control block:
    For Execute Database Search:
    When the system executes the database search via x1100-call-one-ssa, then the system performs the database call using cims with the function code, pcb, io area, and ssa to retrieve matching cargo records.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill search request is initiated with GCWUSIO-INDEX-WAYBILL condition
GIVEN
A waybill search request is initiated with GCWUSIO-INDEX-WAYBILL condition
Applied to: Set Waybill Search Parameters
WHEN
The system processes the waybill index search request
THEN
The system sets PCB3 as the database control block and extracts waybill index value from GCUSRT-RT072-WAYBILL-INDEX to GCUW-KEY-VALUE for search processing
Context: A waybill search is being configured with search parameters
GIVEN
A waybill search is being configured with search parameters
Applied to: Set Search Operator
WHEN
The system assigns the search operator
THEN
The system copies the operator from GCWUSIO-OPERATOR to GCUW-OPERATOR for waybill comparison logic
Context: Waybill search parameters including key value and operator are configured
GIVEN
Waybill search parameters including key value and operator are configured
Applied to: Build Qualified Search Statement
WHEN
The system constructs the database search statement
THEN
The system assigns GCUW-SSA-QUAL to WS-SSA-1 to create a qualified search statement for waybill-based cargo lookup
Context: A qualified search statement is constructed with waybill parameters and PCB3 is set as the database control block
GIVEN
A qualified search statement is constructed with waybill parameters and PCB3 is set as the database control block
Applied to: Execute Database Search
WHEN
The system executes the database search via X1100-CALL-ONE-SSA
THEN
The system performs the database call using CIMS with the function code, PCB, IO area, and SSA to retrieve matching cargo records
R-GCCUSIO-cbl-00268 (+4) File: GCCUSIO.cbl Execute Car Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Car':
  • Context - a car-waybill search request is initiated:
    For Car-Waybill Index Available?:
    When the car-waybill index field is checked for content, then if index contains data, qualified search is prepared; if index is empty or spaces, unqualified search is prepared.
  • Context - car-waybill index contains valid data:
    For Build Qualified Search with Car-Waybill Key:
    When qualified search is being configured, then car-waybill index value is moved to search key and qualified ssa is set for precise record matching.
  • Context - car-waybill index is empty or contains only spaces:
    For Build Unqualified Search:
    When unqualified search is being configured, then search key is set to spaces and unqualified ssa is set to retrieve all records.
  • Context - car-waybill search parameters are being configured:
    For Set Search Operator:
    When search operator needs to be set, then the operator from the request is assigned to the car-waybill search operator field.
  • Context - car-waybill search parameters are configured with pcb4 and appropriate ssa:
    For Execute Database Search on Car-Waybill Index:
    When database search is executed, then system performs database call using the configured search criteria to retrieve cargo records via car-waybill index.
👨‍💻 Technical ACs (Gherkin)
Context: A car-waybill search request is initiated
GIVEN
A car-waybill search request is initiated
Applied to: Car-Waybill Index Available?
WHEN
The car-waybill index field is checked for content
THEN
If index contains data, qualified search is prepared; if index is empty or spaces, unqualified search is prepared
Context: Car-waybill index contains valid data
GIVEN
Car-waybill index contains valid data
Applied to: Build Qualified Search with Car-Waybill Key
WHEN
Qualified search is being configured
THEN
Car-waybill index value is moved to search key and qualified SSA is set for precise record matching
Context: Car-waybill index is empty or contains only spaces
GIVEN
Car-waybill index is empty or contains only spaces
Applied to: Build Unqualified Search
WHEN
Unqualified search is being configured
THEN
Search key is set to spaces and unqualified SSA is set to retrieve all records
Context: Car-waybill search parameters are being configured
GIVEN
Car-waybill search parameters are being configured
Applied to: Set Search Operator
WHEN
Search operator needs to be set
THEN
The operator from the request is assigned to the car-waybill search operator field
Context: Car-waybill search parameters are configured with PCB4 and appropriate SSA
GIVEN
Car-waybill search parameters are configured with PCB4 and appropriate SSA
Applied to: Execute Database Search on Car-Waybill Index
WHEN
Database search is executed
THEN
System performs database call using the configured search criteria to retrieve cargo records via car-waybill index
R-GCCUSIO-cbl-00273 (+4) File: GCCUSIO.cbl Execute Bond Search Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Bond Search':
  • Context - a cargo search request is initiated using bond control number index:
    For Bond Index Available?:
    When the system checks if bond index field contains data, then if bond index is not empty, use qualified search with bond number, otherwise use unqualified search.
  • Context - bond index field contains a valid bond control number:
    For Set Bond Search Parameters:
    When setting up bond search parameters, then copy bond index value to search key and set operator from request parameters.
  • Context - bond index contains a valid bond control number and search parameters are set:
    For Build Qualified SSA with Bond Number:
    When building search argument for bond index query, then create qualified ssa using bond key value and set pcb5 as the search control block.
  • Context - bond index field is empty or contains spaces:
    For Build Unqualified SSA:
    When building search argument for bond index query, then create unqualified ssa with empty key value and set pcb5 as the search control block.
  • Context - search arguments are constructed and pcb5 is set for bond index access:
    For Execute Bond Index Search:
    When executing the bond index search operation, then call database interface using function code, pcb5, data area, and constructed ssa.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo search request is initiated using bond control number index
GIVEN
A cargo search request is initiated using bond control number index
Applied to: Bond Index Available?
WHEN
The system checks if bond index field contains data
THEN
If bond index is not empty, use qualified search with bond number, otherwise use unqualified search
Context: Bond index field contains a valid bond control number
GIVEN
Bond index field contains a valid bond control number
Applied to: Set Bond Search Parameters
WHEN
Setting up bond search parameters
THEN
Copy bond index value to search key and set operator from request parameters
Context: Bond index contains a valid bond control number and search parameters are set
GIVEN
Bond index contains a valid bond control number and search parameters are set
Applied to: Build Qualified SSA with Bond Number
WHEN
Building search argument for bond index query
THEN
Create qualified SSA using bond key value and set PCB5 as the search control block
Context: Bond index field is empty or contains spaces
GIVEN
Bond index field is empty or contains spaces
Applied to: Build Unqualified SSA
WHEN
Building search argument for bond index query
THEN
Create unqualified SSA with empty key value and set PCB5 as the search control block
Context: Search arguments are constructed and PCB5 is set for bond index access
GIVEN
Search arguments are constructed and PCB5 is set for bond index access
Applied to: Execute Bond Index Search
WHEN
Executing the bond index search operation
THEN
Call database interface using function code, PCB5, data area, and constructed SSA
R-GCCUSIO-cbl-00278 (+17) File: GCCUSIO.cbl Execute Error Index Search Merged 18 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Error Index Search':
  • Context - a cargo search request with error index specification:
    For Error Index Type?:
    When the system evaluates the error index type from the request parameters, then the system routes to the appropriate error index search path (origin, border, or destination error index).
  • Context - an origin error index search is requested:
    For Set Origin Error Search Parameters:
    When the system prepares to search by origin error index, then the system sets error code to 'e', maps origin station number to error origin key, and sets cargo ccn as the error origin cargo key.
  • Context - a border error index search is requested:
    For Set Border Error Search Parameters:
    When the system prepares to search by border error index, then the system sets error code to 'e', retrieves border station number from mc table lookup using location id, and sets cargo ccn as the error border cargo key.
  • Context - a destination error index search is requested:
    For Set Destination Error Search Parameters:
    When the system prepares to search by destination error index, then the system sets error code to 'e', maps destination station number to error destination key, and sets cargo ccn as the error destination cargo key.
  • Context - origin error search parameters are configured:
    For Search GCSB1RT by Origin Error Index:
    When the system executes search against gcsb1rt table using origin error index, then the system attempts to retrieve cargo status record matching the origin error criteria using qualified ssa.
  • Context - border error search parameters are configured:
    For Search GCSB1RT by Border Error Index:
    When the system executes search against gcsb1rt table using border error index, then the system attempts to retrieve cargo status record matching the border error criteria using qualified ssa.
  • Context - destination error search parameters are configured:
    For Search GCSB1RT by Destination Error Index:
    When the system executes search against gcsb1rt table using destination error index, then the system attempts to retrieve cargo status record matching the destination error criteria using qualified ssa.
  • Context - a search for origin error record has been executed:
    For Origin Error Record Found?:
    When the system checks the database operation status code, then if status code is spaces then record is found, otherwise no record found.
  • Context - a search for border error record has been executed:
    For Border Error Record Found?:
    When the system checks the database operation status code, then if status code is spaces then record is found, otherwise no record found.
  • Context - a search for destination error record has been executed:
    For Destination Error Record Found?:
    When the system checks the database operation status code, then if status code is spaces then record is found, otherwise no record found.
  • Context - an origin error status record has been found with cargo ccn key:
    For Retrieve Associated Cargo Record:
    When the system attempts to retrieve the associated main cargo record, then the system searches gcsusrt table using the cargo ccn key from the error status record.
  • Context - a border error status record has been found with cargo ccn key:
    For Retrieve Associated Cargo Record:
    When the system attempts to retrieve the associated main cargo record, then the system searches gcsusrt table using the cargo ccn key from the error status record.
  • Context - a destination error status record has been found with cargo ccn key:
    For Retrieve Associated Cargo Record:
    When the system attempts to retrieve the associated main cargo record, then the system searches gcsusrt table using the cargo ccn key from the error status record.
  • Context - a retrieval attempt for main cargo record associated with origin error has been made:
    For Cargo Record Exists?:
    When the system checks if the cargo record retrieval was successful, then if status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency.
  • Context - a retrieval attempt for main cargo record associated with border error has been made:
    For Cargo Record Exists?:
    When the system checks if the cargo record retrieval was successful, then if status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency.
  • Context - a retrieval attempt for main cargo record associated with destination error has been made:
    For Cargo Record Exists?:
    When the system checks if the cargo record retrieval was successful, then if status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency.
  • Context - an error status record exists in gcsb1rt but the associated cargo record does not exist in gcsusrt:
    For Log Index Inconsistency Error:
    When the system detects this data inconsistency condition, then the system logs error message 'gcsb1rt exist without gcsusrt' and calls error handling routine.
  • Context - a cargo record has been successfully found through error index search and validated for existence:
    For Return Cargo Record Data:
    When the system completes the error index search process, then the system returns the cargo record data in the io area for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo search request with error index specification
GIVEN
A cargo search request with error index specification
Applied to: Error Index Type?
WHEN
The system evaluates the error index type from the request parameters
THEN
The system routes to the appropriate error index search path (origin, border, or destination error index)
Context: An origin error index search is requested
GIVEN
An origin error index search is requested
Applied to: Set Origin Error Search Parameters
WHEN
The system prepares to search by origin error index
THEN
The system sets error code to 'E', maps origin station number to error origin key, and sets cargo CCN as the error origin cargo key
Context: A border error index search is requested
GIVEN
A border error index search is requested
Applied to: Set Border Error Search Parameters
WHEN
The system prepares to search by border error index
THEN
The system sets error code to 'E', retrieves border station number from MC table lookup using location ID, and sets cargo CCN as the error border cargo key
Context: A destination error index search is requested
GIVEN
A destination error index search is requested
Applied to: Set Destination Error Search Parameters
WHEN
The system prepares to search by destination error index
THEN
The system sets error code to 'E', maps destination station number to error destination key, and sets cargo CCN as the error destination cargo key
Context: Origin error search parameters are configured
GIVEN
Origin error search parameters are configured
Applied to: Search GCSB1RT by Origin Error Index
WHEN
The system executes search against GCSB1RT table using origin error index
THEN
The system attempts to retrieve cargo status record matching the origin error criteria using qualified SSA
Context: Border error search parameters are configured
GIVEN
Border error search parameters are configured
Applied to: Search GCSB1RT by Border Error Index
WHEN
The system executes search against GCSB1RT table using border error index
THEN
The system attempts to retrieve cargo status record matching the border error criteria using qualified SSA
Context: Destination error search parameters are configured
GIVEN
Destination error search parameters are configured
Applied to: Search GCSB1RT by Destination Error Index
WHEN
The system executes search against GCSB1RT table using destination error index
THEN
The system attempts to retrieve cargo status record matching the destination error criteria using qualified SSA
Context: A search for origin error record has been executed
GIVEN
A search for origin error record has been executed
Applied to: Origin Error Record Found?
WHEN
The system checks the database operation status code
THEN
If status code is spaces then record is found, otherwise no record found
Context: A search for border error record has been executed
GIVEN
A search for border error record has been executed
Applied to: Border Error Record Found?
WHEN
The system checks the database operation status code
THEN
If status code is spaces then record is found, otherwise no record found
Context: A search for destination error record has been executed
GIVEN
A search for destination error record has been executed
Applied to: Destination Error Record Found?
WHEN
The system checks the database operation status code
THEN
If status code is spaces then record is found, otherwise no record found
Context: An origin error status record has been found with cargo CCN key
GIVEN
An origin error status record has been found with cargo CCN key
Applied to: Retrieve Associated Cargo Record
WHEN
The system attempts to retrieve the associated main cargo record
THEN
The system searches GCSUSRT table using the cargo CCN key from the error status record
Context: A border error status record has been found with cargo CCN key
GIVEN
A border error status record has been found with cargo CCN key
Applied to: Retrieve Associated Cargo Record
WHEN
The system attempts to retrieve the associated main cargo record
THEN
The system searches GCSUSRT table using the cargo CCN key from the error status record
Context: A destination error status record has been found with cargo CCN key
GIVEN
A destination error status record has been found with cargo CCN key
Applied to: Retrieve Associated Cargo Record
WHEN
The system attempts to retrieve the associated main cargo record
THEN
The system searches GCSUSRT table using the cargo CCN key from the error status record
Context: A retrieval attempt for main cargo record associated with origin error has been made
GIVEN
A retrieval attempt for main cargo record associated with origin error has been made
Applied to: Cargo Record Exists?
WHEN
The system checks if the cargo record retrieval was successful
THEN
If status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency
Context: A retrieval attempt for main cargo record associated with border error has been made
GIVEN
A retrieval attempt for main cargo record associated with border error has been made
Applied to: Cargo Record Exists?
WHEN
The system checks if the cargo record retrieval was successful
THEN
If status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency
Context: A retrieval attempt for main cargo record associated with destination error has been made
GIVEN
A retrieval attempt for main cargo record associated with destination error has been made
Applied to: Cargo Record Exists?
WHEN
The system checks if the cargo record retrieval was successful
THEN
If status code is spaces then cargo record exists, otherwise cargo record does not exist indicating data inconsistency
Context: An error status record exists in GCSB1RT but the associated cargo record does not exist in GCSUSRT
GIVEN
An error status record exists in GCSB1RT but the associated cargo record does not exist in GCSUSRT
Applied to: Log Index Inconsistency Error
WHEN
The system detects this data inconsistency condition
THEN
The system logs error message 'GCSB1RT EXIST WITHOUT GCSUSRT' and calls error handling routine
Context: A cargo record has been successfully found through error index search and validated for existence
GIVEN
A cargo record has been successfully found through error index search and validated for existence
Applied to: Return Cargo Record Data
WHEN
The system completes the error index search process
THEN
The system returns the cargo record data in the IO area for further processing
R-GCX126-cbl-00289 (+5) File: GCX126R.cbl Process Authorized to Deliver Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Authorized to Deliver':
  • Context - an edi 350 message with v9 segment notice reason code indicating 'auth to deliver' status:
    For Log Message: 'EDI 350: AUTHORIZED TO PROCEED':
    When the authorization to deliver processing begins, then the system logs the message 'edi 350: authorized to proceed' to the cargo information log with current date, time, and cargo ccn.
  • Context - a cargo record with authorization to deliver status from edi 350:
    For Is Cargo CSA Manifest?:
    When the system evaluates the cargo's csa indicator, then if csa indicator is on, proceed with csa authorization processing; if csa indicator is off, log non-csa rejection message.
  • Context - a cargo record with csa indicator on and authorization to deliver status from edi 350:
    For Process CSA Authorization: - Log 'EDI 350: ACCEPTED - CSA' - Set Status to CSA-DLV - Set CSA Authorization Flag:
    When the system processes the csa authorization, then the system logs 'edi 350: accepted - csa' message, sets cargo current status to 'csa-dlv', sets csa authorization to deliver received flag to true.
  • Context - a cargo record with csa status and authorization flag set:
    For Update Cargo Record with CSA Status:
    When the csa authorization processing is complete, then the system replaces the cargo record in the database with updated csa delivery status and authorization received flag.
  • Context - a cargo record with csa indicator off and authorization to deliver status from edi 350:
    For Log Message: 'EDI 350: NOT ACCEPTED - NON-CSA':
    When the system evaluates the non-csa cargo, then the system logs 'edi 350: not accepted - non-csa' message to the cargo information log without updating cargo status.
  • Context - a cargo record with authorization to deliver status and associated equipment car id and waybill number:
    For Process Associated US Manifest: - Find US Cargo by Car ID and Waybill - Log Release Message to US CCN - Reference Canadian CCN:
    When the authorization processing is complete, then the system searches for us cargo records matching the car id and waybill number, and if found and not deleted and no train created, logs a message 'cdn ccn rlsed by edi 350' with the canadian ccn to the us cargo log entry.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with V9 segment notice reason code indicating 'AUTH TO DELIVER' status
GIVEN
An EDI 350 message with V9 segment notice reason code indicating 'AUTH TO DELIVER' status
Applied to: Log Message: 'EDI 350: AUTHORIZED TO PROCEED'
WHEN
The authorization to deliver processing begins
THEN
The system logs the message 'EDI 350: AUTHORIZED TO PROCEED' to the cargo information log with current date, time, and cargo CCN
Context: A cargo record with authorization to deliver status from EDI 350
GIVEN
A cargo record with authorization to deliver status from EDI 350
Applied to: Is Cargo CSA Manifest?
WHEN
The system evaluates the cargo's CSA indicator
THEN
If CSA indicator is ON, proceed with CSA authorization processing; If CSA indicator is OFF, log non-CSA rejection message
Context: A cargo record with CSA indicator ON and authorization to deliver status from EDI 350
GIVEN
A cargo record with CSA indicator ON and authorization to deliver status from EDI 350
Applied to: Process CSA Authorization: - Log 'EDI 350: ACCEPTED - CSA' - Set Status to CSA-DLV - Set CSA Authorization Flag
WHEN
The system processes the CSA authorization
THEN
The system logs 'EDI 350: ACCEPTED - CSA' message, sets cargo current status to 'CSA-DLV', sets CSA authorization to deliver received flag to TRUE
Context: A cargo record with CSA status and authorization flag set
GIVEN
A cargo record with CSA status and authorization flag set
Applied to: Update Cargo Record with CSA Status
WHEN
The CSA authorization processing is complete
THEN
The system replaces the cargo record in the database with updated CSA delivery status and authorization received flag
Context: A cargo record with CSA indicator OFF and authorization to deliver status from EDI 350
GIVEN
A cargo record with CSA indicator OFF and authorization to deliver status from EDI 350
Applied to: Log Message: 'EDI 350: NOT ACCEPTED - NON-CSA'
WHEN
The system evaluates the non-CSA cargo
THEN
The system logs 'EDI 350: NOT ACCEPTED - NON-CSA' message to the cargo information log without updating cargo status
Context: A cargo record with authorization to deliver status and associated equipment car ID and waybill number
GIVEN
A cargo record with authorization to deliver status and associated equipment car ID and waybill number
Applied to: Process Associated US Manifest: - Find US Cargo by Car ID and Waybill - Log Release Message to US CCN - Reference Canadian CCN
WHEN
The authorization processing is complete
THEN
The system searches for US cargo records matching the car ID and waybill number, and if found and not deleted and no train created, logs a message 'CDN CCN RLSED BY EDI 350' with the Canadian CCN to the US cargo log entry
R-GCX126-cbl-00295 (+6) File: GCX126R.cbl Process Cargo Hold Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Hold':
  • Context - an edi 350 message with v9 notice reason code indicating held status has been received for a cargo:
    For Log Message: 'EDI 350: GOODS HELD FOR EXAMINATION':
    When the cargo hold processing is initiated, then the system logs the message 'edi 350: goods held for examination' to the cargo information log.
  • Context - a cargo record exists in the system and customs has issued a hold notice via edi 350:
    For Set Cargo Status to HOLD:
    When the hold status processing is executed, then the cargo status is set to hold in the cargo record.
  • Context - the cargo status has been set to hold:
    For Update Cargo Record in Database:
    When the cargo record update is performed, then the cargo record is replaced in the database with the updated hold status.
  • Context - a cargo has been placed on hold by customs:
    For CCN Prefix = '6105'?:
    When the system checks the first 4 characters of the ccn (cargo control number), then if the ccn starts with '6105', the system proceeds to prepare a hold notification email; otherwise, the hold processing is complete.
  • Context - a cargo with ccn starting with '6105' has been placed on hold:
    For Prepare Hold Email: - Subject: 'CBSA CARGO HOLD' - Equipment ID - Waybill Number - CCN - Destination Station - Manifest Station:
    When the hold notification preparation is executed, then the system creates an email with subject 'cbsa cargo hold - [ccn]' and body containing: line 1 - 'cargo on hold for inspection by cbsa - edi350', line 3 - 'equipment: [equipment id]', line 4 - 'waybill: [carrier][origin station][waybill number]', line 5 - 'ccn: [ccn]', line 6 - 'destination: [destination station name], [state code]', line 7 - 'manifest upon: [manifest station name]'.
  • Context - the hold notification email content has been prepared:
    For Set Email Route: - Filename: CAHOLD - To: OM01247:
    When the email routing is configured, then the system sets the destination filename to 'cahold', sets the primary recipient to 'om01247', and sets the message type indicator to hold.
  • Context - the hold notification email has been prepared with routing parameters set to cahold destination and om01247 recipient:
    For Send Email Notification via EMCSEND2:
    When the email send operation is invoked, then the system calls emcsend2 program to transmit the hold notification email with the prepared content and routing information.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with V9 notice reason code indicating HELD status has been received for a cargo
GIVEN
An EDI 350 message with V9 notice reason code indicating HELD status has been received for a cargo
Applied to: Log Message: 'EDI 350: GOODS HELD FOR EXAMINATION'
WHEN
The cargo hold processing is initiated
THEN
The system logs the message 'EDI 350: GOODS HELD FOR EXAMINATION' to the cargo information log
Context: A cargo record exists in the system and customs has issued a hold notice via EDI 350
GIVEN
A cargo record exists in the system and customs has issued a hold notice via EDI 350
Applied to: Set Cargo Status to HOLD
WHEN
The hold status processing is executed
THEN
The cargo status is set to HOLD in the cargo record
Context: The cargo status has been set to HOLD
GIVEN
The cargo status has been set to HOLD
Applied to: Update Cargo Record in Database
WHEN
The cargo record update is performed
THEN
The cargo record is replaced in the database with the updated hold status
Context: A cargo has been placed on hold by customs
GIVEN
A cargo has been placed on hold by customs
Applied to: CCN Prefix = '6105'?
WHEN
The system checks the first 4 characters of the CCN (Cargo Control Number)
THEN
If the CCN starts with '6105', the system proceeds to prepare a hold notification email; otherwise, the hold processing is complete
Context: A cargo with CCN starting with '6105' has been placed on hold
GIVEN
A cargo with CCN starting with '6105' has been placed on hold
Applied to: Prepare Hold Email: - Subject: 'CBSA CARGO HOLD' - Equipment ID - Waybill Number - CCN - Destination Station - Manifest Station
WHEN
The hold notification preparation is executed
THEN
The system creates an email with subject 'CBSA CARGO HOLD - [CCN]' and body containing: line 1 - 'Cargo on HOLD for inspection by CBSA - EDI350', line 3 - 'Equipment: [Equipment ID]', line 4 - 'Waybill: [Carrier][Origin Station][Waybill Number]', line 5 - 'CCN: [CCN]', line 6 - 'DESTINATION: [Destination Station Name], [State Code]', line 7 - 'MANIFEST UPON: [Manifest Station Name]'
Context: The hold notification email content has been prepared
GIVEN
The hold notification email content has been prepared
Applied to: Set Email Route: - Filename: CAHOLD - To: OM01247
WHEN
The email routing is configured
THEN
The system sets the destination filename to 'CAHOLD', sets the primary recipient to 'OM01247', and sets the message type indicator to HOLD
Context: The hold notification email has been prepared with routing parameters set to CAHOLD destination and OM01247 recipient
GIVEN
The hold notification email has been prepared with routing parameters set to CAHOLD destination and OM01247 recipient
Applied to: Send Email Notification via EMCSEND2
WHEN
The email send operation is invoked
THEN
The system calls EMCSEND2 program to transmit the hold notification email with the prepared content and routing information
R-GCCUSIO-cbl-00296 (+8) File: GCCUSIO.cbl Execute Hold Index Search Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Hold Index Search':
  • Context - a hold index search request is initiated:
    For Hold Index Type?:
    When the system evaluates the index type specified in gcwusio-index-held-dest or gcwusio-index-held-border, then the system routes to the appropriate hold index search processing.
  • Context - the index type is held destination (gcwusio-index-held-dest is true):
    For Search Held Destination Index:
    When the system processes the held destination index search, then the system retrieves gcsb1rt record using held destination key and cargo key from the index, then calls cims to access the held destination index database.
  • Context - the index type is held border (gcwusio-index-held-border is true):
    For Search Held Border Index:
    When the system processes the held border index search, then the system retrieves gcsb1rt record using held border key and cargo key from the index, then calls cims to access the held border index database.
  • Context - a hold index search is being performed with valid index keys:
    For Retrieve GCSB1RT Index Record:
    When the system calls cims with the function code, pcb, gcsb1rt record, and qualified ssa, then the system retrieves the gcsb1rt index record from the database and the status code indicates success or failure.
  • Context - a gcsb1rt index record has been successfully retrieved:
    For Extract Cargo Key from Index:
    When the system processes the index record, then the system extracts the cargo key (gcb1-key-cargo) from the index record and prepares it for primary cargo record retrieval.
  • Context - a cargo key has been extracted from the gcsb1rt index record:
    For Retrieve Primary Cargo Record:
    When the system sets the function code to gu (get unique) and calls x1100-call-one-ssa with the cargo key, then the system attempts to retrieve the primary gcsusrt cargo record using the extracted key.
  • Context - an attempt to retrieve the primary cargo record has been made:
    For Primary Record Found?:
    When the system checks the status code after the retrieval attempt, then if status code is spaces then primary record is found, otherwise primary record is not found.
  • Context - the primary cargo record has been successfully retrieved (status code is spaces):
    For Return Cargo Data:
    When the hold index search completes successfully, then the system returns the retrieved cargo data to the calling process.
  • Context - a gcsb1rt index record exists but the corresponding primary cargo record is not found (status code is not spaces):
    For Log Index Inconsistency Error:
    When the system detects this index inconsistency, then the system sets error message to 'gcsb1rt exist without gcsusrt' and calls cerr error handling program.
👨‍💻 Technical ACs (Gherkin)
Context: A hold index search request is initiated
GIVEN
A hold index search request is initiated
Applied to: Hold Index Type?
WHEN
The system evaluates the index type specified in GCWUSIO-INDEX-HELD-DEST or GCWUSIO-INDEX-HELD-BORDER
THEN
The system routes to the appropriate hold index search processing
Context: The index type is held destination (GCWUSIO-INDEX-HELD-DEST is true)
GIVEN
The index type is held destination (GCWUSIO-INDEX-HELD-DEST is true)
Applied to: Search Held Destination Index
WHEN
The system processes the held destination index search
THEN
The system retrieves GCSB1RT record using held destination key and cargo key from the index, then calls CIMS to access the held destination index database
Context: The index type is held border (GCWUSIO-INDEX-HELD-BORDER is true)
GIVEN
The index type is held border (GCWUSIO-INDEX-HELD-BORDER is true)
Applied to: Search Held Border Index
WHEN
The system processes the held border index search
THEN
The system retrieves GCSB1RT record using held border key and cargo key from the index, then calls CIMS to access the held border index database
Context: A hold index search is being performed with valid index keys
GIVEN
A hold index search is being performed with valid index keys
Applied to: Retrieve GCSB1RT Index Record
WHEN
The system calls CIMS with the function code, PCB, GCSB1RT record, and qualified SSA
THEN
The system retrieves the GCSB1RT index record from the database and the status code indicates success or failure
Context: A GCSB1RT index record has been successfully retrieved
GIVEN
A GCSB1RT index record has been successfully retrieved
Applied to: Extract Cargo Key from Index
WHEN
The system processes the index record
THEN
The system extracts the cargo key (GCB1-KEY-CARGO) from the index record and prepares it for primary cargo record retrieval
Context: A cargo key has been extracted from the GCSB1RT index record
GIVEN
A cargo key has been extracted from the GCSB1RT index record
Applied to: Retrieve Primary Cargo Record
WHEN
The system sets the function code to GU (Get Unique) and calls X1100-CALL-ONE-SSA with the cargo key
THEN
The system attempts to retrieve the primary GCSUSRT cargo record using the extracted key
Context: An attempt to retrieve the primary cargo record has been made
GIVEN
An attempt to retrieve the primary cargo record has been made
Applied to: Primary Record Found?
WHEN
The system checks the status code after the retrieval attempt
THEN
If status code is spaces then primary record is found, otherwise primary record is not found
Context: The primary cargo record has been successfully retrieved (status code is spaces)
GIVEN
The primary cargo record has been successfully retrieved (status code is spaces)
Applied to: Return Cargo Data
WHEN
The hold index search completes successfully
THEN
The system returns the retrieved cargo data to the calling process
Context: A GCSB1RT index record exists but the corresponding primary cargo record is not found (status code is not spaces)
GIVEN
A GCSB1RT index record exists but the corresponding primary cargo record is not found (status code is not spaces)
Applied to: Log Index Inconsistency Error
WHEN
The system detects this index inconsistency
THEN
The system sets error message to 'GCSB1RT EXIST WITHOUT GCSUSRT' and calls CERR error handling program
R-GCX126-cbl-00302 (+14) File: GCX126R.cbl Process Deconsolidation Release Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Deconsolidation Release':
  • Context - an edi 350 message has been received and parsed with v9 segment containing notice reason code:
    For V9 Notice Reason = DECON?:
    When the system evaluates the v9 notice reason code field, then if v9-02-decon is true, proceed with deconsolidation release processing; otherwise, skip deconsolidation processing and continue to next evaluation.
  • Context - a cargo record exists and v9 notice reason code indicates deconsolidation:
    For 30: Set Release Information - Clear destination station - Set release date/time - Set release by user - Set status to RELEASED - Set release status 'R' - Set release type 'A' - Clear error fields:
    When the system processes the deconsolidation release, then clear gccc-destin-stn-num-index and gccc-destin-stn-num-for-index to spaces, set gccc-release-date to cc-machine-date-x, set gccc-release-time to cc-machine-time-x, set gccc-release-by to cc-acf2-userid, set gccc-current-status to 'released', set gccc-release-status to 'r', set gccc-release-type to 'a', clear gccc-release-reason to spaces, clear gccc-err-or-rel-status-index to spaces, and clear gccc-error-status to spaces.
  • Context - deconsolidation release information has been set and p4 segment contains port code:
    For Log Message: 'RELEASE VIA DECON AT PORT' + Port Code:
    When the system logs the deconsolidation release event, then construct message 'edi 350: release via decon at port ' concatenated with p4-01-port-cde (first 4 characters), store in ws-gcx105-info-msg, and perform z150-log-cargo-info-msg to create audit log entry.
  • Context - p4 segment contains the port code where deconsolidation occurred:
    For Update Release Reason: 'DECONSOLIDATION AT' + Port Code:
    When the system updates the release reason for deconsolidation, then construct string 'deconsolidation at ' concatenated with p4-01-port-cde (first 4 characters) and store in gccc-release-reason field.
  • Context - a canadian cargo has been released via deconsolidation with valid equipment car id and waybill number stored in ws-current-carid-key and save-waybill-index:
    For 31: Process Associated US Manifest - Find US manifest by car ID and waybill - Log release message to US CCN - Reference Canadian CCN:
    When the system processes the associated us manifest, then perform z3300-gu-us-cargo-by-carwb to retrieve us cargo by car id and waybill, then perform z3350-gn-us-cargo-by-carwb until ws-us-mfst-found is true or ws-eof is true; if us manifest found and not eof, perform z200-move-log-information, construct gcx105-date from cc-machine-century and cc-machine-date-x, set gcx105-time to cc-machine-time-x, set gcx105-action-code to log-use-input-message, set gcx105-train-or-us-ccn to gcusrt-us-ccn-key, set gcx105-us-cargo to true, construct gcx105-message as 'cdn ccn rlsed by edi 350: ' concatenated with gccc-ccn-key, and perform z300-spawn-gct1051e.
  • Context - cargo release date and time have been set in gccc-release-date and gccc-release-time:
    For Save Release Date/Time to Hold Variables:
    When the system saves the release date and time, then move gccc-release-date to hold-date and move gccc-release-time to hold-time.
  • Context - cargo record gccc-cargo-report-segment has been updated with release information:
    For 43: Update Cargo Record - Replace cargo record in database:
    When the system updates the cargo record, then perform z3100-repl-cargo which clears cc-status-code, sets cc-accept-status to spaces, and calls cims with repl function code, gccc-pcb, and gccc-cargo-report-segment to replace the cargo record.
  • Context - a cargo record has been updated with deconsolidation release information:
    For Is Master Manifest?:
    When the system checks the manifest type, then if gccc-master-mfst is true, proceed to process follower manifests; otherwise, end deconsolidation processing.
  • Context - current cargo is a master manifest that has been released via deconsolidation with gccc-ccn-key stored in gcb0rt-ccn-key:
    For 33: Process Follower Manifests - Retrieve all follower manifests - Set release information for each - Log release message - Update release reason - Process US manifest - Update cargo record:
    When the system processes follower manifests, then save gccc-cargo-report-segment to ws-save-gcsccrt, set cc-accept-status to 'gegb', initialize ws-follower-mani-array to spaces, set ws-follower-not-end-of-db to true, set i to 1; perform until ws-follower-end-of-db or i > 100: call cims with gn, gccc-pcb7, gccc-cargo-report-segment, and ccrt-b0rt-ssaq; if cc-status-code is space and gccc-master-mfst-ccn equals ws-save-ccn: if gccc-follower-mfst is true, move gccc-ccn-key to ws-follower-mani(i) and add 1 to i; else set ws-follower-end-of-db to true; subtract 1 from i; if i > 0, perform varying j from 1 by 1 until ws-follower-mani(i) is spaces or low-values or j > i: move ws-follower-mani(j) to key-value of ccrt-ssaq and a2rt-ssaq, perform z3000-ghu-cargo; if ws-cargo-found: perform d110-set-release-information, construct ws-gcx105-info-msg as 'edi 350: release via decon at port ' concatenated with p4-01-port-cde (first 4 characters), construct gccc-release-reason as 'deconsolidation at ' concatenated with p4-01-port-cde (first 4 characters), move gccc-ccn-key to ws-current-ccn-key, perform z150-log-cargo-info-msg, move gccc-waybill-key-for-index to save-waybill-index, move gccc-equipment-car to ws-current-carid-key, perform d120-process-us-mfst, clear cc-status-code, set cc-accept-status to spaces, and call cims with repl, gccc-pcb, and gccc-cargo-report-segment.
  • Context - a master manifest ccn is stored in gcb0rt-ccn-key and ws-save-ccn:
    For 33: Process Follower Manifests - Retrieve all follower manifests:
    When the system retrieves follower manifests, then set cc-accept-status to 'gegb', initialize ws-follower-mani-array to spaces, set i to 1, set ws-follower-not-end-of-db to true; perform until ws-follower-end-of-db is true or i > 100: call cims with gn function, gccc-pcb7, gccc-cargo-report-segment, and ccrt-b0rt-ssaq; if cc-status-code is space and gccc-master-mfst-ccn equals ws-save-ccn: if gccc-follower-mfst is true, move gccc-ccn-key to ws-follower-mani(i) and add 1 to i; else if cc-status-code is not space or gccc-master-mfst-ccn does not equal ws-save-ccn, set ws-follower-end-of-db to true; subtract 1 from i after loop completes.
  • Context - follower manifest ccn is stored in ws-follower-mani(j) and cargo record has been retrieved:
    For 33: Process Follower Manifests - Set release information for each:
    When the system sets release information for the follower, then if ws-cargo-found is true, perform d110-set-release-information which clears gccc-destin-stn-num-index and gccc-destin-stn-num-for-index to spaces, sets gccc-release-date to cc-machine-date-x, sets gccc-release-time to cc-machine-time-x, sets gccc-release-by to cc-acf2-userid, sets gccc-current-status to 'released', sets gccc-release-status to 'r', sets gccc-release-type to 'a', clears gccc-release-reason to spaces, clears gccc-err-or-rel-status-index to spaces, and clears gccc-error-status to spaces.
  • Context - follower manifest has been found and release information has been set:
    For 33: Process Follower Manifests - Log release message:
    When the system logs the release message for the follower, then clear ws-gcx105-info-msg to spaces, construct message 'edi 350: release via decon at port ' concatenated with p4-01-port-cde (first 4 characters) and store in ws-gcx105-info-msg, move gccc-ccn-key to ws-current-ccn-key, and perform z150-log-cargo-info-msg.
  • Context - follower manifest has been found and p4 segment contains port code:
    For 33: Process Follower Manifests - Update release reason:
    When the system updates the release reason for the follower, then construct string 'deconsolidation at ' concatenated with p4-01-port-cde (first 4 characters) and store in gccc-release-reason field.
  • Context - follower manifest has been found with valid gccc-waybill-key-for-index and gccc-equipment-car:
    For 33: Process Follower Manifests - Process US manifest:
    When the system processes the us manifest for the follower, then move gccc-waybill-key-for-index to save-waybill-index, move gccc-equipment-car to ws-current-carid-key, and perform d120-process-us-mfst which sets ws-us-mfst-not-found to true, sets ws-not-eof to true, performs z3300-gu-us-cargo-by-carwb, performs z3350-gn-us-cargo-by-carwb until ws-us-mfst-found or ws-eof; if not eof: performs z200-move-log-information, constructs gcx105-date from cc-machine-century and cc-machine-date-x, sets gcx105-time to cc-machine-time-x, sets gcx105-action-code to log-use-input-message, sets gcx105-train-or-us-ccn to gcusrt-us-ccn-key, sets gcx105-us-cargo to true, constructs gcx105-message as 'cdn ccn rlsed by edi 350: ' concatenated with gccc-ccn-key, and performs z300-spawn-gct1051e.
  • Context - follower cargo record gccc-cargo-report-segment has been updated with release information:
    For 33: Process Follower Manifests - Update cargo record:
    When the system updates the follower cargo record, then clear cc-status-code to spaces, set cc-accept-status to spaces, and call cims with repl function code, gccc-pcb, and gccc-cargo-report-segment to replace the cargo record.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been received and parsed with V9 segment containing notice reason code
GIVEN
An EDI 350 message has been received and parsed with V9 segment containing notice reason code
Applied to: V9 Notice Reason = DECON?
WHEN
The system evaluates the V9 notice reason code field
THEN
If V9-02-DECON is true, proceed with deconsolidation release processing; otherwise, skip deconsolidation processing and continue to next evaluation
Context: A cargo record exists and V9 notice reason code indicates deconsolidation
GIVEN
A cargo record exists and V9 notice reason code indicates deconsolidation
Applied to: 30: Set Release Information - Clear destination station - Set release date/time - Set release by user - Set status to RELEASED - Set release status 'R' - Set release type 'A' - Clear error fields
WHEN
The system processes the deconsolidation release
THEN
Clear GCCC-DESTIN-STN-NUM-INDEX and GCCC-DESTIN-STN-NUM-FOR-INDEX to spaces, set GCCC-RELEASE-DATE to CC-MACHINE-DATE-X, set GCCC-RELEASE-TIME to CC-MACHINE-TIME-X, set GCCC-RELEASE-BY to CC-ACF2-USERID, set GCCC-CURRENT-STATUS to 'RELEASED', set GCCC-RELEASE-STATUS to 'R', set GCCC-RELEASE-TYPE to 'A', clear GCCC-RELEASE-REASON to spaces, clear GCCC-ERR-OR-REL-STATUS-INDEX to spaces, and clear GCCC-ERROR-STATUS to spaces
Context: Deconsolidation release information has been set and P4 segment contains port code
GIVEN
Deconsolidation release information has been set and P4 segment contains port code
Applied to: Log Message: 'RELEASE VIA DECON AT PORT' + Port Code
WHEN
The system logs the deconsolidation release event
THEN
Construct message 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with P4-01-PORT-CDE (first 4 characters), store in WS-GCX105-INFO-MSG, and perform Z150-LOG-CARGO-INFO-MSG to create audit log entry
Context: P4 segment contains the port code where deconsolidation occurred
GIVEN
P4 segment contains the port code where deconsolidation occurred
Applied to: Update Release Reason: 'DECONSOLIDATION AT' + Port Code
WHEN
The system updates the release reason for deconsolidation
THEN
Construct string 'DECONSOLIDATION AT ' concatenated with P4-01-PORT-CDE (first 4 characters) and store in GCCC-RELEASE-REASON field
Context: A Canadian cargo has been released via deconsolidation with valid equipment car ID and waybill number stored in WS-CURRENT-CARID-KEY and SAVE-WAYBILL-INDEX
GIVEN
A Canadian cargo has been released via deconsolidation with valid equipment car ID and waybill number stored in WS-CURRENT-CARID-KEY and SAVE-WAYBILL-INDEX
Applied to: 31: Process Associated US Manifest - Find US manifest by car ID and waybill - Log release message to US CCN - Reference Canadian CCN
WHEN
The system processes the associated US manifest
THEN
Perform Z3300-GU-US-CARGO-BY-CARWB to retrieve US cargo by car ID and waybill, then perform Z3350-GN-US-CARGO-BY-CARWB until WS-US-MFST-FOUND is true or WS-EOF is true; if US manifest found and not EOF, perform Z200-MOVE-LOG-INFORMATION, construct GCX105-DATE from CC-MACHINE-CENTURY and CC-MACHINE-DATE-X, set GCX105-TIME to CC-MACHINE-TIME-X, set GCX105-ACTION-CODE to LOG-USE-INPUT-MESSAGE, set GCX105-TRAIN-OR-US-CCN to GCUSRT-US-CCN-KEY, set GCX105-US-CARGO to true, construct GCX105-MESSAGE as 'CDN CCN RLSED BY EDI 350: ' concatenated with GCCC-CCN-KEY, and perform Z300-SPAWN-GCT1051E
Context: Cargo release date and time have been set in GCCC-RELEASE-DATE and GCCC-RELEASE-TIME
GIVEN
Cargo release date and time have been set in GCCC-RELEASE-DATE and GCCC-RELEASE-TIME
Applied to: Save Release Date/Time to Hold Variables
WHEN
The system saves the release date and time
THEN
Move GCCC-RELEASE-DATE to HOLD-DATE and move GCCC-RELEASE-TIME to HOLD-TIME
Context: Cargo record GCCC-CARGO-REPORT-SEGMENT has been updated with release information
GIVEN
Cargo record GCCC-CARGO-REPORT-SEGMENT has been updated with release information
Applied to: 43: Update Cargo Record - Replace cargo record in database
WHEN
The system updates the cargo record
THEN
Perform Z3100-REPL-CARGO which clears CC-STATUS-CODE, sets CC-ACCEPT-STATUS to spaces, and calls CIMS with REPL function code, GCCC-PCB, and GCCC-CARGO-REPORT-SEGMENT to replace the cargo record
Context: A cargo record has been updated with deconsolidation release information
GIVEN
A cargo record has been updated with deconsolidation release information
Applied to: Is Master Manifest?
WHEN
The system checks the manifest type
THEN
If GCCC-MASTER-MFST is true, proceed to process follower manifests; otherwise, end deconsolidation processing
Context: Current cargo is a master manifest that has been released via deconsolidation with GCCC-CCN-KEY stored in GCB0RT-CCN-KEY
GIVEN
Current cargo is a master manifest that has been released via deconsolidation with GCCC-CCN-KEY stored in GCB0RT-CCN-KEY
Applied to: 33: Process Follower Manifests - Retrieve all follower manifests - Set release information for each - Log release message - Update release reason - Process US manifest - Update cargo record
WHEN
The system processes follower manifests
THEN
Save GCCC-CARGO-REPORT-SEGMENT to WS-SAVE-GCSCCRT, set CC-ACCEPT-STATUS to 'GEGB', initialize WS-FOLLOWER-MANI-ARRAY to spaces, set WS-FOLLOWER-NOT-END-OF-DB to true, set I to 1; perform until WS-FOLLOWER-END-OF-DB or I > 100: call CIMS with GN, GCCC-PCB7, GCCC-CARGO-REPORT-SEGMENT, and CCRT-B0RT-SSAQ; if CC-STATUS-CODE is space and GCCC-MASTER-MFST-CCN equals WS-SAVE-CCN: if GCCC-FOLLOWER-MFST is true, move GCCC-CCN-KEY to WS-FOLLOWER-MANI(I) and add 1 to I; else set WS-FOLLOWER-END-OF-DB to true; subtract 1 from I; if I > 0, perform varying J from 1 by 1 until WS-FOLLOWER-MANI(I) is spaces or low-values or J > I: move WS-FOLLOWER-MANI(J) to KEY-VALUE of CCRT-SSAQ and A2RT-SSAQ, perform Z3000-GHU-CARGO; if WS-CARGO-FOUND: perform D110-SET-RELEASE-INFORMATION, construct WS-GCX105-INFO-MSG as 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with P4-01-PORT-CDE (first 4 characters), construct GCCC-RELEASE-REASON as 'DECONSOLIDATION AT ' concatenated with P4-01-PORT-CDE (first 4 characters), move GCCC-CCN-KEY to WS-CURRENT-CCN-KEY, perform Z150-LOG-CARGO-INFO-MSG, move GCCC-WAYBILL-KEY-FOR-INDEX to SAVE-WAYBILL-INDEX, move GCCC-EQUIPMENT-CAR to WS-CURRENT-CARID-KEY, perform D120-PROCESS-US-MFST, clear CC-STATUS-CODE, set CC-ACCEPT-STATUS to spaces, and call CIMS with REPL, GCCC-PCB, and GCCC-CARGO-REPORT-SEGMENT
Context: A master manifest CCN is stored in GCB0RT-CCN-KEY and WS-SAVE-CCN
GIVEN
A master manifest CCN is stored in GCB0RT-CCN-KEY and WS-SAVE-CCN
Applied to: 33: Process Follower Manifests - Retrieve all follower manifests
WHEN
The system retrieves follower manifests
THEN
Set CC-ACCEPT-STATUS to 'GEGB', initialize WS-FOLLOWER-MANI-ARRAY to spaces, set I to 1, set WS-FOLLOWER-NOT-END-OF-DB to true; perform until WS-FOLLOWER-END-OF-DB is true or I > 100: call CIMS with GN function, GCCC-PCB7, GCCC-CARGO-REPORT-SEGMENT, and CCRT-B0RT-SSAQ; if CC-STATUS-CODE is space and GCCC-MASTER-MFST-CCN equals WS-SAVE-CCN: if GCCC-FOLLOWER-MFST is true, move GCCC-CCN-KEY to WS-FOLLOWER-MANI(I) and add 1 to I; else if CC-STATUS-CODE is not space or GCCC-MASTER-MFST-CCN does not equal WS-SAVE-CCN, set WS-FOLLOWER-END-OF-DB to true; subtract 1 from I after loop completes
Context: Follower manifest CCN is stored in WS-FOLLOWER-MANI(J) and cargo record has been retrieved
GIVEN
Follower manifest CCN is stored in WS-FOLLOWER-MANI(J) and cargo record has been retrieved
Applied to: 33: Process Follower Manifests - Set release information for each
WHEN
The system sets release information for the follower
THEN
If WS-CARGO-FOUND is true, perform D110-SET-RELEASE-INFORMATION which clears GCCC-DESTIN-STN-NUM-INDEX and GCCC-DESTIN-STN-NUM-FOR-INDEX to spaces, sets GCCC-RELEASE-DATE to CC-MACHINE-DATE-X, sets GCCC-RELEASE-TIME to CC-MACHINE-TIME-X, sets GCCC-RELEASE-BY to CC-ACF2-USERID, sets GCCC-CURRENT-STATUS to 'RELEASED', sets GCCC-RELEASE-STATUS to 'R', sets GCCC-RELEASE-TYPE to 'A', clears GCCC-RELEASE-REASON to spaces, clears GCCC-ERR-OR-REL-STATUS-INDEX to spaces, and clears GCCC-ERROR-STATUS to spaces
Context: Follower manifest has been found and release information has been set
GIVEN
Follower manifest has been found and release information has been set
Applied to: 33: Process Follower Manifests - Log release message
WHEN
The system logs the release message for the follower
THEN
Clear WS-GCX105-INFO-MSG to spaces, construct message 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with P4-01-PORT-CDE (first 4 characters) and store in WS-GCX105-INFO-MSG, move GCCC-CCN-KEY to WS-CURRENT-CCN-KEY, and perform Z150-LOG-CARGO-INFO-MSG
Context: Follower manifest has been found and P4 segment contains port code
GIVEN
Follower manifest has been found and P4 segment contains port code
Applied to: 33: Process Follower Manifests - Update release reason
WHEN
The system updates the release reason for the follower
THEN
Construct string 'DECONSOLIDATION AT ' concatenated with P4-01-PORT-CDE (first 4 characters) and store in GCCC-RELEASE-REASON field
Context: Follower manifest has been found with valid GCCC-WAYBILL-KEY-FOR-INDEX and GCCC-EQUIPMENT-CAR
GIVEN
Follower manifest has been found with valid GCCC-WAYBILL-KEY-FOR-INDEX and GCCC-EQUIPMENT-CAR
Applied to: 33: Process Follower Manifests - Process US manifest
WHEN
The system processes the US manifest for the follower
THEN
Move GCCC-WAYBILL-KEY-FOR-INDEX to SAVE-WAYBILL-INDEX, move GCCC-EQUIPMENT-CAR to WS-CURRENT-CARID-KEY, and perform D120-PROCESS-US-MFST which sets WS-US-MFST-NOT-FOUND to true, sets WS-NOT-EOF to true, performs Z3300-GU-US-CARGO-BY-CARWB, performs Z3350-GN-US-CARGO-BY-CARWB until WS-US-MFST-FOUND or WS-EOF; if not EOF: performs Z200-MOVE-LOG-INFORMATION, constructs GCX105-DATE from CC-MACHINE-CENTURY and CC-MACHINE-DATE-X, sets GCX105-TIME to CC-MACHINE-TIME-X, sets GCX105-ACTION-CODE to LOG-USE-INPUT-MESSAGE, sets GCX105-TRAIN-OR-US-CCN to GCUSRT-US-CCN-KEY, sets GCX105-US-CARGO to true, constructs GCX105-MESSAGE as 'CDN CCN RLSED BY EDI 350: ' concatenated with GCCC-CCN-KEY, and performs Z300-SPAWN-GCT1051E
Context: Follower cargo record GCCC-CARGO-REPORT-SEGMENT has been updated with release information
GIVEN
Follower cargo record GCCC-CARGO-REPORT-SEGMENT has been updated with release information
Applied to: 33: Process Follower Manifests - Update cargo record
WHEN
The system updates the follower cargo record
THEN
Clear CC-STATUS-CODE to spaces, set CC-ACCEPT-STATUS to spaces, and call CIMS with REPL function code, GCCC-PCB, and GCCC-CARGO-REPORT-SEGMENT to replace the cargo record
R-GCCUSIO-cbl-00305 (+4) File: GCCUSIO.cbl Populate Origin Error Index Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Origin Error Index':
  • Context - the system is processing error fields for origin station cargo processing:
    For Set Error Code to 'E':
    When the origin error index needs to be populated, then the error code for origin station must be set to 'e'.
  • Context - a cargo record exists with origin station information:
    For Extract Origin Station Number:
    When processing error conditions for the origin station, then the origin station number must be extracted from the cargo record field rt28-orig-stn-num.
  • Context - the origin station number has been extracted from the cargo record:
    For Set Origin Error Index Key:
    When building the error index for origin station processing, then the origin error index key must be set to the extracted origin station number.
  • Context - a cargo record exists with a unique ccn key identifier:
    For Extract Cargo CCN Key:
    When processing error conditions that need to be linked to specific cargo, then the cargo ccn key must be extracted from the cargo record us-ccn-key field.
  • Context - the cargo ccn key has been extracted from the cargo record:
    For Set Origin Error Cargo Key:
    When building the error index that links errors to specific cargo, then the origin error cargo key must be set to the extracted cargo ccn key.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing error fields for origin station cargo processing
GIVEN
The system is processing error fields for origin station cargo processing
Applied to: Set Error Code to 'E'
WHEN
The origin error index needs to be populated
THEN
The error code for origin station must be set to 'E'
Context: A cargo record exists with origin station information
GIVEN
A cargo record exists with origin station information
Applied to: Extract Origin Station Number
WHEN
Processing error conditions for the origin station
THEN
The origin station number must be extracted from the cargo record field RT28-ORIG-STN-NUM
Context: The origin station number has been extracted from the cargo record
GIVEN
The origin station number has been extracted from the cargo record
Applied to: Set Origin Error Index Key
WHEN
Building the error index for origin station processing
THEN
The origin error index key must be set to the extracted origin station number
Context: A cargo record exists with a unique CCN key identifier
GIVEN
A cargo record exists with a unique CCN key identifier
Applied to: Extract Cargo CCN Key
WHEN
Processing error conditions that need to be linked to specific cargo
THEN
The cargo CCN key must be extracted from the cargo record US-CCN-KEY field
Context: The cargo CCN key has been extracted from the cargo record
GIVEN
The cargo CCN key has been extracted from the cargo record
Applied to: Set Origin Error Cargo Key
WHEN
Building the error index that links errors to specific cargo
THEN
The origin error cargo key must be set to the extracted cargo CCN key
R-GCCUSIO-cbl-00310 (+7) File: GCCUSIO.cbl Get Border Station from MC Table Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Border Station from MC Table':
  • Context - a request to retrieve border station information from mc table:
    For Initialize Table Request Parameters:
    When the system prepares for table lookup, then all table request parameters are cleared and initialized to spaces, and pcb flags are reset.
  • Context - a table lookup request is being prepared:
    For Set Function Code to 'GU':
    When the system configures the database operation type, then the function code is set to 'gu' for get unique operation.
  • Context - a table lookup request for border station information:
    For Set Table ID to 'MC':
    When the system identifies which table to query, then the table id is set to 'mc' to target the mc table.
  • Context - a cargo record with location id information:
    For Set Location ID from Cargo Record:
    When the system prepares the mc table lookup key, then the location id from the cargo record is used as the sequence id for table lookup.
  • Context - all table lookup parameters are properly configured:
    For Call Table Lookup Service GCCTBIO:
    When the system needs to retrieve mc table data, then the gcctbio service is called with the configured parameters to perform the table lookup.
  • Context - a completed mc table lookup operation:
    For Table Lookup Successful?:
    When the system evaluates the lookup result, then if return flag equals '0' then lookup is successful, otherwise lookup failed.
  • Context - a successful mc table lookup with retrieved table segment data:
    For Extract Border Station Number from MC Segment:
    When the system processes the mc segment information, then the border station number is extracted from the mc segment structure.
  • Context - a successfully extracted border station number from mc table:
    For Set Border Station in Index Fields:
    When the system updates error index fields, then the border station number is assigned to the error border key field.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve border station information from MC table
GIVEN
A request to retrieve border station information from MC table
Applied to: Initialize Table Request Parameters
WHEN
The system prepares for table lookup
THEN
All table request parameters are cleared and initialized to spaces, and PCB flags are reset
Context: A table lookup request is being prepared
GIVEN
A table lookup request is being prepared
Applied to: Set Function Code to 'GU'
WHEN
The system configures the database operation type
THEN
The function code is set to 'GU' for Get Unique operation
Context: A table lookup request for border station information
GIVEN
A table lookup request for border station information
Applied to: Set Table ID to 'MC'
WHEN
The system identifies which table to query
THEN
The table ID is set to 'MC' to target the MC table
Context: A cargo record with location ID information
GIVEN
A cargo record with location ID information
Applied to: Set Location ID from Cargo Record
WHEN
The system prepares the MC table lookup key
THEN
The location ID from the cargo record is used as the sequence ID for table lookup
Context: All table lookup parameters are properly configured
GIVEN
All table lookup parameters are properly configured
Applied to: Call Table Lookup Service GCCTBIO
WHEN
The system needs to retrieve MC table data
THEN
The GCCTBIO service is called with the configured parameters to perform the table lookup
Context: A completed MC table lookup operation
GIVEN
A completed MC table lookup operation
Applied to: Table Lookup Successful?
WHEN
The system evaluates the lookup result
THEN
If return flag equals '0' then lookup is successful, otherwise lookup failed
Context: A successful MC table lookup with retrieved table segment data
GIVEN
A successful MC table lookup with retrieved table segment data
Applied to: Extract Border Station Number from MC Segment
WHEN
The system processes the MC segment information
THEN
The border station number is extracted from the MC segment structure
Context: A successfully extracted border station number from MC table
GIVEN
A successfully extracted border station number from MC table
Applied to: Set Border Station in Index Fields
WHEN
The system updates error index fields
THEN
The border station number is assigned to the error border key field
R-GCX126-cbl-00317 (+9) File: GCX126R.cbl Set Release Information Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Release Information':
  • Context - a cargo record exists in the system:
    For Clear Destination Station Number:
    When the cargo is being released by customs, then the destination station number index field is set to spaces and the destination station number for index field is set to spaces.
  • Context - a cargo record is being released:
    For Set Release Date to Current Machine Date & Set Release Time to Current Machine Time & Set Release By User to ACF2 User ID & Initialize Release Reason to Spaces & Clear Error/Release Status Index & Clear Error Status:
    When the release information is being set, then the cargo release date field is populated with the current machine date in ccyymmdd format and the cargo release time field is populated with the current machine time in hhmmss format and the cargo release by field is populated with the current acf2 user id from the system and the cargo release reason field is set to spaces and the cargo error or release status index field is set to spaces and the cargo error status field is set to spaces.
  • Context - a cargo record is being released by customs:
    For Set Current Status to 'RELEASED' & Set Release Status to 'R':
    When the release information is being set, then the cargo current status field is set to the literal value 'released' and the cargo release status field is set to the character 'r'.
  • Context - a cargo record is being released through edi 350 message processing:
    For Set Release Type to 'A':
    When the release information is being set, then the cargo release type field is set to the character 'a'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Clear Destination Station Number
WHEN
The cargo is being released by customs
THEN
The destination station number index field is set to spaces and the destination station number for index field is set to spaces
Context: A cargo record is being released
GIVEN
A cargo record is being released
Applied to: Set Release Date to Current Machine Date & Set Release Time to Current Machine Time & Set Release By User to ACF2 User ID & Initialize Release Reason to Spaces & Clear Error/Release Status Index & Clear Error Status
WHEN
The release information is being set
THEN
The cargo release date field is populated with the current machine date in CCYYMMDD format AND The cargo release time field is populated with the current machine time in HHMMSS format AND The cargo release by field is populated with the current ACF2 user ID from the system AND The cargo release reason field is set to spaces AND The cargo error or release status index field is set to spaces AND The cargo error status field is set to spaces
Context: A cargo record is being released by customs
GIVEN
A cargo record is being released by customs
Applied to: Set Current Status to 'RELEASED' & Set Release Status to 'R'
WHEN
The release information is being set
THEN
The cargo current status field is set to the literal value 'RELEASED' AND The cargo release status field is set to the character 'R'
Context: A cargo record is being released through EDI 350 message processing
GIVEN
A cargo record is being released through EDI 350 message processing
Applied to: Set Release Type to 'A'
WHEN
The release information is being set
THEN
The cargo release type field is set to the character 'A'
R-GCCUSIO-cbl-00318 (+6) File: GCCUSIO.cbl Populate Border Error Index Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Border Error Index':
  • Context - a cargo record requires border error index processing:
    For Set Error Code to 'E' for Border:
    When the system processes error fields for border station tracking, then the border error code is set to 'e' to identify it as an error condition.
  • Context - a cargo record contains location information:
    For Get Location ID from Cargo Record:
    When border error index processing requires station number lookup, then the location id is retrieved from the cargo record rt04 field for table lookup.
  • Context - a location id is available for border station lookup:
    For Call MC Table Lookup for Border Station:
    When the system needs to determine the border station number, then the mc table lookup service is called with function code 'gu', table id 'mc', and the location id as sequence identifier.
  • Context - an mc table lookup has been performed for border station information:
    For Table Lookup Successful?:
    When the system checks the lookup result, then if the return flag equals '0', the lookup is considered successful and border station processing continues, otherwise border index processing is skipped.
  • Context - mc table lookup has returned successfully with table segment data:
    For Extract Border Station Number from MC Table:
    When the system processes the returned mc table segment, then the border station number is extracted from the mc segment station number field.
  • Context - a border station number has been successfully retrieved from mc table lookup:
    For Set Border Error Index Key with Station Number:
    When the system builds the border error index key, then the border error index key is set with the retrieved border station number.
  • Context - a cargo record has a valid ccn key and border station number is available:
    For Set Border Error Index Key with Cargo CCN:
    When the system finalizes the border error index key construction, then the cargo ccn key is set as the border error cargo identifier in the index key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires border error index processing
GIVEN
A cargo record requires border error index processing
Applied to: Set Error Code to 'E' for Border
WHEN
The system processes error fields for border station tracking
THEN
The border error code is set to 'E' to identify it as an error condition
Context: A cargo record contains location information
GIVEN
A cargo record contains location information
Applied to: Get Location ID from Cargo Record
WHEN
Border error index processing requires station number lookup
THEN
The location ID is retrieved from the cargo record RT04 field for table lookup
Context: A location ID is available for border station lookup
GIVEN
A location ID is available for border station lookup
Applied to: Call MC Table Lookup for Border Station
WHEN
The system needs to determine the border station number
THEN
The MC table lookup service is called with function code 'GU', table ID 'MC', and the location ID as sequence identifier
Context: An MC table lookup has been performed for border station information
GIVEN
An MC table lookup has been performed for border station information
Applied to: Table Lookup Successful?
WHEN
The system checks the lookup result
THEN
If the return flag equals '0', the lookup is considered successful and border station processing continues, otherwise border index processing is skipped
Context: MC table lookup has returned successfully with table segment data
GIVEN
MC table lookup has returned successfully with table segment data
Applied to: Extract Border Station Number from MC Table
WHEN
The system processes the returned MC table segment
THEN
The border station number is extracted from the MC segment station number field
Context: A border station number has been successfully retrieved from MC table lookup
GIVEN
A border station number has been successfully retrieved from MC table lookup
Applied to: Set Border Error Index Key with Station Number
WHEN
The system builds the border error index key
THEN
The border error index key is set with the retrieved border station number
Context: A cargo record has a valid CCN key and border station number is available
GIVEN
A cargo record has a valid CCN key and border station number is available
Applied to: Set Border Error Index Key with Cargo CCN
WHEN
The system finalizes the border error index key construction
THEN
The cargo CCN key is set as the border error cargo identifier in the index key
R-GCCUSIO-cbl-00325 (+5) File: GCCUSIO.cbl Populate Destination Error Index Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Destination Error Index':
  • Context - the system is processing destination error index fields for a cargo record:
    For Set Error Code to 'E':
    When the destination error index population process is initiated, then the destination error code field must be set to 'e'.
  • Context - a cargo record exists with destination station information:
    For Extract Destination Station Number:
    When the destination error index is being populated, then the destination station number must be extracted from the cargo record's destination station field.
  • Context - a cargo record exists with a valid ccn key:
    For Get Cargo CCN Key:
    When the destination error index is being populated, then the cargo's ccn key must be retrieved from the cargo record.
  • Context - the destination error index is being created or updated:
    For Set GCB1-KEY-ECODE-DEST = 'E':
    When the error code field needs to be set, then the gcb1-key-ecode-dest field must be set to 'e'.
  • Context - the destination station number has been extracted from the cargo record:
    For Set GCB1-KEY-ERROR-DEST = Destination Station Number:
    When the destination error index is being populated, then the gcb1-key-error-dest field must be set to the destination station number.
  • Context - the cargo ccn key has been retrieved from the cargo record:
    For Set GCB1-KEY-ERROR-DEST-CARGO = CCN Key:
    When the destination error index is being populated, then the gcb1-key-error-dest-cargo field must be set to the cargo's ccn key.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing destination error index fields for a cargo record
GIVEN
The system is processing destination error index fields for a cargo record
Applied to: Set Error Code to 'E'
WHEN
The destination error index population process is initiated
THEN
The destination error code field must be set to 'E'
Context: A cargo record exists with destination station information
GIVEN
A cargo record exists with destination station information
Applied to: Extract Destination Station Number
WHEN
The destination error index is being populated
THEN
The destination station number must be extracted from the cargo record's destination station field
Context: A cargo record exists with a valid CCN key
GIVEN
A cargo record exists with a valid CCN key
Applied to: Get Cargo CCN Key
WHEN
The destination error index is being populated
THEN
The cargo's CCN key must be retrieved from the cargo record
Context: The destination error index is being created or updated
GIVEN
The destination error index is being created or updated
Applied to: Set GCB1-KEY-ECODE-DEST = 'E'
WHEN
The error code field needs to be set
THEN
The GCB1-KEY-ECODE-DEST field must be set to 'E'
Context: The destination station number has been extracted from the cargo record
GIVEN
The destination station number has been extracted from the cargo record
Applied to: Set GCB1-KEY-ERROR-DEST = Destination Station Number
WHEN
The destination error index is being populated
THEN
The GCB1-KEY-ERROR-DEST field must be set to the destination station number
Context: The cargo CCN key has been retrieved from the cargo record
GIVEN
The cargo CCN key has been retrieved from the cargo record
Applied to: Set GCB1-KEY-ERROR-DEST-CARGO = CCN Key
WHEN
The destination error index is being populated
THEN
The GCB1-KEY-ERROR-DEST-CARGO field must be set to the cargo's CCN key
R-GCX126-cbl-00327 (+16) File: GCX126R.cbl Process Associated US Manifest Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Associated US Manifest':
  • Context - a canadian cargo record has been processed with release or deconsolidation status:
    For Initialize US Manifest Search Flags:
    When the system initiates us manifest search process, then us manifest found flag is set to false and end of file flag is set to false.
  • Context - a canadian cargo record with equipment car id and waybill index exists:
    For Set Search Keys: Car ID and Waybill Index:
    When the system prepares to search for us manifest, then us cargo search key car id is set to current canadian cargo equipment car id and us cargo search key waybill index is set to saved canadian cargo waybill index.
  • Context - us cargo search keys are set with car id and waybill index:
    For Retrieve First US Cargo Record by Car ID and Waybill:
    When the system executes first us cargo retrieval using car-waybill index with '>=' operator, then database returns first us cargo record matching or exceeding the search criteria.
  • Context - first us cargo record retrieval has been attempted:
    For Database Status OK?:
    When database status code is not spaces (indicating error), then end of file flag is set to true.
  • Context - a us cargo record has been successfully retrieved from database:
    For Car ID and Waybill Match?:
    When the system compares us cargo car id (first 12 characters) with current car id key and compares us cargo waybill index with saved waybill index, then if both car id and waybill match, proceed to deletion check else set end of file flag to true.
  • Context - a us cargo record with matching car id and waybill has been retrieved:
    For Cargo Deleted or TR Created?:
    When the system checks us cargo deletion status indicator or train created indicator, then if cargo is deleted or train created indicator equals 'y', skip this record and continue search else set us manifest found flag to true.
  • Context - a us cargo record matches car id and waybill and is not deleted and does not have train created:
    For Set US Manifest Found Flag:
    When the system validates the us cargo record, then us manifest found flag is set to true.
  • Context - first us cargo retrieval and validation has completed:
    For US Manifest Found?:
    When the system checks us manifest found flag, then if us manifest found flag is true, proceed to prepare log information else retrieve next us cargo record.
  • Context - first us cargo record did not meet criteria or was not found:
    For Retrieve Next US Cargo Record by Car ID and Waybill:
    When the system executes next us cargo retrieval using car-waybill index with '>' operator, then database returns next us cargo record in sequence.
  • Context - next us cargo record retrieval has been attempted:
    For Database Status OK?:
    When database status code is not spaces (indicating error), then end of file flag is set to true.
  • Context - a next us cargo record has been successfully retrieved from database:
    For Car ID and Waybill Match?:
    When the system compares us cargo car id (first 12 characters) with current car id key and compares us cargo waybill index with saved waybill index, then if both car id and waybill match, proceed to deletion check else set end of file flag to true.
  • Context - a next us cargo record with matching car id and waybill has been retrieved:
    For Cargo Deleted or TR Created?:
    When the system checks us cargo deletion status indicator or train created indicator, then if cargo is deleted or train created indicator equals 'y', check for end of file to continue search else set us manifest found flag to true.
  • Context - a next us cargo record matches car id and waybill and is not deleted and does not have train created:
    For Set US Manifest Found Flag:
    When the system validates the next us cargo record, then us manifest found flag is set to true.
  • Context - a us cargo record has been retrieved and validated:
    For End of File?:
    When the system checks end of file flag, then if end of file flag is true, exit us manifest processing else retrieve next us cargo record.
  • Context - a valid us manifest record has been found:
    For Prepare Log Information: - Current Date/Time - US CCN - Action Code: LOG-USE-INPUT-MESSAGE - Message Type: US Cargo:
    When the system prepares to log the release message, then log date is set to current machine century and date and log time is set to current machine time and log ccn is set to us cargo ccn and action code is set to log-use-input-message and cargo type indicator is set to us cargo.
  • Context - log information has been prepared with us cargo details:
    For Build Release Message: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN:
    When the system builds the release message, then message text is set to 'cdn ccn rlsed by edi 350: ' concatenated with canadian cargo ccn key.
  • Context - release message has been built with all required log information:
    For Spawn GCT1051E Transaction to Log Message:
    When the system invokes gct1051e logging transaction, then log entry is created with date, time, us ccn, action code, cargo type, and release message.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record has been processed with release or deconsolidation status
GIVEN
A Canadian cargo record has been processed with release or deconsolidation status
Applied to: Initialize US Manifest Search Flags
WHEN
The system initiates US manifest search process
THEN
US manifest found flag is set to false AND end of file flag is set to false
Context: A Canadian cargo record with equipment car ID and waybill index exists
GIVEN
A Canadian cargo record with equipment car ID and waybill index exists
Applied to: Set Search Keys: Car ID and Waybill Index
WHEN
The system prepares to search for US manifest
THEN
US cargo search key car ID is set to current Canadian cargo equipment car ID AND US cargo search key waybill index is set to saved Canadian cargo waybill index
Context: US cargo search keys are set with car ID and waybill index
GIVEN
US cargo search keys are set with car ID and waybill index
Applied to: Retrieve First US Cargo Record by Car ID and Waybill
WHEN
The system executes first US cargo retrieval using car-waybill index with '>=' operator
THEN
Database returns first US cargo record matching or exceeding the search criteria
Context: First US cargo record retrieval has been attempted
GIVEN
First US cargo record retrieval has been attempted
Applied to: Database Status OK?
WHEN
Database status code is not spaces (indicating error)
THEN
End of file flag is set to true
Context: A US cargo record has been successfully retrieved from database
GIVEN
A US cargo record has been successfully retrieved from database
Applied to: Car ID and Waybill Match?
WHEN
The system compares US cargo car ID (first 12 characters) with current car ID key AND compares US cargo waybill index with saved waybill index
THEN
If both car ID and waybill match, proceed to deletion check ELSE set end of file flag to true
Context: A US cargo record with matching car ID and waybill has been retrieved
GIVEN
A US cargo record with matching car ID and waybill has been retrieved
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks US cargo deletion status indicator OR train created indicator
THEN
If cargo is deleted OR train created indicator equals 'Y', skip this record and continue search ELSE set US manifest found flag to true
Context: A US cargo record matches car ID and waybill AND is not deleted AND does not have train created
GIVEN
A US cargo record matches car ID and waybill AND is not deleted AND does not have train created
Applied to: Set US Manifest Found Flag
WHEN
The system validates the US cargo record
THEN
US manifest found flag is set to true
Context: First US cargo retrieval and validation has completed
GIVEN
First US cargo retrieval and validation has completed
Applied to: US Manifest Found?
WHEN
The system checks US manifest found flag
THEN
If US manifest found flag is true, proceed to prepare log information ELSE retrieve next US cargo record
Context: First US cargo record did not meet criteria or was not found
GIVEN
First US cargo record did not meet criteria or was not found
Applied to: Retrieve Next US Cargo Record by Car ID and Waybill
WHEN
The system executes next US cargo retrieval using car-waybill index with '>' operator
THEN
Database returns next US cargo record in sequence
Context: Next US cargo record retrieval has been attempted
GIVEN
Next US cargo record retrieval has been attempted
Applied to: Database Status OK?
WHEN
Database status code is not spaces (indicating error)
THEN
End of file flag is set to true
Context: A next US cargo record has been successfully retrieved from database
GIVEN
A next US cargo record has been successfully retrieved from database
Applied to: Car ID and Waybill Match?
WHEN
The system compares US cargo car ID (first 12 characters) with current car ID key AND compares US cargo waybill index with saved waybill index
THEN
If both car ID and waybill match, proceed to deletion check ELSE set end of file flag to true
Context: A next US cargo record with matching car ID and waybill has been retrieved
GIVEN
A next US cargo record with matching car ID and waybill has been retrieved
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks US cargo deletion status indicator OR train created indicator
THEN
If cargo is deleted OR train created indicator equals 'Y', check for end of file to continue search ELSE set US manifest found flag to true
Context: A next US cargo record matches car ID and waybill AND is not deleted AND does not have train created
GIVEN
A next US cargo record matches car ID and waybill AND is not deleted AND does not have train created
Applied to: Set US Manifest Found Flag
WHEN
The system validates the next US cargo record
THEN
US manifest found flag is set to true
Context: A US cargo record has been retrieved and validated
GIVEN
A US cargo record has been retrieved and validated
Applied to: End of File?
WHEN
The system checks end of file flag
THEN
If end of file flag is true, exit US manifest processing ELSE retrieve next US cargo record
Context: A valid US manifest record has been found
GIVEN
A valid US manifest record has been found
Applied to: Prepare Log Information: - Current Date/Time - US CCN - Action Code: LOG-USE-INPUT-MESSAGE - Message Type: US Cargo
WHEN
The system prepares to log the release message
THEN
Log date is set to current machine century and date AND log time is set to current machine time AND log CCN is set to US cargo CCN AND action code is set to LOG-USE-INPUT-MESSAGE AND cargo type indicator is set to US Cargo
Context: Log information has been prepared with US cargo details
GIVEN
Log information has been prepared with US cargo details
Applied to: Build Release Message: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN
WHEN
The system builds the release message
THEN
Message text is set to 'CDN CCN RLSED BY EDI 350: ' concatenated with Canadian cargo CCN key
Context: Release message has been built with all required log information
GIVEN
Release message has been built with all required log information
Applied to: Spawn GCT1051E Transaction to Log Message
WHEN
The system invokes GCT1051E logging transaction
THEN
Log entry is created with date, time, US CCN, action code, cargo type, and release message
R-GCCUSIO-cbl-00331 (+3) File: GCCUSIO.cbl Determine Hold Type Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Hold Type':
  • Context - a cargo record with us cargo status conditions:
    For Check Cargo Status for Hold Conditions:
    When the cargo status indicates hold, holdpcs, pr-hpcs, hold-d, pr-h-de, or holdfda, then the system sets the destination station number as held destination key and the ccn key as held destination cargo key.
    For Check Cargo Status for Hold Conditions:
    When the cargo status indicates hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, or holdfda, then the system initiates mc table lookup to determine the border station information.
  • Context - a cargo record requiring border hold processing with a location id:
    For Get Station Information from MC Table:
    When the system performs mc table lookup using the location id as sequence id, then the system retrieves the corresponding station segment information from the mc table.
  • Context - a successful mc table lookup that returns station information with return flag '0':
    For Set Border Station Number:
    When the station segment contains valid station number information, then the system sets the station number as held border key and the ccn key as held border cargo key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with US cargo status conditions
GIVEN
A cargo record with US cargo status conditions
Applied to: Check Cargo Status for Hold Conditions
WHEN
The cargo status indicates HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA
THEN
The system sets the destination station number as held destination key and the CCN key as held destination cargo key
Applied to: Check Cargo Status for Hold Conditions
WHEN
The cargo status indicates HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA
THEN
The system initiates MC table lookup to determine the border station information
Context: A cargo record requiring border hold processing with a location ID
GIVEN
A cargo record requiring border hold processing with a location ID
Applied to: Get Station Information from MC Table
WHEN
The system performs MC table lookup using the location ID as sequence ID
THEN
The system retrieves the corresponding station segment information from the MC table
Context: A successful MC table lookup that returns station information with return flag '0'
GIVEN
A successful MC table lookup that returns station information with return flag '0'
Applied to: Set Border Station Number
WHEN
The station segment contains valid station number information
THEN
The system sets the station number as held border key and the CCN key as held border cargo key
R-GCCUSIO-cbl-00335 (+2) File: GCCUSIO.cbl Set Destination Hold Index Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Destination Hold Index':
  • Context - a cargo record with various hold status conditions:
    For Check Cargo Hold Status:
    When the system checks for destination hold status types including hold, holdpcs, pr-hpcs, hold-d, pr-h-de, or holdfda, then the system identifies whether destination hold index processing is required.
  • Context - a cargo record with destination hold status and a destination station number:
    For Set Destination Hold Index Key:
    When the system processes destination hold index creation, then the destination station number is assigned to the destination hold index key field.
  • Context - a cargo record with destination hold status and a valid ccn key:
    For Set Cargo CCN for Destination Hold:
    When the system creates the destination hold index entry, then the cargo ccn key is assigned to the destination hold cargo reference field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with various hold status conditions
GIVEN
A cargo record with various hold status conditions
Applied to: Check Cargo Hold Status
WHEN
The system checks for destination hold status types including HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA
THEN
The system identifies whether destination hold index processing is required
Context: A cargo record with destination hold status and a destination station number
GIVEN
A cargo record with destination hold status and a destination station number
Applied to: Set Destination Hold Index Key
WHEN
The system processes destination hold index creation
THEN
The destination station number is assigned to the destination hold index key field
Context: A cargo record with destination hold status and a valid CCN key
GIVEN
A cargo record with destination hold status and a valid CCN key
Applied to: Set Cargo CCN for Destination Hold
WHEN
The system creates the destination hold index entry
THEN
The cargo CCN key is assigned to the destination hold cargo reference field
R-GCCUSIO-cbl-00338 (+6) File: GCCUSIO.cbl Set Border Hold Index Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Border Hold Index':
  • Context - a cargo record with various hold status conditions:
    For Check Cargo Hold Status:
    When the system checks for border hold requirements, then border hold processing is triggered only for specific hold status types: hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, or holdfda.
  • Context - cargo with confirmed hold status conditions:
    For Is Border Hold Status?:
    When the hold status is hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, or holdfda, then border hold index processing is required and mc table lookup is initiated.
  • Context - cargo requiring border hold index with location id information:
    For Perform MC Table Lookup:
    When mc table lookup is performed using table id 'mc' and cargo location id as sequence id, then system attempts to retrieve corresponding station information from the mc reference table.
  • Context - mc table lookup has been performed for border station information:
    For Table Lookup Successful?:
    When the table lookup return flag equals '0', then the lookup is considered successful and station number extraction proceeds.
  • Context - successful mc table lookup with valid table segment data:
    For Extract Station Number from MC Table:
    When station information is available in the mc table segment, then the mc station number is extracted and prepared for border hold index key population.
  • Context - valid border station number extracted from mc table:
    For Set Border Hold Index Key:
    When border hold index requires population, then the border hold index key is set with the extracted mc station number.
  • Context - border hold index key has been populated with station number:
    For Set Border Hold Cargo Key:
    When cargo ccn key is available for reference, then the border hold cargo key is set with the cargo's us ccn key for cross-reference.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with various hold status conditions
GIVEN
A cargo record with various hold status conditions
Applied to: Check Cargo Hold Status
WHEN
The system checks for border hold requirements
THEN
Border hold processing is triggered only for specific hold status types: HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA
Context: Cargo with confirmed hold status conditions
GIVEN
Cargo with confirmed hold status conditions
Applied to: Is Border Hold Status?
WHEN
The hold status is HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA
THEN
Border hold index processing is required and MC table lookup is initiated
Context: Cargo requiring border hold index with location ID information
GIVEN
Cargo requiring border hold index with location ID information
Applied to: Perform MC Table Lookup
WHEN
MC table lookup is performed using table ID 'MC' and cargo location ID as sequence ID
THEN
System attempts to retrieve corresponding station information from the MC reference table
Context: MC table lookup has been performed for border station information
GIVEN
MC table lookup has been performed for border station information
Applied to: Table Lookup Successful?
WHEN
The table lookup return flag equals '0'
THEN
The lookup is considered successful and station number extraction proceeds
Context: Successful MC table lookup with valid table segment data
GIVEN
Successful MC table lookup with valid table segment data
Applied to: Extract Station Number from MC Table
WHEN
Station information is available in the MC table segment
THEN
The MC station number is extracted and prepared for border hold index key population
Context: Valid border station number extracted from MC table
GIVEN
Valid border station number extracted from MC table
Applied to: Set Border Hold Index Key
WHEN
Border hold index requires population
THEN
The border hold index key is set with the extracted MC station number
Context: Border hold index key has been populated with station number
GIVEN
Border hold index key has been populated with station number
Applied to: Set Border Hold Cargo Key
WHEN
Cargo CCN key is available for reference
THEN
The border hold cargo key is set with the cargo's US CCN key for cross-reference
R-GCX126-cbl-00344 (+7) File: GCX126R.cbl Process CSA Authorization Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process CSA Authorization':
  • Context - an edi 350 message with v9 segment notice reason code indicating 'authorization to deliver' and the cargo record exists in the database and the cargo has csa indicator turned on (gccc-csa-ind-on is true):
    For Is Cargo CSA Manifest?:
    When the system processes the authorization to deliver message, then the system logs the message 'edi 350: accepted - csa' and sets the cargo current status to csa-dlv (gccc-status-csa-dlv) and sets the csa authorization to deliver received flag to true (gccc-csa-auth-deliver-recd) and updates the cargo record in the database.
  • Context - an edi 350 message with v9 segment notice reason code indicating 'authorization to deliver' and the cargo record exists in the database and the cargo has csa indicator turned off (gccc-csa-ind-on is false):
    For Is Cargo CSA Manifest?:
    When the system processes the authorization to deliver message, then the system logs the message 'edi 350: not accepted - non-csa' and does not update the cargo record in the database.
  • Context - the cargo is a csa manifest (gccc-csa-ind-on is true) and an authorization to deliver message is being processed:
    For Log Message: 'EDI 350: ACCEPTED - CSA':
    When the system logs the csa acceptance, then the system creates a log message 'edi 350: accepted - csa' and includes the current machine date in format ccyymmdd and includes the current machine time in format hhmmss and includes the current ccn key (ws-current-ccn-key) and sets the cargo type indicator to ca-cargo and sets the action code to 'log-use-input-message' and spawns a gct1051e log entry.
  • Context - the cargo is not a csa manifest (gccc-csa-ind-on is false) and an authorization to deliver message is being processed:
    For Log Message: 'EDI 350: NOT ACCEPTED - NON-CSA':
    When the system logs the non-csa rejection, then the system creates a log message 'edi 350: not accepted - non-csa' and includes the current machine date in format ccyymmdd and includes the current machine time in format hhmmss and includes the current ccn key (ws-current-ccn-key) and sets the cargo type indicator to ca-cargo and sets the action code to 'log-use-input-message' and spawns a gct1051e log entry.
  • Context - the cargo is a csa manifest and the authorization to deliver message has been accepted:
    For Set Cargo Status to CSA-DLV:
    When the system updates the cargo status, then the system sets the cargo status indicator to gccc-status-csa-dlv (csa delivery authorized status).
  • Context - the cargo is a csa manifest and the authorization to deliver message has been accepted and the cargo status has been set to csa-dlv:
    For Set CSA Authorization Deliver Flag to TRUE:
    When the system sets the authorization flag, then the system sets the csa authorization to deliver received flag (gccc-csa-auth-deliver-recd) to true.
  • Context - the cargo is a csa manifest and the authorization to deliver has been accepted and the cargo status has been set to csa-dlv and the csa authorization flag has been set to true:
    For Update Cargo Record in Database:
    When the system updates the cargo record, then the system replaces the cargo record (gccc-cargo-report-segment) in the database using the repl function through the gccc-pcb program control block.
  • Context - an authorization to deliver message has been processed (either accepted for csa or rejected for non-csa):
    For End Process:
    When the system completes the authorization processing, then the system performs us manifest processing (d120-process-us-mfst) to update any associated us cargo records with the canadian ccn release information.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message with V9 segment notice reason code indicating 'Authorization to Deliver' AND the cargo record exists in the database AND the cargo has CSA indicator turned ON (GCCC-CSA-IND-ON is true)
GIVEN
An EDI 350 message with V9 segment notice reason code indicating 'Authorization to Deliver' AND the cargo record exists in the database AND the cargo has CSA indicator turned ON (GCCC-CSA-IND-ON is true)
Applied to: Is Cargo CSA Manifest?
WHEN
The system processes the authorization to deliver message
THEN
The system logs the message 'EDI 350: ACCEPTED - CSA' AND sets the cargo current status to CSA-DLV (GCCC-STATUS-CSA-DLV) AND sets the CSA authorization to deliver received flag to TRUE (GCCC-CSA-AUTH-DELIVER-RECD) AND updates the cargo record in the database
Context: An EDI 350 message with V9 segment notice reason code indicating 'Authorization to Deliver' AND the cargo record exists in the database AND the cargo has CSA indicator turned OFF (GCCC-CSA-IND-ON is false)
GIVEN
An EDI 350 message with V9 segment notice reason code indicating 'Authorization to Deliver' AND the cargo record exists in the database AND the cargo has CSA indicator turned OFF (GCCC-CSA-IND-ON is false)
Applied to: Is Cargo CSA Manifest?
WHEN
The system processes the authorization to deliver message
THEN
The system logs the message 'EDI 350: NOT ACCEPTED - NON-CSA' AND does not update the cargo record in the database
Context: The cargo is a CSA manifest (GCCC-CSA-IND-ON is true) AND an authorization to deliver message is being processed
GIVEN
The cargo is a CSA manifest (GCCC-CSA-IND-ON is true) AND an authorization to deliver message is being processed
Applied to: Log Message: 'EDI 350: ACCEPTED - CSA'
WHEN
The system logs the CSA acceptance
THEN
The system creates a log message 'EDI 350: ACCEPTED - CSA' AND includes the current machine date in format CCYYMMDD AND includes the current machine time in format HHMMSS AND includes the current CCN key (WS-CURRENT-CCN-KEY) AND sets the cargo type indicator to CA-CARGO AND sets the action code to 'LOG-USE-INPUT-MESSAGE' AND spawns a GCT1051E log entry
Context: The cargo is not a CSA manifest (GCCC-CSA-IND-ON is false) AND an authorization to deliver message is being processed
GIVEN
The cargo is not a CSA manifest (GCCC-CSA-IND-ON is false) AND an authorization to deliver message is being processed
Applied to: Log Message: 'EDI 350: NOT ACCEPTED - NON-CSA'
WHEN
The system logs the non-CSA rejection
THEN
The system creates a log message 'EDI 350: NOT ACCEPTED - NON-CSA' AND includes the current machine date in format CCYYMMDD AND includes the current machine time in format HHMMSS AND includes the current CCN key (WS-CURRENT-CCN-KEY) AND sets the cargo type indicator to CA-CARGO AND sets the action code to 'LOG-USE-INPUT-MESSAGE' AND spawns a GCT1051E log entry
Context: The cargo is a CSA manifest AND the authorization to deliver message has been accepted
GIVEN
The cargo is a CSA manifest AND the authorization to deliver message has been accepted
Applied to: Set Cargo Status to CSA-DLV
WHEN
The system updates the cargo status
THEN
The system sets the cargo status indicator to GCCC-STATUS-CSA-DLV (CSA delivery authorized status)
Context: The cargo is a CSA manifest AND the authorization to deliver message has been accepted AND the cargo status has been set to CSA-DLV
GIVEN
The cargo is a CSA manifest AND the authorization to deliver message has been accepted AND the cargo status has been set to CSA-DLV
Applied to: Set CSA Authorization Deliver Flag to TRUE
WHEN
The system sets the authorization flag
THEN
The system sets the CSA authorization to deliver received flag (GCCC-CSA-AUTH-DELIVER-RECD) to TRUE
Context: The cargo is a CSA manifest AND the authorization to deliver has been accepted AND the cargo status has been set to CSA-DLV AND the CSA authorization flag has been set to TRUE
GIVEN
The cargo is a CSA manifest AND the authorization to deliver has been accepted AND the cargo status has been set to CSA-DLV AND the CSA authorization flag has been set to TRUE
Applied to: Update Cargo Record in Database
WHEN
The system updates the cargo record
THEN
The system replaces the cargo record (GCCC-CARGO-REPORT-SEGMENT) in the database using the REPL function through the GCCC-PCB program control block
Context: An authorization to deliver message has been processed (either accepted for CSA or rejected for non-CSA)
GIVEN
An authorization to deliver message has been processed (either accepted for CSA or rejected for non-CSA)
Applied to: End Process
WHEN
The system completes the authorization processing
THEN
The system performs US manifest processing (D120-PROCESS-US-MFST) to update any associated US cargo records with the Canadian CCN release information
R-GCCUSIO-cbl-00345 (+11) File: GCCUSIO.cbl Retrieve Existing Secondary Record Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Existing Secondary Record':
  • Context - a secondary cargo data processing request is received:
    For Function Type?:
    When the function code is repl (replace) or dlet (delete), then the system routes to retrieval processing to check for existing records before performing the operation.
  • Context - a repl or dlet operation is requested for secondary cargo data:
    For Set Function to GHU for Retrieval:
    When the system needs to verify record existence, then the function code is temporarily changed to ghu (get hold unique) for the existence check.
  • Context - a secondary record existence check is being performed:
    For Set Accept Status to GE:
    When the system prepares the database call parameters, then the accept status is set to 'ge' to handle both found and not-found scenarios gracefully.
  • Context - a secondary cargo record needs to be retrieved:
    For Build Secondary SSA with Key:
    When the secondary record key is available and not empty, then the system builds a qualified ssa (segment search argument) using the key value for precise record location.
  • Context - the retrieval parameters are properly configured with function code, pcb, and ssa:
    For Call Database with Retrieval Parameters:
    When the database call is executed, then the system attempts to retrieve the secondary cargo record and returns the operation status.
  • Context - a database retrieval operation has been completed:
    For Record Found?:
    When the status code is empty (spaces), then the system determines that the record was found and sets the found flag to true.
    For Set Not Found Flag - No Record:
    When the status code is 'ge' (record not found), then the system sets the not-found flag and prepares for insert operation if data is provided.
  • Context - secondary cargo data has been prepared for processing:
    For Data Content Check:
    When the data content is all spaces, low-values, or underscore characters, then the system treats this as empty data and prepares for delete operation if record exists, or skips operation if record doesn't exist.
  • Context - an existing secondary cargo record is found and new data contains meaningful content:
    For Prepare for Replace Operation:
    When the operation type is repl and data is not empty, then the system prepares to replace the existing record with the new data using repl function code.
  • Context - no existing secondary cargo record is found and new data contains meaningful content:
    For Prepare for Insert Operation:
    When the operation type is repl and data is not empty, then the system changes the function code to isrt to insert a new record with the provided data.
  • Context - an existing secondary cargo record is found and either new data is empty or delete operation is explicitly requested:
    For Prepare for Delete Operation:
    When the data content is empty (spaces, low-values, or underscores) or function code is dlet, then the system prepares to delete the existing record using dlet function code.
  • Context - an insert operation is requested for secondary cargo data:
    For Continue with Requested Operation:
    When the cargo data is not all spaces, not all low-values, and not all underscore characters, then the system proceeds with the insert operation using the provided meaningful data.
👨‍💻 Technical ACs (Gherkin)
Context: A secondary cargo data processing request is received
GIVEN
A secondary cargo data processing request is received
Applied to: Function Type?
WHEN
The function code is REPL (Replace) or DLET (Delete)
THEN
The system routes to retrieval processing to check for existing records before performing the operation
Context: A REPL or DLET operation is requested for secondary cargo data
GIVEN
A REPL or DLET operation is requested for secondary cargo data
Applied to: Set Function to GHU for Retrieval
WHEN
The system needs to verify record existence
THEN
The function code is temporarily changed to GHU (Get Hold Unique) for the existence check
Context: A secondary record existence check is being performed
GIVEN
A secondary record existence check is being performed
Applied to: Set Accept Status to GE
WHEN
The system prepares the database call parameters
THEN
The accept status is set to 'GE' to handle both found and not-found scenarios gracefully
Context: A secondary cargo record needs to be retrieved
GIVEN
A secondary cargo record needs to be retrieved
Applied to: Build Secondary SSA with Key
WHEN
The secondary record key is available and not empty
THEN
The system builds a qualified SSA (Segment Search Argument) using the key value for precise record location
Context: The retrieval parameters are properly configured with function code, PCB, and SSA
GIVEN
The retrieval parameters are properly configured with function code, PCB, and SSA
Applied to: Call Database with Retrieval Parameters
WHEN
The database call is executed
THEN
The system attempts to retrieve the secondary cargo record and returns the operation status
Context: A database retrieval operation has been completed
GIVEN
A database retrieval operation has been completed
Applied to: Record Found?
WHEN
The status code is empty (spaces)
THEN
The system determines that the record was found and sets the found flag to true
Applied to: Set Not Found Flag - No Record
WHEN
The status code is 'GE' (record not found)
THEN
The system sets the not-found flag and prepares for insert operation if data is provided
Context: Secondary cargo data has been prepared for processing
GIVEN
Secondary cargo data has been prepared for processing
Applied to: Data Content Check
WHEN
The data content is all spaces, low-values, or underscore characters
THEN
The system treats this as empty data and prepares for delete operation if record exists, or skips operation if record doesn't exist
Context: An existing secondary cargo record is found and new data contains meaningful content
GIVEN
An existing secondary cargo record is found and new data contains meaningful content
Applied to: Prepare for Replace Operation
WHEN
The operation type is REPL and data is not empty
THEN
The system prepares to replace the existing record with the new data using REPL function code
Context: No existing secondary cargo record is found and new data contains meaningful content
GIVEN
No existing secondary cargo record is found and new data contains meaningful content
Applied to: Prepare for Insert Operation
WHEN
The operation type is REPL and data is not empty
THEN
The system changes the function code to ISRT to insert a new record with the provided data
Context: An existing secondary cargo record is found and either new data is empty or delete operation is explicitly requested
GIVEN
An existing secondary cargo record is found and either new data is empty or delete operation is explicitly requested
Applied to: Prepare for Delete Operation
WHEN
The data content is empty (spaces, low-values, or underscores) or function code is DLET
THEN
The system prepares to delete the existing record using DLET function code
Context: An insert operation is requested for secondary cargo data
GIVEN
An insert operation is requested for secondary cargo data
Applied to: Continue with Requested Operation
WHEN
The cargo data is not all spaces, not all low-values, and not all underscore characters
THEN
The system proceeds with the insert operation using the provided meaningful data
R-GCX126-cbl-00352 (+25) File: GCX126R.cbl Process Follower Manifests Merged 26 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Follower Manifests':
  • Context - a master manifest needs to be processed for follower manifests:
    For Initialize Follower Array, Set Index I = 1:
    When the follower manifest processing begins, then the follower manifest array is cleared to spaces and the processing index i is set to 1.
  • Context - a master manifest ccn exists in the cargo report segment:
    For Set Master CCN as Search Key:
    When preparing to search for follower manifests, then the master manifest ccn is set as the search key in the database query structure.
  • Context - the database search key is set to the master manifest ccn:
    For Get Next Cargo Record from Database:
    When retrieving follower manifests, then the system calls the database with get next function using the cargo pcb and qualified ssa for the master ccn key.
  • Context - a database get next call has been executed:
    For Database Status OK?:
    When the database returns a status code, then if the status code is blank (spaces), the retrieval is successful; otherwise, set the end-of-database flag to true.
  • Context - a cargo record has been successfully retrieved from the database:
    For Same Master CCN?:
    When checking if the record is associated with the current master manifest, then if the master manifest ccn in the retrieved record equals the saved master ccn, continue processing; otherwise, set the end-of-database flag to true.
  • Context - a cargo record with matching master ccn has been retrieved:
    For Is Follower Manifest?:
    When evaluating the manifest type, then if the cargo is a follower manifest (not a master manifest), store its ccn in the follower array; if it is a master manifest, skip to retrieve the next record.
  • Context - a follower manifest has been identified:
    For Store Follower CCN in Array Position I:
    When storing the follower information, then the follower manifest ccn is moved to the follower array at position i.
  • Context - a follower manifest ccn has been stored in the array:
    For Increment Index I:
    When preparing to process the next follower, then the index i is incremented by 1.
  • Context - the follower array index i has been incremented:
    For I > 100?:
    When checking if more followers can be stored, then if i is greater than 100, set the end-of-database flag to true; otherwise, continue retrieving more followers.
  • Context - either the database status is not ok, the master ccn does not match, or the follower limit of 100 is exceeded:
    For Set End of Database Flag:
    When terminating the follower retrieval loop, then the end-of-database flag is set to true.
  • Context - the follower retrieval loop has completed:
    For Calculate Total Follower Count = I - 1:
    When determining how many followers were found, then the total follower count is calculated as i minus 1.
  • Context - the total follower count has been calculated:
    For Follower Count > 0?:
    When deciding whether to process followers, then if the follower count is less than or equal to 0, exit the process; otherwise, proceed to process each follower.
  • Context - at least one follower manifest exists in the array:
    For Initialize Loop Index J = 1:
    When starting to process individual followers, then the loop index j is initialized to 1.
  • Context - the loop index j points to a valid array position:
    For Get Follower CCN from Array Position J:
    When processing a specific follower manifest, then the follower ccn at array position j is retrieved and set as the search key.
  • Context - a follower ccn has been retrieved from the array:
    For Lookup Follower Cargo by CCN:
    When accessing the follower cargo details, then the system performs a get hold unique call to retrieve the follower cargo record using the ccn as the key.
  • Context - a database lookup has been performed for the follower ccn:
    For Follower Cargo Found?:
    When checking the retrieval result, then if the cargo is found (status indicates found), proceed with release processing; otherwise, skip to the next follower.
  • Context - a follower cargo record has been found:
    For Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields:
    When applying release information to the follower, then the destination station numbers are cleared to spaces, release date is set to current machine date, release time is set to current machine time, release by is set to current user id, current status is set to 'released', release status is set to 'r', release type is set to 'a', error/release status index is cleared to spaces, and error status is cleared to spaces.
  • Context - release information has been set for the follower:
    For Notice Reason?:
    When determining the type of release, then if the notice reason code indicates 'released', log a standard release message; if it indicates 'decon', log a deconsolidation release message.
  • Context - the notice reason code indicates a standard release:
    For Log Message: 'EDI 350: RELEASE' with Release Ref and Port:
    When logging the release action, then a message is logged with the text 'edi 350: release : ' concatenated with the release reference id (first 15 characters) and ' at port ' concatenated with the port code (first 4 characters).
  • Context - a standard release message has been logged:
    For Set Release Reason: Release Ref / Port Code:
    When recording the release reason, then the release reason field is set to the release reference id (first 15 characters) concatenated with '/' and the port code (first 4 characters).
  • Context - the notice reason code indicates a deconsolidation release:
    For Log Message: 'EDI 350: RELEASE VIA DECON AT PORT' with Port:
    When logging the deconsolidation action, then a message is logged with the text 'edi 350: release via decon at port ' concatenated with the port code (first 4 characters).
  • Context - a deconsolidation release message has been logged:
    For Set Release Reason: 'DECONSOLIDATION AT' Port:
    When recording the deconsolidation reason, then the release reason field is set to 'deconsolidation at ' concatenated with the port code (first 4 characters).
  • Context - the release reason has been set for the follower:
    For Process Associated US Manifest:
    When processing related us cargo, then the us manifest processing routine is performed to search for and update us cargo records using the equipment car id and waybill number.
  • Context - all release information has been set and us manifest has been processed:
    For Update Follower Cargo Record:
    When persisting the changes to the database, then the system calls the database with replace function to update the follower cargo record, with status code cleared to spaces and accept status set to blank.
  • Context - the current follower has been processed:
    For Increment Index J:
    When moving to the next follower, then the loop index j is incremented by 1.
  • Context - the loop index j has been incremented:
    For J <= Total Follower Count?:
    When checking if processing should continue, then if j is less than or equal to the total follower count, continue processing the next follower; otherwise, exit the follower processing loop.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest needs to be processed for follower manifests
GIVEN
A master manifest needs to be processed for follower manifests
Applied to: Initialize Follower Array, Set Index I = 1
WHEN
The follower manifest processing begins
THEN
The follower manifest array is cleared to spaces and the processing index I is set to 1
Context: A master manifest CCN exists in the cargo report segment
GIVEN
A master manifest CCN exists in the cargo report segment
Applied to: Set Master CCN as Search Key
WHEN
Preparing to search for follower manifests
THEN
The master manifest CCN is set as the search key in the database query structure
Context: The database search key is set to the master manifest CCN
GIVEN
The database search key is set to the master manifest CCN
Applied to: Get Next Cargo Record from Database
WHEN
Retrieving follower manifests
THEN
The system calls the database with Get Next function using the cargo PCB and qualified SSA for the master CCN key
Context: A database Get Next call has been executed
GIVEN
A database Get Next call has been executed
Applied to: Database Status OK?
WHEN
The database returns a status code
THEN
If the status code is blank (spaces), the retrieval is successful; otherwise, set the end-of-database flag to true
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Same Master CCN?
WHEN
Checking if the record is associated with the current master manifest
THEN
If the master manifest CCN in the retrieved record equals the saved master CCN, continue processing; otherwise, set the end-of-database flag to true
Context: A cargo record with matching master CCN has been retrieved
GIVEN
A cargo record with matching master CCN has been retrieved
Applied to: Is Follower Manifest?
WHEN
Evaluating the manifest type
THEN
If the cargo is a follower manifest (not a master manifest), store its CCN in the follower array; if it is a master manifest, skip to retrieve the next record
Context: A follower manifest has been identified
GIVEN
A follower manifest has been identified
Applied to: Store Follower CCN in Array Position I
WHEN
Storing the follower information
THEN
The follower manifest CCN is moved to the follower array at position I
Context: A follower manifest CCN has been stored in the array
GIVEN
A follower manifest CCN has been stored in the array
Applied to: Increment Index I
WHEN
Preparing to process the next follower
THEN
The index I is incremented by 1
Context: The follower array index I has been incremented
GIVEN
The follower array index I has been incremented
Applied to: I > 100?
WHEN
Checking if more followers can be stored
THEN
If I is greater than 100, set the end-of-database flag to true; otherwise, continue retrieving more followers
Context: Either the database status is not OK, the master CCN does not match, or the follower limit of 100 is exceeded
GIVEN
Either the database status is not OK, the master CCN does not match, or the follower limit of 100 is exceeded
Applied to: Set End of Database Flag
WHEN
Terminating the follower retrieval loop
THEN
The end-of-database flag is set to true
Context: The follower retrieval loop has completed
GIVEN
The follower retrieval loop has completed
Applied to: Calculate Total Follower Count = I - 1
WHEN
Determining how many followers were found
THEN
The total follower count is calculated as I minus 1
Context: The total follower count has been calculated
GIVEN
The total follower count has been calculated
Applied to: Follower Count > 0?
WHEN
Deciding whether to process followers
THEN
If the follower count is less than or equal to 0, exit the process; otherwise, proceed to process each follower
Context: At least one follower manifest exists in the array
GIVEN
At least one follower manifest exists in the array
Applied to: Initialize Loop Index J = 1
WHEN
Starting to process individual followers
THEN
The loop index J is initialized to 1
Context: The loop index J points to a valid array position
GIVEN
The loop index J points to a valid array position
Applied to: Get Follower CCN from Array Position J
WHEN
Processing a specific follower manifest
THEN
The follower CCN at array position J is retrieved and set as the search key
Context: A follower CCN has been retrieved from the array
GIVEN
A follower CCN has been retrieved from the array
Applied to: Lookup Follower Cargo by CCN
WHEN
Accessing the follower cargo details
THEN
The system performs a Get Hold Unique call to retrieve the follower cargo record using the CCN as the key
Context: A database lookup has been performed for the follower CCN
GIVEN
A database lookup has been performed for the follower CCN
Applied to: Follower Cargo Found?
WHEN
Checking the retrieval result
THEN
If the cargo is found (status indicates found), proceed with release processing; otherwise, skip to the next follower
Context: A follower cargo record has been found
GIVEN
A follower cargo record has been found
Applied to: Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields
WHEN
Applying release information to the follower
THEN
The destination station numbers are cleared to spaces, release date is set to current machine date, release time is set to current machine time, release by is set to current user ID, current status is set to 'RELEASED', release status is set to 'R', release type is set to 'A', error/release status index is cleared to spaces, and error status is cleared to spaces
Context: Release information has been set for the follower
GIVEN
Release information has been set for the follower
Applied to: Notice Reason?
WHEN
Determining the type of release
THEN
If the notice reason code indicates 'Released', log a standard release message; if it indicates 'Decon', log a deconsolidation release message
Context: The notice reason code indicates a standard release
GIVEN
The notice reason code indicates a standard release
Applied to: Log Message: 'EDI 350: RELEASE' with Release Ref and Port
WHEN
Logging the release action
THEN
A message is logged with the text 'EDI 350: RELEASE : ' concatenated with the release reference ID (first 15 characters) and ' AT PORT ' concatenated with the port code (first 4 characters)
Context: A standard release message has been logged
GIVEN
A standard release message has been logged
Applied to: Set Release Reason: Release Ref / Port Code
WHEN
Recording the release reason
THEN
The release reason field is set to the release reference ID (first 15 characters) concatenated with '/' and the port code (first 4 characters)
Context: The notice reason code indicates a deconsolidation release
GIVEN
The notice reason code indicates a deconsolidation release
Applied to: Log Message: 'EDI 350: RELEASE VIA DECON AT PORT' with Port
WHEN
Logging the deconsolidation action
THEN
A message is logged with the text 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with the port code (first 4 characters)
Context: A deconsolidation release message has been logged
GIVEN
A deconsolidation release message has been logged
Applied to: Set Release Reason: 'DECONSOLIDATION AT' Port
WHEN
Recording the deconsolidation reason
THEN
The release reason field is set to 'DECONSOLIDATION AT ' concatenated with the port code (first 4 characters)
Context: The release reason has been set for the follower
GIVEN
The release reason has been set for the follower
Applied to: Process Associated US Manifest
WHEN
Processing related US cargo
THEN
The US manifest processing routine is performed to search for and update US cargo records using the equipment car ID and waybill number
Context: All release information has been set and US manifest has been processed
GIVEN
All release information has been set and US manifest has been processed
Applied to: Update Follower Cargo Record
WHEN
Persisting the changes to the database
THEN
The system calls the database with Replace function to update the follower cargo record, with status code cleared to spaces and accept status set to blank
Context: The current follower has been processed
GIVEN
The current follower has been processed
Applied to: Increment Index J
WHEN
Moving to the next follower
THEN
The loop index J is incremented by 1
Context: The loop index J has been incremented
GIVEN
The loop index J has been incremented
Applied to: J <= Total Follower Count?
WHEN
Checking if processing should continue
THEN
If J is less than or equal to the total follower count, continue processing the next follower; otherwise, exit the follower processing loop
R-GCCUSIO-cbl-00357 (+7) File: GCCUSIO.cbl Process Secondary Data Validation Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Secondary Data Validation':
  • Context - secondary cargo data is being processed for validation:
    For Data = ALL SPACES?:
    When the cargo data content equals all spaces, then the data should be marked as empty and invalid for processing.
    For Mark Data as Valid:
    When the cargo data content does not equal all spaces and does not equal all low-values and does not equal all underscore characters, then the data should be marked as valid for processing.
  • Context - secondary cargo data is being processed for validation and does not contain all spaces:
    For Data = ALL LOW-VALUES?:
    When the cargo data content equals all low-values, then the data should be marked as empty and invalid for processing.
  • Context - secondary cargo data is being processed for validation and does not contain all spaces or low-values:
    For Data = ALL Underscores '_'?:
    When the cargo data content equals all underscore characters, then the data should be marked as empty and invalid for processing.
  • Context - a secondary cargo insert operation is requested and the data has been validated as empty or invalid:
    For Skip Insert Operation:
    When the function code is isrt (insert), then the insert operation should be skipped and not executed.
  • Context - a secondary cargo replace operation is requested and the new data has been validated as empty or invalid:
    For Execute Delete Operation:
    When the function code is repl (replace) and an existing record is found, then a delete operation should be executed to remove the existing record.
  • Context - a secondary cargo replace operation is requested and the data has been validated as valid:
    For Proceed with Replace:
    When the function code is repl (replace) and an existing record is found, then the replace operation should proceed to update the existing record with the new valid data.
    For Proceed with Insert:
    When the function code is repl (replace) and no existing record is found, then an insert operation should be executed to create a new record with the valid data.
👨‍💻 Technical ACs (Gherkin)
Context: Secondary cargo data is being processed for validation
GIVEN
Secondary cargo data is being processed for validation
Applied to: Data = ALL SPACES?
WHEN
The cargo data content equals all spaces
THEN
The data should be marked as empty and invalid for processing
Applied to: Mark Data as Valid
WHEN
The cargo data content does not equal all spaces and does not equal all low-values and does not equal all underscore characters
THEN
The data should be marked as valid for processing
Context: Secondary cargo data is being processed for validation and does not contain all spaces
GIVEN
Secondary cargo data is being processed for validation and does not contain all spaces
Applied to: Data = ALL LOW-VALUES?
WHEN
The cargo data content equals all low-values
THEN
The data should be marked as empty and invalid for processing
Context: Secondary cargo data is being processed for validation and does not contain all spaces or low-values
GIVEN
Secondary cargo data is being processed for validation and does not contain all spaces or low-values
Applied to: Data = ALL Underscores '_'?
WHEN
The cargo data content equals all underscore characters
THEN
The data should be marked as empty and invalid for processing
Context: A secondary cargo insert operation is requested and the data has been validated as empty or invalid
GIVEN
A secondary cargo insert operation is requested and the data has been validated as empty or invalid
Applied to: Skip Insert Operation
WHEN
The function code is ISRT (Insert)
THEN
The insert operation should be skipped and not executed
Context: A secondary cargo replace operation is requested and the new data has been validated as empty or invalid
GIVEN
A secondary cargo replace operation is requested and the new data has been validated as empty or invalid
Applied to: Execute Delete Operation
WHEN
The function code is REPL (Replace) and an existing record is found
THEN
A delete operation should be executed to remove the existing record
Context: A secondary cargo replace operation is requested and the data has been validated as valid
GIVEN
A secondary cargo replace operation is requested and the data has been validated as valid
Applied to: Proceed with Replace
WHEN
The function code is REPL (Replace) and an existing record is found
THEN
The replace operation should proceed to update the existing record with the new valid data
Applied to: Proceed with Insert
WHEN
The function code is REPL (Replace) and no existing record is found
THEN
An insert operation should be executed to create a new record with the valid data
R-GCCUSIO-cbl-00365 (+4) File: GCCUSIO.cbl Format Message Data Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format Message Data':
  • Context - a message insert operation is requested with message data containing key and content information:
    For Structure Message for Insert/Replace:
    When the system processes the insert operation for gcsa8rt segment, then the system extracts the message key from the input, extracts the data content, combines the key and data into a properly structured message segment, and prepares it for database storage.
  • Context - a message retrieval operation is requested for gcsa8rt segment:
    For Extract Data Content from Segment:
    When the system successfully retrieves the message segment from storage, then the system extracts the data content from the retrieved segment structure and formats it for return to the calling program.
  • Context - a message retrieval operation (gu or gn) is requested for gcsa8rt segment:
    For Extract Message Key:
    When the message key is empty or contains only spaces, then the system sets error number '0012' and error message 'gcsa8rt-key equal spaces' to indicate invalid key for retrieval.
  • Context - a message operation request is received for gcsa8rt segment:
    For Message Operation Type?:
    When the system evaluates the function code, then the system routes to delete processing for 'dlet', insert processing for 'isrt', or retrieval processing for 'gu' function codes.
  • Context - an insert operation is requested for a message segment:
    For Structure Message for Insert/Replace:
    When the system attempts to retrieve the existing message using ghu function, then if the message exists, the system performs a replace operation; if the message does not exist, the system performs an insert operation.
👨‍💻 Technical ACs (Gherkin)
Context: A message insert operation is requested with message data containing key and content information
GIVEN
A message insert operation is requested with message data containing key and content information
Applied to: Structure Message for Insert/Replace
WHEN
The system processes the insert operation for GCSA8RT segment
THEN
The system extracts the message key from the input, extracts the data content, combines the key and data into a properly structured message segment, and prepares it for database storage
Context: A message retrieval operation is requested for GCSA8RT segment
GIVEN
A message retrieval operation is requested for GCSA8RT segment
Applied to: Extract Data Content from Segment
WHEN
The system successfully retrieves the message segment from storage
THEN
The system extracts the data content from the retrieved segment structure and formats it for return to the calling program
Context: A message retrieval operation (GU or GN) is requested for GCSA8RT segment
GIVEN
A message retrieval operation (GU or GN) is requested for GCSA8RT segment
Applied to: Extract Message Key
WHEN
The message key is empty or contains only spaces
THEN
The system sets error number '0012' and error message 'GCSA8RT-KEY EQUAL SPACES' to indicate invalid key for retrieval
Context: A message operation request is received for GCSA8RT segment
GIVEN
A message operation request is received for GCSA8RT segment
Applied to: Message Operation Type?
WHEN
The system evaluates the function code
THEN
The system routes to delete processing for 'DLET', insert processing for 'ISRT', or retrieval processing for 'GU' function codes
Context: An insert operation is requested for a message segment
GIVEN
An insert operation is requested for a message segment
Applied to: Structure Message for Insert/Replace
WHEN
The system attempts to retrieve the existing message using GHU function
THEN
If the message exists, the system performs a replace operation; if the message does not exist, the system performs an insert operation
R-GCCUSIO-cbl-00370 (+7) File: GCCUSIO.cbl Retrieve Existing GCSB1RT Record Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Existing GCSB1RT Record':
  • Context - a request to retrieve an existing gcsb1rt index record:
    For Clear GCSB1RT Work Area:
    When the system begins the retrieval process, then the gcsb1rt work area is cleared to spaces.
  • Context - a primary cargo record with a us ccn key:
    For Set Cargo Key from Primary Record:
    When the system needs to search for the corresponding gcsb1rt index record, then the us ccn key from the primary record is set as the key value for gcsb1rt search.
  • Context - a request to retrieve a gcsb1rt record from the database:
    For Set Database Status to Accept 'GE':
    When the system prepares for database access, then the database accept status is set to 'ge' to handle record not found conditions.
  • Context - a need to retrieve a gcsb1rt record that may be updated:
    For Set Function Code to 'GHU':
    When the system sets up the database function code, then the function code is set to 'ghu' to obtain exclusive access to the record.
  • Context - a configured database request with cargo key, function code, and qualified search criteria:
    For Call Database with Qualified Search:
    When the system executes the database call, then the database is accessed using cims with the specified parameters and qualified search criteria.
  • Context - a database call response for gcsb1rt record retrieval:
    For Record Found?:
    When the system evaluates the database status code, then if status code equals spaces then record is found, otherwise record is not found.
  • Context - a successful database retrieval with status code equal to spaces:
    For Set Found Flag:
    When the system processes the successful retrieval response, then the gcsb1rt found flag is set to true.
  • Context - a database retrieval with status code not equal to spaces:
    For Set Not Found Flag:
    When the system processes the unsuccessful retrieval response, then the gcsb1rt not found flag is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve an existing GCSB1RT index record
GIVEN
A request to retrieve an existing GCSB1RT index record
Applied to: Clear GCSB1RT Work Area
WHEN
The system begins the retrieval process
THEN
The GCSB1RT work area is cleared to spaces
Context: A primary cargo record with a US CCN key
GIVEN
A primary cargo record with a US CCN key
Applied to: Set Cargo Key from Primary Record
WHEN
The system needs to search for the corresponding GCSB1RT index record
THEN
The US CCN key from the primary record is set as the key value for GCSB1RT search
Context: A request to retrieve a GCSB1RT record from the database
GIVEN
A request to retrieve a GCSB1RT record from the database
Applied to: Set Database Status to Accept 'GE'
WHEN
The system prepares for database access
THEN
The database accept status is set to 'GE' to handle record not found conditions
Context: A need to retrieve a GCSB1RT record that may be updated
GIVEN
A need to retrieve a GCSB1RT record that may be updated
Applied to: Set Function Code to 'GHU'
WHEN
The system sets up the database function code
THEN
The function code is set to 'GHU' to obtain exclusive access to the record
Context: A configured database request with cargo key, function code, and qualified search criteria
GIVEN
A configured database request with cargo key, function code, and qualified search criteria
Applied to: Call Database with Qualified Search
WHEN
The system executes the database call
THEN
The database is accessed using CIMS with the specified parameters and qualified search criteria
Context: A database call response for GCSB1RT record retrieval
GIVEN
A database call response for GCSB1RT record retrieval
Applied to: Record Found?
WHEN
The system evaluates the database status code
THEN
If status code equals spaces then record is found, otherwise record is not found
Context: A successful database retrieval with status code equal to spaces
GIVEN
A successful database retrieval with status code equal to spaces
Applied to: Set Found Flag
WHEN
The system processes the successful retrieval response
THEN
The GCSB1RT found flag is set to true
Context: A database retrieval with status code not equal to spaces
GIVEN
A database retrieval with status code not equal to spaces
Applied to: Set Not Found Flag
WHEN
The system processes the unsuccessful retrieval response
THEN
The GCSB1RT not found flag is set to true
R-GCCUSIO-cbl-00378 (+19) File: GCCUSIO.cbl Populate Error Index Fields Merged 20 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Error Index Fields':
  • Context - a cargo record requires error index field population:
    For Set Origin Error Code to 'E':
    When the system processes origin error information, then the origin error code is set to 'e' to indicate an error classification.
    For Set Border Error Code to 'E':
    When the system processes border error information, then the border error code is set to 'e' to indicate an error classification.
    For Set Destination Error Code to 'E':
    When the system processes destination error information, then the destination error code is set to 'e' to indicate an error classification.
    For Set Error Code 'E' for Origin Station:
    When the system begins populating error fields for the origin station, then the error code 'e' is assigned to the origin station error code field.
    For Set Error Code 'E' for Border Station:
    When the system begins populating error fields for the border station, then the error code 'e' is assigned to the border station error code field.
    For Set Error Code 'E' for Destination Station:
    When the system begins populating error fields for the destination station, then the error code 'e' is assigned to the destination station error code field.
  • Context - a cargo record contains origin station information:
    For Extract Origin Station Number from Cargo Record:
    When the system populates error index fields, then the origin station number is extracted from the cargo record field rt28-orig-stn-num and used for error index population.
  • Context - origin error code and station number are established:
    For Set Origin Error Index with CCN Key:
    When the system creates the origin error index entry, then the cargo's ccn key is assigned to the origin error cargo field to link the error to the specific cargo record.
  • Context - a cargo record contains location identifier information:
    For Lookup Border Station from MC Table:
    When the system needs to determine the border station for error indexing, then the system performs a table lookup using the location id from field rt04-location-id-name to retrieve border station details from the mc table.
  • Context - the mc table lookup returns successful results with return flag '0':
    For Extract Border Station Number from Table:
    When the system processes the table lookup results, then the border station number is extracted from the mc segment station number field for error index population.
  • Context - border error code and station information are established:
    For Set Border Error Index with CCN Key:
    When the system creates the border error index entry, then the cargo's ccn key is assigned to the border error cargo field to link the error to the specific cargo record.
  • Context - a cargo record contains destination station information:
    For Extract Destination Station Number from Cargo Record:
    When the system populates error index fields, then the destination station number is extracted from the cargo record field rt29-dest-stn-num and used for error index population.
  • Context - destination error code and station number are established:
    For Set Destination Error Index with CCN Key:
    When the system creates the destination error index entry, then the cargo's ccn key is assigned to the destination error cargo field to link the error to the specific cargo record.
  • Context - a cargo record exists with origin station information:
    For Extract Origin Station Number from Cargo Record:
    When the system populates error index fields for origin station, then the origin station number is extracted from field rt28-orig-stn-num and assigned to the error origin key.
  • Context - a cargo record has a unique ccn key and origin station error information:
    For Set Cargo CCN Key for Origin Error Index:
    When the system populates the origin error index, then the cargo's ccn key is assigned to the error origin cargo field to establish the link.
  • Context - a cargo record contains a location id and the mc table is available:
    For Lookup Border Station from MC Table:
    When the system needs to determine the border station for error indexing, then the system performs a table lookup using the cargo's location id to retrieve the corresponding border station information.
  • Context - the mc table lookup returns a successful result with station information:
    For Extract Border Station Number from Table:
    When the system processes the table lookup response, then the border station number is extracted from the mc-station-num field in the table segment and assigned to the error border key.
  • Context - a cargo record has a unique ccn key and border station error information is being processed:
    For Set Cargo CCN Key for Border Error Index:
    When the system populates the border error index, then the cargo's ccn key is assigned to the error border cargo field to establish the link.
  • Context - a cargo record exists with destination station information:
    For Extract Destination Station Number from Cargo Record:
    When the system populates error index fields for destination station, then the destination station number is extracted from field rt29-dest-stn-num and assigned to the error destination key.
  • Context - a cargo record has a unique ccn key and destination station error information:
    For Set Cargo CCN Key for Destination Error Index:
    When the system populates the destination error index, then the cargo's ccn key is assigned to the error destination cargo field to establish the link.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires error index field population
GIVEN
A cargo record requires error index field population
Applied to: Set Origin Error Code to 'E'
WHEN
The system processes origin error information
THEN
The origin error code is set to 'E' to indicate an error classification
Applied to: Set Border Error Code to 'E'
WHEN
The system processes border error information
THEN
The border error code is set to 'E' to indicate an error classification
Applied to: Set Destination Error Code to 'E'
WHEN
The system processes destination error information
THEN
The destination error code is set to 'E' to indicate an error classification
Applied to: Set Error Code 'E' for Origin Station
WHEN
The system begins populating error fields for the origin station
THEN
The error code 'E' is assigned to the origin station error code field
Applied to: Set Error Code 'E' for Border Station
WHEN
The system begins populating error fields for the border station
THEN
The error code 'E' is assigned to the border station error code field
Applied to: Set Error Code 'E' for Destination Station
WHEN
The system begins populating error fields for the destination station
THEN
The error code 'E' is assigned to the destination station error code field
Context: A cargo record contains origin station information
GIVEN
A cargo record contains origin station information
Applied to: Extract Origin Station Number from Cargo Record
WHEN
The system populates error index fields
THEN
The origin station number is extracted from the cargo record field RT28-ORIG-STN-NUM and used for error index population
Context: Origin error code and station number are established
GIVEN
Origin error code and station number are established
Applied to: Set Origin Error Index with CCN Key
WHEN
The system creates the origin error index entry
THEN
The cargo's CCN key is assigned to the origin error cargo field to link the error to the specific cargo record
Context: A cargo record contains location identifier information
GIVEN
A cargo record contains location identifier information
Applied to: Lookup Border Station from MC Table
WHEN
The system needs to determine the border station for error indexing
THEN
The system performs a table lookup using the location ID from field RT04-LOCATION-ID-NAME to retrieve border station details from the MC table
Context: The MC table lookup returns successful results with return flag '0'
GIVEN
The MC table lookup returns successful results with return flag '0'
Applied to: Extract Border Station Number from Table
WHEN
The system processes the table lookup results
THEN
The border station number is extracted from the MC segment station number field for error index population
Context: Border error code and station information are established
GIVEN
Border error code and station information are established
Applied to: Set Border Error Index with CCN Key
WHEN
The system creates the border error index entry
THEN
The cargo's CCN key is assigned to the border error cargo field to link the error to the specific cargo record
Context: A cargo record contains destination station information
GIVEN
A cargo record contains destination station information
Applied to: Extract Destination Station Number from Cargo Record
WHEN
The system populates error index fields
THEN
The destination station number is extracted from the cargo record field RT29-DEST-STN-NUM and used for error index population
Context: Destination error code and station number are established
GIVEN
Destination error code and station number are established
Applied to: Set Destination Error Index with CCN Key
WHEN
The system creates the destination error index entry
THEN
The cargo's CCN key is assigned to the destination error cargo field to link the error to the specific cargo record
Context: A cargo record exists with origin station information
GIVEN
A cargo record exists with origin station information
Applied to: Extract Origin Station Number from Cargo Record
WHEN
The system populates error index fields for origin station
THEN
The origin station number is extracted from field RT28-ORIG-STN-NUM and assigned to the error origin key
Context: A cargo record has a unique CCN key and origin station error information
GIVEN
A cargo record has a unique CCN key and origin station error information
Applied to: Set Cargo CCN Key for Origin Error Index
WHEN
The system populates the origin error index
THEN
The cargo's CCN key is assigned to the error origin cargo field to establish the link
Context: A cargo record contains a location ID and the MC table is available
GIVEN
A cargo record contains a location ID and the MC table is available
Applied to: Lookup Border Station from MC Table
WHEN
The system needs to determine the border station for error indexing
THEN
The system performs a table lookup using the cargo's location ID to retrieve the corresponding border station information
Context: The MC table lookup returns a successful result with station information
GIVEN
The MC table lookup returns a successful result with station information
Applied to: Extract Border Station Number from Table
WHEN
The system processes the table lookup response
THEN
The border station number is extracted from the MC-STATION-NUM field in the table segment and assigned to the error border key
Context: A cargo record has a unique CCN key and border station error information is being processed
GIVEN
A cargo record has a unique CCN key and border station error information is being processed
Applied to: Set Cargo CCN Key for Border Error Index
WHEN
The system populates the border error index
THEN
The cargo's CCN key is assigned to the error border cargo field to establish the link
Context: A cargo record exists with destination station information
GIVEN
A cargo record exists with destination station information
Applied to: Extract Destination Station Number from Cargo Record
WHEN
The system populates error index fields for destination station
THEN
The destination station number is extracted from field RT29-DEST-STN-NUM and assigned to the error destination key
Context: A cargo record has a unique CCN key and destination station error information
GIVEN
A cargo record has a unique CCN key and destination station error information
Applied to: Set Cargo CCN Key for Destination Error Index
WHEN
The system populates the destination error index
THEN
The cargo's CCN key is assigned to the error destination cargo field to establish the link
R-GCX126-cbl-00378 (+10) File: GCX126R.cbl Prepare Cargo Hold Email Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Cargo Hold Email':
  • Context - a cargo record with a ccn (cargo control number):
    For CCN starts with '6105'?:
    When the system evaluates whether to prepare a hold notification, then if the ccn starts with '6105', proceed to prepare the hold notification email; otherwise, skip the notification preparation.
  • Context - a cargo hold notification is being prepared for ccn starting with '6105':
    For Set Line 1: 'Cargo on HOLD for inspection by CBSA - EDI350':
    When the system constructs the notification message, then set the first detail line to 'cargo on hold for inspection by cbsa - edi350'.
  • Context - a cargo hold notification message is being constructed:
    For Set Line 2: Blank:
    When the system formats the notification content, then set the second detail line to blank space.
  • Context - a cargo hold notification is being prepared with cargo equipment information available:
    For Set Line 3: Equipment ID:
    When the system constructs the notification details, then set the third detail line to 'equipment : ' followed by the equipment id from the cargo record.
  • Context - a cargo hold notification is being prepared with waybill information available:
    For Set Line 4: Waybill Number (Carrier + Origin Station + Waybill):
    When the system constructs the notification details, then set the fourth detail line to 'waybill : ' followed by the concatenated carrier code, origin station number, and waybill number from the cargo record.
  • Context - a cargo hold notification is being prepared with ccn information available:
    For Set Line 5: CCN Number:
    When the system constructs the notification details, then set the fifth detail line to 'ccn : ' followed by the ccn key from the cargo record.
  • Context - a cargo hold notification is being prepared with destination information available:
    For Set Line 6: Destination Station Name and State:
    When the system constructs the notification details, then set the sixth detail line to 'destination : ' followed by the destination station name, comma, space, and destination station state code from the cargo record.
  • Context - a cargo hold notification is being prepared with manifest station information available:
    For Set Line 7: Manifest Upon Station Name:
    When the system constructs the notification details, then set the seventh detail line to 'manifest upon : ' followed by the manifest to station name from the cargo record.
  • Context - a cargo hold notification message has been fully constructed with all detail lines:
    For Set Total Lines to 7:
    When the system finalizes the notification structure, then set the line counter to 7 to indicate seven detail lines are included in the notification.
  • Context - a cargo hold notification has been prepared with all required details:
    For Set Email Type to HOLD:
    When the system categorizes the notification for routing, then set the notification type indicator to hold type.
  • Context - a cargo hold notification has been fully prepared with type set to hold and all detail lines populated:
    For Call Email Preparation Routine:
    When the system is ready to send the notification, then call the email preparation routine (z110-prep-emcsend) to process and send the notification.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with a CCN (Cargo Control Number)
GIVEN
A cargo record with a CCN (Cargo Control Number)
Applied to: CCN starts with '6105'?
WHEN
The system evaluates whether to prepare a hold notification
THEN
If the CCN starts with '6105', proceed to prepare the hold notification email; otherwise, skip the notification preparation
Context: A cargo hold notification is being prepared for CCN starting with '6105'
GIVEN
A cargo hold notification is being prepared for CCN starting with '6105'
Applied to: Set Line 1: 'Cargo on HOLD for inspection by CBSA - EDI350'
WHEN
The system constructs the notification message
THEN
Set the first detail line to 'Cargo on HOLD for inspection by CBSA - EDI350'
Context: A cargo hold notification message is being constructed
GIVEN
A cargo hold notification message is being constructed
Applied to: Set Line 2: Blank
WHEN
The system formats the notification content
THEN
Set the second detail line to blank space
Context: A cargo hold notification is being prepared with cargo equipment information available
GIVEN
A cargo hold notification is being prepared with cargo equipment information available
Applied to: Set Line 3: Equipment ID
WHEN
The system constructs the notification details
THEN
Set the third detail line to 'Equipment : ' followed by the equipment ID from the cargo record
Context: A cargo hold notification is being prepared with waybill information available
GIVEN
A cargo hold notification is being prepared with waybill information available
Applied to: Set Line 4: Waybill Number (Carrier + Origin Station + Waybill)
WHEN
The system constructs the notification details
THEN
Set the fourth detail line to 'Waybill : ' followed by the concatenated carrier code, origin station number, and waybill number from the cargo record
Context: A cargo hold notification is being prepared with CCN information available
GIVEN
A cargo hold notification is being prepared with CCN information available
Applied to: Set Line 5: CCN Number
WHEN
The system constructs the notification details
THEN
Set the fifth detail line to 'CCN : ' followed by the CCN key from the cargo record
Context: A cargo hold notification is being prepared with destination information available
GIVEN
A cargo hold notification is being prepared with destination information available
Applied to: Set Line 6: Destination Station Name and State
WHEN
The system constructs the notification details
THEN
Set the sixth detail line to 'DESTINATION : ' followed by the destination station name, comma, space, and destination station state code from the cargo record
Context: A cargo hold notification is being prepared with manifest station information available
GIVEN
A cargo hold notification is being prepared with manifest station information available
Applied to: Set Line 7: Manifest Upon Station Name
WHEN
The system constructs the notification details
THEN
Set the seventh detail line to 'MANIFEST UPON : ' followed by the manifest to station name from the cargo record
Context: A cargo hold notification message has been fully constructed with all detail lines
GIVEN
A cargo hold notification message has been fully constructed with all detail lines
Applied to: Set Total Lines to 7
WHEN
The system finalizes the notification structure
THEN
Set the line counter to 7 to indicate seven detail lines are included in the notification
Context: A cargo hold notification has been prepared with all required details
GIVEN
A cargo hold notification has been prepared with all required details
Applied to: Set Email Type to HOLD
WHEN
The system categorizes the notification for routing
THEN
Set the notification type indicator to HOLD type
Context: A cargo hold notification has been fully prepared with type set to HOLD and all detail lines populated
GIVEN
A cargo hold notification has been fully prepared with type set to HOLD and all detail lines populated
Applied to: Call Email Preparation Routine
WHEN
The system is ready to send the notification
THEN
Call the email preparation routine (Z110-PREP-EMCSEND) to process and send the notification
R-GCCUSIO-cbl-00388 (+7) File: GCCUSIO.cbl Populate Hold Index Fields Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Hold Index Fields':
  • Context - a cargo record exists with hold status conditions:
    For Set Destination Hold Index:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda status, then the system sets the destination hold index with the destination station number and copies the cargo control number key to the destination hold cargo field.
    For Set Border Hold Index:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-b or uscargo-pr-h-bo or uscargo-holdfda status, then the system sets the border hold index with the border station number and copies the cargo control number key to the border hold cargo field.
  • Context - a cargo record requires border hold index population:
    For Lookup Border Station Information & Lookup Border Station from MC Table:
    When the system needs to determine the border station number, then the system queries the mc table using the cargo location id and retrieves the station number if found and the system calls the table lookup service with table id 'mc' and cargo location id to retrieve the station number.
  • Context - the system has performed an mc table lookup for border station information:
    For Station Found?:
    When the table lookup returns a successful result with return flag '0', then the system assigns the retrieved station number to the border hold index, otherwise no border station assignment occurs.
  • Context - a cargo record exists with destination hold status conditions:
    For Set Destination Hold Index:
    When the cargo status is hold or holdpcs or pr-hpcs or hold-d or pr-h-de or holdfda, then the system sets the destination hold index using the destination station number and cargo ccn key.
  • Context - a cargo record exists with border hold status conditions:
    For Set Border Hold Index:
    When the cargo status is hold or holdpcs or pr-hpcs or hold-b or pr-h-bo or holdfda, then the system performs mc table lookup and sets the border hold index using the border station number and cargo ccn key.
  • Context - the mc table lookup has been performed for border station information:
    For Use Border Station Number:
    When the table lookup returns successfully with return flag '0', then the system uses the retrieved station number from the table segment to set the border hold index.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with hold status conditions
GIVEN
A cargo record exists with hold status conditions
Applied to: Set Destination Hold Index
WHEN
The cargo has USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA status
THEN
The system sets the destination hold index with the destination station number and copies the cargo control number key to the destination hold cargo field
Applied to: Set Border Hold Index
WHEN
The cargo has USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-B or USCARGO-PR-H-BO or USCARGO-HOLDFDA status
THEN
The system sets the border hold index with the border station number and copies the cargo control number key to the border hold cargo field
Context: A cargo record requires border hold index population
GIVEN
A cargo record requires border hold index population
Applied to: Lookup Border Station Information & Lookup Border Station from MC Table
WHEN
The system needs to determine the border station number
THEN
The system queries the MC table using the cargo location ID and retrieves the station number if found AND The system calls the table lookup service with table ID 'MC' and cargo location ID to retrieve the station number
Context: The system has performed an MC table lookup for border station information
GIVEN
The system has performed an MC table lookup for border station information
Applied to: Station Found?
WHEN
The table lookup returns a successful result with return flag '0'
THEN
The system assigns the retrieved station number to the border hold index, otherwise no border station assignment occurs
Context: A cargo record exists with destination hold status conditions
GIVEN
A cargo record exists with destination hold status conditions
Applied to: Set Destination Hold Index
WHEN
The cargo status is HOLD or HOLDPCS or PR-HPCS or HOLD-D or PR-H-DE or HOLDFDA
THEN
The system sets the destination hold index using the destination station number and cargo CCN key
Context: A cargo record exists with border hold status conditions
GIVEN
A cargo record exists with border hold status conditions
Applied to: Set Border Hold Index
WHEN
The cargo status is HOLD or HOLDPCS or PR-HPCS or HOLD-B or PR-H-BO or HOLDFDA
THEN
The system performs MC table lookup and sets the border hold index using the border station number and cargo CCN key
Context: The MC table lookup has been performed for border station information
GIVEN
The MC table lookup has been performed for border station information
Applied to: Use Border Station Number
WHEN
The table lookup returns successfully with return flag '0'
THEN
The system uses the retrieved station number from the table segment to set the border hold index
R-GCX126-cbl-00389 (+7) File: GCX126R.cbl Prepare Error Email Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Error Email':
  • Context - a customs error message needs to be sent for a cargo:
    For Set Email Subject, Append CCN to Subject:
    When the error email preparation process is initiated, then the email subject is set to 'customs received err msg' concatenated with the cargo ccn key.
  • Context - email recipient configuration exists in the system:
    For Save Current Email Recipients, Clear Email Recipients:
    When error email preparation begins, then the current email recipient usercode and destination filename are saved to temporary storage and the email recipient usercode field is cleared to spaces.
  • Context - the admin segment has been successfully retrieved and the admin segment found indicator is true:
    For Admin Config Available?, Set Primary Recipient from Admin Config, Set Secondary Recipient from Admin Config:
    When email recipients need to be configured for error notification, then the first email recipient usercode is set to the primary merlin user id from admin table field ad-dc-p-merlin-1 and the second email recipient usercode is set to the secondary merlin user id from admin table field ad-dc-p-merlin-5.
  • Context - the admin segment was not successfully retrieved or the admin segment found indicator is false:
    For Admin Config Available?, Set Default Recipient OM01247:
    When email recipients need to be configured for error notification, then the first email recipient usercode is set to the default value 'om01247' and the second email recipient usercode is set to spaces.
  • Context - email keywords field is empty or contains low-values and cargo was found in the database with a non-empty ccn key:
    For Set Email Keywords, Keywords Empty?, Cargo Found?, Use Cargo CCN as Keywords:
    When email keywords need to be assigned, then the email keywords field is set to the cargo ccn key from the cargo report segment.
  • Context - email keywords field is empty or contains low-values and cargo was not found in the database:
    For Set Email Keywords, Keywords Empty?, Cargo Found?, Use Current CCN as Keywords:
    When email keywords need to be assigned, then the email keywords field is set to the current ccn key from working storage.
  • Context - an error email has been prepared with subject and keywords:
    For Set Destination Filename to CAERROR, Clear Email Recipients, Set Recipient to OM01247, Call Email Send Service:
    When the error email needs to be sent to the error monitoring destination, then the email destination filename is set to 'caerror', the email recipient usercode is cleared to spaces, the first email recipient usercode is set to 'om01247', and the email send service is invoked with the configured parameters.
  • Context - the error email has been successfully sent to caerror destination:
    For Set Destination Filename to IN, Clear Email Recipients, Set Recipient to OM01247, Call Email Send Service:
    When a copy of the error email needs to be sent to the general inbox, then the email destination filename is set to 'in', the email recipient usercode is cleared to spaces, the first email recipient usercode is set to 'om01247', and the email send service is invoked again with the configured parameters.
👨‍💻 Technical ACs (Gherkin)
Context: A customs error message needs to be sent for a cargo
GIVEN
A customs error message needs to be sent for a cargo
Applied to: Set Email Subject, Append CCN to Subject
WHEN
The error email preparation process is initiated
THEN
The email subject is set to 'CUSTOMS RECEIVED ERR MSG' concatenated with the cargo CCN key
Context: Email recipient configuration exists in the system
GIVEN
Email recipient configuration exists in the system
Applied to: Save Current Email Recipients, Clear Email Recipients
WHEN
Error email preparation begins
THEN
The current email recipient usercode and destination filename are saved to temporary storage and the email recipient usercode field is cleared to spaces
Context: The admin segment has been successfully retrieved and the admin segment found indicator is true
GIVEN
The admin segment has been successfully retrieved and the admin segment found indicator is true
Applied to: Admin Config Available?, Set Primary Recipient from Admin Config, Set Secondary Recipient from Admin Config
WHEN
Email recipients need to be configured for error notification
THEN
The first email recipient usercode is set to the primary Merlin user ID from admin table field AD-DC-P-MERLIN-1 and the second email recipient usercode is set to the secondary Merlin user ID from admin table field AD-DC-P-MERLIN-5
Context: The admin segment was not successfully retrieved or the admin segment found indicator is false
GIVEN
The admin segment was not successfully retrieved or the admin segment found indicator is false
Applied to: Admin Config Available?, Set Default Recipient OM01247
WHEN
Email recipients need to be configured for error notification
THEN
The first email recipient usercode is set to the default value 'OM01247' and the second email recipient usercode is set to spaces
Context: Email keywords field is empty or contains low-values and cargo was found in the database with a non-empty CCN key
GIVEN
Email keywords field is empty or contains low-values and cargo was found in the database with a non-empty CCN key
Applied to: Set Email Keywords, Keywords Empty?, Cargo Found?, Use Cargo CCN as Keywords
WHEN
Email keywords need to be assigned
THEN
The email keywords field is set to the cargo CCN key from the cargo report segment
Context: Email keywords field is empty or contains low-values and cargo was not found in the database
GIVEN
Email keywords field is empty or contains low-values and cargo was not found in the database
Applied to: Set Email Keywords, Keywords Empty?, Cargo Found?, Use Current CCN as Keywords
WHEN
Email keywords need to be assigned
THEN
The email keywords field is set to the current CCN key from working storage
Context: An error email has been prepared with subject and keywords
GIVEN
An error email has been prepared with subject and keywords
Applied to: Set Destination Filename to CAERROR, Clear Email Recipients, Set Recipient to OM01247, Call Email Send Service
WHEN
The error email needs to be sent to the error monitoring destination
THEN
The email destination filename is set to 'CAERROR', the email recipient usercode is cleared to spaces, the first email recipient usercode is set to 'OM01247', and the email send service is invoked with the configured parameters
Context: The error email has been successfully sent to CAERROR destination
GIVEN
The error email has been successfully sent to CAERROR destination
Applied to: Set Destination Filename to IN, Clear Email Recipients, Set Recipient to OM01247, Call Email Send Service
WHEN
A copy of the error email needs to be sent to the general inbox
THEN
The email destination filename is set to 'IN', the email recipient usercode is cleared to spaces, the first email recipient usercode is set to 'OM01247', and the email send service is invoked again with the configured parameters
R-GCCUSIO-cbl-00392 (+6) File: GCCUSIO.cbl Retrieve Iron Highway Station Configuration Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Iron Highway Station Configuration':
  • Context - a cargo record with us cargo status and cp cargo status fields:
    For IH Status Processing Required?:
    When the system evaluates if ih notification processing is needed, then ih processing is required if both status fields are not empty or if cp status is 'sent' when us status is empty or if status is not 'release'.
  • Context - a table lookup operation is required:
    For Set Table Lookup Parameters:
    When the system prepares for table lookup, then all lookup parameter fields are cleared and function code is set to 'gu' (get unique).
  • Context - a table lookup operation for ih configuration:
    For Set Table ID to 'IH':
    When the system sets the table identifier, then the table id is set to 'ih' to identify the iron highway configuration table.
  • Context - a saved waybill station code from cargo processing:
    For Set Station Code as Search Key:
    When the system sets the search key for ih table lookup, then the waybill station code is assigned as the sequence id search key.
  • Context - table lookup parameters are configured with table id 'ih' and station code:
    For Call Table Lookup Service:
    When the system calls the table lookup service, then the gcctbio service is invoked with the configured parameters to retrieve table segment data.
  • Context - a table lookup service call has been executed:
    For IH Configuration Found?:
    When the system checks the lookup result, then configuration is found if the return flag equals '0', otherwise no configuration is available.
  • Context - ih configuration table lookup was successful:
    For Retrieve IH Station Settings:
    When the system processes the retrieved table segment, then ih station settings are extracted and made available for notification processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with US cargo status and CP cargo status fields
GIVEN
A cargo record with US cargo status and CP cargo status fields
Applied to: IH Status Processing Required?
WHEN
The system evaluates if IH notification processing is needed
THEN
IH processing is required if both status fields are not empty OR if CP status is 'SENT' when US status is empty OR if status is not 'RELEASE'
Context: A table lookup operation is required
GIVEN
A table lookup operation is required
Applied to: Set Table Lookup Parameters
WHEN
The system prepares for table lookup
THEN
All lookup parameter fields are cleared and function code is set to 'GU' (Get Unique)
Context: A table lookup operation for IH configuration
GIVEN
A table lookup operation for IH configuration
Applied to: Set Table ID to 'IH'
WHEN
The system sets the table identifier
THEN
The table ID is set to 'IH' to identify the Iron Highway configuration table
Context: A saved waybill station code from cargo processing
GIVEN
A saved waybill station code from cargo processing
Applied to: Set Station Code as Search Key
WHEN
The system sets the search key for IH table lookup
THEN
The waybill station code is assigned as the sequence ID search key
Context: Table lookup parameters are configured with table ID 'IH' and station code
GIVEN
Table lookup parameters are configured with table ID 'IH' and station code
Applied to: Call Table Lookup Service
WHEN
The system calls the table lookup service
THEN
The GCCTBIO service is invoked with the configured parameters to retrieve table segment data
Context: A table lookup service call has been executed
GIVEN
A table lookup service call has been executed
Applied to: IH Configuration Found?
WHEN
The system checks the lookup result
THEN
Configuration is found if the return flag equals '0', otherwise no configuration is available
Context: IH configuration table lookup was successful
GIVEN
IH configuration table lookup was successful
Applied to: Retrieve IH Station Settings
WHEN
The system processes the retrieved table segment
THEN
IH station settings are extracted and made available for notification processing
R-GCX126-cbl-00397 (+6) File: GCX126R.cbl Prepare Info Email Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Info Email':
  • Context - an info email type notification needs to be prepared:
    For Set Email Subject to 'BROKER/MANIFEST MISMATCH' with CCN:
    When the system is setting up the email subject for a broker/manifest mismatch scenario, then the email subject is set to 'broker/manifest mismatch ' concatenated with the cargo ccn key.
  • Context - an info email notification is being prepared:
    For Set Email Recipient to OM01247:
    When the email recipient needs to be set, then the email recipient user code is set to 'om01247' in the first position of the recipient array and the email to usercode field is cleared.
    For Set Destination Filename to 'IN':
    When the destination filename needs to be set for routing, then the email destination filename is set to 'in'.
  • Context - email keywords field is empty or contains low-values and cargo record was found in the database and cargo ccn key is not empty:
    For Use Cargo CCN as Keywords:
    When the system needs to set email keywords, then the email keywords field is populated with the cargo ccn key from the cargo record.
  • Context - email keywords field is empty or contains low-values and (cargo record was not found or cargo ccn key is empty):
    For Use Current CCN Key as Keywords:
    When the system needs to set email keywords, then the email keywords field is populated with the current ccn key from working storage.
  • Context - email subject is set to 'broker/manifest mismatch' with ccn and email recipient is set to 'om01247' and destination filename is set to 'in' and email keywords are populated:
    For Call EMCSEND2 to Send Email:
    When the system calls the email sending service emcsend2, then the email is sent with from-usercode 'om01247', destination filename 'in', recipient usercode 'om01247', the prepared subject line, keywords, and the 350 report message content.
  • Context - an email notification has been successfully sent via emcsend2:
    For Reset Email Report Fields:
    When the system performs post-send cleanup, then the 350 report area is cleared, line counter is reset to zero, email subject is cleared, destination filename is reset to 'in', email keywords are cleared, machine sequence number is incremented by 1, copy usercode is cleared, to usercode is cleared, and recipient usercodes are reset to configured values from admin table or default 'om01247'.
👨‍💻 Technical ACs (Gherkin)
Context: An info email type notification needs to be prepared
GIVEN
An info email type notification needs to be prepared
Applied to: Set Email Subject to 'BROKER/MANIFEST MISMATCH' with CCN
WHEN
The system is setting up the email subject for a broker/manifest mismatch scenario
THEN
The email subject is set to 'BROKER/MANIFEST MISMATCH ' concatenated with the cargo CCN key
Context: An info email notification is being prepared
GIVEN
An info email notification is being prepared
Applied to: Set Email Recipient to OM01247
WHEN
The email recipient needs to be set
THEN
The email recipient user code is set to 'OM01247' in the first position of the recipient array and the email TO usercode field is cleared
Applied to: Set Destination Filename to 'IN'
WHEN
The destination filename needs to be set for routing
THEN
The email destination filename is set to 'IN'
Context: Email keywords field is empty or contains low-values AND cargo record was found in the database AND cargo CCN key is not empty
GIVEN
Email keywords field is empty or contains low-values AND cargo record was found in the database AND cargo CCN key is not empty
Applied to: Use Cargo CCN as Keywords
WHEN
The system needs to set email keywords
THEN
The email keywords field is populated with the cargo CCN key from the cargo record
Context: Email keywords field is empty or contains low-values AND (cargo record was not found OR cargo CCN key is empty)
GIVEN
Email keywords field is empty or contains low-values AND (cargo record was not found OR cargo CCN key is empty)
Applied to: Use Current CCN Key as Keywords
WHEN
The system needs to set email keywords
THEN
The email keywords field is populated with the current CCN key from working storage
Context: Email subject is set to 'BROKER/MANIFEST MISMATCH' with CCN AND email recipient is set to 'OM01247' AND destination filename is set to 'IN' AND email keywords are populated
GIVEN
Email subject is set to 'BROKER/MANIFEST MISMATCH' with CCN AND email recipient is set to 'OM01247' AND destination filename is set to 'IN' AND email keywords are populated
Applied to: Call EMCSEND2 to Send Email
WHEN
The system calls the email sending service EMCSEND2
THEN
The email is sent with from-usercode 'OM01247', destination filename 'IN', recipient usercode 'OM01247', the prepared subject line, keywords, and the 350 report message content
Context: An email notification has been successfully sent via EMCSEND2
GIVEN
An email notification has been successfully sent via EMCSEND2
Applied to: Reset Email Report Fields
WHEN
The system performs post-send cleanup
THEN
The 350 report area is cleared, line counter is reset to zero, email subject is cleared, destination filename is reset to 'IN', email keywords are cleared, machine sequence number is incremented by 1, copy usercode is cleared, TO usercode is cleared, and recipient usercodes are reset to configured values from admin table or default 'OM01247'
R-GCCUSIO-cbl-00399 (+8) File: GCCUSIO.cbl Extract N9 Reference Numbers Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract N9 Reference Numbers':
  • Context - a cargo control number (ccn) exists in the primary cargo record:
    For Build Secondary Key with CCN + Record Type '02' + Sequence '0001':
    When the system needs to extract n9 reference numbers for notification processing, then the system builds a secondary record key using the ccn, record type '02', and sequence '0001'.
  • Context - a secondary record key has been constructed with ccn, record type '02', and sequence '0001':
    For Retrieve Secondary Cargo Record GCSUSS02:
    When the system executes a database retrieval operation for the secondary cargo record, then the system retrieves the gcsuss02 record if it exists in the database.
  • Context - a database retrieval operation has been executed for secondary cargo record gcsuss02:
    For Record Found?:
    When the system checks the operation result status, then the system proceeds with n9 extraction if the record exists, otherwise terminates n9 processing.
  • Context - a secondary cargo record with n9 reference data has been successfully retrieved:
    For Initialize Reference Counter to Zero:
    When the system begins processing reference number fields, then the system initializes the reference counter to zero to start sequential processing.
  • Context - n9 reference data exists in the secondary cargo record and counter is initialized:
    For Loop Through 20 Reference Number Positions:
    When the system processes reference number positions sequentially, then the system examines each of the 20 possible reference number positions for qualifying data.
  • Context - the system is examining a specific reference number position in the n9 data:
    For Reference Qualifier = 'CN'?:
    When the reference qualifier field is evaluated, then the system identifies positions where the qualifier equals 'cn' for shipment id extraction.
  • Context - a reference number position contains the qualifier 'cn':
    For Extract Reference Number as Shipment ID:
    When the system processes this qualified reference position, then the system extracts the corresponding reference number value and assigns it as the shipment id.
  • Context - the system has processed a reference number position:
    For More Positions to Check?:
    When the system evaluates the current position count against the total available positions, then the system continues processing if more positions exist, otherwise completes the n9 extraction.
  • Context - additional reference number positions remain to be processed:
    For Move to Next Reference Position:
    When the system advances the processing sequence, then the system increments the position counter and moves to examine the next reference number field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo control number (CCN) exists in the primary cargo record
GIVEN
A cargo control number (CCN) exists in the primary cargo record
Applied to: Build Secondary Key with CCN + Record Type '02' + Sequence '0001'
WHEN
The system needs to extract N9 reference numbers for notification processing
THEN
The system builds a secondary record key using the CCN, record type '02', and sequence '0001'
Context: A secondary record key has been constructed with CCN, record type '02', and sequence '0001'
GIVEN
A secondary record key has been constructed with CCN, record type '02', and sequence '0001'
Applied to: Retrieve Secondary Cargo Record GCSUSS02
WHEN
The system executes a database retrieval operation for the secondary cargo record
THEN
The system retrieves the GCSUSS02 record if it exists in the database
Context: A database retrieval operation has been executed for secondary cargo record GCSUSS02
GIVEN
A database retrieval operation has been executed for secondary cargo record GCSUSS02
Applied to: Record Found?
WHEN
The system checks the operation result status
THEN
The system proceeds with N9 extraction if the record exists, otherwise terminates N9 processing
Context: A secondary cargo record with N9 reference data has been successfully retrieved
GIVEN
A secondary cargo record with N9 reference data has been successfully retrieved
Applied to: Initialize Reference Counter to Zero
WHEN
The system begins processing reference number fields
THEN
The system initializes the reference counter to zero to start sequential processing
Context: N9 reference data exists in the secondary cargo record and counter is initialized
GIVEN
N9 reference data exists in the secondary cargo record and counter is initialized
Applied to: Loop Through 20 Reference Number Positions
WHEN
The system processes reference number positions sequentially
THEN
The system examines each of the 20 possible reference number positions for qualifying data
Context: The system is examining a specific reference number position in the N9 data
GIVEN
The system is examining a specific reference number position in the N9 data
Applied to: Reference Qualifier = 'CN'?
WHEN
The reference qualifier field is evaluated
THEN
The system identifies positions where the qualifier equals 'CN' for shipment ID extraction
Context: A reference number position contains the qualifier 'CN'
GIVEN
A reference number position contains the qualifier 'CN'
Applied to: Extract Reference Number as Shipment ID
WHEN
The system processes this qualified reference position
THEN
The system extracts the corresponding reference number value and assigns it as the shipment ID
Context: The system has processed a reference number position
GIVEN
The system has processed a reference number position
Applied to: More Positions to Check?
WHEN
The system evaluates the current position count against the total available positions
THEN
The system continues processing if more positions exist, otherwise completes the N9 extraction
Context: Additional reference number positions remain to be processed
GIVEN
Additional reference number positions remain to be processed
Applied to: Move to Next Reference Position
WHEN
The system advances the processing sequence
THEN
The system increments the position counter and moves to examine the next reference number field
R-GCX126-cbl-00404 (+6) File: GCX126R.cbl Prepare Unknown Cargo Email Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Unknown Cargo Email':
  • Context - an edi 350 release message is received with notice reason code indicating released status and the ccn from m10 segment does not exist in the cargo database:
    For Prepare Release Error Email:
    When the system attempts to process the release notification, then prepare email notification with subject 'unknown edi 350 release from cbsa' and message line 1 contains 'unknown edi 350 release from cbsa' followed by the ccn and message line 3 contains 'this ccn was not found.' and message line 4 contains 'release number: ' followed by the cbsa release reference id and ' done by port ' followed by the port code and set message line count to 5 and set destination filename to 'unknown' and set recipient to 'om01247' and route the notification.
  • Context - an edi 350 message is received with notice reason code indicating decon status and the ccn from m10 segment does not exist in the cargo database:
    For Prepare Deconsolidation Error Email:
    When the system attempts to process the deconsolidation notification, then prepare email notification with subject 'unknown edi 350 dcon notice' and message line 1 contains 'unknown edi 350 dcon notice' followed by the ccn and message line 3 contains 'this ccn was not found.' and message line 4 contains 'house bill close number' followed by the cbsa release reference id and ' done by port ' followed by the port code and set message line count to 5 and set destination filename to 'unknown' and set recipient to 'om01247' and route the notification.
  • Context - an edi 350 message is received with a notice reason code that is not released or decon and the ccn from m10 segment does not exist in the cargo database:
    For Prepare General Entry Error Email:
    When the system attempts to process the notification, then prepare email notification with subject from message line 1 and message line 1 contains 'unknown edi 350 entry from cbsa' followed by the ccn and message line 3 contains 'this ccn was not found.' and message line 4 contains 'notice doc type: ' followed by the notice document type code and ' with reason code ' followed by the notice reason code and set message line count to 5 and set destination filename to 'unknown' and set recipient to 'om01247' and route the notification.
  • Context - an edi 350 message has been received and the ccn does not exist in the cargo database:
    For Check Notice Reason Code:
    When the system evaluates the v9 segment notice reason code, then if notice reason code indicates released then prepare release error notification or if notice reason code indicates decon then prepare deconsolidation error notification or if notice reason code is any other value then prepare general entry error notification.
  • Context - an unknown cargo notification has been prepared with all message details:
    For Set Destination Filename: UNKNOWN:
    When the system configures routing parameters, then set the destination filename to 'unknown' to route the message to the unknown message queue.
  • Context - an unknown cargo notification has been prepared and the destination filename has been set to 'unknown':
    For Set Recipient: OM01247:
    When the system assigns the notification recipient, then set the recipient user code to 'om01247' as the default operations mailbox.
  • Context - an unknown cargo notification has been fully prepared with subject, message lines, destination filename set to 'unknown', and recipient set to 'om01247':
    For Call Email Send Process:
    When the system invokes the email send process, then call the email notification service with all prepared notification parameters to deliver the message to the recipient.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 release message is received with notice reason code indicating RELEASED status AND the CCN from M10 segment does not exist in the cargo database
GIVEN
An EDI 350 release message is received with notice reason code indicating RELEASED status AND the CCN from M10 segment does not exist in the cargo database
Applied to: Prepare Release Error Email
WHEN
The system attempts to process the release notification
THEN
Prepare email notification with subject 'UNKNOWN EDI 350 RELEASE FROM CBSA' AND message line 1 contains 'UNKNOWN EDI 350 RELEASE FROM CBSA' followed by the CCN AND message line 3 contains 'THIS CCN WAS NOT FOUND.' AND message line 4 contains 'RELEASE NUMBER: ' followed by the CBSA release reference ID and ' DONE BY PORT ' followed by the port code AND set message line count to 5 AND set destination filename to 'UNKNOWN' AND set recipient to 'OM01247' AND route the notification
Context: An EDI 350 message is received with notice reason code indicating DECON status AND the CCN from M10 segment does not exist in the cargo database
GIVEN
An EDI 350 message is received with notice reason code indicating DECON status AND the CCN from M10 segment does not exist in the cargo database
Applied to: Prepare Deconsolidation Error Email
WHEN
The system attempts to process the deconsolidation notification
THEN
Prepare email notification with subject 'UNKNOWN EDI 350 DCON NOTICE' AND message line 1 contains 'UNKNOWN EDI 350 DCON NOTICE' followed by the CCN AND message line 3 contains 'THIS CCN WAS NOT FOUND.' AND message line 4 contains 'HOUSE BILL CLOSE NUMBER' followed by the CBSA release reference ID and ' DONE BY PORT ' followed by the port code AND set message line count to 5 AND set destination filename to 'UNKNOWN' AND set recipient to 'OM01247' AND route the notification
Context: An EDI 350 message is received with a notice reason code that is not RELEASED or DECON AND the CCN from M10 segment does not exist in the cargo database
GIVEN
An EDI 350 message is received with a notice reason code that is not RELEASED or DECON AND the CCN from M10 segment does not exist in the cargo database
Applied to: Prepare General Entry Error Email
WHEN
The system attempts to process the notification
THEN
Prepare email notification with subject from message line 1 AND message line 1 contains 'UNKNOWN EDI 350 ENTRY FROM CBSA' followed by the CCN AND message line 3 contains 'THIS CCN WAS NOT FOUND.' AND message line 4 contains 'NOTICE DOC TYPE: ' followed by the notice document type code and ' WITH REASON CODE ' followed by the notice reason code AND set message line count to 5 AND set destination filename to 'UNKNOWN' AND set recipient to 'OM01247' AND route the notification
Context: An EDI 350 message has been received AND the CCN does not exist in the cargo database
GIVEN
An EDI 350 message has been received AND the CCN does not exist in the cargo database
Applied to: Check Notice Reason Code
WHEN
The system evaluates the V9 segment notice reason code
THEN
If notice reason code indicates RELEASED then prepare release error notification OR if notice reason code indicates DECON then prepare deconsolidation error notification OR if notice reason code is any other value then prepare general entry error notification
Context: An unknown cargo notification has been prepared with all message details
GIVEN
An unknown cargo notification has been prepared with all message details
Applied to: Set Destination Filename: UNKNOWN
WHEN
The system configures routing parameters
THEN
Set the destination filename to 'UNKNOWN' to route the message to the unknown message queue
Context: An unknown cargo notification has been prepared AND the destination filename has been set to 'UNKNOWN'
GIVEN
An unknown cargo notification has been prepared AND the destination filename has been set to 'UNKNOWN'
Applied to: Set Recipient: OM01247
WHEN
The system assigns the notification recipient
THEN
Set the recipient user code to 'OM01247' as the default operations mailbox
Context: An unknown cargo notification has been fully prepared with subject, message lines, destination filename set to 'UNKNOWN', and recipient set to 'OM01247'
GIVEN
An unknown cargo notification has been fully prepared with subject, message lines, destination filename set to 'UNKNOWN', and recipient set to 'OM01247'
Applied to: Call Email Send Process
WHEN
The system invokes the email send process
THEN
Call the email notification service with all prepared notification parameters to deliver the message to the recipient
R-GCCUSIO-cbl-00408 (+9) File: GCCUSIO.cbl Determine Notification Status Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Notification Status':
  • Context - a cargo record exists with empty cargo status description and cp cargo status equals sent:
    For Set Status to SENT:
    When the system evaluates notification status determination, then the system should set the notification status to sent.
  • Context - a cargo record exists with both cargo status description and cp cargo status description being empty or spaces:
    For Exit - No Notification Needed:
    When the system evaluates notification requirements, then the system should exit without sending any notification.
  • Context - a cargo record exists with cp cargo status description equal to deleted or release:
    For Continue Processing:
    When the system evaluates notification processing requirements, then the system should continue with notification processing.
  • Context - a cargo record exists where the saved notification status equals the current cargo status description:
    For Exit - No Status Change:
    When the system compares current status with previous notification status, then the system should exit without sending notification.
  • Context - a cargo record exists with cargo status description equal to release:
    For Exit - Release Status:
    When the system evaluates notification requirements, then the system should exit without sending any notification.
  • Context - a cargo record exists with cp cargo status description equal to deleted:
    For Set Status to DELETED:
    When the system determines final notification status, then the system should set notification status to deleted and saved status to deleted.
  • Context - a cargo record exists with cp cargo status description equal to release:
    For Set Status to RELEASE:
    When the system determines final notification status, then the system should set notification status to release and saved status to release.
  • Context - a cargo record exists with empty cargo status description and cp cargo status description equal to sent:
    For Set Status to SENT:
    When the system determines final notification status, then the system should set notification status to sent.
  • Context - a cargo record exists where cp status is not deleted, not release, and either us status is not empty or cp status is not sent:
    For Use US Cargo Status:
    When the system determines final notification status, then the system should use the us cargo status description as the notification status and save the us cargo status as the saved status.
  • Context - a cargo record exists with determined notification status and iron highway table configuration is found:
    For Send Notification to Iron Highway:
    When the system prepares to send notification, then the system should call iron highway notification service with record type uc, car id, waybill number, ccn, shipment id, and status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with empty cargo status description and CP cargo status equals SENT
GIVEN
A cargo record exists with empty cargo status description and CP cargo status equals SENT
Applied to: Set Status to SENT
WHEN
The system evaluates notification status determination
THEN
The system should set the notification status to SENT
Context: A cargo record exists with both cargo status description and CP cargo status description being empty or spaces
GIVEN
A cargo record exists with both cargo status description and CP cargo status description being empty or spaces
Applied to: Exit - No Notification Needed
WHEN
The system evaluates notification requirements
THEN
The system should exit without sending any notification
Context: A cargo record exists with CP cargo status description equal to DELETED or RELEASE
GIVEN
A cargo record exists with CP cargo status description equal to DELETED or RELEASE
Applied to: Continue Processing
WHEN
The system evaluates notification processing requirements
THEN
The system should continue with notification processing
Context: A cargo record exists where the saved notification status equals the current cargo status description
GIVEN
A cargo record exists where the saved notification status equals the current cargo status description
Applied to: Exit - No Status Change
WHEN
The system compares current status with previous notification status
THEN
The system should exit without sending notification
Context: A cargo record exists with cargo status description equal to RELEASE
GIVEN
A cargo record exists with cargo status description equal to RELEASE
Applied to: Exit - Release Status
WHEN
The system evaluates notification requirements
THEN
The system should exit without sending any notification
Context: A cargo record exists with CP cargo status description equal to DELETED
GIVEN
A cargo record exists with CP cargo status description equal to DELETED
Applied to: Set Status to DELETED
WHEN
The system determines final notification status
THEN
The system should set notification status to DELETED and saved status to DELETED
Context: A cargo record exists with CP cargo status description equal to RELEASE
GIVEN
A cargo record exists with CP cargo status description equal to RELEASE
Applied to: Set Status to RELEASE
WHEN
The system determines final notification status
THEN
The system should set notification status to RELEASE and saved status to RELEASE
Context: A cargo record exists with empty cargo status description and CP cargo status description equal to SENT
GIVEN
A cargo record exists with empty cargo status description and CP cargo status description equal to SENT
Applied to: Set Status to SENT
WHEN
The system determines final notification status
THEN
The system should set notification status to SENT
Context: A cargo record exists where CP status is not DELETED, not RELEASE, and either US status is not empty or CP status is not SENT
GIVEN
A cargo record exists where CP status is not DELETED, not RELEASE, and either US status is not empty or CP status is not SENT
Applied to: Use US Cargo Status
WHEN
The system determines final notification status
THEN
The system should use the US cargo status description as the notification status and save the US cargo status as the saved status
Context: A cargo record exists with determined notification status and Iron Highway table configuration is found
GIVEN
A cargo record exists with determined notification status and Iron Highway table configuration is found
Applied to: Send Notification to Iron Highway
WHEN
The system prepares to send notification
THEN
The system should call Iron Highway notification service with record type UC, car ID, waybill number, CCN, shipment ID, and status
R-GCX126-cbl-00411 (+13) File: GCX126R.cbl Prepare Hold Email Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Hold Email':
  • Context - a cargo record exists with a ccn (cargo control number), equipment id, waybill information (carrier, origin station, waybill number), destination station details (name and state code), and manifest station name:
    For CCN starts with '6105'?:
    When the cargo status is set to held and the ccn starts with '6105', then the system prepares a hold notification email with subject 'cbsa cargo hold - [ccn]', body containing cargo on hold message, equipment details, waybill information, ccn, destination station, and manifest upon station, and routes it to recipient om01247 with destination filename cahold.
  • Context - a cargo record exists with a ccn that does not start with '6105':
    For CCN starts with '6105'?:
    When the cargo status is set to held, then the system skips the hold notification email preparation and continues processing without sending a hold notification.
  • Context - a cargo record with a valid ccn that starts with '6105':
    For Build Email Subject: 'CBSA CARGO HOLD - ' + CCN:
    When the hold notification email is being prepared, then the system creates the email subject by combining 'cbsa cargo hold - ' with the ccn value.
  • Context - a hold notification email is being prepared:
    For Add Line 1: 'Cargo on HOLD for inspection by CBSA - EDI350':
    When the email body content is being constructed, then the system adds 'cargo on hold for inspection by cbsa - edi350' as the first detail line in the email body.
  • Context - the primary hold message has been added to the email body:
    For Add Line 2: Blank:
    When the email body content is being constructed, then the system adds a blank line as the second line in the email body.
  • Context - a cargo record with equipment id information:
    For Add Line 3: 'Equipment: ' + Equipment ID:
    When the email body content is being constructed, then the system adds a line containing 'equipment : ' followed by the equipment id value as the third line in the email body.
  • Context - a cargo record with waybill information including carrier code, origin station number, and waybill number:
    For Add Line 4: 'Waybill: ' + Carrier + Origin Station + Waybill Number:
    When the email body content is being constructed, then the system adds a line containing 'waybill : ' followed by the concatenated carrier code, origin station number, and waybill number as the fourth line in the email body.
  • Context - a cargo record with a ccn key:
    For Add Line 5: 'CCN: ' + CCN Key:
    When the email body content is being constructed, then the system adds a line containing 'ccn : ' followed by the ccn key value as the fifth line in the email body.
  • Context - a cargo record with destination station name and state code:
    For Add Line 6: 'DESTINATION: ' + Destination Station Name + State Code:
    When the email body content is being constructed, then the system adds a line containing 'destination : ' followed by the destination station name, ', ', and state code as the sixth line in the email body.
  • Context - a cargo record with manifest to station name:
    For Add Line 7: 'MANIFEST UPON: ' + Manifest To Station Name:
    When the email body content is being constructed, then the system adds a line containing 'manifest upon : ' followed by the manifest to station name as the seventh line in the email body.
  • Context - a hold notification email has been prepared with all cargo details:
    For Set Email Recipient: OM01247:
    When the email routing information is being configured, then the system sets the email recipient to 'om01247'.
  • Context - a hold notification email has been prepared with recipient information:
    For Set Destination Filename: CAHOLD:
    When the email routing information is being configured, then the system sets the destination filename to 'cahold'.
  • Context - a hold notification email has been prepared with all cargo details and routing information:
    For Set Total Lines: 7:
    When the email is ready to be sent, then the system sets the line count to 7 indicating the number of detail lines in the email body.
  • Context - a hold notification email has been fully prepared with subject, body content, recipient om01247, destination filename cahold, and line count 7:
    For Call Email Send Process:
    When all email preparation is complete, then the system calls the email send preparation process (z110-prep-emcsend) to deliver the notification.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with a CCN (Cargo Control Number), equipment ID, waybill information (carrier, origin station, waybill number), destination station details (name and state code), and manifest station name
GIVEN
A cargo record exists with a CCN (Cargo Control Number), equipment ID, waybill information (carrier, origin station, waybill number), destination station details (name and state code), and manifest station name
Applied to: CCN starts with '6105'?
WHEN
The cargo status is set to HELD and the CCN starts with '6105'
THEN
The system prepares a hold notification email with subject 'CBSA CARGO HOLD - [CCN]', body containing cargo on hold message, equipment details, waybill information, CCN, destination station, and manifest upon station, and routes it to recipient OM01247 with destination filename CAHOLD
Context: A cargo record exists with a CCN that does not start with '6105'
GIVEN
A cargo record exists with a CCN that does not start with '6105'
Applied to: CCN starts with '6105'?
WHEN
The cargo status is set to HELD
THEN
The system skips the hold notification email preparation and continues processing without sending a hold notification
Context: A cargo record with a valid CCN that starts with '6105'
GIVEN
A cargo record with a valid CCN that starts with '6105'
Applied to: Build Email Subject: 'CBSA CARGO HOLD - ' + CCN
WHEN
The hold notification email is being prepared
THEN
The system creates the email subject by combining 'CBSA CARGO HOLD - ' with the CCN value
Context: A hold notification email is being prepared
GIVEN
A hold notification email is being prepared
Applied to: Add Line 1: 'Cargo on HOLD for inspection by CBSA - EDI350'
WHEN
The email body content is being constructed
THEN
The system adds 'Cargo on HOLD for inspection by CBSA - EDI350' as the first detail line in the email body
Context: The primary hold message has been added to the email body
GIVEN
The primary hold message has been added to the email body
Applied to: Add Line 2: Blank
WHEN
The email body content is being constructed
THEN
The system adds a blank line as the second line in the email body
Context: A cargo record with equipment ID information
GIVEN
A cargo record with equipment ID information
Applied to: Add Line 3: 'Equipment: ' + Equipment ID
WHEN
The email body content is being constructed
THEN
The system adds a line containing 'Equipment : ' followed by the equipment ID value as the third line in the email body
Context: A cargo record with waybill information including carrier code, origin station number, and waybill number
GIVEN
A cargo record with waybill information including carrier code, origin station number, and waybill number
Applied to: Add Line 4: 'Waybill: ' + Carrier + Origin Station + Waybill Number
WHEN
The email body content is being constructed
THEN
The system adds a line containing 'Waybill : ' followed by the concatenated carrier code, origin station number, and waybill number as the fourth line in the email body
Context: A cargo record with a CCN key
GIVEN
A cargo record with a CCN key
Applied to: Add Line 5: 'CCN: ' + CCN Key
WHEN
The email body content is being constructed
THEN
The system adds a line containing 'CCN : ' followed by the CCN key value as the fifth line in the email body
Context: A cargo record with destination station name and state code
GIVEN
A cargo record with destination station name and state code
Applied to: Add Line 6: 'DESTINATION: ' + Destination Station Name + State Code
WHEN
The email body content is being constructed
THEN
The system adds a line containing 'DESTINATION : ' followed by the destination station name, ', ', and state code as the sixth line in the email body
Context: A cargo record with manifest to station name
GIVEN
A cargo record with manifest to station name
Applied to: Add Line 7: 'MANIFEST UPON: ' + Manifest To Station Name
WHEN
The email body content is being constructed
THEN
The system adds a line containing 'MANIFEST UPON : ' followed by the manifest to station name as the seventh line in the email body
Context: A hold notification email has been prepared with all cargo details
GIVEN
A hold notification email has been prepared with all cargo details
Applied to: Set Email Recipient: OM01247
WHEN
The email routing information is being configured
THEN
The system sets the email recipient to 'OM01247'
Context: A hold notification email has been prepared with recipient information
GIVEN
A hold notification email has been prepared with recipient information
Applied to: Set Destination Filename: CAHOLD
WHEN
The email routing information is being configured
THEN
The system sets the destination filename to 'CAHOLD'
Context: A hold notification email has been prepared with all cargo details and routing information
GIVEN
A hold notification email has been prepared with all cargo details and routing information
Applied to: Set Total Lines: 7
WHEN
The email is ready to be sent
THEN
The system sets the line count to 7 indicating the number of detail lines in the email body
Context: A hold notification email has been fully prepared with subject, body content, recipient OM01247, destination filename CAHOLD, and line count 7
GIVEN
A hold notification email has been fully prepared with subject, body content, recipient OM01247, destination filename CAHOLD, and line count 7
Applied to: Call Email Send Process
WHEN
All email preparation is complete
THEN
The system calls the email send preparation process (Z110-PREP-EMCSEND) to deliver the notification
R-GCCUSIO-cbl-00418 (+13) File: GCCUSIO.cbl Prepare Iron Highway Message Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Iron Highway Message':
  • Context - a cargo record is being processed for iron highway notification:
    For Set Status to 'SENT':
    When the us cargo status description is empty and the cp cargo status description equals 'sent ', then the system sets the saved ih status to the cp cargo status description value.
    For Exit - No Message Needed:
    When both us cargo status description is empty and cp cargo status description is empty, then the system exits the notification process without sending a message.
    For Continue Processing:
    When the cp cargo status description equals 'deleted' or equals 'release', then the system continues with the notification processing workflow.
    For Exit - Release Status:
    When the us cargo status description equals 'release', then the system exits the notification process without sending a message.
  • Context - a cargo record is being processed for iron highway notification and the status is not deleted or release:
    For Exit - No Change:
    When the saved ih status equals the current us cargo status description, then the system exits the notification process without sending a message.
  • Context - a cargo record has passed initial status validation for iron highway notification:
    For Lookup Iron Highway Station Table:
    When the system needs to determine if the station supports iron highway notifications, then the system looks up the ih table using the saved waybill station as the sequence id.
  • Context - the system has looked up the iron highway station configuration table:
    For Exit - Station Not Configured:
    When the table lookup returns a non-zero return flag indicating the station is not found, then the system exits the notification process without sending a message.
  • Context - the waybill station is configured for iron highway notifications:
    For Extract N9 Reference Numbers:
    When the system processes the cargo record for notification, then the system retrieves n9 reference information and extracts the shipment id from cn reference qualifier.
  • Context - a cargo record is being prepared for iron highway notification:
    For Set Message Status to 'DELETED':
    When the cp cargo status description equals 'deleted', then the system sets the iron highway message status to 'deleted' and the saved ih status to 'deleted'.
  • Context - a cargo record is being prepared for iron highway notification and the status is not deleted:
    For Set Message Status to 'RELEASE':
    When the cp cargo status description equals 'release', then the system sets the iron highway message status to 'release' and the saved ih status to 'release'.
  • Context - a cargo record is being prepared for iron highway notification and the status is not deleted or release:
    For Set Message Status to 'SENT':
    When the us cargo status description is empty and the cp cargo status description equals 'sent ', then the system sets the iron highway message status to 'sent'.
    For Set Message Status from US Cargo Description:
    When the us cargo status description is not empty or the cp cargo status description is not 'sent ', then the system sets the iron highway message status to the us cargo status description and updates the saved ih status to the us cargo status.
  • Context - a cargo record has been validated and status determined for iron highway notification:
    For Set Message Record Type to 'UC':
    When the system prepares the notification message content, then the system sets record type to 'uc', car id from saved car number, waybill from saved waybill number, and ccn from cargo key.
  • Context - the iron highway notification message has been formatted with all required information:
    For Call Iron Highway Interface:
    When the system is ready to send the notification, then the system calls the gccih program with the common control block and iron highway message structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for Iron Highway notification
GIVEN
A cargo record is being processed for Iron Highway notification
Applied to: Set Status to 'SENT'
WHEN
The US cargo status description is empty AND the CP cargo status description equals 'SENT '
THEN
The system sets the saved IH status to the CP cargo status description value
Applied to: Exit - No Message Needed
WHEN
Both US cargo status description is empty AND CP cargo status description is empty
THEN
The system exits the notification process without sending a message
Applied to: Continue Processing
WHEN
The CP cargo status description equals 'DELETED' OR equals 'RELEASE'
THEN
The system continues with the notification processing workflow
Applied to: Exit - Release Status
WHEN
The US cargo status description equals 'RELEASE'
THEN
The system exits the notification process without sending a message
Context: A cargo record is being processed for Iron Highway notification AND the status is not DELETED or RELEASE
GIVEN
A cargo record is being processed for Iron Highway notification AND the status is not DELETED or RELEASE
Applied to: Exit - No Change
WHEN
The saved IH status equals the current US cargo status description
THEN
The system exits the notification process without sending a message
Context: A cargo record has passed initial status validation for Iron Highway notification
GIVEN
A cargo record has passed initial status validation for Iron Highway notification
Applied to: Lookup Iron Highway Station Table
WHEN
The system needs to determine if the station supports Iron Highway notifications
THEN
The system looks up the IH table using the saved waybill station as the sequence ID
Context: The system has looked up the Iron Highway station configuration table
GIVEN
The system has looked up the Iron Highway station configuration table
Applied to: Exit - Station Not Configured
WHEN
The table lookup returns a non-zero return flag indicating the station is not found
THEN
The system exits the notification process without sending a message
Context: The waybill station is configured for Iron Highway notifications
GIVEN
The waybill station is configured for Iron Highway notifications
Applied to: Extract N9 Reference Numbers
WHEN
The system processes the cargo record for notification
THEN
The system retrieves N9 reference information and extracts the shipment ID from CN reference qualifier
Context: A cargo record is being prepared for Iron Highway notification
GIVEN
A cargo record is being prepared for Iron Highway notification
Applied to: Set Message Status to 'DELETED'
WHEN
The CP cargo status description equals 'DELETED'
THEN
The system sets the Iron Highway message status to 'DELETED' and the saved IH status to 'DELETED'
Context: A cargo record is being prepared for Iron Highway notification AND the status is not DELETED
GIVEN
A cargo record is being prepared for Iron Highway notification AND the status is not DELETED
Applied to: Set Message Status to 'RELEASE'
WHEN
The CP cargo status description equals 'RELEASE'
THEN
The system sets the Iron Highway message status to 'RELEASE' and the saved IH status to 'RELEASE'
Context: A cargo record is being prepared for Iron Highway notification AND the status is not DELETED or RELEASE
GIVEN
A cargo record is being prepared for Iron Highway notification AND the status is not DELETED or RELEASE
Applied to: Set Message Status to 'SENT'
WHEN
The US cargo status description is empty AND the CP cargo status description equals 'SENT '
THEN
The system sets the Iron Highway message status to 'SENT'
Applied to: Set Message Status from US Cargo Description
WHEN
The US cargo status description is not empty OR the CP cargo status description is not 'SENT '
THEN
The system sets the Iron Highway message status to the US cargo status description and updates the saved IH status to the US cargo status
Context: A cargo record has been validated and status determined for Iron Highway notification
GIVEN
A cargo record has been validated and status determined for Iron Highway notification
Applied to: Set Message Record Type to 'UC'
WHEN
The system prepares the notification message content
THEN
The system sets record type to 'UC', car ID from saved car number, waybill from saved waybill number, and CCN from cargo key
Context: The Iron Highway notification message has been formatted with all required information
GIVEN
The Iron Highway notification message has been formatted with all required information
Applied to: Call Iron Highway Interface
WHEN
The system is ready to send the notification
THEN
The system calls the GCCIH program with the common control block and Iron Highway message structure
R-GCX126-cbl-00425 (+11) File: GCX126R.cbl Send Email Notification Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Email Notification':
  • Context - email parameters are prepared with from usercode, destination filename, to usercode, copy usercode, subject, keywords, and report content:
    For Call EMCSEND2 to Send Email:
    When emcsend2 is called with these parameters, then the email is transmitted through the messaging system.
  • Context - an email has been sent successfully through emcsend2 and the return status flag indicates no errors:
    For Purge IMS Message Queue:
    When the email send operation completes without errors, then the system calls cims with purg function to purge the alternate pcb message queue.
  • Context - an email send attempt has been made through emcsend2:
    For Abort: Invalid FROM User:
    When the return status flag indicates from user not found, then the system sets error message 'emi - invalid merlin from' and calls cerr to abort the program.
    For Abort: Invalid Filename:
    When the return status flag indicates filename is invalid, then the system sets error message 'emi - invalid merlin filename' and calls cerr to abort the program.
  • Context - an email send attempt has failed because to or copy usercode was not found:
    For Resend Failed Email to OM01247:
    When the return status flag indicates to or copy user not found, then the system clears to usercode, sets to usercode to om01247, sets destination filename to in, and calls the resend email procedure.
    For Resend Failed Email to OM01247:
    When the system determines which recipient was invalid based on message type, then if message type is unrlse, store the second to usercode as the bad merlin id, otherwise store the first to usercode as the bad merlin id.
  • Context - an email has been successfully rerouted to om01247 after the original recipient was not found and the resend operation returned no errors:
    For Resend Failed Email to OM01247:
    When the rerouted email send completes successfully, then the system clears the subject, constructs a new subject containing the invalid merlin id and text 'invalid merlin to - report reroute', and calls the resend email procedure again.
  • Context - an email is being resent to the default user om01247 after initial recipient failure:
    For Resend Failed Email to OM01247:
    When the resend operation return status flag indicates to or copy user not found, then the system sets error message 'emi - invalid merlin to or copy' and calls cerr to abort the program.
  • Context - an email is being resent after initial failure:
    For Resend Failed Email to OM01247:
    When the resend operation return status flag indicates from user not found, then the system sets error message 'emi - invalid merlin from' and calls cerr to abort the program.
    For Resend Failed Email to OM01247:
    When the resend operation return status flag indicates filename is invalid, then the system sets error message 'emi - invalid merlin filename' and calls cerr to abort the program.
  • Context - an email send operation has completed through emcsend2:
    For Call EMCSEND2 to Send Email:
    When the email processing finishes regardless of success or reroute, then the system adds 1 to the formatted machine sequence number.
  • Context - an email has been resent successfully and the return status flag indicates no errors:
    For Resend Failed Email to OM01247:
    When the resend operation completes without errors, then the system calls cims with purg function to purge the alternate pcb message queue.
👨‍💻 Technical ACs (Gherkin)
Context: Email parameters are prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and report content
GIVEN
Email parameters are prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and report content
Applied to: Call EMCSEND2 to Send Email
WHEN
EMCSEND2 is called with these parameters
THEN
The email is transmitted through the messaging system
Context: An email has been sent successfully through EMCSEND2 and the return status flag indicates no errors
GIVEN
An email has been sent successfully through EMCSEND2 and the return status flag indicates no errors
Applied to: Purge IMS Message Queue
WHEN
The email send operation completes without errors
THEN
The system calls CIMS with PURG function to purge the alternate PCB message queue
Context: An email send attempt has been made through EMCSEND2
GIVEN
An email send attempt has been made through EMCSEND2
Applied to: Abort: Invalid FROM User
WHEN
The return status flag indicates FROM user not found
THEN
The system sets error message 'EMI - INVALID MERLIN FROM' and calls CERR to abort the program
Applied to: Abort: Invalid Filename
WHEN
The return status flag indicates filename is invalid
THEN
The system sets error message 'EMI - INVALID MERLIN FILENAME' and calls CERR to abort the program
Context: An email send attempt has failed because TO or COPY usercode was not found
GIVEN
An email send attempt has failed because TO or COPY usercode was not found
Applied to: Resend Failed Email to OM01247
WHEN
The return status flag indicates TO or COPY user not found
THEN
The system clears TO usercode, sets TO usercode to OM01247, sets destination filename to IN, and calls the resend email procedure
Applied to: Resend Failed Email to OM01247
WHEN
The system determines which recipient was invalid based on message type
THEN
If message type is UNRLSE, store the second TO usercode as the bad Merlin ID, otherwise store the first TO usercode as the bad Merlin ID
Context: An email has been successfully rerouted to OM01247 after the original recipient was not found and the resend operation returned no errors
GIVEN
An email has been successfully rerouted to OM01247 after the original recipient was not found and the resend operation returned no errors
Applied to: Resend Failed Email to OM01247
WHEN
The rerouted email send completes successfully
THEN
The system clears the subject, constructs a new subject containing the invalid Merlin ID and text 'INVALID MERLIN TO - REPORT REROUTE', and calls the resend email procedure again
Context: An email is being resent to the default user OM01247 after initial recipient failure
GIVEN
An email is being resent to the default user OM01247 after initial recipient failure
Applied to: Resend Failed Email to OM01247
WHEN
The resend operation return status flag indicates TO or COPY user not found
THEN
The system sets error message 'EMI - INVALID MERLIN TO OR COPY' and calls CERR to abort the program
Context: An email is being resent after initial failure
GIVEN
An email is being resent after initial failure
Applied to: Resend Failed Email to OM01247
WHEN
The resend operation return status flag indicates FROM user not found
THEN
The system sets error message 'EMI - INVALID MERLIN FROM' and calls CERR to abort the program
Applied to: Resend Failed Email to OM01247
WHEN
The resend operation return status flag indicates filename is invalid
THEN
The system sets error message 'EMI - INVALID MERLIN FILENAME' and calls CERR to abort the program
Context: An email send operation has completed through EMCSEND2
GIVEN
An email send operation has completed through EMCSEND2
Applied to: Call EMCSEND2 to Send Email
WHEN
The email processing finishes regardless of success or reroute
THEN
The system adds 1 to the formatted machine sequence number
Context: An email has been resent successfully and the return status flag indicates no errors
GIVEN
An email has been resent successfully and the return status flag indicates no errors
Applied to: Resend Failed Email to OM01247
WHEN
The resend operation completes without errors
THEN
The system calls CIMS with PURG function to purge the alternate PCB message queue
R-GCCUSIO-cbl-00432 (+2) File: GCCUSIO.cbl Loop Through 20 N9 Reference Entries Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Loop Through 20 N9 Reference Entries':
  • Context - a cargo ccn key exists in the system:
    For Retrieve Secondary Cargo Record Type 02:
    When the system needs to process n9 reference numbers for shipment identification, then the system retrieves the secondary cargo record with record type '02' and sequence '0001' using the cargo ccn key.
  • Context - a secondary cargo record exists with n9 reference number data:
    For Loop Through 20 N9 Reference Entries:
    When the system processes the n9 reference numbers, then the system loops through 20 reference entries, checks each reference qualifier, and extracts the reference number as shipment id when the qualifier equals 'cn'.
  • Context - n9 reference number entries are being processed:
    For Reference Qualifier = 'CN'?:
    When a reference entry has qualifier 'cn', then the system extracts the corresponding reference number and stores it as the shipment id for iron highway notification.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo CCN key exists in the system
GIVEN
A cargo CCN key exists in the system
Applied to: Retrieve Secondary Cargo Record Type 02
WHEN
The system needs to process N9 reference numbers for shipment identification
THEN
The system retrieves the secondary cargo record with record type '02' and sequence '0001' using the cargo CCN key
Context: A secondary cargo record exists with N9 reference number data
GIVEN
A secondary cargo record exists with N9 reference number data
Applied to: Loop Through 20 N9 Reference Entries
WHEN
The system processes the N9 reference numbers
THEN
The system loops through 20 reference entries, checks each reference qualifier, and extracts the reference number as shipment ID when the qualifier equals 'CN'
Context: N9 reference number entries are being processed
GIVEN
N9 reference number entries are being processed
Applied to: Reference Qualifier = 'CN'?
WHEN
A reference entry has qualifier 'CN'
THEN
The system extracts the corresponding reference number and stores it as the shipment ID for Iron Highway notification
R-GCCUSIO-cbl-00435 (+2) File: GCCUSIO.cbl Determine Bond Number Source Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Bond Number Source':
  • Context - a cargo record requires bond number indexing for tracking purposes:
    For In-Bond Control Number Available?:
    When the system evaluates available bond control numbers and the in-bond control number field (m1206) is not empty, then the system uses the in-bond control number as the bond number index value.
  • Context - a cargo record requires bond number indexing and the in-bond control number is empty:
    For Entry Number Available?:
    When the system evaluates the entry number field (m1202) and it is not empty, then the system uses the entry number as the bond number index value.
  • Context - a cargo record requires bond number indexing and both in-bond control number and entry number are empty:
    For Set Bond Index to Spaces:
    When the system cannot find any valid bond number source, then the system sets the bond number index to spaces (empty value).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record requires bond number indexing for tracking purposes
GIVEN
A cargo record requires bond number indexing for tracking purposes
Applied to: In-Bond Control Number Available?
WHEN
The system evaluates available bond control numbers and the in-bond control number field (M1206) is not empty
THEN
The system uses the in-bond control number as the bond number index value
Context: A cargo record requires bond number indexing and the in-bond control number is empty
GIVEN
A cargo record requires bond number indexing and the in-bond control number is empty
Applied to: Entry Number Available?
WHEN
The system evaluates the entry number field (M1202) and it is not empty
THEN
The system uses the entry number as the bond number index value
Context: A cargo record requires bond number indexing and both in-bond control number and entry number are empty
GIVEN
A cargo record requires bond number indexing and both in-bond control number and entry number are empty
Applied to: Set Bond Index to Spaces
WHEN
The system cannot find any valid bond number source
THEN
The system sets the bond number index to spaces (empty value)
R-GCX126-cbl-00437 (+12) File: GCX126R.cbl Resend Failed Email Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Resend Failed Email':
  • Context - an email send operation has failed with error status emi-to-or-copy-not-found:
    For Email Send Failed:
    When the system detects the recipient not found error, then the system saves the invalid recipient id, clears the to recipient field, sets the to recipient to om01247, sets the destination filename to in, resends the original email, and if successful, sends a reroute notification with subject containing the invalid merlin id and message 'invalid merlin to - report reroute'.
  • Context - an email send has failed with emi-to-or-copy-not-found error status:
    For Save Failed Recipient ID:
    When the system needs to identify the invalid recipient, then if the message type is unrelease (88-z110-mrln-type-is-unrlse), save emi-to-usercodes(02) as the bad merlin id, otherwise save emi-to-usercodes(01) as the bad merlin id.
  • Context - the invalid recipient id has been saved to ws-bad-merlin-id:
    For Clear Recipient Field:
    When the system prepares to resend the email, then clear emi-to-usercode field to spaces, set emi-to-usercodes(01) to om01247, and set emi-destination-filename to in.
  • Context - email recipients have been reset with emi-to-usercodes(01) set to om01247 and emi-destination-filename set to in:
    For Call EMCSEND2 to Resend Email:
    When the system calls the z116-resend-merlin procedure, then the system invokes emcsend2 program with all email parameters including from usercode, destination filename, to usercode, copy usercode, subject, keywords, report content, return status flag, segment numbers, and item type.
  • Context - the emcsend2 program has been called to resend the email:
    For Resend Successful?:
    When the system evaluates the emi-return-status-flag, then if emi-no-errors is true, proceed to prepare reroute notification; otherwise if emi-from-not-found, abend with error 'emi - invalid merlin from'; if emi-to-or-copy-not-found, abend with error 'emi - invalid merlin to or copy'; if emi-filename-invalid, abend with error 'emi - invalid merlin filename'.
  • Context - the email has been successfully resent to om01247 and ws-bad-merlin-id contains the invalid recipient id:
    For Build Subject: Bad Merlin ID + INVALID MERLIN TO - REPORT REROUTE:
    When the system prepares the reroute notification, then clear emi-subject to spaces and build a new subject by concatenating ws-bad-merlin-id, a space, and the text 'invalid merlin to - report reroute'.
  • Context - the reroute notification subject has been built with the invalid merlin id and reroute message:
    For Send Reroute Notification Email:
    When the system calls the z116-resend-merlin procedure again, then the system invokes emcsend2 program with the reroute notification subject and all other email parameters to send the notification to om01247.
  • Context - the reroute notification email has been sent via emcsend2:
    For Final Send Successful?:
    When the system evaluates the emi-return-status-flag, then if emi-no-errors is true, the reroute process completes successfully; if emi-from-not-found, abend with error 'emi - invalid merlin from'; if emi-to-or-copy-not-found, abend with error 'emi - invalid merlin to or copy'; if emi-filename-invalid, abend with error 'emi - invalid merlin filename'.
  • Context - an email has been successfully sent via emcsend2 with emi-no-errors status:
    For Email Successfully Rerouted:
    When the z116-resend-merlin procedure completes, then add 1 to ws-fmt-machine-seq to increment the sequence number.
  • Context - an email has been successfully sent with emi-no-errors status:
    For Email Successfully Rerouted:
    When the system completes the email send operation in z116-resend-merlin, then call cims program with purg function code and alt-pcb to remove the message from the queue.
  • Context - the emcsend2 program has returned with emi-from-not-found status:
    For Abend: Invalid FROM User:
    When the system evaluates the return status in z116-resend-merlin, then move 'emi - invalid merlin from' to cc-error-message and call cerr program to abend the transaction.
  • Context - the emcsend2 program has returned with emi-to-or-copy-not-found status:
    For Abend: Invalid TO/COPY User:
    When the system evaluates the return status in z116-resend-merlin, then move 'emi - invalid merlin to or copy' to cc-error-message and call cerr program to abend the transaction.
  • Context - the emcsend2 program has returned with emi-filename-invalid status:
    For Abend: Invalid Filename:
    When the system evaluates the return status in z116-resend-merlin, then move 'emi - invalid merlin filename' to cc-error-message and call cerr program to abend the transaction.
👨‍💻 Technical ACs (Gherkin)
Context: An email send operation has failed with error status EMI-TO-OR-COPY-NOT-FOUND
GIVEN
An email send operation has failed with error status EMI-TO-OR-COPY-NOT-FOUND
Applied to: Email Send Failed
WHEN
The system detects the recipient not found error
THEN
The system saves the invalid recipient ID, clears the TO recipient field, sets the TO recipient to OM01247, sets the destination filename to IN, resends the original email, and if successful, sends a reroute notification with subject containing the invalid Merlin ID and message 'INVALID MERLIN TO - REPORT REROUTE'
Context: An email send has failed with EMI-TO-OR-COPY-NOT-FOUND error status
GIVEN
An email send has failed with EMI-TO-OR-COPY-NOT-FOUND error status
Applied to: Save Failed Recipient ID
WHEN
The system needs to identify the invalid recipient
THEN
If the message type is unrelease (88-Z110-MRLN-TYPE-IS-UNRLSE), save EMI-TO-USERCODES(02) as the bad Merlin ID, otherwise save EMI-TO-USERCODES(01) as the bad Merlin ID
Context: The invalid recipient ID has been saved to WS-BAD-MERLIN-ID
GIVEN
The invalid recipient ID has been saved to WS-BAD-MERLIN-ID
Applied to: Clear Recipient Field
WHEN
The system prepares to resend the email
THEN
Clear EMI-TO-USERCODE field to spaces, set EMI-TO-USERCODES(01) to OM01247, and set EMI-DESTINATION-FILENAME to IN
Context: Email recipients have been reset with EMI-TO-USERCODES(01) set to OM01247 and EMI-DESTINATION-FILENAME set to IN
GIVEN
Email recipients have been reset with EMI-TO-USERCODES(01) set to OM01247 and EMI-DESTINATION-FILENAME set to IN
Applied to: Call EMCSEND2 to Resend Email
WHEN
The system calls the Z116-RESEND-MERLIN procedure
THEN
The system invokes EMCSEND2 program with all email parameters including FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, report content, return status flag, segment numbers, and item type
Context: The EMCSEND2 program has been called to resend the email
GIVEN
The EMCSEND2 program has been called to resend the email
Applied to: Resend Successful?
WHEN
The system evaluates the EMI-RETURN-STATUS-FLAG
THEN
If EMI-NO-ERRORS is true, proceed to prepare reroute notification; otherwise if EMI-FROM-NOT-FOUND, abend with error 'EMI - INVALID MERLIN FROM'; if EMI-TO-OR-COPY-NOT-FOUND, abend with error 'EMI - INVALID MERLIN TO OR COPY'; if EMI-FILENAME-INVALID, abend with error 'EMI - INVALID MERLIN FILENAME'
Context: The email has been successfully resent to OM01247 and WS-BAD-MERLIN-ID contains the invalid recipient ID
GIVEN
The email has been successfully resent to OM01247 and WS-BAD-MERLIN-ID contains the invalid recipient ID
Applied to: Build Subject: Bad Merlin ID + INVALID MERLIN TO - REPORT REROUTE
WHEN
The system prepares the reroute notification
THEN
Clear EMI-SUBJECT to spaces and build a new subject by concatenating WS-BAD-MERLIN-ID, a space, and the text 'INVALID MERLIN TO - REPORT REROUTE'
Context: The reroute notification subject has been built with the invalid Merlin ID and reroute message
GIVEN
The reroute notification subject has been built with the invalid Merlin ID and reroute message
Applied to: Send Reroute Notification Email
WHEN
The system calls the Z116-RESEND-MERLIN procedure again
THEN
The system invokes EMCSEND2 program with the reroute notification subject and all other email parameters to send the notification to OM01247
Context: The reroute notification email has been sent via EMCSEND2
GIVEN
The reroute notification email has been sent via EMCSEND2
Applied to: Final Send Successful?
WHEN
The system evaluates the EMI-RETURN-STATUS-FLAG
THEN
If EMI-NO-ERRORS is true, the reroute process completes successfully; if EMI-FROM-NOT-FOUND, abend with error 'EMI - INVALID MERLIN FROM'; if EMI-TO-OR-COPY-NOT-FOUND, abend with error 'EMI - INVALID MERLIN TO OR COPY'; if EMI-FILENAME-INVALID, abend with error 'EMI - INVALID MERLIN FILENAME'
Context: An email has been successfully sent via EMCSEND2 with EMI-NO-ERRORS status
GIVEN
An email has been successfully sent via EMCSEND2 with EMI-NO-ERRORS status
Applied to: Email Successfully Rerouted
WHEN
The Z116-RESEND-MERLIN procedure completes
THEN
Add 1 to WS-FMT-MACHINE-SEQ to increment the sequence number
Context: An email has been successfully sent with EMI-NO-ERRORS status
GIVEN
An email has been successfully sent with EMI-NO-ERRORS status
Applied to: Email Successfully Rerouted
WHEN
The system completes the email send operation in Z116-RESEND-MERLIN
THEN
Call CIMS program with PURG function code and ALT-PCB to remove the message from the queue
Context: The EMCSEND2 program has returned with EMI-FROM-NOT-FOUND status
GIVEN
The EMCSEND2 program has returned with EMI-FROM-NOT-FOUND status
Applied to: Abend: Invalid FROM User
WHEN
The system evaluates the return status in Z116-RESEND-MERLIN
THEN
Move 'EMI - INVALID MERLIN FROM' to CC-ERROR-MESSAGE and call CERR program to abend the transaction
Context: The EMCSEND2 program has returned with EMI-TO-OR-COPY-NOT-FOUND status
GIVEN
The EMCSEND2 program has returned with EMI-TO-OR-COPY-NOT-FOUND status
Applied to: Abend: Invalid TO/COPY User
WHEN
The system evaluates the return status in Z116-RESEND-MERLIN
THEN
Move 'EMI - INVALID MERLIN TO OR COPY' to CC-ERROR-MESSAGE and call CERR program to abend the transaction
Context: The EMCSEND2 program has returned with EMI-FILENAME-INVALID status
GIVEN
The EMCSEND2 program has returned with EMI-FILENAME-INVALID status
Applied to: Abend: Invalid Filename
WHEN
The system evaluates the return status in Z116-RESEND-MERLIN
THEN
Move 'EMI - INVALID MERLIN FILENAME' to CC-ERROR-MESSAGE and call CERR program to abend the transaction
R-GCCUSIO-cbl-00438 (+5) File: GCCUSIO.cbl Lookup MC Table for Border Station Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup MC Table for Border Station':
  • Context - a need to lookup border station code from mc table:
    For Initialize MC Table Lookup Parameters:
    When the system prepares to perform mc table lookup, then all lookup parameters are cleared and initialized to spaces, and function code is set to 'gu' for retrieval.
  • Context - a requirement to lookup station master data:
    For Set Table ID to 'MC':
    When the system configures table lookup parameters, then table id is set to 'mc' to identify the station master table.
  • Context - a cargo record with location id information:
    For Set Search Key to Location ID:
    When the system prepares mc table lookup, then the cargo location id is set as the sequence id search key for mc table lookup.
  • Context - all mc table lookup parameters are properly initialized:
    For Call Table Lookup Routine GCCTBIO:
    When the system needs to retrieve station master data, then external routine gcctbio is called with function code, table parameters, and search keys to perform the lookup.
  • Context - mc table lookup has been executed:
    For Table Record Found?:
    When the system evaluates the lookup result, then if return flag equals '0' then lookup is successful, otherwise lookup failed.
  • Context - mc table lookup was successful and returned a valid table segment:
    For Extract Border Station Number from MC Segment:
    When the system processes the retrieved mc table data, then the border station number is extracted from the mc segment and made available for cargo status processing.
👨‍💻 Technical ACs (Gherkin)
Context: A need to lookup border station code from MC table
GIVEN
A need to lookup border station code from MC table
Applied to: Initialize MC Table Lookup Parameters
WHEN
The system prepares to perform MC table lookup
THEN
All lookup parameters are cleared and initialized to spaces, and function code is set to 'GU' for retrieval
Context: A requirement to lookup station master data
GIVEN
A requirement to lookup station master data
Applied to: Set Table ID to 'MC'
WHEN
The system configures table lookup parameters
THEN
Table ID is set to 'MC' to identify the station master table
Context: A cargo record with location ID information
GIVEN
A cargo record with location ID information
Applied to: Set Search Key to Location ID
WHEN
The system prepares MC table lookup
THEN
The cargo location ID is set as the sequence ID search key for MC table lookup
Context: All MC table lookup parameters are properly initialized
GIVEN
All MC table lookup parameters are properly initialized
Applied to: Call Table Lookup Routine GCCTBIO
WHEN
The system needs to retrieve station master data
THEN
External routine GCCTBIO is called with function code, table parameters, and search keys to perform the lookup
Context: MC table lookup has been executed
GIVEN
MC table lookup has been executed
Applied to: Table Record Found?
WHEN
The system evaluates the lookup result
THEN
If return flag equals '0' then lookup is successful, otherwise lookup failed
Context: MC table lookup was successful and returned a valid table segment
GIVEN
MC table lookup was successful and returned a valid table segment
Applied to: Extract Border Station Number from MC Segment
WHEN
The system processes the retrieved MC table data
THEN
The border station number is extracted from the MC segment and made available for cargo status processing
R-GCCUSIO-cbl-00444 (+11) File: GCCUSIO.cbl Check Error Status Conditions Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Error Status Conditions':
  • Context - a cargo record is being processed for status evaluation:
    For CP Cargo Error Status?:
    When the cp cargo status field rt10-cpcargo-status indicates an error condition (88-gcusrt-rt10-cpcargo-error is true), then the system flags the cargo as having an error condition and proceeds to error handling workflow.
    For No Error/Hold Conditions:
    When all error and hold status checks return false (no cp cargo errors, no cp cargo pending, no us cargo errors, and no us cargo hold conditions of any type), then the system determines the cargo has clean status and proceeds to normal processing workflow without special handling requirements.
  • Context - a cargo record is being processed and cp cargo error status is false:
    For CP Cargo Pending Status?:
    When the cp cargo status field rt10-cpcargo-status indicates a pending condition (88-gcusrt-rt10-cpcargo-pending is true), then the system flags the cargo as having a pending condition and proceeds to pending status handling workflow.
  • Context - a cargo record is being processed and both cp cargo error and pending statuses are false:
    For US Cargo Error Status?:
    When the us cargo status field rt11-uscargo-status indicates an error condition (88-gcusrt-rt11-uscargo-error is true), then the system flags the cargo as having an error condition and proceeds to error handling workflow.
  • Context - a cargo record is being processed and no error conditions exist:
    For US Cargo Hold Status?:
    When the us cargo status field rt11-uscargo-status indicates a general hold condition (88-gcusrt-rt11-uscargo-hold is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
  • Context - a cargo record is being processed and no error or general hold conditions exist:
    For US Cargo Hold PCS Status?:
    When the us cargo status field rt11-uscargo-status indicates a pcs hold condition (88-gcusrt-rt11-uscargo-holdpcs is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
  • Context - a cargo record is being processed and no error, general hold, or pcs hold conditions exist:
    For US Cargo PR-HPCS Status?:
    When the us cargo status field rt11-uscargo-status indicates a pre-release pcs hold condition (88-gcusrt-rt11-uscargo-pr-hpcs is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
  • Context - a cargo record is being processed and no error or previous hold conditions exist:
    For US Cargo Hold Border Status?:
    When the us cargo status field rt11-uscargo-status indicates a border hold condition (88-gcusrt-rt11-uscargo-hold-b is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
    For US Cargo PR-H-BO Status?:
    When the us cargo status field rt11-uscargo-status indicates a pre-release border hold condition (88-gcusrt-rt11-uscargo-pr-h-bo is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
    For US Cargo Hold Dest Status?:
    When the us cargo status field rt11-uscargo-status indicates a destination hold condition (88-gcusrt-rt11-uscargo-hold-d is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
    For US Cargo PR-H-DE Status?:
    When the us cargo status field rt11-uscargo-status indicates a pre-release destination hold condition (88-gcusrt-rt11-uscargo-pr-h-de is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
    For US Cargo Hold FDA Status?:
    When the us cargo status field rt11-uscargo-status indicates an fda hold condition (88-gcusrt-rt11-uscargo-holdfda is true), then the system flags the cargo as having a hold condition and proceeds to hold status handling workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for status evaluation
GIVEN
A cargo record is being processed for status evaluation
Applied to: CP Cargo Error Status?
WHEN
The CP cargo status field RT10-CPCARGO-STATUS indicates an error condition (88-GCUSRT-RT10-CPCARGO-ERROR is true)
THEN
The system flags the cargo as having an error condition and proceeds to error handling workflow
Applied to: No Error/Hold Conditions
WHEN
All error and hold status checks return false (no CP cargo errors, no CP cargo pending, no US cargo errors, and no US cargo hold conditions of any type)
THEN
The system determines the cargo has clean status and proceeds to normal processing workflow without special handling requirements
Context: A cargo record is being processed and CP cargo error status is false
GIVEN
A cargo record is being processed and CP cargo error status is false
Applied to: CP Cargo Pending Status?
WHEN
The CP cargo status field RT10-CPCARGO-STATUS indicates a pending condition (88-GCUSRT-RT10-CPCARGO-PENDING is true)
THEN
The system flags the cargo as having a pending condition and proceeds to pending status handling workflow
Context: A cargo record is being processed and both CP cargo error and pending statuses are false
GIVEN
A cargo record is being processed and both CP cargo error and pending statuses are false
Applied to: US Cargo Error Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates an error condition (88-GCUSRT-RT11-USCARGO-ERROR is true)
THEN
The system flags the cargo as having an error condition and proceeds to error handling workflow
Context: A cargo record is being processed and no error conditions exist
GIVEN
A cargo record is being processed and no error conditions exist
Applied to: US Cargo Hold Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a general hold condition (88-GCUSRT-RT11-USCARGO-HOLD is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Context: A cargo record is being processed and no error or general hold conditions exist
GIVEN
A cargo record is being processed and no error or general hold conditions exist
Applied to: US Cargo Hold PCS Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a PCS hold condition (88-GCUSRT-RT11-USCARGO-HOLDPCS is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Context: A cargo record is being processed and no error, general hold, or PCS hold conditions exist
GIVEN
A cargo record is being processed and no error, general hold, or PCS hold conditions exist
Applied to: US Cargo PR-HPCS Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a pre-release PCS hold condition (88-GCUSRT-RT11-USCARGO-PR-HPCS is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Context: A cargo record is being processed and no error or previous hold conditions exist
GIVEN
A cargo record is being processed and no error or previous hold conditions exist
Applied to: US Cargo Hold Border Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a border hold condition (88-GCUSRT-RT11-USCARGO-HOLD-B is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Applied to: US Cargo PR-H-BO Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a pre-release border hold condition (88-GCUSRT-RT11-USCARGO-PR-H-BO is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Applied to: US Cargo Hold Dest Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a destination hold condition (88-GCUSRT-RT11-USCARGO-HOLD-D is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Applied to: US Cargo PR-H-DE Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates a pre-release destination hold condition (88-GCUSRT-RT11-USCARGO-PR-H-DE is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
Applied to: US Cargo Hold FDA Status?
WHEN
The US cargo status field RT11-USCARGO-STATUS indicates an FDA hold condition (88-GCUSRT-RT11-USCARGO-HOLDFDA is true)
THEN
The system flags the cargo as having a hold condition and proceeds to hold status handling workflow
R-GCX126-cbl-00450 (+5) File: GCX126R.cbl Fetch Merlin Contact Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fetch Merlin Contact':
  • Context - a need to retrieve merlin contact information from the customs table:
    For Initialize Function Code to GU, Clear Key Values and Flags:
    When the merlin contact fetch process is initiated, then the function code should be set to 'gu' (get unique), all key values (gcstbrt-key-value, gcstbdp-key-value) should be cleared to spaces, the return flag (gcctbio-return-flag) should be cleared to spaces, the mc segment (gcstbrt-mc-segment) should be cleared to spaces, and both second-pcb-flag and unqual-ssa-flag should be cleared to spaces.
  • Context - the retrieval parameters have been initialized:
    For Set Table ID to MC Customs Table:
    When preparing to fetch merlin contact information, then the table identifier (gcstbrt-key-table-id) should be set to 'mc-table-id' to identify the merlin contact segment in the customs table.
  • Context - the table identifier has been set to mc and a cargo record with manifest-to station name exists:
    For Set Sequence ID to Manifest-To Station Name:
    When setting up the search criteria for merlin contact, then the sequence id (gcstbrt-key-seqid) should be set to the manifest-to station name (gccc-manif-to-station-name) from the cargo record.
  • Context - the function code is 'gu', table id is 'mc', and sequence id is set to manifest-to station name:
    For Call GCCTBIO to Retrieve MC Segment:
    When the table i/o service is invoked, then the gcctbio program should be called with parameters: cccom, second-pcb-flag, unqual-ssa-flag, gcctbio-func-code, gcstbrt-lit, gcstbrt-key-value, gcstbdp-key-value, ws-table-segment, and gcctbio-return-flag to retrieve the mc segment.
  • Context - the gcctbio service has been called to retrieve the mc segment:
    For Move Retrieved Segment to MC Segment Structure, Extract Merlin Email ID from MC Segment:
    When the return flag (gcctbio-return-flag) equals '0' indicating successful retrieval, then the retrieved segment (ws-table-segment) should be moved to the mc segment structure (gcstbrt-mc-segment), making the merlin email id (gcstbrt-mc-merlin-id) available for use in notification routing.
    For Clear MC Segment Set to Spaces:
    When the return flag (gcctbio-return-flag) does not equal '0' indicating retrieval failure, then the mc segment structure (gcstbrt-mc-segment) should be cleared to spaces, indicating that no merlin email id is available for the manifest-to station.
👨‍💻 Technical ACs (Gherkin)
Context: A need to retrieve Merlin contact information from the customs table
GIVEN
A need to retrieve Merlin contact information from the customs table
Applied to: Initialize Function Code to GU, Clear Key Values and Flags
WHEN
The Merlin contact fetch process is initiated
THEN
The function code should be set to 'GU' (Get Unique), all key values (GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE) should be cleared to spaces, the return flag (GCCTBIO-RETURN-FLAG) should be cleared to spaces, the MC segment (GCSTBRT-MC-SEGMENT) should be cleared to spaces, and both SECOND-PCB-FLAG and UNQUAL-SSA-FLAG should be cleared to spaces
Context: The retrieval parameters have been initialized
GIVEN
The retrieval parameters have been initialized
Applied to: Set Table ID to MC Customs Table
WHEN
Preparing to fetch Merlin contact information
THEN
The table identifier (GCSTBRT-KEY-TABLE-ID) should be set to 'MC-TABLE-ID' to identify the Merlin contact segment in the customs table
Context: The table identifier has been set to MC and a cargo record with manifest-to station name exists
GIVEN
The table identifier has been set to MC and a cargo record with manifest-to station name exists
Applied to: Set Sequence ID to Manifest-To Station Name
WHEN
Setting up the search criteria for Merlin contact
THEN
The sequence ID (GCSTBRT-KEY-SEQID) should be set to the manifest-to station name (GCCC-MANIF-TO-STATION-NAME) from the cargo record
Context: The function code is 'GU', table ID is 'MC', and sequence ID is set to manifest-to station name
GIVEN
The function code is 'GU', table ID is 'MC', and sequence ID is set to manifest-to station name
Applied to: Call GCCTBIO to Retrieve MC Segment
WHEN
The table I/O service is invoked
THEN
The GCCTBIO program should be called with parameters: CCCOM, SECOND-PCB-FLAG, UNQUAL-SSA-FLAG, GCCTBIO-FUNC-CODE, GCSTBRT-LIT, GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE, WS-TABLE-SEGMENT, and GCCTBIO-RETURN-FLAG to retrieve the MC segment
Context: The GCCTBIO service has been called to retrieve the MC segment
GIVEN
The GCCTBIO service has been called to retrieve the MC segment
Applied to: Move Retrieved Segment to MC Segment Structure, Extract Merlin Email ID from MC Segment
WHEN
The return flag (GCCTBIO-RETURN-FLAG) equals '0' indicating successful retrieval
THEN
The retrieved segment (WS-TABLE-SEGMENT) should be moved to the MC segment structure (GCSTBRT-MC-SEGMENT), making the Merlin email ID (GCSTBRT-MC-MERLIN-ID) available for use in notification routing
Applied to: Clear MC Segment Set to Spaces
WHEN
The return flag (GCCTBIO-RETURN-FLAG) does not equal '0' indicating retrieval failure
THEN
The MC segment structure (GCSTBRT-MC-SEGMENT) should be cleared to spaces, indicating that no Merlin email ID is available for the manifest-to station
R-GCCUSIO-cbl-00456 (+13) File: GCCUSIO.cbl Check Hold Status Conditions Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Hold Status Conditions':
  • Context - a cargo record with rt11 uscargo status field:
    For Check RT11 USCARGO HOLD Status?:
    When the system checks if rt11 uscargo status equals hold, then the system identifies cargo as having general hold status requiring destination hold index processing.
  • Context - a cargo record with rt11 uscargo status field and no general hold status:
    For Check RT11 USCARGO HOLDPCS Status?:
    When the system checks if rt11 uscargo status equals holdpcs, then the system identifies cargo as having hold pcs status requiring destination hold index processing.
  • Context - a cargo record with rt11 uscargo status field and no hold or holdpcs status:
    For Check RT11 USCARGO PR-HPCS Status?:
    When the system checks if rt11 uscargo status equals pr-hpcs, then the system identifies cargo as having pre-release hold pcs status requiring destination hold index processing.
  • Context - a cargo record with rt11 uscargo status field and no destination hold statuses:
    For Check RT11 USCARGO HOLD-B Status?:
    When the system checks if rt11 uscargo status equals hold-b, then the system identifies cargo as having border hold status requiring border hold index processing.
  • Context - a cargo record with rt11 uscargo status field and no destination hold or hold-b statuses:
    For Check RT11 USCARGO PR-H-BO Status?:
    When the system checks if rt11 uscargo status equals pr-h-bo, then the system identifies cargo as having pre-release hold border status requiring border hold index processing.
  • Context - a cargo record with rt11 uscargo status field and no previous hold statuses:
    For Check RT11 USCARGO HOLD-D Status?:
    When the system checks if rt11 uscargo status equals hold-d, then the system identifies cargo as having destination hold status requiring destination hold index processing.
    For Check RT11 USCARGO PR-H-DE Status?:
    When the system checks if rt11 uscargo status equals pr-h-de, then the system identifies cargo as having pre-release hold destination status requiring destination hold index processing.
    For Check RT11 USCARGO HOLDFDA Status?:
    When the system checks if rt11 uscargo status equals holdfda, then the system identifies cargo as having fda hold status requiring destination hold index processing.
  • Context - a cargo record with destination-related hold status (hold, holdpcs, pr-hpcs, hold-d, pr-h-de, or holdfda):
    For Set Destination Hold Index:
    When the system processes the hold status, then the system sets gcb1-key-held-dest to cargo destination station number rt29-dest-stn-num and gcb1-key-held-dest-cargo to cargo ccn key.
  • Context - a cargo record with border-related hold status (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, or holdfda):
    For Set Border Hold Index:
    When the system processes the hold status, then the system retrieves station information for the border location and sets gcb1-key-held-border to the border station number and gcb1-key-held-border-cargo to cargo ccn key.
  • Context - a cargo record requiring border hold index processing:
    For Retrieve Station Information for Border:
    When the system needs to set border hold index, then the system calls table lookup function to retrieve mc table segment using cargo location id and extracts station number for border hold index.
  • Context - a cargo record with hold status and populated hold index fields:
    For Update GCSB1RT Index Record:
    When the system processes hold status, then the system checks if gcsb1rt record exists and either updates existing record or inserts new record with hold index information.
  • Context - a cargo record with no hold status conditions:
    For Clear Hold Index Fields:
    When the system processes cargo status update, then the system clears gcb1-held-dest-index and gcb1-held-border-index fields to spaces.
  • Context - a gcsb1rt record exists for cargo with cleared hold indexes:
    For Delete GCSB1RT if No Other Indexes:
    When the cargo has no error index fields populated (error-dest, error-orig, error-border are all spaces), then the system deletes the gcsb1rt index record completely.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with RT11 USCARGO status field
GIVEN
A cargo record with RT11 USCARGO status field
Applied to: Check RT11 USCARGO HOLD Status?
WHEN
The system checks if RT11 USCARGO status equals HOLD
THEN
The system identifies cargo as having general hold status requiring destination hold index processing
Context: A cargo record with RT11 USCARGO status field and no general HOLD status
GIVEN
A cargo record with RT11 USCARGO status field and no general HOLD status
Applied to: Check RT11 USCARGO HOLDPCS Status?
WHEN
The system checks if RT11 USCARGO status equals HOLDPCS
THEN
The system identifies cargo as having hold PCS status requiring destination hold index processing
Context: A cargo record with RT11 USCARGO status field and no HOLD or HOLDPCS status
GIVEN
A cargo record with RT11 USCARGO status field and no HOLD or HOLDPCS status
Applied to: Check RT11 USCARGO PR-HPCS Status?
WHEN
The system checks if RT11 USCARGO status equals PR-HPCS
THEN
The system identifies cargo as having pre-release hold PCS status requiring destination hold index processing
Context: A cargo record with RT11 USCARGO status field and no destination hold statuses
GIVEN
A cargo record with RT11 USCARGO status field and no destination hold statuses
Applied to: Check RT11 USCARGO HOLD-B Status?
WHEN
The system checks if RT11 USCARGO status equals HOLD-B
THEN
The system identifies cargo as having border hold status requiring border hold index processing
Context: A cargo record with RT11 USCARGO status field and no destination hold or HOLD-B statuses
GIVEN
A cargo record with RT11 USCARGO status field and no destination hold or HOLD-B statuses
Applied to: Check RT11 USCARGO PR-H-BO Status?
WHEN
The system checks if RT11 USCARGO status equals PR-H-BO
THEN
The system identifies cargo as having pre-release hold border status requiring border hold index processing
Context: A cargo record with RT11 USCARGO status field and no previous hold statuses
GIVEN
A cargo record with RT11 USCARGO status field and no previous hold statuses
Applied to: Check RT11 USCARGO HOLD-D Status?
WHEN
The system checks if RT11 USCARGO status equals HOLD-D
THEN
The system identifies cargo as having destination hold status requiring destination hold index processing
Applied to: Check RT11 USCARGO PR-H-DE Status?
WHEN
The system checks if RT11 USCARGO status equals PR-H-DE
THEN
The system identifies cargo as having pre-release hold destination status requiring destination hold index processing
Applied to: Check RT11 USCARGO HOLDFDA Status?
WHEN
The system checks if RT11 USCARGO status equals HOLDFDA
THEN
The system identifies cargo as having FDA hold status requiring destination hold index processing
Context: A cargo record with destination-related hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA)
GIVEN
A cargo record with destination-related hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA)
Applied to: Set Destination Hold Index
WHEN
The system processes the hold status
THEN
The system sets GCB1-KEY-HELD-DEST to cargo destination station number RT29-DEST-STN-NUM and GCB1-KEY-HELD-DEST-CARGO to cargo CCN key
Context: A cargo record with border-related hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA)
GIVEN
A cargo record with border-related hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA)
Applied to: Set Border Hold Index
WHEN
The system processes the hold status
THEN
The system retrieves station information for the border location and sets GCB1-KEY-HELD-BORDER to the border station number and GCB1-KEY-HELD-BORDER-CARGO to cargo CCN key
Context: A cargo record requiring border hold index processing
GIVEN
A cargo record requiring border hold index processing
Applied to: Retrieve Station Information for Border
WHEN
The system needs to set border hold index
THEN
The system calls table lookup function to retrieve MC table segment using cargo location ID and extracts station number for border hold index
Context: A cargo record with hold status and populated hold index fields
GIVEN
A cargo record with hold status and populated hold index fields
Applied to: Update GCSB1RT Index Record
WHEN
The system processes hold status
THEN
The system checks if GCSB1RT record exists and either updates existing record or inserts new record with hold index information
Context: A cargo record with no hold status conditions
GIVEN
A cargo record with no hold status conditions
Applied to: Clear Hold Index Fields
WHEN
The system processes cargo status update
THEN
The system clears GCB1-HELD-DEST-INDEX and GCB1-HELD-BORDER-INDEX fields to spaces
Context: A GCSB1RT record exists for cargo with cleared hold indexes
GIVEN
A GCSB1RT record exists for cargo with cleared hold indexes
Applied to: Delete GCSB1RT if No Other Indexes
WHEN
The cargo has no error index fields populated (error-dest, error-orig, error-border are all spaces)
THEN
The system deletes the GCSB1RT index record completely
R-GCX126-cbl-00456 (+11) File: GCX126R.cbl Log Cargo Information Message Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Cargo Information Message':
  • Context - a request to log cargo information message is received:
    For Prepare Log Information Structure:
    When the log information structure is being prepared, then the log input structure should be cleared to spaces, security byte should be set to high-value, sending transaction should be set to 'gct1261e', and acf2 user id should be populated from the common control area.
  • Context - the log information structure has been initialized with security and transaction details:
    For Format Date and Time:
    When date and time formatting is performed, then the log date should be formatted by concatenating machine century and machine date, and the log time should be set to the machine time.
  • Context - date and time have been formatted for the log entry:
    For Set CCN/Train ID:
    When the cargo or train identifier is being set, then the current ccn key should be moved to the train or us ccn field in the log structure.
  • Context - the ccn or train identifier has been set in the log structure:
    For Set Cargo Type - CA Cargo or US Cargo:
    When the cargo type is being determined, then the cargo type indicator should be set to ca-cargo to indicate this is a canadian cargo record.
  • Context - the cargo type has been identified as canadian cargo:
    For Set Action Code to LOG-USE-INPUT-MESSAGE:
    When the action code is being assigned, then the action code should be set to log-use-input-message to indicate this is an input message log.
  • Context - the action code has been set to log-use-input-message:
    For Set Message Text:
    When the message text is being populated, then the information message content should be moved to the log message field.
  • Context - the message text has been populated in the log structure:
    For Message Text Empty?:
    When message text validation is performed, then if the message text is spaces or low-values, exit without creating a log entry; otherwise, proceed with log creation.
  • Context - the message text validation has passed and message is not empty:
    For Replace Spaces with Zeroes in Date, Replace Spaces with '1' in Time:
    When date and time normalization is performed, then all spaces in the date field should be replaced with zeroes, and all spaces in the time field should be replaced with '1'.
  • Context - date and time values have been normalized:
    For Move Log Input to GCT1051E Message:
    When the log data is being transferred to the message structure, then the complete log input structure should be moved to the gct1051e message field.
  • Context - the log data has been transferred to the gct1051e message structure:
    For Change Alternate PCB Status:
    When the alternate pcb status is being changed, then the cims program should be called with chng function for the alternate pcb using the gct1051e message.
  • Context - the alternate pcb status has been changed successfully:
    For Call WRITMSGL to Write Message:
    When the message writing is invoked, then the writmsgl program should be called with the common control area, alternate pcb, message code, message text, message length, and module name parameters.
  • Context - the log message has been written using writmsgl:
    For Purge Alternate PCB:
    When the alternate pcb is being purged, then the cims program should be called with purg function for the alternate pcb to complete the logging transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A request to log cargo information message is received
GIVEN
A request to log cargo information message is received
Applied to: Prepare Log Information Structure
WHEN
The log information structure is being prepared
THEN
The log input structure should be cleared to spaces, security byte should be set to HIGH-VALUE, sending transaction should be set to 'GCT1261E', and ACF2 user ID should be populated from the common control area
Context: The log information structure has been initialized with security and transaction details
GIVEN
The log information structure has been initialized with security and transaction details
Applied to: Format Date and Time
WHEN
Date and time formatting is performed
THEN
The log date should be formatted by concatenating machine century and machine date, and the log time should be set to the machine time
Context: Date and time have been formatted for the log entry
GIVEN
Date and time have been formatted for the log entry
Applied to: Set CCN/Train ID
WHEN
The cargo or train identifier is being set
THEN
The current CCN key should be moved to the train or US CCN field in the log structure
Context: The CCN or train identifier has been set in the log structure
GIVEN
The CCN or train identifier has been set in the log structure
Applied to: Set Cargo Type - CA Cargo or US Cargo
WHEN
The cargo type is being determined
THEN
The cargo type indicator should be set to CA-CARGO to indicate this is a Canadian cargo record
Context: The cargo type has been identified as Canadian cargo
GIVEN
The cargo type has been identified as Canadian cargo
Applied to: Set Action Code to LOG-USE-INPUT-MESSAGE
WHEN
The action code is being assigned
THEN
The action code should be set to LOG-USE-INPUT-MESSAGE to indicate this is an input message log
Context: The action code has been set to LOG-USE-INPUT-MESSAGE
GIVEN
The action code has been set to LOG-USE-INPUT-MESSAGE
Applied to: Set Message Text
WHEN
The message text is being populated
THEN
The information message content should be moved to the log message field
Context: The message text has been populated in the log structure
GIVEN
The message text has been populated in the log structure
Applied to: Message Text Empty?
WHEN
Message text validation is performed
THEN
If the message text is spaces or low-values, exit without creating a log entry; otherwise, proceed with log creation
Context: The message text validation has passed and message is not empty
GIVEN
The message text validation has passed and message is not empty
Applied to: Replace Spaces with Zeroes in Date, Replace Spaces with '1' in Time
WHEN
Date and time normalization is performed
THEN
All spaces in the date field should be replaced with zeroes, and all spaces in the time field should be replaced with '1'
Context: Date and time values have been normalized
GIVEN
Date and time values have been normalized
Applied to: Move Log Input to GCT1051E Message
WHEN
The log data is being transferred to the message structure
THEN
The complete log input structure should be moved to the GCT1051E message field
Context: The log data has been transferred to the GCT1051E message structure
GIVEN
The log data has been transferred to the GCT1051E message structure
Applied to: Change Alternate PCB Status
WHEN
The alternate PCB status is being changed
THEN
The CIMS program should be called with CHNG function for the alternate PCB using the GCT1051E message
Context: The alternate PCB status has been changed successfully
GIVEN
The alternate PCB status has been changed successfully
Applied to: Call WRITMSGL to Write Message
WHEN
The message writing is invoked
THEN
The WRITMSGL program should be called with the common control area, alternate PCB, message code, message text, message length, and module name parameters
Context: The log message has been written using WRITMSGL
GIVEN
The log message has been written using WRITMSGL
Applied to: Purge Alternate PCB
WHEN
The alternate PCB is being purged
THEN
The CIMS program should be called with PURG function for the alternate PCB to complete the logging transaction
R-GCX126-cbl-00468 (+3) File: GCX126R.cbl Update Cargo Record Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Cargo Record':
  • Context - a cargo record has been retrieved and modified with updated customs status, release information, or other edi 350 message data:
    For Update Cargo Record - Replace cargo record in database with updated information:
    When the system needs to persist the changes to the cargo database, then the system clears the status code, sets the accept status to blank, and replaces the cargo record in the gcsccrt cargo database using the ims repl function.
  • Context - a cargo record is ready to be updated in the database:
    For Clear Status Code:
    When the update process is initiated, then the system sets the status code field to spaces to clear any previous status information.
  • Context - the status code has been cleared and the cargo record is ready for update:
    For Set Accept Status to Blank:
    When the system prepares to call the ims replace function, then the system sets the accept status field to two blank spaces.
  • Context - the status code is cleared, accept status is set to blank, and the cargo record contains all updated information:
    For Call IMS REPL Function:
    When the system calls the ims cims program with the repl function, then the system passes the common communication area, repl function code, cargo pcb, and the cargo report segment to update the gcsccrt cargo database record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been retrieved and modified with updated customs status, release information, or other EDI 350 message data
GIVEN
A cargo record has been retrieved and modified with updated customs status, release information, or other EDI 350 message data
Applied to: Update Cargo Record - Replace cargo record in database with updated information
WHEN
The system needs to persist the changes to the cargo database
THEN
The system clears the status code, sets the accept status to blank, and replaces the cargo record in the GCSCCRT cargo database using the IMS REPL function
Context: A cargo record is ready to be updated in the database
GIVEN
A cargo record is ready to be updated in the database
Applied to: Clear Status Code
WHEN
The update process is initiated
THEN
The system sets the status code field to spaces to clear any previous status information
Context: The status code has been cleared and the cargo record is ready for update
GIVEN
The status code has been cleared and the cargo record is ready for update
Applied to: Set Accept Status to Blank
WHEN
The system prepares to call the IMS replace function
THEN
The system sets the accept status field to two blank spaces
Context: The status code is cleared, accept status is set to blank, and the cargo record contains all updated information
GIVEN
The status code is cleared, accept status is set to blank, and the cargo record contains all updated information
Applied to: Call IMS REPL Function
WHEN
The system calls the IMS CIMS program with the REPL function
THEN
The system passes the common communication area, REPL function code, cargo PCB, and the cargo report segment to update the GCSCCRT cargo database record
R-GCCUSIO-cbl-00470 (+11) File: GCCUSIO.cbl Update Error Index Entries Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Error Index Entries':
  • Context - a cargo record is being processed for index updates:
    For Cargo Has Error Status?:
    When the system checks for cp cargo error status or cp cargo pending status or us cargo error status, then the cargo is classified as having error status if any of these conditions are true.
  • Context - a cargo record requires error index processing:
    For Retrieve Existing Error Index Record:
    When the system searches for existing gcsb1rt error index record using cargo ccn key, then the system retrieves the record if it exists and sets appropriate status flag.
  • Context - cargo has error status and error index record is being processed:
    For Populate Error Origin Station & Populate Error Destination Station:
    When the system fills error fields for the index record, then error code 'e' is set, origin station number is populated from cargo record, and cargo ccn is set as error origin cargo key and error code 'e' is set, destination station number is populated from cargo record, and cargo ccn is set as error destination cargo key.
  • Context - cargo has error status and error index record needs border station information:
    For Get Border Station from MC Table:
    When the system looks up mc table using cargo location id, then if table lookup is successful, the border station number is retrieved from the table segment.
  • Context - cargo has error status and border station information is available from mc table lookup:
    For Populate Error Border Station:
    When the system fills error border fields for the index record, then error code 'e' is set, border station number is populated from mc table result, and cargo ccn is set as error border cargo key.
  • Context - cargo has error status and no existing error index record is found:
    For Create New Error Index Record:
    When the system needs to create error index entry, then a new gcsb1rt record is inserted with cargo ccn as key and populated error fields.
  • Context - cargo has error status and existing error index record is found:
    For Update Existing Error Index Record:
    When the system needs to update error index entry, then the existing gcsb1rt record is updated with current error field information.
  • Context - cargo no longer has error status but has existing error index record:
    For Clear Error Index Fields:
    When the system processes index cleanup for non-error cargo, then error origin index, error destination index, and error border index fields are set to spaces.
  • Context - error fields have been cleared from index record:
    For Any Other Index Entries Remain?:
    When the system checks if held destination index and held border index are both empty, then if both held indexes are empty, the record should be deleted; otherwise, the record should be kept.
  • Context - error fields have been cleared and no other index entries remain in the record:
    For Delete Error Index Record:
    When the system determines the index record is no longer needed, then the gcsb1rt error index record is deleted from the database.
  • Context - error fields have been cleared but other index entries still remain in the record:
    For Keep Error Index Record:
    When the system determines the index record is still needed for other purposes, then the gcsb1rt error index record is updated and retained in the database.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index updates
GIVEN
A cargo record is being processed for index updates
Applied to: Cargo Has Error Status?
WHEN
The system checks for CP cargo error status OR CP cargo pending status OR US cargo error status
THEN
The cargo is classified as having error status if any of these conditions are true
Context: A cargo record requires error index processing
GIVEN
A cargo record requires error index processing
Applied to: Retrieve Existing Error Index Record
WHEN
The system searches for existing GCSB1RT error index record using cargo CCN key
THEN
The system retrieves the record if it exists and sets appropriate status flag
Context: Cargo has error status and error index record is being processed
GIVEN
Cargo has error status and error index record is being processed
Applied to: Populate Error Origin Station & Populate Error Destination Station
WHEN
The system fills error fields for the index record
THEN
Error code 'E' is set, origin station number is populated from cargo record, and cargo CCN is set as error origin cargo key AND Error code 'E' is set, destination station number is populated from cargo record, and cargo CCN is set as error destination cargo key
Context: Cargo has error status and error index record needs border station information
GIVEN
Cargo has error status and error index record needs border station information
Applied to: Get Border Station from MC Table
WHEN
The system looks up MC table using cargo location ID
THEN
If table lookup is successful, the border station number is retrieved from the table segment
Context: Cargo has error status and border station information is available from MC table lookup
GIVEN
Cargo has error status and border station information is available from MC table lookup
Applied to: Populate Error Border Station
WHEN
The system fills error border fields for the index record
THEN
Error code 'E' is set, border station number is populated from MC table result, and cargo CCN is set as error border cargo key
Context: Cargo has error status and no existing error index record is found
GIVEN
Cargo has error status and no existing error index record is found
Applied to: Create New Error Index Record
WHEN
The system needs to create error index entry
THEN
A new GCSB1RT record is inserted with cargo CCN as key and populated error fields
Context: Cargo has error status and existing error index record is found
GIVEN
Cargo has error status and existing error index record is found
Applied to: Update Existing Error Index Record
WHEN
The system needs to update error index entry
THEN
The existing GCSB1RT record is updated with current error field information
Context: Cargo no longer has error status but has existing error index record
GIVEN
Cargo no longer has error status but has existing error index record
Applied to: Clear Error Index Fields
WHEN
The system processes index cleanup for non-error cargo
THEN
Error origin index, error destination index, and error border index fields are set to spaces
Context: Error fields have been cleared from index record
GIVEN
Error fields have been cleared from index record
Applied to: Any Other Index Entries Remain?
WHEN
The system checks if held destination index and held border index are both empty
THEN
If both held indexes are empty, the record should be deleted; otherwise, the record should be kept
Context: Error fields have been cleared and no other index entries remain in the record
GIVEN
Error fields have been cleared and no other index entries remain in the record
Applied to: Delete Error Index Record
WHEN
The system determines the index record is no longer needed
THEN
The GCSB1RT error index record is deleted from the database
Context: Error fields have been cleared but other index entries still remain in the record
GIVEN
Error fields have been cleared but other index entries still remain in the record
Applied to: Keep Error Index Record
WHEN
The system determines the index record is still needed for other purposes
THEN
The GCSB1RT error index record is updated and retained in the database
R-GCX126-cbl-00472 (+13) File: GCX126R.cbl Retrieve US Cargo by Car and Waybill Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve US Cargo by Car and Waybill':
  • Context - a current cargo record with equipment car identification and a saved waybill index value:
    For Set Car ID from Current Cargo, Set Waybill Index from Saved Value, Set US CCN to Low Values:
    When preparing to search for associated us cargo records, then the car id index is set to the current cargo's equipment car key, the waybill index is set to the saved waybill index value, and the us ccn key index is initialized to low values for the search operation.
  • Context - search parameters are set with car id index, waybill index, and us ccn key initialized to low values:
    For Initialize Search with >= Operator, Retrieve First US Cargo Record:
    When initiating the us cargo search using the car-waybill index with greater-than-or-equal-to operator, then the system retrieves the first us cargo record from gcsusrt table matching or exceeding the search criteria.
  • Context - an initial retrieval attempt for us cargo by car and waybill has been executed:
    For Record Found? - Not Found, Set End of File Flag:
    When the database returns a status indicating no record was found, then the end-of-file flag is set to true indicating no matching us cargo exists.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID Matches Current Cargo?:
    When comparing the first 12 characters of the retrieved us cargo's car id index with the current cargo's equipment car key, then if the car ids match, continue validation; if they do not match, set the end-of-file flag to terminate the search.
  • Context - a us cargo record has been retrieved and the car id has been validated as matching:
    For Waybill Matches Saved Index?:
    When comparing the retrieved us cargo's waybill number index with the saved waybill index value, then if the waybill numbers match, proceed to check cargo status; if they do not match, set the end-of-file flag to terminate the search.
  • Context - a us cargo record has been retrieved with matching car id and waybill number:
    For Cargo Deleted or TR Created?:
    When evaluating the cargo's deletion status indicator and the train-created-for-it flag, then if the cargo is marked as deleted or the train-created-for-it flag equals 'y', skip this record and continue searching; if both conditions are false, mark the us manifest as found.
  • Context - a us cargo record has been retrieved with matching car id and waybill, and the cargo is not deleted and has no train record created:
    For Mark US Manifest Found:
    When all validation checks pass successfully, then the us manifest found flag is set to true and the search process completes successfully.
  • Context - the current us cargo record was skipped due to deletion or train creation status, and the search should continue:
    For Get Next US Cargo Record:
    When executing a get-next operation using the car-waybill index with greater-than operator, then the system retrieves the next us cargo record in sequence from the gcsusrt table.
  • Context - a get-next retrieval attempt for us cargo by car and waybill has been executed:
    For Record Found? - Not Found (from Get Next), Set End of File Flag:
    When the database returns a status indicating no more records exist, then the end-of-file flag is set to true indicating the search is complete with no valid us cargo found.
  • Context - a subsequent us cargo record has been successfully retrieved from the database:
    For Car ID Matches Current Cargo? (from Get Next):
    When comparing the first 12 characters of the retrieved us cargo's car id index with the current cargo's equipment car key, then if the car ids match, continue validation; if they do not match, set the end-of-file flag to terminate the search.
  • Context - a subsequent us cargo record has been retrieved and the car id has been validated as matching:
    For Waybill Matches Saved Index? (from Get Next):
    When comparing the retrieved us cargo's waybill number index with the saved waybill index value, then if the waybill numbers match, proceed to check cargo status; if they do not match, set the end-of-file flag to terminate the search.
  • Context - a subsequent us cargo record has been retrieved with matching car id and waybill number:
    For Cargo Deleted or TR Created? (from Get Next):
    When evaluating the cargo's deletion status indicator and the train-created-for-it flag, then if the cargo is marked as deleted or the train-created-for-it flag equals 'y', continue the search loop; if both conditions are false, mark the us manifest as found.
  • Context - a subsequent us cargo record has been retrieved with matching car id and waybill, and the cargo is not deleted and has no train record created:
    For Mark US Manifest Found (from Get Next):
    When all validation checks pass successfully on the subsequent record, then the us manifest found flag is set to true and the search process completes successfully.
  • Context - a us cargo record has been processed and either found valid or skipped:
    For Continue Search?:
    When the us manifest found flag is false and the end-of-file flag is false, then continue the search loop to retrieve the next us cargo record; otherwise, exit the search process.
👨‍💻 Technical ACs (Gherkin)
Context: A current cargo record with equipment car identification and a saved waybill index value
GIVEN
A current cargo record with equipment car identification and a saved waybill index value
Applied to: Set Car ID from Current Cargo, Set Waybill Index from Saved Value, Set US CCN to Low Values
WHEN
Preparing to search for associated US cargo records
THEN
The car ID index is set to the current cargo's equipment car key, the waybill index is set to the saved waybill index value, and the US CCN key index is initialized to low values for the search operation
Context: Search parameters are set with car ID index, waybill index, and US CCN key initialized to low values
GIVEN
Search parameters are set with car ID index, waybill index, and US CCN key initialized to low values
Applied to: Initialize Search with >= Operator, Retrieve First US Cargo Record
WHEN
Initiating the US cargo search using the car-waybill index with greater-than-or-equal-to operator
THEN
The system retrieves the first US cargo record from GCSUSRT table matching or exceeding the search criteria
Context: An initial retrieval attempt for US cargo by car and waybill has been executed
GIVEN
An initial retrieval attempt for US cargo by car and waybill has been executed
Applied to: Record Found? - Not Found, Set End of File Flag
WHEN
The database returns a status indicating no record was found
THEN
The end-of-file flag is set to true indicating no matching US cargo exists
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID Matches Current Cargo?
WHEN
Comparing the first 12 characters of the retrieved US cargo's car ID index with the current cargo's equipment car key
THEN
If the car IDs match, continue validation; if they do not match, set the end-of-file flag to terminate the search
Context: A US cargo record has been retrieved and the car ID has been validated as matching
GIVEN
A US cargo record has been retrieved and the car ID has been validated as matching
Applied to: Waybill Matches Saved Index?
WHEN
Comparing the retrieved US cargo's waybill number index with the saved waybill index value
THEN
If the waybill numbers match, proceed to check cargo status; if they do not match, set the end-of-file flag to terminate the search
Context: A US cargo record has been retrieved with matching car ID and waybill number
GIVEN
A US cargo record has been retrieved with matching car ID and waybill number
Applied to: Cargo Deleted or TR Created?
WHEN
Evaluating the cargo's deletion status indicator and the train-created-for-it flag
THEN
If the cargo is marked as deleted OR the train-created-for-it flag equals 'Y', skip this record and continue searching; if both conditions are false, mark the US manifest as found
Context: A US cargo record has been retrieved with matching car ID and waybill, and the cargo is not deleted and has no train record created
GIVEN
A US cargo record has been retrieved with matching car ID and waybill, and the cargo is not deleted and has no train record created
Applied to: Mark US Manifest Found
WHEN
All validation checks pass successfully
THEN
The US manifest found flag is set to true and the search process completes successfully
Context: The current US cargo record was skipped due to deletion or train creation status, and the search should continue
GIVEN
The current US cargo record was skipped due to deletion or train creation status, and the search should continue
Applied to: Get Next US Cargo Record
WHEN
Executing a get-next operation using the car-waybill index with greater-than operator
THEN
The system retrieves the next US cargo record in sequence from the GCSUSRT table
Context: A get-next retrieval attempt for US cargo by car and waybill has been executed
GIVEN
A get-next retrieval attempt for US cargo by car and waybill has been executed
Applied to: Record Found? - Not Found (from Get Next), Set End of File Flag
WHEN
The database returns a status indicating no more records exist
THEN
The end-of-file flag is set to true indicating the search is complete with no valid US cargo found
Context: A subsequent US cargo record has been successfully retrieved from the database
GIVEN
A subsequent US cargo record has been successfully retrieved from the database
Applied to: Car ID Matches Current Cargo? (from Get Next)
WHEN
Comparing the first 12 characters of the retrieved US cargo's car ID index with the current cargo's equipment car key
THEN
If the car IDs match, continue validation; if they do not match, set the end-of-file flag to terminate the search
Context: A subsequent US cargo record has been retrieved and the car ID has been validated as matching
GIVEN
A subsequent US cargo record has been retrieved and the car ID has been validated as matching
Applied to: Waybill Matches Saved Index? (from Get Next)
WHEN
Comparing the retrieved US cargo's waybill number index with the saved waybill index value
THEN
If the waybill numbers match, proceed to check cargo status; if they do not match, set the end-of-file flag to terminate the search
Context: A subsequent US cargo record has been retrieved with matching car ID and waybill number
GIVEN
A subsequent US cargo record has been retrieved with matching car ID and waybill number
Applied to: Cargo Deleted or TR Created? (from Get Next)
WHEN
Evaluating the cargo's deletion status indicator and the train-created-for-it flag
THEN
If the cargo is marked as deleted OR the train-created-for-it flag equals 'Y', continue the search loop; if both conditions are false, mark the US manifest as found
Context: A subsequent US cargo record has been retrieved with matching car ID and waybill, and the cargo is not deleted and has no train record created
GIVEN
A subsequent US cargo record has been retrieved with matching car ID and waybill, and the cargo is not deleted and has no train record created
Applied to: Mark US Manifest Found (from Get Next)
WHEN
All validation checks pass successfully on the subsequent record
THEN
The US manifest found flag is set to true and the search process completes successfully
Context: A US cargo record has been processed and either found valid or skipped
GIVEN
A US cargo record has been processed and either found valid or skipped
Applied to: Continue Search?
WHEN
The US manifest found flag is false AND the end-of-file flag is false
THEN
Continue the search loop to retrieve the next US cargo record; otherwise, exit the search process
R-GCCUSIO-cbl-00482 (+8) File: GCCUSIO.cbl Update Hold Index Entries Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Hold Index Entries':
  • Context - a cargo record with various status flags:
    For Check Cargo Hold Status:
    When the system checks for any active hold conditions including uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-b, uscargo-pr-h-bo, uscargo-hold-d, uscargo-pr-h-de, or uscargo-holdfda, then the system proceeds with hold index processing if any hold condition is active, otherwise skips hold processing.
  • Context - a cargo record with active hold status:
    For Set Destination Hold Index Fields:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda status, then the system sets the destination station number to held destination index and cargo ccn key to held destination cargo index.
  • Context - a cargo record with border hold status and successful mc table lookup:
    For Set Border Hold Index Fields:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-b or uscargo-pr-h-bo or uscargo-holdfda status and mc table lookup returns successfully, then the system sets the mc station number to held border index and cargo ccn key to held border cargo index.
  • Context - a cargo record requiring border hold index processing:
    For Lookup Border Station from MC Table:
    When the system needs to determine border station number for hold indexing, then the system calls table lookup service with mc table id and cargo location id to retrieve station number.
  • Context - a cargo record with hold conditions and no existing gcsb1rt index record:
    For Create New GCSB1RT Index Record:
    When the system attempts to retrieve gcsb1rt record and receives not found status, then the system creates a new gcsb1rt record with cargo ccn as the key and populated hold index fields.
  • Context - a cargo record with hold conditions and an existing gcsb1rt index record:
    For Update Existing GCSB1RT Index Record:
    When the system successfully retrieves an existing gcsb1rt record, then the system updates the existing record with current hold index field values.
  • Context - a cargo record that previously had hold conditions:
    For Clear Hold Index Fields:
    When the cargo no longer has any of the hold status conditions (uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-b, uscargo-pr-h-bo, uscargo-hold-d, uscargo-pr-h-de, uscargo-holdfda), then the system clears the held destination index and held border index fields.
  • Context - a gcsb1rt index record with cleared hold fields:
    For Delete GCSB1RT Index Record:
    When the error destination index, error origin index, and error border index are all empty, then the system deletes the entire gcsb1rt index record.
  • Context - a gcsb1rt index record with cleared hold fields and existing error index entries:
    For Update GCSB1RT with Cleared Hold Fields:
    When at least one of the error destination index, error origin index, or error border index contains data, then the system updates the gcsb1rt record with cleared hold fields while preserving error index entries.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with various status flags
GIVEN
A cargo record with various status flags
Applied to: Check Cargo Hold Status
WHEN
The system checks for any active hold conditions including USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, USCARGO-HOLD-D, USCARGO-PR-H-DE, or USCARGO-HOLDFDA
THEN
The system proceeds with hold index processing if any hold condition is active, otherwise skips hold processing
Context: A cargo record with active hold status
GIVEN
A cargo record with active hold status
Applied to: Set Destination Hold Index Fields
WHEN
The cargo has USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-D or USCARGO-PR-H-DE or USCARGO-HOLDFDA status
THEN
The system sets the destination station number to held destination index and cargo CCN key to held destination cargo index
Context: A cargo record with border hold status and successful MC table lookup
GIVEN
A cargo record with border hold status and successful MC table lookup
Applied to: Set Border Hold Index Fields
WHEN
The cargo has USCARGO-HOLD or USCARGO-HOLDPCS or USCARGO-PR-HPCS or USCARGO-HOLD-B or USCARGO-PR-H-BO or USCARGO-HOLDFDA status and MC table lookup returns successfully
THEN
The system sets the MC station number to held border index and cargo CCN key to held border cargo index
Context: A cargo record requiring border hold index processing
GIVEN
A cargo record requiring border hold index processing
Applied to: Lookup Border Station from MC Table
WHEN
The system needs to determine border station number for hold indexing
THEN
The system calls table lookup service with MC table ID and cargo location ID to retrieve station number
Context: A cargo record with hold conditions and no existing GCSB1RT index record
GIVEN
A cargo record with hold conditions and no existing GCSB1RT index record
Applied to: Create New GCSB1RT Index Record
WHEN
The system attempts to retrieve GCSB1RT record and receives not found status
THEN
The system creates a new GCSB1RT record with cargo CCN as the key and populated hold index fields
Context: A cargo record with hold conditions and an existing GCSB1RT index record
GIVEN
A cargo record with hold conditions and an existing GCSB1RT index record
Applied to: Update Existing GCSB1RT Index Record
WHEN
The system successfully retrieves an existing GCSB1RT record
THEN
The system updates the existing record with current hold index field values
Context: A cargo record that previously had hold conditions
GIVEN
A cargo record that previously had hold conditions
Applied to: Clear Hold Index Fields
WHEN
The cargo no longer has any of the hold status conditions (USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, USCARGO-HOLD-D, USCARGO-PR-H-DE, USCARGO-HOLDFDA)
THEN
The system clears the held destination index and held border index fields
Context: A GCSB1RT index record with cleared hold fields
GIVEN
A GCSB1RT index record with cleared hold fields
Applied to: Delete GCSB1RT Index Record
WHEN
The error destination index, error origin index, and error border index are all empty
THEN
The system deletes the entire GCSB1RT index record
Context: A GCSB1RT index record with cleared hold fields and existing error index entries
GIVEN
A GCSB1RT index record with cleared hold fields and existing error index entries
Applied to: Update GCSB1RT with Cleared Hold Fields
WHEN
At least one of the error destination index, error origin index, or error border index contains data
THEN
The system updates the GCSB1RT record with cleared hold fields while preserving error index entries
R-GCX126-cbl-00486 (+7) File: GCX126R.cbl Set Cargo Status Flags Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Cargo Status Flags':
  • Context - the cargo status evaluation process is starting:
    For Initialize All Cargo Status Flags to Space:
    When the system begins to set cargo status flags, then all four cargo status switches (ws-switch1-cargo, ws-switch2-cargo, ws-switch3-cargo, ws-switch4-cargo) are set to space.
  • Context - a cargo database query has been executed:
    For Set Flag: Cargo Not Found:
    When the database status code is not equal to spaces, then the cargo not found flag (ws-cargo-not-found) is set to true.
    For Set Flag: Cargo Found:
    When the database status code equals spaces, then the cargo found flag (ws-cargo-found) is set to true.
  • Context - cargo record has been found in the database and a saved waybill index exists (not blank):
    For Set Flag: Cargo Not Waybill Match:
    When the cargo waybill key for index does not equal the saved waybill index, then the cargo not waybill match flag (ws-cargo-not-wb) is set to true.
  • Context - cargo record has been found in the database and waybill validation has passed (or no waybill index was provided):
    For Set Flag: Cargo Deleted:
    When the cargo delete status field equals 'd', then the cargo deleted flag (ws-cargo-deleted) is set to true.
  • Context - cargo record has been found in the database and is not deleted and waybill validation has passed:
    For Set Flag: Cargo Returned:
    When the cargo status return indicator (gccc-status-return) is true, then the cargo returned flag (ws-cargo-returned) is set to true.
    For Set Flag: Cargo Released:
    When the cargo release status field equals 'r', then the cargo released flag (ws-cargo-released) is set to true.
    For Set Flag: Cargo On A Train:
    When the cargo train id field (gccc-cp-train-id) is not equal to spaces, then the cargo on a train flag (ws-cargo-on-a-train) is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: The cargo status evaluation process is starting
GIVEN
The cargo status evaluation process is starting
Applied to: Initialize All Cargo Status Flags to Space
WHEN
The system begins to set cargo status flags
THEN
All four cargo status switches (WS-SWITCH1-CARGO, WS-SWITCH2-CARGO, WS-SWITCH3-CARGO, WS-SWITCH4-CARGO) are set to SPACE
Context: A cargo database query has been executed
GIVEN
A cargo database query has been executed
Applied to: Set Flag: Cargo Not Found
WHEN
The database status code is not equal to SPACES
THEN
The cargo not found flag (WS-CARGO-NOT-FOUND) is set to TRUE
Applied to: Set Flag: Cargo Found
WHEN
The database status code equals SPACES
THEN
The cargo found flag (WS-CARGO-FOUND) is set to TRUE
Context: Cargo record has been found in the database AND a saved waybill index exists (not blank)
GIVEN
Cargo record has been found in the database AND a saved waybill index exists (not blank)
Applied to: Set Flag: Cargo Not Waybill Match
WHEN
The cargo waybill key for index does not equal the saved waybill index
THEN
The cargo not waybill match flag (WS-CARGO-NOT-WB) is set to TRUE
Context: Cargo record has been found in the database AND waybill validation has passed (or no waybill index was provided)
GIVEN
Cargo record has been found in the database AND waybill validation has passed (or no waybill index was provided)
Applied to: Set Flag: Cargo Deleted
WHEN
The cargo delete status field equals 'D'
THEN
The cargo deleted flag (WS-CARGO-DELETED) is set to TRUE
Context: Cargo record has been found in the database AND is not deleted AND waybill validation has passed
GIVEN
Cargo record has been found in the database AND is not deleted AND waybill validation has passed
Applied to: Set Flag: Cargo Returned
WHEN
The cargo status return indicator (GCCC-STATUS-RETURN) is TRUE
THEN
The cargo returned flag (WS-CARGO-RETURNED) is set to TRUE
Applied to: Set Flag: Cargo Released
WHEN
The cargo release status field equals 'R'
THEN
The cargo released flag (WS-CARGO-RELEASED) is set to TRUE
Applied to: Set Flag: Cargo On A Train
WHEN
The cargo train ID field (GCCC-CP-TRAIN-ID) is not equal to SPACES
THEN
The cargo on a train flag (WS-CARGO-ON-A-TRAIN) is set to TRUE
R-GCCUSIO-cbl-00491 (+2) File: GCCUSIO.cbl Set CCN Key Index Fields Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set CCN Key Index Fields':
  • Context - a cargo record is being processed for index field updates:
    For Is Cargo Deleted?:
    When the cargo status indicates it is deleted (88-gcusrt-rt10-cpcargo-deleted is true), then the system should skip all ccn key index field setting operations and exit the process.
  • Context - a cargo record is active (not deleted) and being processed for index updates:
    For Copy CCN Key to RT071 Index Field, Copy CCN Key to RT072 Index Field, Copy CCN Key to RT073 Index Field:
    When the ccn key index fields need to be populated, then the system should copy the cargo control number key (gcusrt-us-ccn-key) to rt071, rt072, and rt073 index fields.
  • Context - a cargo record is being processed and primary ccn index fields have been set:
    For Is Destination Index Not Empty?, Copy CCN Key to RT076 Destination Index Field:
    When the destination index field (gcusrt-rt076-dest-index) is not empty (not equal to spaces), then the system should copy the cargo control number key (gcusrt-us-ccn-key) to the rt076 destination index field (gcusrt-rt076-us-ccn-key-index).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index field updates
GIVEN
A cargo record is being processed for index field updates
Applied to: Is Cargo Deleted?
WHEN
The cargo status indicates it is deleted (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The system should skip all CCN key index field setting operations and exit the process
Context: A cargo record is active (not deleted) and being processed for index updates
GIVEN
A cargo record is active (not deleted) and being processed for index updates
Applied to: Copy CCN Key to RT071 Index Field, Copy CCN Key to RT072 Index Field, Copy CCN Key to RT073 Index Field
WHEN
The CCN key index fields need to be populated
THEN
The system should copy the cargo control number key (GCUSRT-US-CCN-KEY) to RT071, RT072, and RT073 index fields
Context: A cargo record is being processed and primary CCN index fields have been set
GIVEN
A cargo record is being processed and primary CCN index fields have been set
Applied to: Is Destination Index Not Empty?, Copy CCN Key to RT076 Destination Index Field
WHEN
The destination index field (GCUSRT-RT076-DEST-INDEX) is not empty (not equal to spaces)
THEN
The system should copy the cargo control number key (GCUSRT-US-CCN-KEY) to the RT076 destination index field (GCUSRT-RT076-US-CCN-KEY-INDEX)
R-GCCUSIO-cbl-00494 (+13) File: GCCUSIO.cbl Populate Waybill Index Fields Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Populate Waybill Index Fields':
  • Context - a cargo record is being processed for waybill index population:
    For Check if Cargo is Deleted:
    When the cargo record has a deleted status indicator set to true, then the system skips all waybill index field population and exits the process.
  • Context - a cargo record is not deleted and contains transportation routing information:
    For Extract Road Number from RT082 & Extract Station Number from RT082 & Extract Waybill Number from RT082 & Extract Waybill Date from RT082:
    When the system processes waybill index fields, then the road number is extracted from the rt082 transportation segment and the station number is extracted from the rt082 transportation segment and the waybill number is extracted from the rt082 transportation segment and the waybill date is extracted from the rt082 transportation segment.
  • Context - the road number has been extracted from rt082 transportation data:
    For Map Road Number to RT072-ROAD-INDEX:
    When the system populates waybill index fields, then the road number is mapped to the rt072-road-index field.
  • Context - the station number has been extracted from rt082 transportation data:
    For Map Station Number to RT072-STN-INDEX:
    When the system populates waybill index fields, then the station number is mapped to the rt072-stn-index field.
  • Context - the waybill number has been extracted from rt082 transportation data:
    For Map Waybill Number to RT072-WB-INDEX:
    When the system populates waybill index fields, then the waybill number is mapped to the rt072-wb-index field.
  • Context - the waybill date has been extracted from rt082 transportation data:
    For Map Waybill Date to RT072-WB-DTE-INDEX:
    When the system populates waybill index fields, then the waybill date is mapped to the rt072-wb-dte-index field.
  • Context - a cargo record is being processed for waybill index field population:
    For Cargo Record Deleted?:
    When the cargo record has a deleted status indicator set to true, then the system skips all waybill index field population and exits the process.
  • Context - a cargo record is active and not deleted:
    For Extract Road Number from Cargo Data & Extract Station Number from Cargo Data & Extract Waybill Number from Cargo Data & Extract Waybill Date from Cargo Data:
    When the system processes waybill index fields, then the road number from the cargo equipment data (rt082-road-num) is copied to the waybill road index field (rt072-road-index) and the station number from the cargo equipment data (rt082-stn-num) is copied to the waybill station index field (rt072-stn-index) and the waybill number from the cargo equipment data (rt082-wb-num) is copied to the waybill number index field (rt072-wb-index) and the waybill date from the cargo equipment data (rt082-wb-dte) is copied to the waybill date index field (rt072-wb-dte-index).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for waybill index population
GIVEN
A cargo record is being processed for waybill index population
Applied to: Check if Cargo is Deleted
WHEN
The cargo record has a deleted status indicator set to true
THEN
The system skips all waybill index field population and exits the process
Context: A cargo record is not deleted and contains transportation routing information
GIVEN
A cargo record is not deleted and contains transportation routing information
Applied to: Extract Road Number from RT082 & Extract Station Number from RT082 & Extract Waybill Number from RT082 & Extract Waybill Date from RT082
WHEN
The system processes waybill index fields
THEN
The road number is extracted from the RT082 transportation segment AND The station number is extracted from the RT082 transportation segment AND The waybill number is extracted from the RT082 transportation segment AND The waybill date is extracted from the RT082 transportation segment
Context: The road number has been extracted from RT082 transportation data
GIVEN
The road number has been extracted from RT082 transportation data
Applied to: Map Road Number to RT072-ROAD-INDEX
WHEN
The system populates waybill index fields
THEN
The road number is mapped to the RT072-ROAD-INDEX field
Context: The station number has been extracted from RT082 transportation data
GIVEN
The station number has been extracted from RT082 transportation data
Applied to: Map Station Number to RT072-STN-INDEX
WHEN
The system populates waybill index fields
THEN
The station number is mapped to the RT072-STN-INDEX field
Context: The waybill number has been extracted from RT082 transportation data
GIVEN
The waybill number has been extracted from RT082 transportation data
Applied to: Map Waybill Number to RT072-WB-INDEX
WHEN
The system populates waybill index fields
THEN
The waybill number is mapped to the RT072-WB-INDEX field
Context: The waybill date has been extracted from RT082 transportation data
GIVEN
The waybill date has been extracted from RT082 transportation data
Applied to: Map Waybill Date to RT072-WB-DTE-INDEX
WHEN
The system populates waybill index fields
THEN
The waybill date is mapped to the RT072-WB-DTE-INDEX field
Context: A cargo record is being processed for waybill index field population
GIVEN
A cargo record is being processed for waybill index field population
Applied to: Cargo Record Deleted?
WHEN
The cargo record has a deleted status indicator set to true
THEN
The system skips all waybill index field population and exits the process
Context: A cargo record is active and not deleted
GIVEN
A cargo record is active and not deleted
Applied to: Extract Road Number from Cargo Data & Extract Station Number from Cargo Data & Extract Waybill Number from Cargo Data & Extract Waybill Date from Cargo Data
WHEN
The system processes waybill index fields
THEN
The road number from the cargo equipment data (RT082-ROAD-NUM) is copied to the waybill road index field (RT072-ROAD-INDEX) AND The station number from the cargo equipment data (RT082-STN-NUM) is copied to the waybill station index field (RT072-STN-INDEX) AND The waybill number from the cargo equipment data (RT082-WB-NUM) is copied to the waybill number index field (RT072-WB-INDEX) AND The waybill date from the cargo equipment data (RT082-WB-DTE) is copied to the waybill date index field (RT072-WB-DTE-INDEX)
R-GCX126-cbl-00494 (+5) File: GCX126R.cbl Verify Train Exists Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Verify Train Exists':
  • Context - a conventional 350 edi message is being processed and the x4 segment contains entry type code '992' and the x4 segment contains a consist release number (crn) in the related document id field (positions 1-25):
    For Verify Train Exists - Retrieve Canadian train information from database using train ID to verify train exists in system:
    When the system attempts to retrieve the train record from the train database using the crn as the search key, then if the train record is found in the database (indicated by blank status code) then the train is confirmed to exist in the system and processing continues with logging arrival acknowledgment at border else if the train record is not found in the database (indicated by non-blank status code) then the system identifies the train as not existing and generates an unknown train notification message containing the crn with text 'unknown train entry in edi 350' and 'this crn was not found'.
  • Context - the x4 segment has been parsed from the edi 350 message and the related document id field contains the consist release number in positions 1-25:
    For Set Train ID as Search Key:
    When the system prepares to query the train database, then the system sets the train database search key (b4-key-value) to the value from x4 related document id positions 1-25 and stores this value as the previous crn (ws-prev-crn) for duplicate checking.
  • Context - the train search key (b4-key-value) has been set to the consist release number from the x4 segment:
    For Retrieve Train Record from Database:
    When the system executes the database retrieval operation, then the system performs a gu (get unique) function call to retrieve the train root segment (gcb4r-train-root-segment) from the train database (gcb4-pcb) using the qualified search key (b4rt-ssaq) and the database returns a status code indicating whether the record was found or not found.
  • Context - the database retrieval operation has been executed for the train record:
    For Train Record Found?:
    When the system evaluates the database status code, then if the status code is blank (spaces) then the train record was successfully found and exists in the system else if the status code is not blank (contains any value) then the train record was not found and does not exist in the system.
  • Context - the train record retrieval returned a blank status code indicating the train exists in the database:
    For Train Exists in System:
    When the system confirms train existence, then the system prepares log information with current machine date (cc-machine-century and cc-machine-date-x concatenated into gcx105-date) and current machine time (cc-machine-time-x into gcx105-time) and action code 'zzz' (into gcx105-action-code) and the consist release number from x4 positions 1-25 (into gcx105-train-or-us-ccn) and sets the cargo type indicator to canadian train (gcx105-ca-train) and sets the message text to '350 ack - arrival ack at border' (into gcx105-message) and spawns the gct1051e log entry process.
  • Context - the train record retrieval returned a non-blank status code indicating the train does not exist in the database:
    For Train Not Found:
    When the system confirms train non-existence, then the system clears the first detail line (mrln-dtl-line 01 to spaces) and constructs an error message by concatenating 'unknown train entry in edi 350 ' with the consist release number from x4 positions 1-25 into the first detail line and sets the third detail line to 'this crn was not found.' and sets the report line counter (mrln-line) to 4 and sets the message type indicator to unknown (88-z110-mrln-type-is-unknown) and invokes the email send preparation process (z110-prep-emcsend).
👨‍💻 Technical ACs (Gherkin)
Context: A Conventional 350 EDI message is being processed AND the X4 segment contains entry type code '992' AND the X4 segment contains a Consist Release Number (CRN) in the related document ID field (positions 1-25)
GIVEN
A Conventional 350 EDI message is being processed AND the X4 segment contains entry type code '992' AND the X4 segment contains a Consist Release Number (CRN) in the related document ID field (positions 1-25)
Applied to: Verify Train Exists - Retrieve Canadian train information from database using train ID to verify train exists in system
WHEN
The system attempts to retrieve the train record from the train database using the CRN as the search key
THEN
IF the train record is found in the database (indicated by blank status code) THEN the train is confirmed to exist in the system and processing continues with logging arrival acknowledgment at border ELSE IF the train record is not found in the database (indicated by non-blank status code) THEN the system identifies the train as not existing and generates an unknown train notification message containing the CRN with text 'UNKNOWN TRAIN ENTRY IN EDI 350' and 'THIS CRN WAS NOT FOUND'
Context: The X4 segment has been parsed from the EDI 350 message AND the related document ID field contains the Consist Release Number in positions 1-25
GIVEN
The X4 segment has been parsed from the EDI 350 message AND the related document ID field contains the Consist Release Number in positions 1-25
Applied to: Set Train ID as Search Key
WHEN
The system prepares to query the train database
THEN
The system sets the train database search key (B4-KEY-VALUE) to the value from X4 related document ID positions 1-25 AND stores this value as the previous CRN (WS-PREV-CRN) for duplicate checking
Context: The train search key (B4-KEY-VALUE) has been set to the Consist Release Number from the X4 segment
GIVEN
The train search key (B4-KEY-VALUE) has been set to the Consist Release Number from the X4 segment
Applied to: Retrieve Train Record from Database
WHEN
The system executes the database retrieval operation
THEN
The system performs a GU (Get Unique) function call to retrieve the train root segment (GCB4R-TRAIN-ROOT-SEGMENT) from the train database (GCB4-PCB) using the qualified search key (B4RT-SSAQ) AND the database returns a status code indicating whether the record was found or not found
Context: The database retrieval operation has been executed for the train record
GIVEN
The database retrieval operation has been executed for the train record
Applied to: Train Record Found?
WHEN
The system evaluates the database status code
THEN
IF the status code is blank (spaces) THEN the train record was successfully found and exists in the system ELSE IF the status code is not blank (contains any value) THEN the train record was not found and does not exist in the system
Context: The train record retrieval returned a blank status code indicating the train exists in the database
GIVEN
The train record retrieval returned a blank status code indicating the train exists in the database
Applied to: Train Exists in System
WHEN
The system confirms train existence
THEN
The system prepares log information with current machine date (CC-MACHINE-CENTURY and CC-MACHINE-DATE-X concatenated into GCX105-DATE) AND current machine time (CC-MACHINE-TIME-X into GCX105-TIME) AND action code 'ZZZ' (into GCX105-ACTION-CODE) AND the Consist Release Number from X4 positions 1-25 (into GCX105-TRAIN-OR-US-CCN) AND sets the cargo type indicator to Canadian train (GCX105-CA-TRAIN) AND sets the message text to '350 ACK - ARRIVAL ACK AT BORDER' (into GCX105-MESSAGE) AND spawns the GCT1051E log entry process
Context: The train record retrieval returned a non-blank status code indicating the train does not exist in the database
GIVEN
The train record retrieval returned a non-blank status code indicating the train does not exist in the database
Applied to: Train Not Found
WHEN
The system confirms train non-existence
THEN
The system clears the first detail line (MRLN-DTL-LINE 01 to spaces) AND constructs an error message by concatenating 'UNKNOWN TRAIN ENTRY IN EDI 350 ' with the Consist Release Number from X4 positions 1-25 into the first detail line AND sets the third detail line to 'THIS CRN WAS NOT FOUND.' AND sets the report line counter (MRLN-LINE) to 4 AND sets the message type indicator to unknown (88-Z110-MRLN-TYPE-IS-UNKNOWN) AND invokes the email send preparation process (Z110-PREP-EMCSEND)
R-GCX126-cbl-00500 (+7) File: GCX126R.cbl Retrieve Admin Configuration from GCSTBRT Table Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Admin Configuration from GCSTBRT Table':
  • Context - the system needs to retrieve admin configuration data:
    For Initialize Table Access Fields:
    When the initialization process begins, then all table access parameters are cleared (gcstbrt-key-value, gcstbdp-key-value, gcctbio-return-flag, gcstbrt-ad-segment) and control flags (second-pcb-flag, unqual-ssa-flag) are set to spaces.
  • Context - the system is preparing to access the gcstbrt table:
    For Set Table ID to 'ADMINID':
    When the table identifier needs to be specified, then the table id is set to 'ad-table-id' value in gcstbrt-key-table-id.
  • Context - the table id has been set to admin table:
    For Set Sequence ID to 'ADMINID':
    When the specific record needs to be identified, then the sequence id is set to 'adminid' in gcstbrt-key-seqid.
  • Context - the table and sequence identifiers are set:
    For Call GCCTBIO to Read GCSTBRT Table:
    When the database operation type needs to be specified, then the function code is set to 'gu' in gcctbio-func-code.
  • Context - the function code is 'gu', table id is set to admin table identifier, sequence id is 'adminid', and all access parameters are initialized:
    For Call GCCTBIO to Read GCSTBRT Table:
    When the gcctbio program is called with parameters cccom, second-pcb-flag, unqual-ssa-flag, gcctbio-func-code, gcstbrt-lit, gcstbrt-key-value, gcstbdp-key-value, ws-table-segment, and gcctbio-return-flag, then the admin configuration record is retrieved and stored in ws-table-segment with operation status returned in gcctbio-return-flag.
  • Context - the gcctbio program has completed execution:
    For Return Flag = '0'?:
    When the return flag is evaluated, then if gcctbio-return-flag equals '0', the retrieval was successful; otherwise, the retrieval failed.
  • Context - the gcctbio-return-flag equals '0' indicating successful retrieval:
    For Set Admin Segment Found Flag:
    When the admin segment status needs to be recorded, then the condition 88-ad-segment-found is set to true.
  • Context - the admin segment has been successfully found (88-ad-segment-found is true) and ws-table-segment contains the retrieved data:
    For Move Merlin User Code from Admin Config to EMI-TO-USERCODE:
    When the merlin user code needs to be extracted, then ws-table-segment is moved to gcstbrt-ad-segment and gcstbrt-ad-dc-p-merlin-1 is moved to ws-emi-to-usercode.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to retrieve admin configuration data
GIVEN
The system needs to retrieve admin configuration data
Applied to: Initialize Table Access Fields
WHEN
The initialization process begins
THEN
All table access parameters are cleared (GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE, GCCTBIO-RETURN-FLAG, GCSTBRT-AD-SEGMENT) and control flags (SECOND-PCB-FLAG, UNQUAL-SSA-FLAG) are set to spaces
Context: The system is preparing to access the GCSTBRT table
GIVEN
The system is preparing to access the GCSTBRT table
Applied to: Set Table ID to 'ADMINID'
WHEN
The table identifier needs to be specified
THEN
The table ID is set to 'AD-TABLE-ID' value in GCSTBRT-KEY-TABLE-ID
Context: The table ID has been set to admin table
GIVEN
The table ID has been set to admin table
Applied to: Set Sequence ID to 'ADMINID'
WHEN
The specific record needs to be identified
THEN
The sequence ID is set to 'ADMINID' in GCSTBRT-KEY-SEQID
Context: The table and sequence identifiers are set
GIVEN
The table and sequence identifiers are set
Applied to: Call GCCTBIO to Read GCSTBRT Table
WHEN
The database operation type needs to be specified
THEN
The function code is set to 'GU' in GCCTBIO-FUNC-CODE
Context: The function code is 'GU', table ID is set to admin table identifier, sequence ID is 'ADMINID', and all access parameters are initialized
GIVEN
The function code is 'GU', table ID is set to admin table identifier, sequence ID is 'ADMINID', and all access parameters are initialized
Applied to: Call GCCTBIO to Read GCSTBRT Table
WHEN
The GCCTBIO program is called with parameters CCCOM, SECOND-PCB-FLAG, UNQUAL-SSA-FLAG, GCCTBIO-FUNC-CODE, GCSTBRT-LIT, GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE, WS-TABLE-SEGMENT, and GCCTBIO-RETURN-FLAG
THEN
The admin configuration record is retrieved and stored in WS-TABLE-SEGMENT with operation status returned in GCCTBIO-RETURN-FLAG
Context: The GCCTBIO program has completed execution
GIVEN
The GCCTBIO program has completed execution
Applied to: Return Flag = '0'?
WHEN
The return flag is evaluated
THEN
If GCCTBIO-RETURN-FLAG equals '0', the retrieval was successful; otherwise, the retrieval failed
Context: The GCCTBIO-RETURN-FLAG equals '0' indicating successful retrieval
GIVEN
The GCCTBIO-RETURN-FLAG equals '0' indicating successful retrieval
Applied to: Set Admin Segment Found Flag
WHEN
The admin segment status needs to be recorded
THEN
The condition 88-AD-SEGMENT-FOUND is set to TRUE
Context: The admin segment has been successfully found (88-AD-SEGMENT-FOUND is TRUE) and WS-TABLE-SEGMENT contains the retrieved data
GIVEN
The admin segment has been successfully found (88-AD-SEGMENT-FOUND is TRUE) and WS-TABLE-SEGMENT contains the retrieved data
Applied to: Move Merlin User Code from Admin Config to EMI-TO-USERCODE
WHEN
The Merlin user code needs to be extracted
THEN
WS-TABLE-SEGMENT is moved to GCSTBRT-AD-SEGMENT and GCSTBRT-AD-DC-P-MERLIN-1 is moved to WS-EMI-TO-USERCODE
R-GCCUSIO-cbl-00503 (+3) File: GCCUSIO.cbl Determine Bond Index Source Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Bond Index Source':
  • Context - a cargo record is being processed for index field population and the cargo is not marked as deleted:
    For Determine Bond Index Source - Evaluates in-bond control number availability, falls back to entry number, or sets to spaces based on customs data hierarchy:
    When the system needs to determine the bond index value for cargo tracking, then the system should use in-bond control number as first priority, entry number as second priority, or set to spaces if neither is available.
  • Context - a cargo record contains an in-bond control number that is not spaces:
    For Use In-Bond Control Number as Bond Index:
    When the system evaluates bond index assignment, then the system should assign the in-bond control number to the bond number index field.
  • Context - a cargo record has no in-bond control number (spaces) but contains an entry number that is not spaces:
    For Use Entry Number as Bond Index:
    When the system evaluates bond index assignment after finding no in-bond control number, then the system should assign the entry number to the bond number index field.
  • Context - a cargo record has both in-bond control number and entry number set to spaces:
    For Set Bond Index to Spaces:
    When the system evaluates bond index assignment after finding no valid customs numbers, then the system should set the bond number index field to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index field population and the cargo is not marked as deleted
GIVEN
A cargo record is being processed for index field population and the cargo is not marked as deleted
Applied to: Determine Bond Index Source - Evaluates in-bond control number availability, falls back to entry number, or sets to spaces based on customs data hierarchy
WHEN
The system needs to determine the bond index value for cargo tracking
THEN
The system should use in-bond control number as first priority, entry number as second priority, or set to spaces if neither is available
Context: A cargo record contains an in-bond control number that is not spaces
GIVEN
A cargo record contains an in-bond control number that is not spaces
Applied to: Use In-Bond Control Number as Bond Index
WHEN
The system evaluates bond index assignment
THEN
The system should assign the in-bond control number to the bond number index field
Context: A cargo record has no in-bond control number (spaces) but contains an entry number that is not spaces
GIVEN
A cargo record has no in-bond control number (spaces) but contains an entry number that is not spaces
Applied to: Use Entry Number as Bond Index
WHEN
The system evaluates bond index assignment after finding no in-bond control number
THEN
The system should assign the entry number to the bond number index field
Context: A cargo record has both in-bond control number and entry number set to spaces
GIVEN
A cargo record has both in-bond control number and entry number set to spaces
Applied to: Set Bond Index to Spaces
WHEN
The system evaluates bond index assignment after finding no valid customs numbers
THEN
The system should set the bond number index field to spaces
R-GCCUSIO-cbl-00507 (+5) File: GCCUSIO.cbl Build Car ID Search Parameters Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Car ID Search Parameters':
  • Context - a cargo record exists with car id index field populated:
    For Extract Car ID from Index Field:
    When car id search parameters are being built, then the car id value is extracted from gcusrt-rt071-car-id-index field.
  • Context - car id has been extracted from the index field:
    For Map Car ID to Search Key Value:
    When search parameters are being configured, then the car id value is mapped to gcuc-key-value for search operations.
  • Context - search operator is provided in input parameters:
    For Set Search Operator from Input:
    When car id search parameters are being built, then the operator from gcwusio-operator is assigned to gcuc-operator.
  • Context - car id search is being initiated:
    For Configure Car ID PCB Path:
    When database access path needs to be configured, then gcus-pcb2 is assigned to ws-pcb for car id index access.
  • Context - car id search key and operator are configured:
    For Build Qualified SSA Statement:
    When database query statement needs to be built, then gcuc-ssa-qual is assigned to ws-ssa-1 for qualified search execution.
  • Context - car id search parameters are fully configured with pcb path and qualified ssa:
    For Execute Car ID Index Search:
    When car id index search is executed, then x1100-call-one-ssa is performed to execute the database search operation.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with car ID index field populated
GIVEN
A cargo record exists with car ID index field populated
Applied to: Extract Car ID from Index Field
WHEN
Car ID search parameters are being built
THEN
The car ID value is extracted from GCUSRT-RT071-CAR-ID-INDEX field
Context: Car ID has been extracted from the index field
GIVEN
Car ID has been extracted from the index field
Applied to: Map Car ID to Search Key Value
WHEN
Search parameters are being configured
THEN
The car ID value is mapped to GCUC-KEY-VALUE for search operations
Context: Search operator is provided in input parameters
GIVEN
Search operator is provided in input parameters
Applied to: Set Search Operator from Input
WHEN
Car ID search parameters are being built
THEN
The operator from GCWUSIO-OPERATOR is assigned to GCUC-OPERATOR
Context: Car ID search is being initiated
GIVEN
Car ID search is being initiated
Applied to: Configure Car ID PCB Path
WHEN
Database access path needs to be configured
THEN
GCUS-PCB2 is assigned to WS-PCB for car ID index access
Context: Car ID search key and operator are configured
GIVEN
Car ID search key and operator are configured
Applied to: Build Qualified SSA Statement
WHEN
Database query statement needs to be built
THEN
GCUC-SSA-QUAL is assigned to WS-SSA-1 for qualified search execution
Context: Car ID search parameters are fully configured with PCB path and qualified SSA
GIVEN
Car ID search parameters are fully configured with PCB path and qualified SSA
Applied to: Execute Car ID Index Search
WHEN
Car ID index search is executed
THEN
X1100-CALL-ONE-SSA is performed to execute the database search operation
R-GCX126-cbl-00508 (+6) File: GCX126R.cbl Establish MQ Connection to Queue Manager Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Establish MQ Connection to Queue Manager':
  • Context - the system needs to process edi 350 customs messages from the message queue:
    For Call MQCONNC API with Queue Manager Name:
    When the system initiates connection to the mq queue manager, then the system calls the mqconnc api with the queue manager name and receives a connection handle and completion status.
  • Context - the mqconnc api has been called to establish connection to the queue manager:
    For MQ Completion Code = OK?:
    When the system receives the completion code from the mqconnc api, then the system checks if the completion code equals mqcc-ok to determine connection success.
  • Context - the mq connection completion code indicates failure (not equal to mqcc-ok):
    For Retrieve MQ Reason Code:
    When the system needs to identify the specific cause of connection failure, then the system retrieves the mq reason code from the connection response.
  • Context - an mq reason code has been retrieved indicating connection failure:
    For Call GCCMQERR to Get Error Message Text:
    When the system needs to provide a descriptive error message for the failure, then the system calls the gccmqerr program with the reason code and receives the corresponding error message text.
  • Context - the mq connection has failed and the reason code and error text have been retrieved:
    For Build Error Message: Reason Code, Error Text, Transaction Set: '355', Error Type: 'CONN FAILED':
    When the system prepares to report the connection failure, then the system builds an error message containing: the mq reason code concatenated with the error message text, transaction set value '355', and error type 'conn failed'.
  • Context - the mq connection has failed and a comprehensive error message has been constructed:
    For Abend Program with Error Message:
    When the system cannot proceed without a valid mq connection, then the system abends the program with the error message containing the reason code, error text, transaction set '355', and error type 'conn failed'.
  • Context - the mqconnc api has been called to connect to the queue manager:
    For Connection Established Successfully:
    When the completion code returned equals mqcc-ok, then the system confirms the connection is established successfully and proceeds with message processing operations.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process EDI 350 customs messages from the message queue
GIVEN
The system needs to process EDI 350 customs messages from the message queue
Applied to: Call MQCONNC API with Queue Manager Name
WHEN
The system initiates connection to the MQ Queue Manager
THEN
The system calls the MQCONNC API with the Queue Manager name and receives a connection handle and completion status
Context: The MQCONNC API has been called to establish connection to the Queue Manager
GIVEN
The MQCONNC API has been called to establish connection to the Queue Manager
Applied to: MQ Completion Code = OK?
WHEN
The system receives the completion code from the MQCONNC API
THEN
The system checks if the completion code equals MQCC-OK to determine connection success
Context: The MQ connection completion code indicates failure (not equal to MQCC-OK)
GIVEN
The MQ connection completion code indicates failure (not equal to MQCC-OK)
Applied to: Retrieve MQ Reason Code
WHEN
The system needs to identify the specific cause of connection failure
THEN
The system retrieves the MQ reason code from the connection response
Context: An MQ reason code has been retrieved indicating connection failure
GIVEN
An MQ reason code has been retrieved indicating connection failure
Applied to: Call GCCMQERR to Get Error Message Text
WHEN
The system needs to provide a descriptive error message for the failure
THEN
The system calls the GCCMQERR program with the reason code and receives the corresponding error message text
Context: The MQ connection has failed and the reason code and error text have been retrieved
GIVEN
The MQ connection has failed and the reason code and error text have been retrieved
Applied to: Build Error Message: Reason Code, Error Text, Transaction Set: '355', Error Type: 'CONN FAILED'
WHEN
The system prepares to report the connection failure
THEN
The system builds an error message containing: the MQ reason code concatenated with the error message text, transaction set value '355', and error type 'CONN FAILED'
Context: The MQ connection has failed and a comprehensive error message has been constructed
GIVEN
The MQ connection has failed and a comprehensive error message has been constructed
Applied to: Abend Program with Error Message
WHEN
The system cannot proceed without a valid MQ connection
THEN
The system abends the program with the error message containing the reason code, error text, transaction set '355', and error type 'CONN FAILED'
Context: The MQCONNC API has been called to connect to the Queue Manager
GIVEN
The MQCONNC API has been called to connect to the Queue Manager
Applied to: Connection Established Successfully
WHEN
The completion code returned equals MQCC-OK
THEN
The system confirms the connection is established successfully and proceeds with message processing operations
R-GCCUSIO-cbl-00513 (+4) File: GCCUSIO.cbl Build Waybill Search Parameters Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Waybill Search Parameters':
  • Context - a cargo record exists with waybill index information in rt072-waybill-index field:
    For Extract Waybill Index Value from RT072-WAYBILL-INDEX:
    When the system processes a waybill index search request, then the waybill index value is extracted from gcusrt-rt072-waybill-index and moved to gcuw-key-value for search parameter construction.
  • Context - a waybill index search request is being processed with a specified search operator in gcwusio-operator:
    For Set Search Operator from Input Parameter:
    When the system builds waybill search parameters, then the search operator from gcwusio-operator is moved to gcuw-operator to define the comparison criteria for the waybill search.
  • Context - a waybill index search operation is being initiated:
    For Configure PCB3 Database Path:
    When the system prepares database access parameters, then the pcb3 database path (gcus-pcb3) is configured in ws-pcb to direct the search to the waybill index database structure.
  • Context - waybill key value and search operator have been set in gcuw-key-value and gcuw-operator respectively:
    For Construct Qualified Search Statement GCUW-SSA-QUAL:
    When the system builds the complete search statement, then a qualified search statement gcuw-ssa-qual is constructed and moved to ws-ssa-1 to enable precise waybill index searching.
  • Context - all waybill search parameters have been configured including pcb, search statement, and key values:
    For Execute Waybill Index Search:
    When the system performs the waybill index search operation, then the search is executed via x1100-call-one-ssa to retrieve cargo records matching the waybill index criteria.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with waybill index information in RT072-WAYBILL-INDEX field
GIVEN
A cargo record exists with waybill index information in RT072-WAYBILL-INDEX field
Applied to: Extract Waybill Index Value from RT072-WAYBILL-INDEX
WHEN
The system processes a waybill index search request
THEN
The waybill index value is extracted from GCUSRT-RT072-WAYBILL-INDEX and moved to GCUW-KEY-VALUE for search parameter construction
Context: A waybill index search request is being processed with a specified search operator in GCWUSIO-OPERATOR
GIVEN
A waybill index search request is being processed with a specified search operator in GCWUSIO-OPERATOR
Applied to: Set Search Operator from Input Parameter
WHEN
The system builds waybill search parameters
THEN
The search operator from GCWUSIO-OPERATOR is moved to GCUW-OPERATOR to define the comparison criteria for the waybill search
Context: A waybill index search operation is being initiated
GIVEN
A waybill index search operation is being initiated
Applied to: Configure PCB3 Database Path
WHEN
The system prepares database access parameters
THEN
The PCB3 database path (GCUS-PCB3) is configured in WS-PCB to direct the search to the waybill index database structure
Context: Waybill key value and search operator have been set in GCUW-KEY-VALUE and GCUW-OPERATOR respectively
GIVEN
Waybill key value and search operator have been set in GCUW-KEY-VALUE and GCUW-OPERATOR respectively
Applied to: Construct Qualified Search Statement GCUW-SSA-QUAL
WHEN
The system builds the complete search statement
THEN
A qualified search statement GCUW-SSA-QUAL is constructed and moved to WS-SSA-1 to enable precise waybill index searching
Context: All waybill search parameters have been configured including PCB, search statement, and key values
GIVEN
All waybill search parameters have been configured including PCB, search statement, and key values
Applied to: Execute Waybill Index Search
WHEN
The system performs the waybill index search operation
THEN
The search is executed via X1100-CALL-ONE-SSA to retrieve cargo records matching the waybill index criteria
R-GCX126-cbl-00515 (+4) File: GCX126R.cbl Calculate Number of EDI Segments Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Calculate Number of EDI Segments':
  • Context - ['an edi 350 message has been retrieved from the mq queue', 'the message data length (w03-datalen) is available from the mq get operation', 'the message header length (ws-mqs-len-header) equals the length of mqs-message-header structure', 'the single entry length (ws-mqs-len-of-1-entry) equals the length of one mqs-table-entry']:
    For Calculate: Segments = Data Length - Header Length / Entry Length:
    When ['the system calculates the number of segments'], then ['subtract the header length from the total message data length to get net data length', 'divide the net data length by the single entry length', 'round the result to get the number of complete segments', 'store the calculated value in ws-max-mqs-entries'].
  • Context - ['the number of segments has been calculated and stored in ws-max-mqs-entries', 'a maximum allowed segment count is defined as cst-max-mqs-entries']:
    For Calculated Segments > Maximum Allowed?:
    When ['the calculated number of segments (ws-max-mqs-entries) exceeds the maximum allowed (cst-max-mqs-entries)'], then ['set ws-max-mqs-entries to the maximum allowed value cst-max-mqs-entries', 'discard any segments beyond the maximum limit'].
  • Context - ['the edi message structure includes a fixed-length header (mqs-message-header)', 'the system needs to calculate net data length for segment counting']:
    For Get Header Length:
    When ['the system initializes message processing parameters'], then ['set ws-mqs-len-header to the length of mqs-message-header structure', 'this value will be used to subtract header length from total message length'].
  • Context - ['each edi segment in the message has a fixed structure (mqs-table-entry)', 'the system needs to calculate how many segments fit in the net data length']:
    For Get Single Entry Length:
    When ['the system initializes message processing parameters'], then ['set ws-mqs-len-of-1-entry to the length of one mqs-table-entry structure', 'this value will be used as the divisor to calculate segment count'].
  • Context - ['an edi 350 message exists in the mq queue', 'the mq get operation has been invoked with buffer length set to the length of mqs-message']:
    For Get Message Data Length from MQ:
    When ['the mqget call completes successfully'], then ['the actual data length of the retrieved message is returned in w03-datalen', 'this length includes both the message header and all segment entries', 'w03-datalen will be used to calculate the number of segments in the message'].
👨‍💻 Technical ACs (Gherkin)
Context: ['An EDI 350 message has been retrieved from the MQ queue', 'The message data length (W03-DATALEN) is available from the MQ GET operation', 'The message header length (WS-MQS-LEN-HEADER) equals the length of MQS-MESSAGE-HEADER structure', 'The single entry length (WS-MQS-LEN-OF-1-ENTRY) equals the length of one MQS-TABLE-ENTRY']
GIVEN
['An EDI 350 message has been retrieved from the MQ queue', 'The message data length (W03-DATALEN) is available from the MQ GET operation', 'The message header length (WS-MQS-LEN-HEADER) equals the length of MQS-MESSAGE-HEADER structure', 'The single entry length (WS-MQS-LEN-OF-1-ENTRY) equals the length of one MQS-TABLE-ENTRY']
Applied to: Calculate: Segments = Data Length - Header Length / Entry Length
WHEN
['The system calculates the number of segments']
THEN
['Subtract the header length from the total message data length to get net data length', 'Divide the net data length by the single entry length', 'Round the result to get the number of complete segments', 'Store the calculated value in WS-MAX-MQS-ENTRIES']
Context: ['The number of segments has been calculated and stored in WS-MAX-MQS-ENTRIES', 'A maximum allowed segment count is defined as CST-MAX-MQS-ENTRIES']
GIVEN
['The number of segments has been calculated and stored in WS-MAX-MQS-ENTRIES', 'A maximum allowed segment count is defined as CST-MAX-MQS-ENTRIES']
Applied to: Calculated Segments > Maximum Allowed?
WHEN
['The calculated number of segments (WS-MAX-MQS-ENTRIES) exceeds the maximum allowed (CST-MAX-MQS-ENTRIES)']
THEN
['Set WS-MAX-MQS-ENTRIES to the maximum allowed value CST-MAX-MQS-ENTRIES', 'Discard any segments beyond the maximum limit']
Context: ['The EDI message structure includes a fixed-length header (MQS-MESSAGE-HEADER)', 'The system needs to calculate net data length for segment counting']
GIVEN
['The EDI message structure includes a fixed-length header (MQS-MESSAGE-HEADER)', 'The system needs to calculate net data length for segment counting']
Applied to: Get Header Length
WHEN
['The system initializes message processing parameters']
THEN
['Set WS-MQS-LEN-HEADER to the length of MQS-MESSAGE-HEADER structure', 'This value will be used to subtract header length from total message length']
Context: ['Each EDI segment in the message has a fixed structure (MQS-TABLE-ENTRY)', 'The system needs to calculate how many segments fit in the net data length']
GIVEN
['Each EDI segment in the message has a fixed structure (MQS-TABLE-ENTRY)', 'The system needs to calculate how many segments fit in the net data length']
Applied to: Get Single Entry Length
WHEN
['The system initializes message processing parameters']
THEN
['Set WS-MQS-LEN-OF-1-ENTRY to the length of one MQS-TABLE-ENTRY structure', 'This value will be used as the divisor to calculate segment count']
Context: ['An EDI 350 message exists in the MQ queue', 'The MQ GET operation has been invoked with buffer length set to the length of MQS-MESSAGE']
GIVEN
['An EDI 350 message exists in the MQ queue', 'The MQ GET operation has been invoked with buffer length set to the length of MQS-MESSAGE']
Applied to: Get Message Data Length from MQ
WHEN
['The MQGET call completes successfully']
THEN
['The actual data length of the retrieved message is returned in W03-DATALEN', 'This length includes both the message header and all segment entries', 'W03-DATALEN will be used to calculate the number of segments in the message']
R-GCCUSIO-cbl-00518 (+2) File: GCCUSIO.cbl Determine Car Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Car':
  • Context - a car-waybill index search request is being processed:
    For Check Car-Waybill Index Content:
    When the car-waybill index field contains data (is not empty spaces), then the system sets up a qualified search using the car-waybill index value as the search key and configures qualified search parameters.
    For Set Up Unqualified Search:
    When the car-waybill index field is empty (contains spaces), then the system clears the search key value to spaces and configures unqualified search parameters to retrieve all records.
  • Context - the car-waybill index field contains data:
    For Set Car-Waybill Index Value as Search Key:
    When setting up a qualified search for car-waybill records, then the system moves the car-waybill index value to the search key field, sets the operator, and configures qualified ssa parameters.
👨‍💻 Technical ACs (Gherkin)
Context: A car-waybill index search request is being processed
GIVEN
A car-waybill index search request is being processed
Applied to: Check Car-Waybill Index Content
WHEN
The car-waybill index field contains data (is not empty spaces)
THEN
The system sets up a qualified search using the car-waybill index value as the search key and configures qualified search parameters
Applied to: Set Up Unqualified Search
WHEN
The car-waybill index field is empty (contains spaces)
THEN
The system clears the search key value to spaces and configures unqualified search parameters to retrieve all records
Context: The car-waybill index field contains data
GIVEN
The car-waybill index field contains data
Applied to: Set Car-Waybill Index Value as Search Key
WHEN
Setting up a qualified search for car-waybill records
THEN
The system moves the car-waybill index value to the search key field, sets the operator, and configures qualified SSA parameters
R-GCX126-cbl-00520 (+11) File: GCX126R.cbl Process X4 Release/Disposition Segment Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process X4 Release/Disposition Segment':
  • Context - an x4 segment is being processed from an edi 350 message:
    For Is Conveyance 350 AND Entry Type = 992?:
    When the message type is conveyance 350 (ws-conv-350 is true) and the x4 entry type code (x4-03-entry-typ-cde) equals '992', then process as train arrival acknowledgment at border, otherwise process as cargo release segment and set x4 segment found flag for cargo processing.
  • Context - a conveyance 350 message with entry type 992 is being processed:
    For Is Train ID Same as Previous?:
    When the train release document id from x4-04-rel-doc-id (first 25 characters) equals the previously processed crn stored in ws-prev-crn, then skip processing this x4 segment and continue to next segment, otherwise proceed with train verification.
  • Context - a new train release number is identified in the x4 segment:
    For Extract Train ID from X4-04-REL-DOC-ID:
    When the x4-04-rel-doc-id (first 25 characters) is different from the previous crn, then move x4-04-rel-doc-id (first 25 characters) to b4-key-value for train lookup and to ws-prev-crn for duplicate tracking.
  • Context - a train release number (crn) has been extracted from the x4 segment:
    For Verify Train Exists in System:
    When the system performs a database lookup using the crn as the key value in the train root segment (b4rt), then return the train record if found, otherwise return a not found status code in cc-status-code.
  • Context - a train lookup has been performed using the crn from x4-04-rel-doc-id:
    For Prepare Error Report: UNKNOWN TRAIN ENTRY IN EDI 350:
    When the train is not found (cc-status-code is not spaces), then prepare error message 'unknown train entry in edi 350' concatenated with the crn in detail line 1, add message 'this crn was not found.' in detail line 3, set message line count to 4, and set message type to unknown.
  • Context - an unknown train error message has been prepared with crn details:
    For Send Error to Merlin:
    When the error preparation is complete, then invoke the merlin email send process (z110-prep-emcsend) to transmit the error notification to the configured recipients.
  • Context - a train has been successfully verified in the system using the crn:
    For Log Train Arrival Action Code: ZZZ Message: 350 ACK - ARRIVAL ACK AT BORDER:
    When the train record exists (cc-status-code equals spaces), then create a log entry with current machine date in gcx105-date, current machine time in gcx105-time, action code 'zzz' in gcx105-action-code, the crn (first 25 characters of x4-04-rel-doc-id) in gcx105-train-or-us-ccn, set cargo type to canadian train (gcx105-ca-train), message '350 ack - arrival ack at border' in gcx105-message, and spawn the log entry process (z300-spawn-gct1051e).
  • Context - a valid train arrival has been logged and cargo exists for the release reference id:
    For Update Cargo Border Arrival Status:
    When the cargo is found using x4-01-cbsa-rel-ref-id (first 25 characters) as the ccn key, then log the message '350 ack - arrival ack at border' to cargo information, set the cargo border arrival acknowledgment flag (gccc-border-arrival-ack) to true, and replace the cargo record in the database.
  • Context - a cargo record has been updated with border arrival acknowledgment:
    For Is Master Manifest?:
    When the cargo master manifest indicator (gccc-master-mfst) is true, then proceed to retrieve and update all follower manifests, otherwise skip follower processing and continue to next segment.
  • Context - a master manifest has been identified with ccn key stored in gccc-ccn-key:
    For Retrieve All Follower Manifests for Master up to 100:
    When the system performs sequential reads of cargo records using the master ccn as parent key (gccc-master-mfst-ccn), then collect all follower manifest ccn keys (where gccc-follower-mfst is true and master ccn matches x4-01-cbsa-rel-ref-id first 25 characters) into ws-follower-mani array up to a maximum of 100 entries, stopping when no more followers are found or limit is reached.
  • Context - a list of follower manifest ccn keys has been retrieved and stored in ws-follower-mani array:
    For Update Border Arrival for Each Follower:
    When processing each follower ccn from index 1 to the count of followers found, then for each follower ccn: retrieve the cargo record using the ccn as key, if cargo is found then log message '350 ack - arrival ack at border', set the border arrival acknowledgment flag (gccc-border-arrival-ack) to true, and replace the cargo record.
  • Context - an x4 segment is being processed:
    For Set X4 Segment Found Flag for Cargo Processing:
    When the message is not a conveyance 350 (ws-conv-350 is false) or the entry type code is not '992', then set the previous x4 segment indicator (ws-segment-prev-x4) to true and set the x4 segment found flag (ws-x4-segment-found) to true to enable cargo release processing in subsequent steps.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed from an EDI 350 message
GIVEN
An X4 segment is being processed from an EDI 350 message
Applied to: Is Conveyance 350 AND Entry Type = 992?
WHEN
The message type is Conveyance 350 (WS-CONV-350 is true) AND the X4 entry type code (X4-03-ENTRY-TYP-CDE) equals '992'
THEN
Process as train arrival acknowledgment at border, otherwise process as cargo release segment and set X4 segment found flag for cargo processing
Context: A conveyance 350 message with entry type 992 is being processed
GIVEN
A conveyance 350 message with entry type 992 is being processed
Applied to: Is Train ID Same as Previous?
WHEN
The train release document ID from X4-04-REL-DOC-ID (first 25 characters) equals the previously processed CRN stored in WS-PREV-CRN
THEN
Skip processing this X4 segment and continue to next segment, otherwise proceed with train verification
Context: A new train release number is identified in the X4 segment
GIVEN
A new train release number is identified in the X4 segment
Applied to: Extract Train ID from X4-04-REL-DOC-ID
WHEN
The X4-04-REL-DOC-ID (first 25 characters) is different from the previous CRN
THEN
Move X4-04-REL-DOC-ID (first 25 characters) to B4-KEY-VALUE for train lookup and to WS-PREV-CRN for duplicate tracking
Context: A train release number (CRN) has been extracted from the X4 segment
GIVEN
A train release number (CRN) has been extracted from the X4 segment
Applied to: Verify Train Exists in System
WHEN
The system performs a database lookup using the CRN as the key value in the train root segment (B4RT)
THEN
Return the train record if found, otherwise return a not found status code in CC-STATUS-CODE
Context: A train lookup has been performed using the CRN from X4-04-REL-DOC-ID
GIVEN
A train lookup has been performed using the CRN from X4-04-REL-DOC-ID
Applied to: Prepare Error Report: UNKNOWN TRAIN ENTRY IN EDI 350
WHEN
The train is not found (CC-STATUS-CODE is not spaces)
THEN
Prepare error message 'UNKNOWN TRAIN ENTRY IN EDI 350' concatenated with the CRN in detail line 1, add message 'THIS CRN WAS NOT FOUND.' in detail line 3, set message line count to 4, and set message type to unknown
Context: An unknown train error message has been prepared with CRN details
GIVEN
An unknown train error message has been prepared with CRN details
Applied to: Send Error to Merlin
WHEN
The error preparation is complete
THEN
Invoke the Merlin email send process (Z110-PREP-EMCSEND) to transmit the error notification to the configured recipients
Context: A train has been successfully verified in the system using the CRN
GIVEN
A train has been successfully verified in the system using the CRN
Applied to: Log Train Arrival Action Code: ZZZ Message: 350 ACK - ARRIVAL ACK AT BORDER
WHEN
The train record exists (CC-STATUS-CODE equals spaces)
THEN
Create a log entry with current machine date in GCX105-DATE, current machine time in GCX105-TIME, action code 'ZZZ' in GCX105-ACTION-CODE, the CRN (first 25 characters of X4-04-REL-DOC-ID) in GCX105-TRAIN-OR-US-CCN, set cargo type to Canadian train (GCX105-CA-TRAIN), message '350 ACK - ARRIVAL ACK AT BORDER' in GCX105-MESSAGE, and spawn the log entry process (Z300-SPAWN-GCT1051E)
Context: A valid train arrival has been logged and cargo exists for the release reference ID
GIVEN
A valid train arrival has been logged and cargo exists for the release reference ID
Applied to: Update Cargo Border Arrival Status
WHEN
The cargo is found using X4-01-CBSA-REL-REF-ID (first 25 characters) as the CCN key
THEN
Log the message '350 ACK - ARRIVAL ACK AT BORDER' to cargo information, set the cargo border arrival acknowledgment flag (GCCC-BORDER-ARRIVAL-ACK) to true, and replace the cargo record in the database
Context: A cargo record has been updated with border arrival acknowledgment
GIVEN
A cargo record has been updated with border arrival acknowledgment
Applied to: Is Master Manifest?
WHEN
The cargo master manifest indicator (GCCC-MASTER-MFST) is true
THEN
Proceed to retrieve and update all follower manifests, otherwise skip follower processing and continue to next segment
Context: A master manifest has been identified with CCN key stored in GCCC-CCN-KEY
GIVEN
A master manifest has been identified with CCN key stored in GCCC-CCN-KEY
Applied to: Retrieve All Follower Manifests for Master up to 100
WHEN
The system performs sequential reads of cargo records using the master CCN as parent key (GCCC-MASTER-MFST-CCN)
THEN
Collect all follower manifest CCN keys (where GCCC-FOLLOWER-MFST is true and master CCN matches X4-01-CBSA-REL-REF-ID first 25 characters) into WS-FOLLOWER-MANI array up to a maximum of 100 entries, stopping when no more followers are found or limit is reached
Context: A list of follower manifest CCN keys has been retrieved and stored in WS-FOLLOWER-MANI array
GIVEN
A list of follower manifest CCN keys has been retrieved and stored in WS-FOLLOWER-MANI array
Applied to: Update Border Arrival for Each Follower
WHEN
Processing each follower CCN from index 1 to the count of followers found
THEN
For each follower CCN: retrieve the cargo record using the CCN as key, if cargo is found then log message '350 ACK - ARRIVAL ACK AT BORDER', set the border arrival acknowledgment flag (GCCC-BORDER-ARRIVAL-ACK) to true, and replace the cargo record
Context: An X4 segment is being processed
GIVEN
An X4 segment is being processed
Applied to: Set X4 Segment Found Flag for Cargo Processing
WHEN
The message is not a conveyance 350 (WS-CONV-350 is false) OR the entry type code is not '992'
THEN
Set the previous X4 segment indicator (WS-SEGMENT-PREV-X4) to true and set the X4 segment found flag (WS-X4-SEGMENT-FOUND) to true to enable cargo release processing in subsequent steps
R-GCCUSIO-cbl-00521 (+3) File: GCCUSIO.cbl Determine Bond Search Type Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Bond Search Type':
  • Context - a cargo record with bond index field that may or may not contain bond number data:
    For Bond Index Available?:
    When the system evaluates the bond index field for content, then the system identifies whether bond index contains valid bond number data or is empty.
  • Context - bond index field contains valid bond number data (not spaces):
    For Set Bond Number from Index Field:
    When the system prepares bond search parameters, then the system sets the bond number value from the bond index field and configures qualified search with specific bond number criteria.
  • Context - bond index field is empty (contains spaces):
    For Set Empty Bond Number:
    When the system prepares bond search parameters, then the system sets empty bond number value and configures unqualified search to retrieve all bond records.
  • Context - bond search parameters are configured with either specific bond number for qualified search or empty value for unqualified search:
    For Execute Bond Index Search:
    When the system executes the bond index search operation, then the system performs the database search using the configured search parameters and retrieval method.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond index field that may or may not contain bond number data
GIVEN
A cargo record with bond index field that may or may not contain bond number data
Applied to: Bond Index Available?
WHEN
The system evaluates the bond index field for content
THEN
The system identifies whether bond index contains valid bond number data or is empty
Context: Bond index field contains valid bond number data (not spaces)
GIVEN
Bond index field contains valid bond number data (not spaces)
Applied to: Set Bond Number from Index Field
WHEN
The system prepares bond search parameters
THEN
The system sets the bond number value from the bond index field and configures qualified search with specific bond number criteria
Context: Bond index field is empty (contains spaces)
GIVEN
Bond index field is empty (contains spaces)
Applied to: Set Empty Bond Number
WHEN
The system prepares bond search parameters
THEN
The system sets empty bond number value and configures unqualified search to retrieve all bond records
Context: Bond search parameters are configured with either specific bond number for qualified search or empty value for unqualified search
GIVEN
Bond search parameters are configured with either specific bond number for qualified search or empty value for unqualified search
Applied to: Execute Bond Index Search
WHEN
The system executes the bond index search operation
THEN
The system performs the database search using the configured search parameters and retrieval method
R-GCCUSIO-cbl-00525 (+3) File: GCCUSIO.cbl Build Secondary SSA Parameters Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Secondary SSA Parameters':
  • Context - a request to build secondary ssa parameters for database access:
    For Is Function GU or GN?:
    When the function code is gu (get unique) or gn (get next) and the secondary key (gcsuss00-key) is empty spaces, then set error code '0012' and error message 'secn-key equal spaces' to indicate invalid parameters.
  • Context - a valid secondary key is provided for database access:
    For Map Secondary Key to Search Value:
    When building ssa parameters for secondary segment access, then map the secondary key (gcsuss00-key) to the database search value (gca2-key-value).
  • Context - secondary key mapping is completed successfully:
    For Set PCB Path for Secondary Database:
    When configuring database access parameters, then set the pcb (program communication block) to gca2-pcb for secondary database path.
  • Context - database path is configured and search key is mapped:
    For Construct Qualified SSA Statement:
    When finalizing ssa parameters for database access, then set the ssa statement to gca2-ssa-qual (qualified ssa) for targeted record retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A request to build secondary SSA parameters for database access
GIVEN
A request to build secondary SSA parameters for database access
Applied to: Is Function GU or GN?
WHEN
The function code is GU (Get Unique) or GN (Get Next) AND the secondary key (GCSUSS00-KEY) is empty spaces
THEN
Set error code '0012' and error message 'SECN-KEY EQUAL SPACES' to indicate invalid parameters
Context: A valid secondary key is provided for database access
GIVEN
A valid secondary key is provided for database access
Applied to: Map Secondary Key to Search Value
WHEN
Building SSA parameters for secondary segment access
THEN
Map the secondary key (GCSUSS00-KEY) to the database search value (GCA2-KEY-VALUE)
Context: Secondary key mapping is completed successfully
GIVEN
Secondary key mapping is completed successfully
Applied to: Set PCB Path for Secondary Database
WHEN
Configuring database access parameters
THEN
Set the PCB (Program Communication Block) to GCA2-PCB for secondary database path
Context: Database path is configured and search key is mapped
GIVEN
Database path is configured and search key is mapped
Applied to: Construct Qualified SSA Statement
WHEN
Finalizing SSA parameters for database access
THEN
Set the SSA statement to GCA2-SSA-QUAL (qualified SSA) for targeted record retrieval
R-GCCUSIO-cbl-00529 (+5) File: GCCUSIO.cbl Validate Secondary Data Content Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Secondary Data Content':
  • Context - secondary cargo data is being processed for repl function:
    For Check Cargo Data Content:
    When the cargo data equals all spaces or all low-values or all underscores, then mark the data as empty and invalid for processing.
  • Context - secondary cargo data is being processed:
    For Mark Data as Valid:
    When the cargo data does not equal all spaces and does not equal all low-values and does not equal all underscores, then mark the data as valid and continue with normal processing.
  • Context - function code is isrt for secondary cargo data:
    For Skip INSERT Operation:
    When the cargo data equals all spaces or all low-values or all underscores, then skip the insert operation and do not create a record.
  • Context - function code is repl for secondary cargo data and existing record is found:
    For Perform DELETE Operation:
    When the replacement cargo data equals all spaces or all low-values or all underscores, then perform delete operation to remove the existing record.
    For Continue with Normal Processing:
    When the replacement cargo data does not equal all spaces and does not equal all low-values and does not equal all underscores, then perform repl operation to update the existing record with new data.
  • Context - function code is repl for secondary cargo data and no existing record is found:
    For Continue with Normal Processing:
    When the cargo data does not equal all spaces and does not equal all low-values and does not equal all underscores, then perform isrt operation to create a new record.
👨‍💻 Technical ACs (Gherkin)
Context: Secondary cargo data is being processed for REPL function
GIVEN
Secondary cargo data is being processed for REPL function
Applied to: Check Cargo Data Content
WHEN
The cargo data equals ALL SPACES OR ALL LOW-VALUES OR ALL UNDERSCORES
THEN
Mark the data as empty and invalid for processing
Context: Secondary cargo data is being processed
GIVEN
Secondary cargo data is being processed
Applied to: Mark Data as Valid
WHEN
The cargo data does NOT equal ALL SPACES AND does NOT equal ALL LOW-VALUES AND does NOT equal ALL UNDERSCORES
THEN
Mark the data as valid and continue with normal processing
Context: Function code is ISRT for secondary cargo data
GIVEN
Function code is ISRT for secondary cargo data
Applied to: Skip INSERT Operation
WHEN
The cargo data equals ALL SPACES OR ALL LOW-VALUES OR ALL UNDERSCORES
THEN
Skip the INSERT operation and do not create a record
Context: Function code is REPL for secondary cargo data AND existing record is found
GIVEN
Function code is REPL for secondary cargo data AND existing record is found
Applied to: Perform DELETE Operation
WHEN
The replacement cargo data equals ALL SPACES OR ALL LOW-VALUES OR ALL UNDERSCORES
THEN
Perform DELETE operation to remove the existing record
Applied to: Continue with Normal Processing
WHEN
The replacement cargo data does NOT equal ALL SPACES AND does NOT equal ALL LOW-VALUES AND does NOT equal ALL UNDERSCORES
THEN
Perform REPL operation to update the existing record with new data
Context: Function code is REPL for secondary cargo data AND no existing record is found
GIVEN
Function code is REPL for secondary cargo data AND no existing record is found
Applied to: Continue with Normal Processing
WHEN
The cargo data does NOT equal ALL SPACES AND does NOT equal ALL LOW-VALUES AND does NOT equal ALL UNDERSCORES
THEN
Perform ISRT operation to create a new record
R-GCX126-cbl-00532 (+16) File: GCX126R.cbl Update Border Arrival for All Follower Manifests Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Border Arrival for All Follower Manifests':
  • Context - a master manifest cargo record has been identified for border arrival acknowledgment:
    For Save Master CCN Key, Initialize Follower Manifest Array, Set Index to 1:
    When the system begins processing follower manifests, then the master manifest ccn key is saved, the follower manifest array is cleared of any previous data, the follower manifest counter is set to 1, and the end-of-database flag is set to indicate more records may exist.
  • Context - the system is searching for follower manifests associated with a master manifest ccn:
    For Get Next Cargo Record:
    When the system requests the next cargo record using the get next function with the master manifest ccn as the search key, then the next cargo record is retrieved from the cargo table and made available for evaluation.
  • Context - a cargo record has been retrieved from the database:
    For Status Code = Blank AND Master CCN Matches?:
    When the system evaluates the cargo record, then if the database status code is blank (indicating successful retrieval) and the cargo record's master manifest ccn equals the saved master ccn, the record is considered valid for further processing; otherwise, the record is skipped.
  • Context - a cargo record has been validated as belonging to the master manifest group:
    For Is Follower Manifest?:
    When the system checks the manifest type indicator, then if the cargo record is identified as a follower manifest (not the master manifest), it is selected for inclusion in the follower array; otherwise, it is skipped.
  • Context - a cargo record has been identified as a follower manifest:
    For Store Follower CCN in Array, Increment Index:
    When the system stores the follower information, then the follower manifest's ccn key is stored in the follower manifest array at the current index position, and the index counter is incremented by 1.
  • Context - the system is collecting follower manifest ccns:
    For End of Database OR Index > 100?:
    When the system checks whether to continue retrieving more cargo records, then if the end of database is reached or the index counter exceeds 100, the collection process stops; otherwise, the system continues to retrieve the next cargo record.
  • Context - the system has completed collecting follower manifest ccns:
    For Subtract 1 from Index:
    When the collection loop terminates, then the index counter is decremented by 1 to convert from a 1-based counter to the actual count of follower manifests stored in the array.
  • Context - the follower manifest collection process has completed and the index has been adjusted:
    For Index <= 0?:
    When the system checks if any follower manifests were found, then if the adjusted index is less than or equal to 0, no follower manifests exist and processing terminates; otherwise, the system proceeds to update each follower manifest.
  • Context - at least one follower manifest ccn has been collected in the array:
    For Set Loop Counter J to 1:
    When the system prepares to update follower manifests, then the loop counter j is set to 1 to begin processing from the first follower manifest in the array.
  • Context - the system is iterating through the follower manifest array:
    For Follower CCN Empty OR J > Index?:
    When the system checks whether to process the next follower manifest, then if the current follower ccn position is empty (spaces or low-values) or the loop counter j exceeds the total count of follower manifests (index), the update loop terminates; otherwise, processing continues with the current follower ccn.
  • Context - the loop counter j points to a valid position in the follower manifest array:
    For Get Follower CCN from Array:
    When the system prepares to update a follower manifest, then the follower manifest ccn at position j is retrieved from the array and set as the search key for cargo record retrieval.
  • Context - a follower manifest ccn has been retrieved from the array:
    For Retrieve Follower Cargo Record by CCN:
    When the system requests the cargo record using the get hold update function with the follower ccn as the key, then the follower cargo record is retrieved from the cargo table and locked for update.
  • Context - the system has attempted to retrieve a follower cargo record by ccn:
    For Cargo Found?:
    When the system evaluates the retrieval result, then if the cargo record is found (cargo-found flag is true), the system proceeds to update the border arrival acknowledgment; otherwise, the system skips to the next follower manifest.
  • Context - a follower cargo record has been successfully retrieved:
    For Log Border Arrival Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the system prepares to update the border arrival status, then an information message '350 ack - arrival ack at border' is logged to the cargo history with the current follower ccn as the reference.
  • Context - the border arrival message has been logged for the follower manifest:
    For Set Border Arrival Acknowledgment Flag:
    When the system updates the cargo record status, then the border arrival acknowledgment flag in the cargo record is set to true to indicate customs has acknowledged the cargo's arrival at the border.
  • Context - the follower cargo record has been updated with the border arrival acknowledgment flag:
    For Update Follower Cargo Record:
    When the system commits the changes, then the updated cargo record is written back to the cargo table using the replace function to persist the border arrival acknowledgment.
  • Context - a follower manifest has been processed (either updated or skipped):
    For Increment Loop Counter J:
    When the system prepares to process the next follower, then the loop counter j is incremented by 1 to point to the next follower manifest ccn in the array.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest cargo record has been identified for border arrival acknowledgment
GIVEN
A master manifest cargo record has been identified for border arrival acknowledgment
Applied to: Save Master CCN Key, Initialize Follower Manifest Array, Set Index to 1
WHEN
The system begins processing follower manifests
THEN
The master manifest CCN key is saved, the follower manifest array is cleared of any previous data, the follower manifest counter is set to 1, and the end-of-database flag is set to indicate more records may exist
Context: The system is searching for follower manifests associated with a master manifest CCN
GIVEN
The system is searching for follower manifests associated with a master manifest CCN
Applied to: Get Next Cargo Record
WHEN
The system requests the next cargo record using the Get Next function with the master manifest CCN as the search key
THEN
The next cargo record is retrieved from the cargo table and made available for evaluation
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Status Code = Blank AND Master CCN Matches?
WHEN
The system evaluates the cargo record
THEN
If the database status code is blank (indicating successful retrieval) AND the cargo record's master manifest CCN equals the saved master CCN, the record is considered valid for further processing; otherwise, the record is skipped
Context: A cargo record has been validated as belonging to the master manifest group
GIVEN
A cargo record has been validated as belonging to the master manifest group
Applied to: Is Follower Manifest?
WHEN
The system checks the manifest type indicator
THEN
If the cargo record is identified as a follower manifest (not the master manifest), it is selected for inclusion in the follower array; otherwise, it is skipped
Context: A cargo record has been identified as a follower manifest
GIVEN
A cargo record has been identified as a follower manifest
Applied to: Store Follower CCN in Array, Increment Index
WHEN
The system stores the follower information
THEN
The follower manifest's CCN key is stored in the follower manifest array at the current index position, and the index counter is incremented by 1
Context: The system is collecting follower manifest CCNs
GIVEN
The system is collecting follower manifest CCNs
Applied to: End of Database OR Index > 100?
WHEN
The system checks whether to continue retrieving more cargo records
THEN
If the end of database is reached OR the index counter exceeds 100, the collection process stops; otherwise, the system continues to retrieve the next cargo record
Context: The system has completed collecting follower manifest CCNs
GIVEN
The system has completed collecting follower manifest CCNs
Applied to: Subtract 1 from Index
WHEN
The collection loop terminates
THEN
The index counter is decremented by 1 to convert from a 1-based counter to the actual count of follower manifests stored in the array
Context: The follower manifest collection process has completed and the index has been adjusted
GIVEN
The follower manifest collection process has completed and the index has been adjusted
Applied to: Index <= 0?
WHEN
The system checks if any follower manifests were found
THEN
If the adjusted index is less than or equal to 0, no follower manifests exist and processing terminates; otherwise, the system proceeds to update each follower manifest
Context: At least one follower manifest CCN has been collected in the array
GIVEN
At least one follower manifest CCN has been collected in the array
Applied to: Set Loop Counter J to 1
WHEN
The system prepares to update follower manifests
THEN
The loop counter J is set to 1 to begin processing from the first follower manifest in the array
Context: The system is iterating through the follower manifest array
GIVEN
The system is iterating through the follower manifest array
Applied to: Follower CCN Empty OR J > Index?
WHEN
The system checks whether to process the next follower manifest
THEN
If the current follower CCN position is empty (spaces or low-values) OR the loop counter J exceeds the total count of follower manifests (Index), the update loop terminates; otherwise, processing continues with the current follower CCN
Context: The loop counter J points to a valid position in the follower manifest array
GIVEN
The loop counter J points to a valid position in the follower manifest array
Applied to: Get Follower CCN from Array
WHEN
The system prepares to update a follower manifest
THEN
The follower manifest CCN at position J is retrieved from the array and set as the search key for cargo record retrieval
Context: A follower manifest CCN has been retrieved from the array
GIVEN
A follower manifest CCN has been retrieved from the array
Applied to: Retrieve Follower Cargo Record by CCN
WHEN
The system requests the cargo record using the Get Hold Update function with the follower CCN as the key
THEN
The follower cargo record is retrieved from the cargo table and locked for update
Context: The system has attempted to retrieve a follower cargo record by CCN
GIVEN
The system has attempted to retrieve a follower cargo record by CCN
Applied to: Cargo Found?
WHEN
The system evaluates the retrieval result
THEN
If the cargo record is found (cargo-found flag is true), the system proceeds to update the border arrival acknowledgment; otherwise, the system skips to the next follower manifest
Context: A follower cargo record has been successfully retrieved
GIVEN
A follower cargo record has been successfully retrieved
Applied to: Log Border Arrival Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The system prepares to update the border arrival status
THEN
An information message '350 ACK - ARRIVAL ACK AT BORDER' is logged to the cargo history with the current follower CCN as the reference
Context: The border arrival message has been logged for the follower manifest
GIVEN
The border arrival message has been logged for the follower manifest
Applied to: Set Border Arrival Acknowledgment Flag
WHEN
The system updates the cargo record status
THEN
The border arrival acknowledgment flag in the cargo record is set to true to indicate customs has acknowledged the cargo's arrival at the border
Context: The follower cargo record has been updated with the border arrival acknowledgment flag
GIVEN
The follower cargo record has been updated with the border arrival acknowledgment flag
Applied to: Update Follower Cargo Record
WHEN
The system commits the changes
THEN
The updated cargo record is written back to the cargo table using the Replace function to persist the border arrival acknowledgment
Context: A follower manifest has been processed (either updated or skipped)
GIVEN
A follower manifest has been processed (either updated or skipped)
Applied to: Increment Loop Counter J
WHEN
The system prepares to process the next follower
THEN
The loop counter J is incremented by 1 to point to the next follower manifest CCN in the array
R-GCCUSIO-cbl-00535 (+11) File: GCCUSIO.cbl Structure Message Segment Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Structure Message Segment':
  • Context - a message segment insert or replace operation is being performed:
    For Save Original IO Area:
    When the operation type is isrt or repl, then the original io area content must be saved to working storage before any modifications.
  • Context - a message segment operation requires key extraction:
    For Extract Message Key from Input:
    When the operation is insert or replace, then the message key must be extracted from the gcwusio input area to the working storage key field.
  • Context - a message segment requires data extraction:
    For Extract Message Data from Input:
    When processing insert or replace operations, then the message data content must be extracted from the saved io area to working storage data field.
  • Context - message key has been extracted from input:
    For Move Key to Working Storage Key Field:
    When structuring a message segment, then the key must be moved to the appropriate working storage key field.
  • Context - message data has been extracted from input:
    For Move Data to Working Storage Data Field:
    When structuring a message segment, then the data must be moved to the appropriate working storage data field.
  • Context - message key and data are in working storage fields:
    For Combine Key and Data into Segment Format:
    When creating a structured segment for database operations, then the key and data must be combined into the complete segment structure in working storage.
  • Context - a complete segment structure exists in working storage:
    For Move Structured Segment to IO Area:
    When preparing for database insert or replace operation, then the structured segment must be moved to the gcwusio io area.
  • Context - a message segment retrieval operation is requested:
    For Validate Key Not Spaces:
    When the function code is gu or gn and the message key is spaces, then an error must be set indicating the key cannot be spaces.
  • Context - a retrieval operation has an empty message key:
    For Set Error - Key Cannot be Spaces:
    When key validation fails for gu or gn operations, then error number '0012' and message 'gcsa8rt-key equal spaces' must be set.
  • Context - a valid message key exists for retrieval:
    For Retrieve Message Segment:
    When processing gu operations with valid key, then the message segment must be retrieved using the qualified ssa and appropriate pcb.
  • Context - a message segment has been successfully retrieved:
    For Extract Segment into Working Storage:
    When processing the retrieved segment data, then the complete segment must be moved to working storage for data extraction.
  • Context - message segment data has been extracted to working storage:
    For Move Data Portion to IO Area:
    When preparing retrieval operation response, then only the data portion must be moved back to the gcwusio io area.
👨‍💻 Technical ACs (Gherkin)
Context: A message segment insert or replace operation is being performed
GIVEN
A message segment insert or replace operation is being performed
Applied to: Save Original IO Area
WHEN
The operation type is ISRT or REPL
THEN
The original IO area content must be saved to working storage before any modifications
Context: A message segment operation requires key extraction
GIVEN
A message segment operation requires key extraction
Applied to: Extract Message Key from Input
WHEN
The operation is insert or replace
THEN
The message key must be extracted from the GCWUSIO input area to the working storage key field
Context: A message segment requires data extraction
GIVEN
A message segment requires data extraction
Applied to: Extract Message Data from Input
WHEN
Processing insert or replace operations
THEN
The message data content must be extracted from the saved IO area to working storage data field
Context: Message key has been extracted from input
GIVEN
Message key has been extracted from input
Applied to: Move Key to Working Storage Key Field
WHEN
Structuring a message segment
THEN
The key must be moved to the appropriate working storage key field
Context: Message data has been extracted from input
GIVEN
Message data has been extracted from input
Applied to: Move Data to Working Storage Data Field
WHEN
Structuring a message segment
THEN
The data must be moved to the appropriate working storage data field
Context: Message key and data are in working storage fields
GIVEN
Message key and data are in working storage fields
Applied to: Combine Key and Data into Segment Format
WHEN
Creating a structured segment for database operations
THEN
The key and data must be combined into the complete segment structure in working storage
Context: A complete segment structure exists in working storage
GIVEN
A complete segment structure exists in working storage
Applied to: Move Structured Segment to IO Area
WHEN
Preparing for database insert or replace operation
THEN
The structured segment must be moved to the GCWUSIO IO area
Context: A message segment retrieval operation is requested
GIVEN
A message segment retrieval operation is requested
Applied to: Validate Key Not Spaces
WHEN
The function code is GU or GN and the message key is spaces
THEN
An error must be set indicating the key cannot be spaces
Context: A retrieval operation has an empty message key
GIVEN
A retrieval operation has an empty message key
Applied to: Set Error - Key Cannot be Spaces
WHEN
Key validation fails for GU or GN operations
THEN
Error number '0012' and message 'GCSA8RT-KEY EQUAL SPACES' must be set
Context: A valid message key exists for retrieval
GIVEN
A valid message key exists for retrieval
Applied to: Retrieve Message Segment
WHEN
Processing GU operations with valid key
THEN
The message segment must be retrieved using the qualified SSA and appropriate PCB
Context: A message segment has been successfully retrieved
GIVEN
A message segment has been successfully retrieved
Applied to: Extract Segment into Working Storage
WHEN
Processing the retrieved segment data
THEN
The complete segment must be moved to working storage for data extraction
Context: Message segment data has been extracted to working storage
GIVEN
Message segment data has been extracted to working storage
Applied to: Move Data Portion to IO Area
WHEN
Preparing retrieval operation response
THEN
Only the data portion must be moved back to the GCWUSIO IO area
R-GCCUSIO-cbl-00547 (+6) File: GCCUSIO.cbl Lookup Border Station Information Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Border Station Information':
  • Context - a border station lookup is required for error index population:
    For Initialize Table Lookup Parameters:
    When the system prepares to lookup border station information, then all table lookup parameters are cleared to spaces and flags are reset to ensure clean initialization.
  • Context - border station lookup parameters are initialized:
    For Set Function Code to 'GU':
    When the system prepares to retrieve border station information, then the function code is set to 'gu' to perform a unique record retrieval.
  • Context - function code is set for border station lookup:
    For Set Table ID to 'MC':
    When the system identifies which table contains border station data, then the table id is set to 'mc' to access the border station reference table.
  • Context - mc table is identified for border station lookup:
    For Set Location ID from Cargo Record:
    When the system needs to specify which location to lookup, then the location id from the cargo record is used as the search sequence id for the mc table lookup.
  • Context - all lookup parameters are set with mc table id and location id:
    For Call Table Lookup Service GCCTBIO:
    When the system executes the border station lookup, then the gcctbio table lookup service is called with the prepared parameters to retrieve border station data.
  • Context - border station table lookup service has been executed:
    For Lookup Successful?:
    When the system checks the lookup result, then if return flag equals '0' then lookup is successful, otherwise lookup failed.
  • Context - border station lookup was successful with return flag '0':
    For Extract Border Station Number from MC Segment:
    When the system processes the retrieved mc table segment, then the border station number is extracted from the mc segment and made available for error index population.
👨‍💻 Technical ACs (Gherkin)
Context: A border station lookup is required for error index population
GIVEN
A border station lookup is required for error index population
Applied to: Initialize Table Lookup Parameters
WHEN
The system prepares to lookup border station information
THEN
All table lookup parameters are cleared to spaces and flags are reset to ensure clean initialization
Context: Border station lookup parameters are initialized
GIVEN
Border station lookup parameters are initialized
Applied to: Set Function Code to 'GU'
WHEN
The system prepares to retrieve border station information
THEN
The function code is set to 'GU' to perform a unique record retrieval
Context: Function code is set for border station lookup
GIVEN
Function code is set for border station lookup
Applied to: Set Table ID to 'MC'
WHEN
The system identifies which table contains border station data
THEN
The table ID is set to 'MC' to access the border station reference table
Context: MC table is identified for border station lookup
GIVEN
MC table is identified for border station lookup
Applied to: Set Location ID from Cargo Record
WHEN
The system needs to specify which location to lookup
THEN
The location ID from the cargo record is used as the search sequence ID for the MC table lookup
Context: All lookup parameters are set with MC table ID and location ID
GIVEN
All lookup parameters are set with MC table ID and location ID
Applied to: Call Table Lookup Service GCCTBIO
WHEN
The system executes the border station lookup
THEN
The GCCTBIO table lookup service is called with the prepared parameters to retrieve border station data
Context: Border station table lookup service has been executed
GIVEN
Border station table lookup service has been executed
Applied to: Lookup Successful?
WHEN
The system checks the lookup result
THEN
If return flag equals '0' then lookup is successful, otherwise lookup failed
Context: Border station lookup was successful with return flag '0'
GIVEN
Border station lookup was successful with return flag '0'
Applied to: Extract Border Station Number from MC Segment
WHEN
The system processes the retrieved MC table segment
THEN
The border station number is extracted from the MC segment and made available for error index population
R-GCX126-cbl-00549 (+23) File: GCX126R.cbl Retrieve All Follower Manifests for Master CCN Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve All Follower Manifests for Master CCN':
  • Context - a master manifest cargo record needs to have its follower manifests retrieved:
    For Initialize Follower Manifest Array, Set Index I = 1, Set Not End of Database Flag:
    When the follower manifest retrieval process begins, then the follower manifest array is cleared to spaces, the array index is set to 1, and the end-of-database flag is set to indicate more records may exist.
  • Context - a cargo record has been identified as a master manifest with a valid ccn key:
    For Set Master CCN Key from Current Cargo Record:
    When the system prepares to search for follower manifests, then the master manifest's ccn key is set as the search criterion for retrieving related follower manifests from the cargo database.
  • Context - a master ccn key has been established as the search criterion:
    For Get Next Cargo Record Using Master CCN Key:
    When the system requests the next cargo record from the database, then the database returns the next cargo record where the master manifest ccn matches the search key, and the database status code is set to indicate success or failure.
  • Context - a database call has been executed to retrieve a cargo record:
    For Database Status OK?:
    When the system evaluates the database status code, then if the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the end-of-database flag is set to terminate the retrieval loop.
  • Context - a cargo record has been successfully retrieved from the database:
    For Master CCN Matches?:
    When the system compares the retrieved record's master manifest ccn with the search key, then if the master manifest ccn in the retrieved record equals the search key, processing continues to check if it is a follower; otherwise, the end-of-database flag is set to terminate the retrieval loop.
    For Master Manifest CCN Matches Current CCN?:
    When the master manifest ccn field (gccc-master-mfst-ccn) in the cargo record is compared with the current master ccn (ws-save-ccn), then if they match, the cargo is part of the master manifest hierarchy and processing continues; otherwise, the end of database flag is set to true indicating no more related records.
  • Context - a cargo record has been retrieved and its master ccn has been verified to match the search key:
    For Is Follower Manifest?:
    When the system checks the manifest type indicator of the cargo record, then if the cargo record is identified as a follower manifest, its ccn is stored in the follower array; if it is the master manifest itself, the system skips storage and checks the array size limit.
  • Context - a cargo record has been confirmed as a follower manifest with a valid ccn:
    For Store Follower CCN in Array Position I:
    When the system stores the follower information, then the follower manifest's ccn is moved to the array position indicated by the current index value i.
  • Context - a follower manifest ccn has been successfully stored in the array:
    For Increment Index I:
    When the system prepares to process the next potential follower, then the array index i is incremented by 1.
  • Context - the array index i has been incremented after storing a follower ccn or skipping a master record:
    For Index I > 100?:
    When the system checks the current value of index i, then if index i is greater than 100, the end-of-database flag is set to terminate the retrieval loop; otherwise, the system continues to retrieve the next cargo record.
  • Context - one of the following conditions has occurred: database status is not ok, master ccn does not match, or the follower array limit has been exceeded:
    For Set End of Database Flag:
    When the system sets the end-of-database flag, then the end-of-database flag is set to true, which will cause the retrieval loop to terminate.
  • Context - the retrieval loop has terminated with the end-of-database flag set:
    For Subtract 1 from Index I - Final Count of Followers:
    When the system calculates the final count of follower manifests, then the value 1 is subtracted from index i to obtain the actual count of follower manifests stored in the array.
  • Context - the final follower count has been calculated by subtracting 1 from index i:
    For Follower Count > 0?:
    When the system checks if any followers were found, then if the adjusted index i is less than or equal to 0, no follower manifests were found and the process exits; if i is greater than 0, follower manifests exist and are available for further processing.
  • Context - a master manifest ccn needs to be processed for follower manifests:
    For Initialize Follower Manifest Array:
    When the follower manifest retrieval process begins, then the follower manifest array is cleared to spaces, the counter i is set to 1, and the database end flag is set to indicate not end of database.
  • Context - follower manifests are being retrieved for a master manifest:
    For End of Database OR Counter > 100?:
    When the counter i exceeds 100 or the end of database flag is set to true, then the retrieval loop terminates and proceeds to finalize the count.
  • Context - the master manifest ccn is stored in gcb0rt-ccn-key:
    For Get Next Cargo Record Using Master CCN:
    When the system needs to find the next cargo record in the hierarchy, then a database call is made using function code gn (get next) with the cargo report segment and the master ccn qualifier to retrieve the next record.
  • Context - a database call has been made to retrieve the next cargo record:
    For Status Code = Blank?:
    When the status code from the database call is evaluated, then if the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the end of database flag is set to true.
  • Context - a cargo record has been retrieved and verified to belong to the master manifest hierarchy:
    For Is Follower Manifest?:
    When the manifest type indicator (gccc-follower-mfst) is evaluated, then if the cargo record is identified as a follower manifest (not a master manifest), it is eligible for collection; otherwise, the loop continues to the next record.
  • Context - a cargo record has been identified as a follower manifest belonging to the master manifest:
    For Store Follower CCN in Array Position I:
    When the follower manifest ccn needs to be stored, then the ccn key (gccc-ccn-key) is moved to the follower manifest array at position i (ws-follower-mani(i)).
  • Context - a follower manifest ccn has been stored in the array:
    For Increment Counter I:
    When the counter needs to be updated for the next iteration, then the counter i is incremented by 1.
  • Context - the follower manifest retrieval loop has completed (either by reaching end of database or maximum count):
    For Subtract 1 from Counter I:
    When the final count needs to be determined, then the counter i is decremented by 1 to represent the actual number of follower manifests stored in the array.
  • Context - the follower manifest retrieval process has completed and the counter has been adjusted:
    For Counter I <= 0?:
    When the final count (i) is evaluated, then if i is less than or equal to 0, no follower manifests were found and processing exits; if i is greater than 0, the follower manifest array contains valid entries for processing.
  • Context - the follower manifest count is zero or negative:
    For Return: No Follower Manifests Found:
    When the system needs to complete the retrieval process, then control returns to the calling process with an empty follower manifest array, and no further follower processing occurs.
  • Context - the follower manifest count is greater than zero and the array contains valid follower ccns:
    For Return: Follower Manifests Array Populated:
    When the system needs to apply release information to follower manifests, then control proceeds to iterate through the follower manifest array and apply the same release information to each follower that was applied to the master manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest cargo record needs to have its follower manifests retrieved
GIVEN
A master manifest cargo record needs to have its follower manifests retrieved
Applied to: Initialize Follower Manifest Array, Set Index I = 1, Set Not End of Database Flag
WHEN
The follower manifest retrieval process begins
THEN
The follower manifest array is cleared to spaces, the array index is set to 1, and the end-of-database flag is set to indicate more records may exist
Context: A cargo record has been identified as a master manifest with a valid CCN key
GIVEN
A cargo record has been identified as a master manifest with a valid CCN key
Applied to: Set Master CCN Key from Current Cargo Record
WHEN
The system prepares to search for follower manifests
THEN
The master manifest's CCN key is set as the search criterion for retrieving related follower manifests from the cargo database
Context: A master CCN key has been established as the search criterion
GIVEN
A master CCN key has been established as the search criterion
Applied to: Get Next Cargo Record Using Master CCN Key
WHEN
The system requests the next cargo record from the database
THEN
The database returns the next cargo record where the master manifest CCN matches the search key, and the database status code is set to indicate success or failure
Context: A database call has been executed to retrieve a cargo record
GIVEN
A database call has been executed to retrieve a cargo record
Applied to: Database Status OK?
WHEN
The system evaluates the database status code
THEN
If the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the end-of-database flag is set to terminate the retrieval loop
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Master CCN Matches?
WHEN
The system compares the retrieved record's master manifest CCN with the search key
THEN
If the master manifest CCN in the retrieved record equals the search key, processing continues to check if it is a follower; otherwise, the end-of-database flag is set to terminate the retrieval loop
Applied to: Master Manifest CCN Matches Current CCN?
WHEN
The master manifest CCN field (GCCC-MASTER-MFST-CCN) in the cargo record is compared with the current master CCN (WS-SAVE-CCN)
THEN
If they match, the cargo is part of the master manifest hierarchy and processing continues; otherwise, the end of database flag is set to true indicating no more related records
Context: A cargo record has been retrieved and its master CCN has been verified to match the search key
GIVEN
A cargo record has been retrieved and its master CCN has been verified to match the search key
Applied to: Is Follower Manifest?
WHEN
The system checks the manifest type indicator of the cargo record
THEN
If the cargo record is identified as a follower manifest, its CCN is stored in the follower array; if it is the master manifest itself, the system skips storage and checks the array size limit
Context: A cargo record has been confirmed as a follower manifest with a valid CCN
GIVEN
A cargo record has been confirmed as a follower manifest with a valid CCN
Applied to: Store Follower CCN in Array Position I
WHEN
The system stores the follower information
THEN
The follower manifest's CCN is moved to the array position indicated by the current index value I
Context: A follower manifest CCN has been successfully stored in the array
GIVEN
A follower manifest CCN has been successfully stored in the array
Applied to: Increment Index I
WHEN
The system prepares to process the next potential follower
THEN
The array index I is incremented by 1
Context: The array index I has been incremented after storing a follower CCN or skipping a master record
GIVEN
The array index I has been incremented after storing a follower CCN or skipping a master record
Applied to: Index I > 100?
WHEN
The system checks the current value of index I
THEN
If index I is greater than 100, the end-of-database flag is set to terminate the retrieval loop; otherwise, the system continues to retrieve the next cargo record
Context: One of the following conditions has occurred: database status is not OK, master CCN does not match, or the follower array limit has been exceeded
GIVEN
One of the following conditions has occurred: database status is not OK, master CCN does not match, or the follower array limit has been exceeded
Applied to: Set End of Database Flag
WHEN
The system sets the end-of-database flag
THEN
The end-of-database flag is set to true, which will cause the retrieval loop to terminate
Context: The retrieval loop has terminated with the end-of-database flag set
GIVEN
The retrieval loop has terminated with the end-of-database flag set
Applied to: Subtract 1 from Index I - Final Count of Followers
WHEN
The system calculates the final count of follower manifests
THEN
The value 1 is subtracted from index I to obtain the actual count of follower manifests stored in the array
Context: The final follower count has been calculated by subtracting 1 from index I
GIVEN
The final follower count has been calculated by subtracting 1 from index I
Applied to: Follower Count > 0?
WHEN
The system checks if any followers were found
THEN
If the adjusted index I is less than or equal to 0, no follower manifests were found and the process exits; if I is greater than 0, follower manifests exist and are available for further processing
Context: A master manifest CCN needs to be processed for follower manifests
GIVEN
A master manifest CCN needs to be processed for follower manifests
Applied to: Initialize Follower Manifest Array
WHEN
The follower manifest retrieval process begins
THEN
The follower manifest array is cleared to spaces, the counter I is set to 1, and the database end flag is set to indicate not end of database
Context: Follower manifests are being retrieved for a master manifest
GIVEN
Follower manifests are being retrieved for a master manifest
Applied to: End of Database OR Counter > 100?
WHEN
The counter I exceeds 100 OR the end of database flag is set to true
THEN
The retrieval loop terminates and proceeds to finalize the count
Context: The master manifest CCN is stored in GCB0RT-CCN-KEY
GIVEN
The master manifest CCN is stored in GCB0RT-CCN-KEY
Applied to: Get Next Cargo Record Using Master CCN
WHEN
The system needs to find the next cargo record in the hierarchy
THEN
A database call is made using function code GN (Get Next) with the cargo report segment and the master CCN qualifier to retrieve the next record
Context: A database call has been made to retrieve the next cargo record
GIVEN
A database call has been made to retrieve the next cargo record
Applied to: Status Code = Blank?
WHEN
The status code from the database call is evaluated
THEN
If the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the end of database flag is set to true
Context: A cargo record has been retrieved and verified to belong to the master manifest hierarchy
GIVEN
A cargo record has been retrieved and verified to belong to the master manifest hierarchy
Applied to: Is Follower Manifest?
WHEN
The manifest type indicator (GCCC-FOLLOWER-MFST) is evaluated
THEN
If the cargo record is identified as a follower manifest (not a master manifest), it is eligible for collection; otherwise, the loop continues to the next record
Context: A cargo record has been identified as a follower manifest belonging to the master manifest
GIVEN
A cargo record has been identified as a follower manifest belonging to the master manifest
Applied to: Store Follower CCN in Array Position I
WHEN
The follower manifest CCN needs to be stored
THEN
The CCN key (GCCC-CCN-KEY) is moved to the follower manifest array at position I (WS-FOLLOWER-MANI(I))
Context: A follower manifest CCN has been stored in the array
GIVEN
A follower manifest CCN has been stored in the array
Applied to: Increment Counter I
WHEN
The counter needs to be updated for the next iteration
THEN
The counter I is incremented by 1
Context: The follower manifest retrieval loop has completed (either by reaching end of database or maximum count)
GIVEN
The follower manifest retrieval loop has completed (either by reaching end of database or maximum count)
Applied to: Subtract 1 from Counter I
WHEN
The final count needs to be determined
THEN
The counter I is decremented by 1 to represent the actual number of follower manifests stored in the array
Context: The follower manifest retrieval process has completed and the counter has been adjusted
GIVEN
The follower manifest retrieval process has completed and the counter has been adjusted
Applied to: Counter I <= 0?
WHEN
The final count (I) is evaluated
THEN
If I is less than or equal to 0, no follower manifests were found and processing exits; if I is greater than 0, the follower manifest array contains valid entries for processing
Context: The follower manifest count is zero or negative
GIVEN
The follower manifest count is zero or negative
Applied to: Return: No Follower Manifests Found
WHEN
The system needs to complete the retrieval process
THEN
Control returns to the calling process with an empty follower manifest array, and no further follower processing occurs
Context: The follower manifest count is greater than zero and the array contains valid follower CCNs
GIVEN
The follower manifest count is greater than zero and the array contains valid follower CCNs
Applied to: Return: Follower Manifests Array Populated
WHEN
The system needs to apply release information to follower manifests
THEN
Control proceeds to iterate through the follower manifest array and apply the same release information to each follower that was applied to the master manifest
R-GCCUSIO-cbl-00554 (+8) File: GCCUSIO.cbl Build IH Table Lookup Parameters Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build IH Table Lookup Parameters':
  • Context - the system needs to retrieve iron highway table configuration:
    For Set Function Code to 'GU':
    When ih table lookup parameters are being initialized, then the function code should be set to 'gu' for get unique operation.
  • Context - the system is preparing to lookup iron highway table data:
    For Set Accept Status to 'GE':
    When table lookup parameters are being configured, then the accept status should be set to 'ge' to handle table not found conditions gracefully.
  • Context - the system is preparing iron highway table lookup parameters:
    For Clear Table Key Fields:
    When table key fields need to be initialized, then all table key fields including table key value, detail key value, second pcb flag, and unqualified ssa flag should be cleared to spaces.
  • Context - the system needs to access iron highway configuration data:
    For Set Table ID to 'IH':
    When table lookup parameters are being set, then the table id should be set to 'ih' to identify the iron highway configuration table.
  • Context - the system has saved waybill station information:
    For Extract Station Code from Waybill:
    When iron highway table lookup requires a station-based search key, then the station code should be extracted from the saved waybill station data and used as the search sequence id.
  • Context - a station code has been extracted from waybill information:
    For Set Station Code as Search Key:
    When iron highway table lookup parameters are being finalized, then the extracted station code should be assigned as the table search sequence id.
  • Context - the system is preparing to call iron highway table lookup service:
    For Clear Return Flag:
    When return flag needs to be initialized, then the return flag should be cleared to spaces to ensure accurate result detection.
  • Context - all iron highway table lookup parameters have been prepared including function code, table id, and station search key:
    For Call Table Lookup Service:
    When the system needs to retrieve iron highway configuration data, then the table lookup service should be called with the prepared parameters to retrieve the configuration segment.
  • Context - iron highway table lookup service has been called:
    For Table Found?:
    When the system needs to determine if the table data was found, then if the return flag equals '0' then the table was found successfully, otherwise the table was not found.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to retrieve Iron Highway table configuration
GIVEN
The system needs to retrieve Iron Highway table configuration
Applied to: Set Function Code to 'GU'
WHEN
IH table lookup parameters are being initialized
THEN
The function code should be set to 'GU' for Get Unique operation
Context: The system is preparing to lookup Iron Highway table data
GIVEN
The system is preparing to lookup Iron Highway table data
Applied to: Set Accept Status to 'GE'
WHEN
Table lookup parameters are being configured
THEN
The accept status should be set to 'GE' to handle table not found conditions gracefully
Context: The system is preparing Iron Highway table lookup parameters
GIVEN
The system is preparing Iron Highway table lookup parameters
Applied to: Clear Table Key Fields
WHEN
Table key fields need to be initialized
THEN
All table key fields including table key value, detail key value, second PCB flag, and unqualified SSA flag should be cleared to spaces
Context: The system needs to access Iron Highway configuration data
GIVEN
The system needs to access Iron Highway configuration data
Applied to: Set Table ID to 'IH'
WHEN
Table lookup parameters are being set
THEN
The table ID should be set to 'IH' to identify the Iron Highway configuration table
Context: The system has saved waybill station information
GIVEN
The system has saved waybill station information
Applied to: Extract Station Code from Waybill
WHEN
Iron Highway table lookup requires a station-based search key
THEN
The station code should be extracted from the saved waybill station data and used as the search sequence ID
Context: A station code has been extracted from waybill information
GIVEN
A station code has been extracted from waybill information
Applied to: Set Station Code as Search Key
WHEN
Iron Highway table lookup parameters are being finalized
THEN
The extracted station code should be assigned as the table search sequence ID
Context: The system is preparing to call Iron Highway table lookup service
GIVEN
The system is preparing to call Iron Highway table lookup service
Applied to: Clear Return Flag
WHEN
Return flag needs to be initialized
THEN
The return flag should be cleared to spaces to ensure accurate result detection
Context: All Iron Highway table lookup parameters have been prepared including function code, table ID, and station search key
GIVEN
All Iron Highway table lookup parameters have been prepared including function code, table ID, and station search key
Applied to: Call Table Lookup Service
WHEN
The system needs to retrieve Iron Highway configuration data
THEN
The table lookup service should be called with the prepared parameters to retrieve the configuration segment
Context: Iron Highway table lookup service has been called
GIVEN
Iron Highway table lookup service has been called
Applied to: Table Found?
WHEN
The system needs to determine if the table data was found
THEN
If the return flag equals '0' then the table was found successfully, otherwise the table was not found
R-GCX126-cbl-00561 (+19) File: GCX126R.cbl Update Border Arrival for Each Follower Manifest Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Border Arrival for Each Follower Manifest':
  • Context - a master manifest cargo record exists with a valid ccn:
    For Set Master CCN as Search Key:
    When the system needs to find all follower manifests associated with this master, then the system sets the master manifest ccn as the search key for database retrieval.
  • Context - the system is about to collect follower manifest ccns:
    For Initialize Follower Manifest Array:
    When the collection process begins, then the system clears the follower manifest array by setting all entries to spaces.
  • Context - the follower manifest collection process is starting:
    For Set Counter to 1:
    When the system prepares to iterate through cargo records, then the system sets the counter variable to 1 to begin indexing from the first position.
  • Context - a master manifest ccn is set as the search key:
    For Retrieve Next Cargo Record:
    When the system executes a database retrieval operation, then the system retrieves the next cargo record that matches or follows the master ccn in the database hierarchy.
  • Context - a cargo record retrieval operation has been executed:
    For Status Code Blank?:
    When the system checks the database operation status code, then if the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the system marks end of database and stops searching for more followers.
  • Context - a cargo record has been successfully retrieved from the database:
    For Master CCN Matches?:
    When the system compares the master manifest ccn field in the retrieved record with the search key master ccn, then if the master manifest ccn in the retrieved record matches the search key, the record is potentially a follower manifest and processing continues; otherwise, the system marks end of database and stops searching.
  • Context - a cargo record has been retrieved and its master ccn matches the search key:
    For Is Follower Manifest?:
    When the system checks the manifest type indicator in the cargo record, then if the cargo record is identified as a follower manifest (not a master manifest), it is added to the collection; if it is a master manifest, it is skipped and the system retrieves the next record.
  • Context - a cargo record has been identified as a follower manifest:
    For Store Follower CCN in Array:
    When the system needs to collect this follower for later processing, then the system stores the follower manifest ccn in the array at the position indicated by the current counter value.
  • Context - a follower manifest ccn has been stored in the array:
    For Increment Counter:
    When the system prepares to continue searching for more followers, then the system adds 1 to the counter variable to move to the next array position.
  • Context - the counter has been incremented after storing a follower manifest ccn:
    For Counter > 100?:
    When the system checks if the maximum limit has been reached, then if the counter exceeds 100, the system stops searching for more followers and proceeds to calculate the total count; otherwise, it continues retrieving the next cargo record.
  • Context - the system has attempted to retrieve a cargo record:
    For End of Database?:
    When the database operation returns a non-blank status code or the master ccn no longer matches, then the system sets the end-of-database flag and stops searching for more follower manifests.
  • Context - the search for follower manifests has completed (either by reaching the limit, end of database, or no more matches):
    For Calculate Total Follower Count:
    When the system needs to determine how many followers were actually found, then the system subtracts 1 from the counter variable to get the accurate count of follower manifests stored in the array.
  • Context - the follower manifest search has completed and the count has been calculated:
    For Any Followers Found?:
    When the system checks if any followers were collected, then if the count is less than or equal to 0, the system exits the process without performing any updates; if the count is greater than 0, the system proceeds to process each follower.
  • Context - at least one follower manifest ccn exists in the collection array:
    For Get Next Follower CCN from Array:
    When the system begins or continues the update process, then the system retrieves the next follower manifest ccn from the array based on the current iteration position.
  • Context - a follower manifest ccn has been retrieved from the collection array:
    For Retrieve Follower Cargo Record:
    When the system needs to update the follower manifest, then the system retrieves the complete cargo record from the database using the follower ccn as the key.
  • Context - the system has attempted to retrieve a follower cargo record by ccn:
    For Cargo Found?:
    When the system checks if the cargo record was found, then if the cargo record is found, the system proceeds with logging and updating; if not found, the system skips to the next follower in the collection.
  • Context - a follower manifest cargo record has been successfully retrieved:
    For Log Border Arrival Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the system prepares to update the cargo record with border arrival acknowledgment, then the system creates a log entry with the message '350 ack - arrival ack at border' associated with the follower manifest ccn.
  • Context - a follower manifest cargo record has been retrieved and logged:
    For Set Border Arrival Flag to TRUE:
    When the system updates the cargo status, then the system sets the border arrival acknowledgment flag to true in the cargo record.
  • Context - the follower cargo record has been modified with the border arrival acknowledgment flag set to true:
    For Update Follower Cargo Record:
    When the system commits the changes, then the system updates the cargo record in the database with the new border arrival acknowledgment status.
  • Context - one follower manifest has been processed (either updated or skipped):
    For More Followers to Process?:
    When the system checks the iteration status, then if there are more follower ccns in the array that have not been processed (not spaces or low-values), the system retrieves the next follower ccn; otherwise, the process completes.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest cargo record exists with a valid CCN
GIVEN
A master manifest cargo record exists with a valid CCN
Applied to: Set Master CCN as Search Key
WHEN
The system needs to find all follower manifests associated with this master
THEN
The system sets the master manifest CCN as the search key for database retrieval
Context: The system is about to collect follower manifest CCNs
GIVEN
The system is about to collect follower manifest CCNs
Applied to: Initialize Follower Manifest Array
WHEN
The collection process begins
THEN
The system clears the follower manifest array by setting all entries to spaces
Context: The follower manifest collection process is starting
GIVEN
The follower manifest collection process is starting
Applied to: Set Counter to 1
WHEN
The system prepares to iterate through cargo records
THEN
The system sets the counter variable to 1 to begin indexing from the first position
Context: A master manifest CCN is set as the search key
GIVEN
A master manifest CCN is set as the search key
Applied to: Retrieve Next Cargo Record
WHEN
The system executes a database retrieval operation
THEN
The system retrieves the next cargo record that matches or follows the master CCN in the database hierarchy
Context: A cargo record retrieval operation has been executed
GIVEN
A cargo record retrieval operation has been executed
Applied to: Status Code Blank?
WHEN
The system checks the database operation status code
THEN
If the status code is blank (spaces), the retrieval was successful and processing continues; otherwise, the system marks end of database and stops searching for more followers
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Master CCN Matches?
WHEN
The system compares the master manifest CCN field in the retrieved record with the search key master CCN
THEN
If the master manifest CCN in the retrieved record matches the search key, the record is potentially a follower manifest and processing continues; otherwise, the system marks end of database and stops searching
Context: A cargo record has been retrieved and its master CCN matches the search key
GIVEN
A cargo record has been retrieved and its master CCN matches the search key
Applied to: Is Follower Manifest?
WHEN
The system checks the manifest type indicator in the cargo record
THEN
If the cargo record is identified as a follower manifest (not a master manifest), it is added to the collection; if it is a master manifest, it is skipped and the system retrieves the next record
Context: A cargo record has been identified as a follower manifest
GIVEN
A cargo record has been identified as a follower manifest
Applied to: Store Follower CCN in Array
WHEN
The system needs to collect this follower for later processing
THEN
The system stores the follower manifest CCN in the array at the position indicated by the current counter value
Context: A follower manifest CCN has been stored in the array
GIVEN
A follower manifest CCN has been stored in the array
Applied to: Increment Counter
WHEN
The system prepares to continue searching for more followers
THEN
The system adds 1 to the counter variable to move to the next array position
Context: The counter has been incremented after storing a follower manifest CCN
GIVEN
The counter has been incremented after storing a follower manifest CCN
Applied to: Counter > 100?
WHEN
The system checks if the maximum limit has been reached
THEN
If the counter exceeds 100, the system stops searching for more followers and proceeds to calculate the total count; otherwise, it continues retrieving the next cargo record
Context: The system has attempted to retrieve a cargo record
GIVEN
The system has attempted to retrieve a cargo record
Applied to: End of Database?
WHEN
The database operation returns a non-blank status code or the master CCN no longer matches
THEN
The system sets the end-of-database flag and stops searching for more follower manifests
Context: The search for follower manifests has completed (either by reaching the limit, end of database, or no more matches)
GIVEN
The search for follower manifests has completed (either by reaching the limit, end of database, or no more matches)
Applied to: Calculate Total Follower Count
WHEN
The system needs to determine how many followers were actually found
THEN
The system subtracts 1 from the counter variable to get the accurate count of follower manifests stored in the array
Context: The follower manifest search has completed and the count has been calculated
GIVEN
The follower manifest search has completed and the count has been calculated
Applied to: Any Followers Found?
WHEN
The system checks if any followers were collected
THEN
If the count is less than or equal to 0, the system exits the process without performing any updates; if the count is greater than 0, the system proceeds to process each follower
Context: At least one follower manifest CCN exists in the collection array
GIVEN
At least one follower manifest CCN exists in the collection array
Applied to: Get Next Follower CCN from Array
WHEN
The system begins or continues the update process
THEN
The system retrieves the next follower manifest CCN from the array based on the current iteration position
Context: A follower manifest CCN has been retrieved from the collection array
GIVEN
A follower manifest CCN has been retrieved from the collection array
Applied to: Retrieve Follower Cargo Record
WHEN
The system needs to update the follower manifest
THEN
The system retrieves the complete cargo record from the database using the follower CCN as the key
Context: The system has attempted to retrieve a follower cargo record by CCN
GIVEN
The system has attempted to retrieve a follower cargo record by CCN
Applied to: Cargo Found?
WHEN
The system checks if the cargo record was found
THEN
If the cargo record is found, the system proceeds with logging and updating; if not found, the system skips to the next follower in the collection
Context: A follower manifest cargo record has been successfully retrieved
GIVEN
A follower manifest cargo record has been successfully retrieved
Applied to: Log Border Arrival Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The system prepares to update the cargo record with border arrival acknowledgment
THEN
The system creates a log entry with the message '350 ACK - ARRIVAL ACK AT BORDER' associated with the follower manifest CCN
Context: A follower manifest cargo record has been retrieved and logged
GIVEN
A follower manifest cargo record has been retrieved and logged
Applied to: Set Border Arrival Flag to TRUE
WHEN
The system updates the cargo status
THEN
The system sets the border arrival acknowledgment flag to TRUE in the cargo record
Context: The follower cargo record has been modified with the border arrival acknowledgment flag set to TRUE
GIVEN
The follower cargo record has been modified with the border arrival acknowledgment flag set to TRUE
Applied to: Update Follower Cargo Record
WHEN
The system commits the changes
THEN
The system updates the cargo record in the database with the new border arrival acknowledgment status
Context: One follower manifest has been processed (either updated or skipped)
GIVEN
One follower manifest has been processed (either updated or skipped)
Applied to: More Followers to Process?
WHEN
The system checks the iteration status
THEN
If there are more follower CCNs in the array that have not been processed (not spaces or low-values), the system retrieves the next follower CCN; otherwise, the process completes
R-GCCUSIO-cbl-00563 (+4) File: GCCUSIO.cbl Build N9 Secondary Key Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build N9 Secondary Key':
  • Context - a cargo record with a valid ccn key exists:
    For Build Complete Secondary Key:
    When the system needs to retrieve n9 reference data for shipment identification, then the system builds a secondary key using the ccn key, record type '02', and sequence '0001'.
  • Context - a complete secondary key has been built with ccn, record type '02', and sequence '0001':
    For Retrieve N9 Reference Data:
    When the system executes a database call to retrieve n9 reference data, then the system retrieves the n9 reference data from the gcsa2rt secondary cargo segment.
  • Context - n9 reference data has been successfully retrieved from the database:
    For Loop Through 20 N9 Records:
    When the system processes the n9 reference numbers, then the system initializes a counter to zero and loops through up to 20 n9 reference number records.
  • Context - the system is processing n9 reference number records:
    For Extract Shipment ID from Reference Number:
    When a reference number qualifier equals 'cn', then the system extracts the corresponding reference number as the shipment id.
  • Context - the system attempts to retrieve n9 reference data using the secondary key:
    For No N9 Data Available:
    When no n9 reference data is found in the database, then the system continues processing without shipment id information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with a valid CCN key exists
GIVEN
A cargo record with a valid CCN key exists
Applied to: Build Complete Secondary Key
WHEN
The system needs to retrieve N9 reference data for shipment identification
THEN
The system builds a secondary key using the CCN key, record type '02', and sequence '0001'
Context: A complete secondary key has been built with CCN, record type '02', and sequence '0001'
GIVEN
A complete secondary key has been built with CCN, record type '02', and sequence '0001'
Applied to: Retrieve N9 Reference Data
WHEN
The system executes a database call to retrieve N9 reference data
THEN
The system retrieves the N9 reference data from the GCSA2RT secondary cargo segment
Context: N9 reference data has been successfully retrieved from the database
GIVEN
N9 reference data has been successfully retrieved from the database
Applied to: Loop Through 20 N9 Records
WHEN
The system processes the N9 reference numbers
THEN
The system initializes a counter to zero and loops through up to 20 N9 reference number records
Context: The system is processing N9 reference number records
GIVEN
The system is processing N9 reference number records
Applied to: Extract Shipment ID from Reference Number
WHEN
A reference number qualifier equals 'CN'
THEN
The system extracts the corresponding reference number as the shipment ID
Context: The system attempts to retrieve N9 reference data using the secondary key
GIVEN
The system attempts to retrieve N9 reference data using the secondary key
Applied to: No N9 Data Available
WHEN
No N9 reference data is found in the database
THEN
The system continues processing without shipment ID information
R-GCCUSIO-cbl-00568 (+6) File: GCCUSIO.cbl Compare Status Changes Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Compare Status Changes':
  • Context - a cargo record is being processed for iron highway notification:
    For Current US Cargo Status Empty?:
    When the us cargo short description is empty (spaces) and the cp cargo status description is not equal to 'sent', then the system should proceed to check if both current and cp status are empty.
    For CP Status = DELETED or RELEASE?:
    When the cp cargo status description equals 'deleted' or equals 'release', then the system should continue with the notification process without checking for status changes.
  • Context - a cargo record has empty us cargo short description and cp cargo status description equals 'sent':
    For CP Cargo Status = SENT?:
    When the system is determining the current status for iron highway notification, then the system should use the cp cargo status description as the current status.
  • Context - a cargo record is being evaluated for iron highway notification:
    For Both Current and CP Status Empty?:
    When both the us cargo short description is empty (spaces) and the cp cargo status description is empty (spaces), then the system should exit the notification process without sending any notification.
    For Current Status = RELEASE?:
    When the us cargo short description equals 'release', then the system should exit the notification process without sending notification.
  • Context - a cargo record has a previously saved status for comparison:
    For Saved Status = Current Status?:
    When the saved iron highway status equals the current us cargo short description, then the system should exit the notification process as no status change has occurred.
  • Context - a cargo record has passed all status comparison checks:
    For Status Change Detected:
    When the current status is different from the saved status and the current status is not 'release' and not both statuses are empty, then the system should proceed with generating and sending the iron highway notification.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for Iron Highway notification
GIVEN
A cargo record is being processed for Iron Highway notification
Applied to: Current US Cargo Status Empty?
WHEN
The US cargo short description is empty (spaces) AND the CP cargo status description is not equal to 'SENT'
THEN
The system should proceed to check if both current and CP status are empty
Applied to: CP Status = DELETED or RELEASE?
WHEN
The CP cargo status description equals 'DELETED' OR equals 'RELEASE'
THEN
The system should continue with the notification process without checking for status changes
Context: A cargo record has empty US cargo short description AND CP cargo status description equals 'SENT'
GIVEN
A cargo record has empty US cargo short description AND CP cargo status description equals 'SENT'
Applied to: CP Cargo Status = SENT?
WHEN
The system is determining the current status for Iron Highway notification
THEN
The system should use the CP cargo status description as the current status
Context: A cargo record is being evaluated for Iron Highway notification
GIVEN
A cargo record is being evaluated for Iron Highway notification
Applied to: Both Current and CP Status Empty?
WHEN
Both the US cargo short description is empty (spaces) AND the CP cargo status description is empty (spaces)
THEN
The system should exit the notification process without sending any notification
Applied to: Current Status = RELEASE?
WHEN
The US cargo short description equals 'RELEASE'
THEN
The system should exit the notification process without sending notification
Context: A cargo record has a previously saved status for comparison
GIVEN
A cargo record has a previously saved status for comparison
Applied to: Saved Status = Current Status?
WHEN
The saved Iron Highway status equals the current US cargo short description
THEN
The system should exit the notification process as no status change has occurred
Context: A cargo record has passed all status comparison checks
GIVEN
A cargo record has passed all status comparison checks
Applied to: Status Change Detected
WHEN
The current status is different from the saved status AND the current status is not 'RELEASE' AND not both statuses are empty
THEN
The system should proceed with generating and sending the Iron Highway notification
R-GCCUSIO-cbl-00575 (+16) File: GCCUSIO.cbl Evaluate CP Cargo Status Conditions Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate CP Cargo Status Conditions':
  • Context - a cp cargo record with rt10 status field:
    For Check RT10 CPCARGO-ERROR Status?:
    When the system checks the rt10 cpcargo-error status condition, then the system identifies if error processing is required based on the cpcargo-error status.
    For Check RT10 CPCARGO-PENDING Status?:
    When the system checks the rt10 cpcargo-pending status condition, then the system identifies if error processing is required based on the cpcargo-pending status.
  • Context - a us cargo record with rt11 status field:
    For Check RT11 USCARGO-ERROR Status?:
    When the system checks the rt11 uscargo-error status condition, then the system identifies if error processing is required based on the uscargo-error status.
    For Check RT11 USCARGO-HOLD Status?:
    When the system checks the rt11 uscargo-hold status condition, then the system identifies if hold processing is required based on the uscargo-hold status.
    For Check RT11 USCARGO-HOLDPCS Status?:
    When the system checks the rt11 uscargo-holdpcs status condition, then the system identifies if hold processing is required based on the uscargo-holdpcs status.
    For Check RT11 USCARGO-PR-HPCS Status?:
    When the system checks the rt11 uscargo-pr-hpcs status condition, then the system identifies if hold processing is required based on the uscargo-pr-hpcs status.
    For Check RT11 USCARGO-HOLD-B Status?:
    When the system checks the rt11 uscargo-hold-b status condition, then the system identifies if hold processing is required based on the uscargo-hold-b status.
    For Check RT11 USCARGO-PR-H-BO Status?:
    When the system checks the rt11 uscargo-pr-h-bo status condition, then the system identifies if hold processing is required based on the uscargo-pr-h-bo status.
    For Check RT11 USCARGO-HOLD-D Status?:
    When the system checks the rt11 uscargo-hold-d status condition, then the system identifies if hold processing is required based on the uscargo-hold-d status.
    For Check RT11 USCARGO-PR-H-DE Status?:
    When the system checks the rt11 uscargo-pr-h-de status condition, then the system identifies if hold processing is required based on the uscargo-pr-h-de status.
    For Check RT11 USCARGO-HOLDFDA Status?:
    When the system checks the rt11 uscargo-holdfda status condition, then the system identifies if hold processing is required based on the uscargo-holdfda status.
  • Context - a cargo record with no error conditions (rt10 cpcargo-error, rt10 cpcargo-pending, rt11 uscargo-error) and no hold conditions (rt11 uscargo-hold, rt11 uscargo-holdpcs, rt11 uscargo-pr-hpcs, rt11 uscargo-hold-b, rt11 uscargo-pr-h-bo, rt11 uscargo-hold-d, rt11 uscargo-pr-h-de, rt11 uscargo-holdfda):
    For Delete GCSB1RT Index Record:
    When the system processes the cargo status update, then the system removes the cargo record from the gcsb1rt status index table.
  • Context - a cargo record with no error conditions (rt10 cpcargo-error, rt10 cpcargo-pending, rt11 uscargo-error) but with hold conditions:
    For Clear Error Index Fields:
    When the system processes the cargo status update, then the system clears the error origin index, error destination index, and error border index fields in the status record.
  • Context - a cargo record with no hold conditions (rt11 uscargo-hold, rt11 uscargo-holdpcs, rt11 uscargo-pr-hpcs, rt11 uscargo-hold-b, rt11 uscargo-pr-h-bo, rt11 uscargo-hold-d, rt11 uscargo-pr-h-de, rt11 uscargo-holdfda) but with error conditions:
    For Clear Hold Index Fields:
    When the system processes the cargo status update, then the system clears the held destination index and held border index fields in the status record.
  • Context - a cargo record with error conditions (rt10 cpcargo-error, rt10 cpcargo-pending, or rt11 uscargo-error):
    For Fill Error Index Fields:
    When the system processes the cargo status update, then the system populates error code and location fields for origin station, border station, and destination station in the status index record.
  • Context - a cargo record with hold conditions (rt11 uscargo-hold, rt11 uscargo-holdpcs, rt11 uscargo-pr-hpcs, rt11 uscargo-hold-b, rt11 uscargo-pr-h-bo, rt11 uscargo-hold-d, rt11 uscargo-pr-h-de, or rt11 uscargo-holdfda):
    For Fill Hold Index Fields:
    When the system processes the cargo status update, then the system populates held destination and held border location fields in the status index record.
  • Context - a cargo record with error or hold conditions requiring status tracking:
    For Insert/Update GCSB1RT Record:
    When the system processes the cargo status update and the status index record exists, then the system updates the existing gcsb1rt status index record with current status information.
👨‍💻 Technical ACs (Gherkin)
Context: A CP cargo record with RT10 status field
GIVEN
A CP cargo record with RT10 status field
Applied to: Check RT10 CPCARGO-ERROR Status?
WHEN
The system checks the RT10 CPCARGO-ERROR status condition
THEN
The system identifies if error processing is required based on the CPCARGO-ERROR status
Applied to: Check RT10 CPCARGO-PENDING Status?
WHEN
The system checks the RT10 CPCARGO-PENDING status condition
THEN
The system identifies if error processing is required based on the CPCARGO-PENDING status
Context: A US cargo record with RT11 status field
GIVEN
A US cargo record with RT11 status field
Applied to: Check RT11 USCARGO-ERROR Status?
WHEN
The system checks the RT11 USCARGO-ERROR status condition
THEN
The system identifies if error processing is required based on the USCARGO-ERROR status
Applied to: Check RT11 USCARGO-HOLD Status?
WHEN
The system checks the RT11 USCARGO-HOLD status condition
THEN
The system identifies if hold processing is required based on the USCARGO-HOLD status
Applied to: Check RT11 USCARGO-HOLDPCS Status?
WHEN
The system checks the RT11 USCARGO-HOLDPCS status condition
THEN
The system identifies if hold processing is required based on the USCARGO-HOLDPCS status
Applied to: Check RT11 USCARGO-PR-HPCS Status?
WHEN
The system checks the RT11 USCARGO-PR-HPCS status condition
THEN
The system identifies if hold processing is required based on the USCARGO-PR-HPCS status
Applied to: Check RT11 USCARGO-HOLD-B Status?
WHEN
The system checks the RT11 USCARGO-HOLD-B status condition
THEN
The system identifies if hold processing is required based on the USCARGO-HOLD-B status
Applied to: Check RT11 USCARGO-PR-H-BO Status?
WHEN
The system checks the RT11 USCARGO-PR-H-BO status condition
THEN
The system identifies if hold processing is required based on the USCARGO-PR-H-BO status
Applied to: Check RT11 USCARGO-HOLD-D Status?
WHEN
The system checks the RT11 USCARGO-HOLD-D status condition
THEN
The system identifies if hold processing is required based on the USCARGO-HOLD-D status
Applied to: Check RT11 USCARGO-PR-H-DE Status?
WHEN
The system checks the RT11 USCARGO-PR-H-DE status condition
THEN
The system identifies if hold processing is required based on the USCARGO-PR-H-DE status
Applied to: Check RT11 USCARGO-HOLDFDA Status?
WHEN
The system checks the RT11 USCARGO-HOLDFDA status condition
THEN
The system identifies if hold processing is required based on the USCARGO-HOLDFDA status
Context: A cargo record with no error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, RT11 USCARGO-ERROR) and no hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, RT11 USCARGO-HOLDFDA)
GIVEN
A cargo record with no error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, RT11 USCARGO-ERROR) and no hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, RT11 USCARGO-HOLDFDA)
Applied to: Delete GCSB1RT Index Record
WHEN
The system processes the cargo status update
THEN
The system removes the cargo record from the GCSB1RT status index table
Context: A cargo record with no error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, RT11 USCARGO-ERROR) but with hold conditions
GIVEN
A cargo record with no error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, RT11 USCARGO-ERROR) but with hold conditions
Applied to: Clear Error Index Fields
WHEN
The system processes the cargo status update
THEN
The system clears the error origin index, error destination index, and error border index fields in the status record
Context: A cargo record with no hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, RT11 USCARGO-HOLDFDA) but with error conditions
GIVEN
A cargo record with no hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, RT11 USCARGO-HOLDFDA) but with error conditions
Applied to: Clear Hold Index Fields
WHEN
The system processes the cargo status update
THEN
The system clears the held destination index and held border index fields in the status record
Context: A cargo record with error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, or RT11 USCARGO-ERROR)
GIVEN
A cargo record with error conditions (RT10 CPCARGO-ERROR, RT10 CPCARGO-PENDING, or RT11 USCARGO-ERROR)
Applied to: Fill Error Index Fields
WHEN
The system processes the cargo status update
THEN
The system populates error code and location fields for origin station, border station, and destination station in the status index record
Context: A cargo record with hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, or RT11 USCARGO-HOLDFDA)
GIVEN
A cargo record with hold conditions (RT11 USCARGO-HOLD, RT11 USCARGO-HOLDPCS, RT11 USCARGO-PR-HPCS, RT11 USCARGO-HOLD-B, RT11 USCARGO-PR-H-BO, RT11 USCARGO-HOLD-D, RT11 USCARGO-PR-H-DE, or RT11 USCARGO-HOLDFDA)
Applied to: Fill Hold Index Fields
WHEN
The system processes the cargo status update
THEN
The system populates held destination and held border location fields in the status index record
Context: A cargo record with error or hold conditions requiring status tracking
GIVEN
A cargo record with error or hold conditions requiring status tracking
Applied to: Insert/Update GCSB1RT Record
WHEN
The system processes the cargo status update and the status index record exists
THEN
The system updates the existing GCSB1RT status index record with current status information
R-GCX126-cbl-00581 (+7) File: GCX126R.cbl Set Cargo Status Flags Based on Database Return Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Cargo Status Flags Based on Database Return':
  • Context - the system needs to evaluate cargo status from database retrieval:
    For Initialize All Status Flags to Space:
    When the cargo status flag initialization process begins, then all four cargo status switches (ws-switch1-cargo, ws-switch2-cargo, ws-switch3-cargo, ws-switch4-cargo) are set to space character.
  • Context - a cargo lookup has been performed in the database:
    For Set Cargo Not Found Flag:
    When the database status code is not equal to spaces, then the cargo-not-found indicator flag is set to true.
    For Set Cargo Found Flag:
    When the database status code equals spaces, then the cargo-found indicator flag is set to true.
  • Context - cargo has been found in the database with cargo-found flag set to true:
    For Set Cargo Not Waybill Flag:
    When the cargo waybill key for index does not equal the saved waybill index and the saved waybill index is not equal to space, then the cargo-not-waybill indicator flag is set to true.
  • Context - cargo has been found in the database and waybill validation has passed (either matched or saved index is blank):
    For Set Cargo Deleted Flag:
    When the cargo delete status field equals 'd', then the cargo-deleted indicator flag is set to true.
  • Context - cargo has been found in the database and waybill validation has passed and cargo delete status is not 'd':
    For Set Cargo Returned Flag:
    When the cargo status indicates a return status condition, then the cargo-returned indicator flag is set to true.
    For Set Cargo Released Flag:
    When the cargo release status field equals 'r', then the cargo-released indicator flag is set to true.
    For Set Cargo On-A-Train Flag:
    When the cargo train id field is not equal to spaces, then the cargo-on-a-train indicator flag is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to evaluate cargo status from database retrieval
GIVEN
The system needs to evaluate cargo status from database retrieval
Applied to: Initialize All Status Flags to Space
WHEN
The cargo status flag initialization process begins
THEN
All four cargo status switches (WS-SWITCH1-CARGO, WS-SWITCH2-CARGO, WS-SWITCH3-CARGO, WS-SWITCH4-CARGO) are set to space character
Context: A cargo lookup has been performed in the database
GIVEN
A cargo lookup has been performed in the database
Applied to: Set Cargo Not Found Flag
WHEN
The database status code is not equal to spaces
THEN
The cargo-not-found indicator flag is set to true
Applied to: Set Cargo Found Flag
WHEN
The database status code equals spaces
THEN
The cargo-found indicator flag is set to true
Context: Cargo has been found in the database with cargo-found flag set to true
GIVEN
Cargo has been found in the database with cargo-found flag set to true
Applied to: Set Cargo Not Waybill Flag
WHEN
The cargo waybill key for index does not equal the saved waybill index AND the saved waybill index is not equal to space
THEN
The cargo-not-waybill indicator flag is set to true
Context: Cargo has been found in the database AND waybill validation has passed (either matched or saved index is blank)
GIVEN
Cargo has been found in the database AND waybill validation has passed (either matched or saved index is blank)
Applied to: Set Cargo Deleted Flag
WHEN
The cargo delete status field equals 'D'
THEN
The cargo-deleted indicator flag is set to true
Context: Cargo has been found in the database AND waybill validation has passed AND cargo delete status is not 'D'
GIVEN
Cargo has been found in the database AND waybill validation has passed AND cargo delete status is not 'D'
Applied to: Set Cargo Returned Flag
WHEN
The cargo status indicates a return status condition
THEN
The cargo-returned indicator flag is set to true
Applied to: Set Cargo Released Flag
WHEN
The cargo release status field equals 'R'
THEN
The cargo-released indicator flag is set to true
Applied to: Set Cargo On-A-Train Flag
WHEN
The cargo train ID field is not equal to spaces
THEN
The cargo-on-a-train indicator flag is set to true
R-GCX126-cbl-00589 (+8) File: GCX126R.cbl Search for Associated US Manifest by Car ID and Waybill Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search for Associated US Manifest by Car ID and Waybill':
  • Context - a cargo record has been processed and current cargo equipment car id and waybill index are available:
    For Initialize Search Parameters: Set Car ID from Current Cargo, Set Waybill Index from Current Cargo, Set US CCN to Low Values:
    When the system initiates a search for associated us manifest records, then the search parameters are initialized with car id from current cargo equipment car key, waybill index from saved waybill index, and us ccn key index set to low values.
  • Context - search parameters have been initialized with car id and waybill index:
    For Set Search Criteria: Function: Get Unique GU, Index Type: Car-Waybill, Operator: Greater Than or Equal:
    When the system prepares to execute the database search, then the search function is set to get unique (gu), segment type is set to us cargo record (gcsusrt), index type is set to car-waybill, and operator is set to greater than or equal (>=).
  • Context - search criteria are configured with function gu, segment gcsusrt, index car-waybill, and operator >=:
    For Execute Database Search on US Cargo Table:
    When the system executes the database call, then the gccusio program is invoked with the search parameters to retrieve us cargo records from gcsusrt table.
  • Context - a database search has been executed on us cargo table:
    For Database Status OK? - Error Path:
    When the database status code is not blank (indicating an error), then the end-of-file flag is set to true to terminate the search process.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID and Waybill Match?:
    When the system validates the retrieved record, then the first 12 characters of the us cargo car id number index are compared with current cargo equipment car key and the us cargo waybill number index is compared with saved waybill index, and if either comparison fails, the end-of-file flag is set to true.
  • Context - a us cargo record has been retrieved and validated for car id and waybill match:
    For Cargo Deleted OR TR Created?:
    When the system checks the cargo processing eligibility, then if the us cargo is marked as deleted or the train-created-for-it indicator equals 'y', the record is skipped and search continues, otherwise the us manifest found flag is set to true.
  • Context - a us cargo record matches car id and waybill and is not deleted and does not have train created:
    For Set US Manifest Found Flag:
    When the system completes validation checks, then the us manifest found flag is set to true to indicate a valid associated us manifest has been located.
  • Context - a us cargo record has been found but is marked as deleted or has train created indicator set to 'y':
    For Continue to Next Record:
    When the system needs to continue searching for valid records, then the search function is set to get next (gn), segment type remains gcsusrt, index type remains car-waybill, operator is set to greater than (>), and the database call is executed to retrieve the next record in sequence.
  • Context - a next us cargo record has been retrieved using get next function:
    For Car ID and Waybill Match? - After Continue:
    When the system validates the continued search result, then the first 12 characters of the us cargo car id number index are compared with current cargo equipment car key and the us cargo waybill number index is compared with saved waybill index, and if either comparison fails, the end-of-file flag is set to true, otherwise the cargo deletion and train creation checks are performed again.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been processed and current cargo equipment car ID and waybill index are available
GIVEN
A cargo record has been processed and current cargo equipment car ID and waybill index are available
Applied to: Initialize Search Parameters: Set Car ID from Current Cargo, Set Waybill Index from Current Cargo, Set US CCN to Low Values
WHEN
The system initiates a search for associated US manifest records
THEN
The search parameters are initialized with car ID from current cargo equipment car key, waybill index from saved waybill index, and US CCN key index set to low values
Context: Search parameters have been initialized with car ID and waybill index
GIVEN
Search parameters have been initialized with car ID and waybill index
Applied to: Set Search Criteria: Function: Get Unique GU, Index Type: Car-Waybill, Operator: Greater Than or Equal
WHEN
The system prepares to execute the database search
THEN
The search function is set to Get Unique (GU), segment type is set to US cargo record (GCSUSRT), index type is set to Car-Waybill, and operator is set to greater than or equal (>=)
Context: Search criteria are configured with function GU, segment GCSUSRT, index Car-Waybill, and operator >=
GIVEN
Search criteria are configured with function GU, segment GCSUSRT, index Car-Waybill, and operator >=
Applied to: Execute Database Search on US Cargo Table
WHEN
The system executes the database call
THEN
The GCCUSIO program is invoked with the search parameters to retrieve US cargo records from GCSUSRT table
Context: A database search has been executed on US cargo table
GIVEN
A database search has been executed on US cargo table
Applied to: Database Status OK? - Error Path
WHEN
The database status code is not blank (indicating an error)
THEN
The end-of-file flag is set to true to terminate the search process
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID and Waybill Match?
WHEN
The system validates the retrieved record
THEN
The first 12 characters of the US cargo car ID number index are compared with current cargo equipment car key AND the US cargo waybill number index is compared with saved waybill index, and if either comparison fails, the end-of-file flag is set to true
Context: A US cargo record has been retrieved and validated for car ID and waybill match
GIVEN
A US cargo record has been retrieved and validated for car ID and waybill match
Applied to: Cargo Deleted OR TR Created?
WHEN
The system checks the cargo processing eligibility
THEN
If the US cargo is marked as deleted OR the train-created-for-it indicator equals 'Y', the record is skipped and search continues, otherwise the US manifest found flag is set to true
Context: A US cargo record matches car ID and waybill AND is not deleted AND does not have train created
GIVEN
A US cargo record matches car ID and waybill AND is not deleted AND does not have train created
Applied to: Set US Manifest Found Flag
WHEN
The system completes validation checks
THEN
The US manifest found flag is set to true to indicate a valid associated US manifest has been located
Context: A US cargo record has been found but is marked as deleted OR has train created indicator set to 'Y'
GIVEN
A US cargo record has been found but is marked as deleted OR has train created indicator set to 'Y'
Applied to: Continue to Next Record
WHEN
The system needs to continue searching for valid records
THEN
The search function is set to Get Next (GN), segment type remains GCSUSRT, index type remains Car-Waybill, operator is set to greater than (>), and the database call is executed to retrieve the next record in sequence
Context: A next US cargo record has been retrieved using Get Next function
GIVEN
A next US cargo record has been retrieved using Get Next function
Applied to: Car ID and Waybill Match? - After Continue
WHEN
The system validates the continued search result
THEN
The first 12 characters of the US cargo car ID number index are compared with current cargo equipment car key AND the US cargo waybill number index is compared with saved waybill index, and if either comparison fails, the end-of-file flag is set to true, otherwise the cargo deletion and train creation checks are performed again
R-GCCUSIO-cbl-00592 (+5) File: GCCUSIO.cbl Evaluate US Cargo Status Conditions Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate US Cargo Status Conditions':
  • Context - a cargo record with rt11 uscargo status fields:
    For Check RT11 USCARGO Status Fields:
    When the system checks for uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda status conditions, then the system should identify that destination hold index processing is required and proceed with hold field population.
    For Check RT11 USCARGO Status Fields:
    When the system checks for uscargo-hold-b or uscargo-pr-h-bo status conditions, then the system should identify that border hold index processing is required and proceed with border hold field population.
    For Check RT11 USCARGO Status Fields:
    When the system checks for uscargo-error status condition, then the system should identify that error index processing is required and proceed with error field population.
  • Context - a cargo record being processed for status table updates:
    For Clear Hold Index Fields:
    When the cargo does not have uscargo-hold and not uscargo-holdpcs and not uscargo-pr-hpcs and not uscargo-hold-b and not uscargo-pr-h-bo and not uscargo-hold-d and not uscargo-pr-h-de and not uscargo-holdfda status conditions, then the system should clear the held destination index and held border index fields and determine if status record deletion is required.
  • Context - a cargo record with destination hold status conditions:
    For Set Destination Hold Index Requirements:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda status, then the system should populate the destination hold index with the destination station number and the destination cargo key with the ccn key.
  • Context - a cargo record with border hold status conditions:
    For Set Border Hold Index Requirements:
    When the cargo has uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-b or uscargo-pr-h-bo or uscargo-holdfda status, then the system should retrieve the border station number from the mc table using the location id and populate the border hold index fields with the station number and ccn key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with RT11 USCARGO status fields
GIVEN
A cargo record with RT11 USCARGO status fields
Applied to: Check RT11 USCARGO Status Fields
WHEN
The system checks for USCARGO-HOLD OR USCARGO-HOLDPCS OR USCARGO-PR-HPCS OR USCARGO-HOLD-D OR USCARGO-PR-H-DE OR USCARGO-HOLDFDA status conditions
THEN
The system should identify that destination hold index processing is required and proceed with hold field population
Applied to: Check RT11 USCARGO Status Fields
WHEN
The system checks for USCARGO-HOLD-B OR USCARGO-PR-H-BO status conditions
THEN
The system should identify that border hold index processing is required and proceed with border hold field population
Applied to: Check RT11 USCARGO Status Fields
WHEN
The system checks for USCARGO-ERROR status condition
THEN
The system should identify that error index processing is required and proceed with error field population
Context: A cargo record being processed for status table updates
GIVEN
A cargo record being processed for status table updates
Applied to: Clear Hold Index Fields
WHEN
The cargo does NOT have USCARGO-HOLD AND NOT USCARGO-HOLDPCS AND NOT USCARGO-PR-HPCS AND NOT USCARGO-HOLD-B AND NOT USCARGO-PR-H-BO AND NOT USCARGO-HOLD-D AND NOT USCARGO-PR-H-DE AND NOT USCARGO-HOLDFDA status conditions
THEN
The system should clear the held destination index and held border index fields and determine if status record deletion is required
Context: A cargo record with destination hold status conditions
GIVEN
A cargo record with destination hold status conditions
Applied to: Set Destination Hold Index Requirements
WHEN
The cargo has USCARGO-HOLD OR USCARGO-HOLDPCS OR USCARGO-PR-HPCS OR USCARGO-HOLD-D OR USCARGO-PR-H-DE OR USCARGO-HOLDFDA status
THEN
The system should populate the destination hold index with the destination station number and the destination cargo key with the CCN key
Context: A cargo record with border hold status conditions
GIVEN
A cargo record with border hold status conditions
Applied to: Set Border Hold Index Requirements
WHEN
The cargo has USCARGO-HOLD OR USCARGO-HOLDPCS OR USCARGO-PR-HPCS OR USCARGO-HOLD-B OR USCARGO-PR-H-BO OR USCARGO-HOLDFDA status
THEN
The system should retrieve the border station number from the MC table using the location ID and populate the border hold index fields with the station number and CCN key
R-GCCUSIO-cbl-00598 (+12) File: GCCUSIO.cbl Determine Error Index Action Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Error Index Action':
  • Context - a cargo record exists in the gcsb1rt index table and the cargo does not have cpcargo-error status and the cargo does not have cpcargo-pending status and the cargo does not have uscargo-error status:
    For Clear Error Index Fields:
    When the system processes the cargo status update, then the system clears the error origin index field and clears the error destination index field and clears the error border index field.
  • Context - error index fields have been cleared and the held destination index field is empty and the held border index field is empty:
    For Delete Index Record:
    When the system evaluates remaining index content, then the system deletes the gcsb1rt index record completely.
  • Context - error index fields have been cleared and either the held destination index field is not empty or the held border index field is not empty:
    For Update Index Record:
    When the system evaluates remaining index content, then the system updates the existing gcsb1rt index record with the current field values.
  • Context - a cargo record exists in the gcsb1rt index table and the cargo does not have uscargo-hold status and the cargo does not have uscargo-holdpcs status and the cargo does not have uscargo-pr-hpcs status and the cargo does not have uscargo-hold-b status and the cargo does not have uscargo-pr-h-bo status and the cargo does not have uscargo-hold-d status and the cargo does not have uscargo-pr-h-de status and the cargo does not have uscargo-holdfda status:
    For Clear Hold Index Fields:
    When the system processes the cargo status update, then the system clears the held destination index field and clears the held border index field.
  • Context - hold index fields have been cleared and the error destination index field is empty and the error origin index field is empty and the error border index field is empty:
    For Delete Index Record:
    When the system evaluates remaining index content, then the system deletes the gcsb1rt index record completely.
  • Context - hold index fields have been cleared and either the error destination index field is not empty or the error origin index field is not empty or the error border index field is not empty:
    For Update Index Record:
    When the system evaluates remaining index content, then the system updates the existing gcsb1rt index record with the current field values.
  • Context - a cargo record has cpcargo-error status or cpcargo-pending status or uscargo-error status:
    For Populate Error Index Fields:
    When the system processes the error status update, then the system sets error code origin to 'e' and sets error origin to origin station number and sets error origin cargo to ccn key and sets error code border to 'e' and retrieves border station from mc table and sets error border to border station number and sets error border cargo to ccn key and sets error code destination to 'e' and sets error destination to destination station number and sets error destination cargo to ccn key.
  • Context - cargo has error or pending status and error index fields have been populated and no existing gcsb1rt index record is found for the cargo:
    For Create New Index Record:
    When the system attempts to update the index, then the system creates a new gcsb1rt index record with the populated error field values.
  • Context - cargo has error or pending status and error index fields have been populated and an existing gcsb1rt index record is found for the cargo:
    For Update Existing Index Record:
    When the system attempts to update the index, then the system updates the existing gcsb1rt index record with the current error field values.
  • Context - a cargo record has uscargo-hold status or uscargo-holdpcs status or uscargo-pr-hpcs status or uscargo-hold-d status or uscargo-pr-h-de status or uscargo-holdfda status:
    For Populate Hold Index Fields:
    When the system processes the hold status for destination fields, then the system sets held destination to destination station number and sets held destination cargo to ccn key.
  • Context - a cargo record has uscargo-hold status or uscargo-holdpcs status or uscargo-pr-hpcs status or uscargo-hold-b status or uscargo-pr-h-bo status or uscargo-holdfda status:
    For Populate Hold Index Fields:
    When the system processes the hold status for border fields, then the system retrieves border station from mc table and sets held border to border station number and sets held border cargo to ccn key.
  • Context - cargo has hold status and hold index fields have been populated and no existing gcsb1rt index record is found for the cargo:
    For Create New Index Record:
    When the system attempts to update the index, then the system creates a new gcsb1rt index record with the populated hold field values.
  • Context - cargo has hold status and hold index fields have been populated and an existing gcsb1rt index record is found for the cargo:
    For Update Existing Index Record:
    When the system attempts to update the index, then the system updates the existing gcsb1rt index record with the current hold field values.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the GCSB1RT index table AND the cargo does not have CPCARGO-ERROR status AND the cargo does not have CPCARGO-PENDING status AND the cargo does not have USCARGO-ERROR status
GIVEN
A cargo record exists in the GCSB1RT index table AND the cargo does not have CPCARGO-ERROR status AND the cargo does not have CPCARGO-PENDING status AND the cargo does not have USCARGO-ERROR status
Applied to: Clear Error Index Fields
WHEN
The system processes the cargo status update
THEN
The system clears the error origin index field AND clears the error destination index field AND clears the error border index field
Context: Error index fields have been cleared AND the held destination index field is empty AND the held border index field is empty
GIVEN
Error index fields have been cleared AND the held destination index field is empty AND the held border index field is empty
Applied to: Delete Index Record
WHEN
The system evaluates remaining index content
THEN
The system deletes the GCSB1RT index record completely
Context: Error index fields have been cleared AND either the held destination index field is not empty OR the held border index field is not empty
GIVEN
Error index fields have been cleared AND either the held destination index field is not empty OR the held border index field is not empty
Applied to: Update Index Record
WHEN
The system evaluates remaining index content
THEN
The system updates the existing GCSB1RT index record with the current field values
Context: A cargo record exists in the GCSB1RT index table AND the cargo does not have USCARGO-HOLD status AND the cargo does not have USCARGO-HOLDPCS status AND the cargo does not have USCARGO-PR-HPCS status AND the cargo does not have USCARGO-HOLD-B status AND the cargo does not have USCARGO-PR-H-BO status AND the cargo does not have USCARGO-HOLD-D status AND the cargo does not have USCARGO-PR-H-DE status AND the cargo does not have USCARGO-HOLDFDA status
GIVEN
A cargo record exists in the GCSB1RT index table AND the cargo does not have USCARGO-HOLD status AND the cargo does not have USCARGO-HOLDPCS status AND the cargo does not have USCARGO-PR-HPCS status AND the cargo does not have USCARGO-HOLD-B status AND the cargo does not have USCARGO-PR-H-BO status AND the cargo does not have USCARGO-HOLD-D status AND the cargo does not have USCARGO-PR-H-DE status AND the cargo does not have USCARGO-HOLDFDA status
Applied to: Clear Hold Index Fields
WHEN
The system processes the cargo status update
THEN
The system clears the held destination index field AND clears the held border index field
Context: Hold index fields have been cleared AND the error destination index field is empty AND the error origin index field is empty AND the error border index field is empty
GIVEN
Hold index fields have been cleared AND the error destination index field is empty AND the error origin index field is empty AND the error border index field is empty
Applied to: Delete Index Record
WHEN
The system evaluates remaining index content
THEN
The system deletes the GCSB1RT index record completely
Context: Hold index fields have been cleared AND either the error destination index field is not empty OR the error origin index field is not empty OR the error border index field is not empty
GIVEN
Hold index fields have been cleared AND either the error destination index field is not empty OR the error origin index field is not empty OR the error border index field is not empty
Applied to: Update Index Record
WHEN
The system evaluates remaining index content
THEN
The system updates the existing GCSB1RT index record with the current field values
Context: A cargo record has CPCARGO-ERROR status OR CPCARGO-PENDING status OR USCARGO-ERROR status
GIVEN
A cargo record has CPCARGO-ERROR status OR CPCARGO-PENDING status OR USCARGO-ERROR status
Applied to: Populate Error Index Fields
WHEN
The system processes the error status update
THEN
The system sets error code origin to 'E' AND sets error origin to origin station number AND sets error origin cargo to CCN key AND sets error code border to 'E' AND retrieves border station from MC table AND sets error border to border station number AND sets error border cargo to CCN key AND sets error code destination to 'E' AND sets error destination to destination station number AND sets error destination cargo to CCN key
Context: Cargo has error or pending status AND error index fields have been populated AND no existing GCSB1RT index record is found for the cargo
GIVEN
Cargo has error or pending status AND error index fields have been populated AND no existing GCSB1RT index record is found for the cargo
Applied to: Create New Index Record
WHEN
The system attempts to update the index
THEN
The system creates a new GCSB1RT index record with the populated error field values
Context: Cargo has error or pending status AND error index fields have been populated AND an existing GCSB1RT index record is found for the cargo
GIVEN
Cargo has error or pending status AND error index fields have been populated AND an existing GCSB1RT index record is found for the cargo
Applied to: Update Existing Index Record
WHEN
The system attempts to update the index
THEN
The system updates the existing GCSB1RT index record with the current error field values
Context: A cargo record has USCARGO-HOLD status OR USCARGO-HOLDPCS status OR USCARGO-PR-HPCS status OR USCARGO-HOLD-D status OR USCARGO-PR-H-DE status OR USCARGO-HOLDFDA status
GIVEN
A cargo record has USCARGO-HOLD status OR USCARGO-HOLDPCS status OR USCARGO-PR-HPCS status OR USCARGO-HOLD-D status OR USCARGO-PR-H-DE status OR USCARGO-HOLDFDA status
Applied to: Populate Hold Index Fields
WHEN
The system processes the hold status for destination fields
THEN
The system sets held destination to destination station number AND sets held destination cargo to CCN key
Context: A cargo record has USCARGO-HOLD status OR USCARGO-HOLDPCS status OR USCARGO-PR-HPCS status OR USCARGO-HOLD-B status OR USCARGO-PR-H-BO status OR USCARGO-HOLDFDA status
GIVEN
A cargo record has USCARGO-HOLD status OR USCARGO-HOLDPCS status OR USCARGO-PR-HPCS status OR USCARGO-HOLD-B status OR USCARGO-PR-H-BO status OR USCARGO-HOLDFDA status
Applied to: Populate Hold Index Fields
WHEN
The system processes the hold status for border fields
THEN
The system retrieves border station from MC table AND sets held border to border station number AND sets held border cargo to CCN key
Context: Cargo has hold status AND hold index fields have been populated AND no existing GCSB1RT index record is found for the cargo
GIVEN
Cargo has hold status AND hold index fields have been populated AND no existing GCSB1RT index record is found for the cargo
Applied to: Create New Index Record
WHEN
The system attempts to update the index
THEN
The system creates a new GCSB1RT index record with the populated hold field values
Context: Cargo has hold status AND hold index fields have been populated AND an existing GCSB1RT index record is found for the cargo
GIVEN
Cargo has hold status AND hold index fields have been populated AND an existing GCSB1RT index record is found for the cargo
Applied to: Update Existing Index Record
WHEN
The system attempts to update the index
THEN
The system updates the existing GCSB1RT index record with the current hold field values
R-GCX126-cbl-00598 (+21) File: GCX126R.cbl Process Follower Manifests for Master Release Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Follower Manifests for Master Release':
  • Context - a cargo record has been retrieved and processed for release or deconsolidation:
    For Is Cargo a Master Manifest?:
    When the system evaluates whether to process associated follower manifests, then if the cargo is not a master manifest, skip follower processing and exit; if the cargo is a master manifest, proceed to save master information and process followers.
  • Context - the cargo is confirmed as a master manifest:
    For Save Master Cargo Information:
    When the system prepares to process follower manifests, then save the complete master cargo report segment to working storage; save the master ccn key; save the master waybill key for index; save the master equipment car identifier.
  • Context - master cargo information has been saved:
    For Initialize Follower Array, Set Counter to 1, Max 100 Followers:
    When the system begins collecting follower manifests, then clear the follower manifest array (set all entries to spaces); set the follower array counter to 1; set the end-of-database flag to false (not end of database); establish maximum limit of 100 follower manifests.
  • Context - the follower collection process is active and the counter is within the 100-follower limit:
    For Get Next Follower Manifest Using Master CCN:
    When the system requests the next follower manifest record, then execute database get next operation using master ccn key; set database accept status to 'gegb'; use cargo report segment pcb7; use qualified ssa with master ccn key (ccrt-b0rt-ssaq).
  • Context - a get next operation has been executed to retrieve a follower manifest:
    For Database Status OK?:
    When the system evaluates the database return status code, then if status code is blank (spaces), the retrieval was successful and processing continues; if status code is not blank, set the end-of-database flag to true and stop retrieving followers.
  • Context - a cargo record has been successfully retrieved from the database:
    For Follower's Master CCN Matches Current Master?:
    When the system validates the master-follower relationship, then if the retrieved cargo's master manifest ccn equals the saved master ccn key, the relationship is valid and processing continues; if the master manifest ccn does not match, set the end-of-database flag to true and stop retrieving followers.
  • Context - a cargo record has been retrieved and validated as belonging to the current master:
    For Is This a Follower Manifest?:
    When the system checks the manifest type indicator, then if the cargo is identified as a follower manifest, store its ccn in the follower array; if the cargo is identified as a master manifest, skip storage and continue to check for more followers.
  • Context - a cargo record has been confirmed as a follower manifest of the current master:
    For Store Follower CCN in Array, Increment Counter:
    When the system stores the follower information, then move the follower's ccn key to the follower manifest array at position indicated by counter; add 1 to the counter.
  • Context - the system has encountered a database error, a non-matching master ccn, or reached the end of available records:
    For Set End of Database Flag:
    When the system needs to stop retrieving additional followers, then set the end-of-database flag to true (ws-follower-end-of-db).
  • Context - a follower has been processed or a continuation condition has been evaluated:
    For More Followers to Retrieve?:
    When the system determines whether to retrieve the next follower, then if the end-of-database flag is false and the counter is less than or equal to 100, continue to get the next follower; if the end-of-database flag is true or the counter exceeds 100, stop retrieval and proceed to count validation.
  • Context - the follower retrieval loop has completed:
    For Any Followers Found?:
    When the system validates the number of followers collected, then subtract 1 from the counter to get the actual count of followers; if the count is less than or equal to 0, no followers were found and processing exits; if the count is greater than 0, proceed to process each follower in the array.
  • Context - at least one follower manifest has been collected in the array:
    For Loop Through Each Follower in Array:
    When the system begins processing the collected followers, then start loop with index j at position 1; continue loop incrementing j by 1 each iteration; stop loop when follower manifest array entry at position i is spaces or low-values or when j exceeds i (the total count of followers).
  • Context - a follower ccn has been retrieved from the processing array at position j:
    For Retrieve Follower Cargo by CCN:
    When the system retrieves the follower cargo record, then move the follower ccn to the cargo report segment key value (ccrt-ssaq); move the follower ccn to the alternate segment key value (a2rt-ssaq); execute get hold unique database operation (z3000-ghu-cargo); evaluate cargo found status based on database return.
  • Context - a database retrieval operation has been executed for a follower cargo record:
    For Follower Cargo Found?:
    When the system evaluates the retrieval result, then if cargo found flag is true (ws-cargo-found), proceed to set release information; if cargo found flag is false, skip this follower and check if there are more followers to process.
  • Context - a follower cargo record has been successfully retrieved:
    For Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields:
    When the system updates the follower with release information, then move spaces to destination station number index; move spaces to destination station number for index; move current machine date to release date; move current machine time to release time; move current user id to release by field; move 'released' to current status field; move 'r' to release status field; move 'a' to release type field; move spaces to release reason field; move spaces to error or release status index; move spaces to error status field.
  • Context - release information has been set for the follower manifest:
    For Notice Reason Type?:
    When the system determines the type of release message to log, then if the v9 notice reason code indicates released, proceed to log release message; if the v9 notice reason code indicates deconsolidation, proceed to log deconsolidation message.
  • Context - the follower manifest is being released through standard release process:
    For Log Message: 'EDI 350: RELEASE : [Ref] AT PORT [Port]', Set Release Reason: '[Ref]/[Port]':
    When the system logs the release information, then clear the information message field to spaces; build message string: 'edi 350: release : ' concatenated with cbsa release reference id (first 15 characters) concatenated with ' at port ' concatenated with port code (first 4 characters); move the built message to information message field; build release reason string: cbsa release reference id (first 15 characters) concatenated with '/' concatenated with port code (first 4 characters); move the built reason to cargo release reason field; set current ccn key to information message ccn key; execute log cargo information message procedure (z150-log-cargo-info-msg).
  • Context - the follower manifest is being released through deconsolidation process:
    For Log Message: 'EDI 350: RELEASE VIA DECON AT PORT [Port]', Set Release Reason: 'DECONSOLIDATION AT [Port]':
    When the system logs the deconsolidation information, then clear the information message field to spaces; build message string: 'edi 350: release via decon at port ' concatenated with port code (first 4 characters); move the built message to information message field; build release reason string: 'deconsolidation at ' concatenated with port code (first 4 characters); move the built reason to cargo release reason field; set current ccn key to information message ccn key; execute log cargo information message procedure (z150-log-cargo-info-msg).
  • Context - a follower manifest has been released or deconsolidated:
    For Process Associated US Manifest: Find US Cargo by Car ID and Waybill, Log Release to US CCN:
    When the system processes associated us manifest, then set us manifest not found flag to true; set not end-of-file flag to true; move current equipment car id key to us cargo car id index; move saved waybill index to us cargo waybill index; execute get unique us cargo by car and waybill (z3300-gu-us-cargo-by-carwb); execute get next us cargo by car and waybill repeatedly (z3350-gn-us-cargo-by-carwb) until us manifest found or end-of-file; if end-of-file reached, exit us manifest processing; if us manifest found: move log information, build date string from machine century and date, move machine time to log time, set action code to use input message, move us ccn key to train or us ccn field, set us cargo indicator to true, build message string 'cdn ccn rlsed by edi 350: ' concatenated with canadian ccn key, execute spawn log entry procedure (z300-spawn-gct1051e).
  • Context - all release information has been set for the follower manifest and us manifest processing is complete:
    For Update Follower Cargo Record in Database:
    When the system updates the follower cargo record, then move spaces to database status code; move blank to database accept status; execute database replace operation using cargo pcb; pass cargo report segment for update.
  • Context - a follower manifest has been processed and updated:
    For More Followers in Array?:
    When the system determines whether to continue the processing loop, then if the current loop index j is less than the total follower count i, continue loop to process next follower; if the current loop index j equals or exceeds the total follower count i, exit loop and proceed to restore master information.
  • Context - all follower manifests have been processed and updated:
    For Restore Master Cargo Information:
    When the system completes follower processing, then move saved master cargo report segment to current cargo report segment; move saved master waybill key to current waybill index; move saved master equipment car to current car id key.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been retrieved and processed for release or deconsolidation
GIVEN
A cargo record has been retrieved and processed for release or deconsolidation
Applied to: Is Cargo a Master Manifest?
WHEN
The system evaluates whether to process associated follower manifests
THEN
If the cargo is not a master manifest, skip follower processing and exit; If the cargo is a master manifest, proceed to save master information and process followers
Context: The cargo is confirmed as a master manifest
GIVEN
The cargo is confirmed as a master manifest
Applied to: Save Master Cargo Information
WHEN
The system prepares to process follower manifests
THEN
Save the complete master cargo report segment to working storage; Save the master CCN key; Save the master waybill key for index; Save the master equipment car identifier
Context: Master cargo information has been saved
GIVEN
Master cargo information has been saved
Applied to: Initialize Follower Array, Set Counter to 1, Max 100 Followers
WHEN
The system begins collecting follower manifests
THEN
Clear the follower manifest array (set all entries to spaces); Set the follower array counter to 1; Set the end-of-database flag to false (not end of database); Establish maximum limit of 100 follower manifests
Context: The follower collection process is active and the counter is within the 100-follower limit
GIVEN
The follower collection process is active and the counter is within the 100-follower limit
Applied to: Get Next Follower Manifest Using Master CCN
WHEN
The system requests the next follower manifest record
THEN
Execute database Get Next operation using master CCN key; Set database accept status to 'GEGB'; Use cargo report segment PCB7; Use qualified SSA with master CCN key (CCRT-B0RT-SSAQ)
Context: A Get Next operation has been executed to retrieve a follower manifest
GIVEN
A Get Next operation has been executed to retrieve a follower manifest
Applied to: Database Status OK?
WHEN
The system evaluates the database return status code
THEN
If status code is blank (spaces), the retrieval was successful and processing continues; If status code is not blank, set the end-of-database flag to true and stop retrieving followers
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Follower's Master CCN Matches Current Master?
WHEN
The system validates the master-follower relationship
THEN
If the retrieved cargo's master manifest CCN equals the saved master CCN key, the relationship is valid and processing continues; If the master manifest CCN does not match, set the end-of-database flag to true and stop retrieving followers
Context: A cargo record has been retrieved and validated as belonging to the current master
GIVEN
A cargo record has been retrieved and validated as belonging to the current master
Applied to: Is This a Follower Manifest?
WHEN
The system checks the manifest type indicator
THEN
If the cargo is identified as a follower manifest, store its CCN in the follower array; If the cargo is identified as a master manifest, skip storage and continue to check for more followers
Context: A cargo record has been confirmed as a follower manifest of the current master
GIVEN
A cargo record has been confirmed as a follower manifest of the current master
Applied to: Store Follower CCN in Array, Increment Counter
WHEN
The system stores the follower information
THEN
Move the follower's CCN key to the follower manifest array at position indicated by counter; Add 1 to the counter
Context: The system has encountered a database error, a non-matching master CCN, or reached the end of available records
GIVEN
The system has encountered a database error, a non-matching master CCN, or reached the end of available records
Applied to: Set End of Database Flag
WHEN
The system needs to stop retrieving additional followers
THEN
Set the end-of-database flag to true (WS-FOLLOWER-END-OF-DB)
Context: A follower has been processed or a continuation condition has been evaluated
GIVEN
A follower has been processed or a continuation condition has been evaluated
Applied to: More Followers to Retrieve?
WHEN
The system determines whether to retrieve the next follower
THEN
If the end-of-database flag is false AND the counter is less than or equal to 100, continue to get the next follower; If the end-of-database flag is true OR the counter exceeds 100, stop retrieval and proceed to count validation
Context: The follower retrieval loop has completed
GIVEN
The follower retrieval loop has completed
Applied to: Any Followers Found?
WHEN
The system validates the number of followers collected
THEN
Subtract 1 from the counter to get the actual count of followers; If the count is less than or equal to 0, no followers were found and processing exits; If the count is greater than 0, proceed to process each follower in the array
Context: At least one follower manifest has been collected in the array
GIVEN
At least one follower manifest has been collected in the array
Applied to: Loop Through Each Follower in Array
WHEN
The system begins processing the collected followers
THEN
Start loop with index J at position 1; Continue loop incrementing J by 1 each iteration; Stop loop when follower manifest array entry at position I is spaces or low-values OR when J exceeds I (the total count of followers)
Context: A follower CCN has been retrieved from the processing array at position J
GIVEN
A follower CCN has been retrieved from the processing array at position J
Applied to: Retrieve Follower Cargo by CCN
WHEN
The system retrieves the follower cargo record
THEN
Move the follower CCN to the cargo report segment key value (CCRT-SSAQ); Move the follower CCN to the alternate segment key value (A2RT-SSAQ); Execute Get Hold Unique database operation (Z3000-GHU-CARGO); Evaluate cargo found status based on database return
Context: A database retrieval operation has been executed for a follower cargo record
GIVEN
A database retrieval operation has been executed for a follower cargo record
Applied to: Follower Cargo Found?
WHEN
The system evaluates the retrieval result
THEN
If cargo found flag is true (WS-CARGO-FOUND), proceed to set release information; If cargo found flag is false, skip this follower and check if there are more followers to process
Context: A follower cargo record has been successfully retrieved
GIVEN
A follower cargo record has been successfully retrieved
Applied to: Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields
WHEN
The system updates the follower with release information
THEN
Move spaces to destination station number index; Move spaces to destination station number for index; Move current machine date to release date; Move current machine time to release time; Move current user ID to release by field; Move 'RELEASED' to current status field; Move 'R' to release status field; Move 'A' to release type field; Move spaces to release reason field; Move spaces to error or release status index; Move spaces to error status field
Context: Release information has been set for the follower manifest
GIVEN
Release information has been set for the follower manifest
Applied to: Notice Reason Type?
WHEN
The system determines the type of release message to log
THEN
If the V9 notice reason code indicates RELEASED, proceed to log release message; If the V9 notice reason code indicates DECONSOLIDATION, proceed to log deconsolidation message
Context: The follower manifest is being released through standard release process
GIVEN
The follower manifest is being released through standard release process
Applied to: Log Message: 'EDI 350: RELEASE : [Ref] AT PORT [Port]', Set Release Reason: '[Ref]/[Port]'
WHEN
The system logs the release information
THEN
Clear the information message field to spaces; Build message string: 'EDI 350: RELEASE : ' concatenated with CBSA release reference ID (first 15 characters) concatenated with ' AT PORT ' concatenated with port code (first 4 characters); Move the built message to information message field; Build release reason string: CBSA release reference ID (first 15 characters) concatenated with '/' concatenated with port code (first 4 characters); Move the built reason to cargo release reason field; Set current CCN key to information message CCN key; Execute log cargo information message procedure (Z150-LOG-CARGO-INFO-MSG)
Context: The follower manifest is being released through deconsolidation process
GIVEN
The follower manifest is being released through deconsolidation process
Applied to: Log Message: 'EDI 350: RELEASE VIA DECON AT PORT [Port]', Set Release Reason: 'DECONSOLIDATION AT [Port]'
WHEN
The system logs the deconsolidation information
THEN
Clear the information message field to spaces; Build message string: 'EDI 350: RELEASE VIA DECON AT PORT ' concatenated with port code (first 4 characters); Move the built message to information message field; Build release reason string: 'DECONSOLIDATION AT ' concatenated with port code (first 4 characters); Move the built reason to cargo release reason field; Set current CCN key to information message CCN key; Execute log cargo information message procedure (Z150-LOG-CARGO-INFO-MSG)
Context: A follower manifest has been released or deconsolidated
GIVEN
A follower manifest has been released or deconsolidated
Applied to: Process Associated US Manifest: Find US Cargo by Car ID and Waybill, Log Release to US CCN
WHEN
The system processes associated US manifest
THEN
Set US manifest not found flag to true; Set not end-of-file flag to true; Move current equipment car ID key to US cargo car ID index; Move saved waybill index to US cargo waybill index; Execute Get Unique US cargo by car and waybill (Z3300-GU-US-CARGO-BY-CARWB); Execute Get Next US cargo by car and waybill repeatedly (Z3350-GN-US-CARGO-BY-CARWB) until US manifest found or end-of-file; If end-of-file reached, exit US manifest processing; If US manifest found: move log information, build date string from machine century and date, move machine time to log time, set action code to use input message, move US CCN key to train or US CCN field, set US cargo indicator to true, build message string 'CDN CCN RLSED BY EDI 350: ' concatenated with Canadian CCN key, execute spawn log entry procedure (Z300-SPAWN-GCT1051E)
Context: All release information has been set for the follower manifest and US manifest processing is complete
GIVEN
All release information has been set for the follower manifest and US manifest processing is complete
Applied to: Update Follower Cargo Record in Database
WHEN
The system updates the follower cargo record
THEN
Move spaces to database status code; Move blank to database accept status; Execute database Replace operation using cargo PCB; Pass cargo report segment for update
Context: A follower manifest has been processed and updated
GIVEN
A follower manifest has been processed and updated
Applied to: More Followers in Array?
WHEN
The system determines whether to continue the processing loop
THEN
If the current loop index J is less than the total follower count I, continue loop to process next follower; If the current loop index J equals or exceeds the total follower count I, exit loop and proceed to restore master information
Context: All follower manifests have been processed and updated
GIVEN
All follower manifests have been processed and updated
Applied to: Restore Master Cargo Information
WHEN
The system completes follower processing
THEN
Move saved master cargo report segment to current cargo report segment; Move saved master waybill key to current waybill index; Move saved master equipment car to current car ID key
R-GCCUSIO-cbl-00611 (+6) File: GCCUSIO.cbl Determine Hold Index Action Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Hold Index Action':
  • Context - a cargo record exists in the system:
    For Clear Hold Index Fields:
    When the cargo does not have any hold status conditions (uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-b, uscargo-pr-h-bo, uscargo-hold-d, uscargo-pr-h-de, uscargo-holdfda), then the system clears the held destination index and held border index fields by setting them to spaces.
  • Context - a cargo status record exists with hold index fields cleared and no hold conditions present:
    For Delete Hold Index Record:
    When there are no error destination index fields, no error origin index fields, and no error border index fields present, then the system deletes the entire cargo status record from gcsb1rt.
    For Update Hold Index Record:
    When there are error destination index fields, error origin index fields, or error border index fields present, then the system updates the existing cargo status record in gcsb1rt with the cleared hold fields while preserving error information.
  • Context - a cargo record has hold status conditions:
    For Set Destination Hold Index Fields:
    When the cargo has uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-d, uscargo-pr-h-de, or uscargo-holdfda status, then the system sets the held destination index to the destination station number and held destination cargo index to the cargo ccn key.
    For Set Border Hold Index Fields:
    When the cargo has uscargo-hold, uscargo-holdpcs, uscargo-pr-hpcs, uscargo-hold-b, uscargo-pr-h-bo, or uscargo-holdfda status, then the system retrieves the station number from the mc table using the location id, sets the held border index to this station number, and sets the held border cargo index to the cargo ccn key.
  • Context - a cargo status record exists in gcsb1rt and cargo has hold conditions:
    For Update Existing Hold Index Record:
    When hold index fields have been populated with destination and/or border hold information, then the system updates the existing cargo status record in gcsb1rt with the new hold index field values.
  • Context - no cargo status record exists in gcsb1rt and cargo has hold conditions:
    For Create New Hold Index Record:
    When hold index fields have been populated with destination and/or border hold information, then the system creates a new cargo status record in gcsb1rt with the hold index field values and cargo key information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Clear Hold Index Fields
WHEN
The cargo does not have any hold status conditions (USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, USCARGO-HOLD-D, USCARGO-PR-H-DE, USCARGO-HOLDFDA)
THEN
The system clears the held destination index and held border index fields by setting them to spaces
Context: A cargo status record exists with hold index fields cleared and no hold conditions present
GIVEN
A cargo status record exists with hold index fields cleared and no hold conditions present
Applied to: Delete Hold Index Record
WHEN
There are no error destination index fields, no error origin index fields, and no error border index fields present
THEN
The system deletes the entire cargo status record from GCSB1RT
Applied to: Update Hold Index Record
WHEN
There are error destination index fields, error origin index fields, or error border index fields present
THEN
The system updates the existing cargo status record in GCSB1RT with the cleared hold fields while preserving error information
Context: A cargo record has hold status conditions
GIVEN
A cargo record has hold status conditions
Applied to: Set Destination Hold Index Fields
WHEN
The cargo has USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-D, USCARGO-PR-H-DE, or USCARGO-HOLDFDA status
THEN
The system sets the held destination index to the destination station number and held destination cargo index to the cargo CCN key
Applied to: Set Border Hold Index Fields
WHEN
The cargo has USCARGO-HOLD, USCARGO-HOLDPCS, USCARGO-PR-HPCS, USCARGO-HOLD-B, USCARGO-PR-H-BO, or USCARGO-HOLDFDA status
THEN
The system retrieves the station number from the MC table using the location ID, sets the held border index to this station number, and sets the held border cargo index to the cargo CCN key
Context: A cargo status record exists in GCSB1RT and cargo has hold conditions
GIVEN
A cargo status record exists in GCSB1RT and cargo has hold conditions
Applied to: Update Existing Hold Index Record
WHEN
Hold index fields have been populated with destination and/or border hold information
THEN
The system updates the existing cargo status record in GCSB1RT with the new hold index field values
Context: No cargo status record exists in GCSB1RT and cargo has hold conditions
GIVEN
No cargo status record exists in GCSB1RT and cargo has hold conditions
Applied to: Create New Hold Index Record
WHEN
Hold index fields have been populated with destination and/or border hold information
THEN
The system creates a new cargo status record in GCSB1RT with the hold index field values and cargo key information
R-GCCUSIO-cbl-00618 (+3) File: GCCUSIO.cbl Execute Car ID Index Search Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Car ID Index Search':
  • Context - a primary cargo record exists with car identification information:
    For Set Car ID Index Key from Primary Record:
    When car id index search is requested, then the car id from the primary record rt071-car-id-index field is set as the search key value.
  • Context - a search operator is provided in the input parameters:
    For Set Search Operator from Input:
    When car id index search is configured, then the input operator is applied to the car id index search criteria.
  • Context - car id search key and operator are configured:
    For Configure Car ID Index PCB and SSA:
    When database access is prepared for car id index, then pcb2 is set for car id index access and qualified ssa is configured with search parameters.
  • Context - car id index search parameters are configured with pcb and ssa:
    For Execute Database Call via Car ID Index:
    When database search is executed, then the database management system is called with car id search parameters to find matching records.
👨‍💻 Technical ACs (Gherkin)
Context: A primary cargo record exists with car identification information
GIVEN
A primary cargo record exists with car identification information
Applied to: Set Car ID Index Key from Primary Record
WHEN
Car ID index search is requested
THEN
The car ID from the primary record RT071-CAR-ID-INDEX field is set as the search key value
Context: A search operator is provided in the input parameters
GIVEN
A search operator is provided in the input parameters
Applied to: Set Search Operator from Input
WHEN
Car ID index search is configured
THEN
The input operator is applied to the car ID index search criteria
Context: Car ID search key and operator are configured
GIVEN
Car ID search key and operator are configured
Applied to: Configure Car ID Index PCB and SSA
WHEN
Database access is prepared for Car ID index
THEN
PCB2 is set for Car ID index access and qualified SSA is configured with search parameters
Context: Car ID index search parameters are configured with PCB and SSA
GIVEN
Car ID index search parameters are configured with PCB and SSA
Applied to: Execute Database Call via Car ID Index
WHEN
Database search is executed
THEN
The database management system is called with Car ID search parameters to find matching records
R-GCX126-cbl-00620 (+18) File: GCX126R.cbl Process Follower Manifests for Master Deconsolidation Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Follower Manifests for Master Deconsolidation':
  • Context - a master manifest cargo record has been identified for deconsolidation processing:
    For Save Master Cargo Information:
    When the system begins processing follower manifests, then the master cargo segment, master ccn key, and master waybill index are saved to temporary storage for later restoration.
  • Context - a master manifest ccn exists and follower manifest array is initialized with index starting at 1:
    For Get Next Cargo Record:
    When the system retrieves the next cargo record using the master ccn as the parent reference, then the system continues retrieving cargo records until either end of database is reached or the index exceeds 100 follower manifests.
  • Context - a cargo record has been retrieved from the database:
    For Status Code = Blank AND Master CCN Matches?:
    When the system validates the cargo record, then the cargo record is considered valid if the database status code is blank (successful retrieval) and the cargo's master manifest ccn matches the current master ccn being processed.
  • Context - a cargo record has been validated as belonging to the master manifest ccn:
    For Is Follower Manifest?:
    When the system checks the manifest type indicator, then the cargo is identified as a follower manifest if it is not flagged as a master manifest.
  • Context - a cargo record has been identified as a valid follower manifest:
    For Store Follower CCN in Array:
    When the system stores the follower ccn, then the follower manifest ccn key is stored in the follower array at the current index position and the index is incremented by 1.
  • Context - the follower manifest retrieval process has completed and the index has been decremented by 1:
    For Index <= 0?:
    When the system checks if any follower manifests were found, then if the adjusted index is less than or equal to 0, exit the process as no follower manifests exist for this master.
  • Context - at least one follower manifest ccn has been stored in the follower array:
    For Initialize Loop Counter J to 1:
    When the system prepares to process each follower manifest, then the loop counter j is set to 1 to begin processing from the first follower manifest in the array.
  • Context - the system is iterating through the follower manifest array:
    For Follower CCN Empty OR J > Index?:
    When the system checks the loop continuation condition, then the loop continues if the follower ccn at position j is not empty (not spaces or low-values) and the counter j has not exceeded the total number of followers (index).
  • Context - a follower manifest ccn exists at the current array position j:
    For Retrieve Follower Cargo by CCN:
    When the system retrieves the cargo record, then the follower ccn is used as the key value to retrieve the cargo report segment from the database.
  • Context - the system has attempted to retrieve a follower cargo record by ccn:
    For Cargo Found?:
    When the system checks the retrieval result, then the cargo is considered found if the cargo found indicator is set to true, otherwise skip to the next follower manifest.
  • Context - a follower cargo record has been successfully retrieved from the database:
    For Set Release Information for Follower:
    When the system applies release information, then the destination station numbers are cleared, release date is set to current machine date, release time is set to current machine time, release by is set to current user id, current status is set to 'released', release status is set to 'r', release type is set to 'a', error/release status index is cleared, and error status is cleared.
  • Context - release information has been applied to the follower cargo record:
    For Build Release Message:
    When the system builds the release message, then the message is formatted as 'edi 350: release via decon at port' followed by the port code from the p4 segment (first 4 characters).
  • Context - the release message has been built for the follower manifest:
    For Set Release Reason with Deconsolidation Port:
    When the system sets the release reason, then the release reason field is populated with 'deconsolidation at' followed by the port code from the p4 segment (first 4 characters).
  • Context - the release reason has been set for the follower cargo record:
    For Log Release Message to Follower CCN:
    When the system logs the release message, then the current follower ccn key is set as the current ccn key and the release message is logged to the cargo information message log with current date, time, user id, and action code.
  • Context - the release message has been logged for the follower cargo:
    For Save Follower Waybill Index:
    When the system prepares to process the us manifest, then the follower's waybill key for index is saved to the waybill index variable and the follower's equipment car id is saved to the current car id key variable.
  • Context - the follower cargo waybill index and equipment car id have been saved:
    For Process Associated US Manifest for Follower:
    When the system processes the us manifest, then the system searches for us cargo records matching the equipment car id and waybill number, and if found (not deleted and no train created), logs a message indicating the canadian ccn was released by edi 350 with the us ccn reference.
  • Context - all release information has been applied to the follower cargo record and us manifest has been processed:
    For Update Follower Cargo Record:
    When the system updates the database, then the cargo report segment is replaced in the database with the updated follower cargo information.
  • Context - the current follower manifest has been fully processed and updated:
    For Increment Loop Counter J:
    When the system advances to the next follower, then the loop counter j is incremented by 1 to point to the next follower ccn in the array.
  • Context - all follower manifests in the array have been processed or an empty follower ccn position was encountered:
    For Restore Master Cargo Information:
    When the system completes follower processing, then the saved master cargo segment is restored to the cargo report segment, the saved master waybill index is restored to the waybill index variable, and the saved master equipment car id is restored to the current car id key variable.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest cargo record has been identified for deconsolidation processing
GIVEN
A master manifest cargo record has been identified for deconsolidation processing
Applied to: Save Master Cargo Information
WHEN
The system begins processing follower manifests
THEN
The master cargo segment, master CCN key, and master waybill index are saved to temporary storage for later restoration
Context: A master manifest CCN exists and follower manifest array is initialized with index starting at 1
GIVEN
A master manifest CCN exists and follower manifest array is initialized with index starting at 1
Applied to: Get Next Cargo Record
WHEN
The system retrieves the next cargo record using the master CCN as the parent reference
THEN
The system continues retrieving cargo records until either end of database is reached OR the index exceeds 100 follower manifests
Context: A cargo record has been retrieved from the database
GIVEN
A cargo record has been retrieved from the database
Applied to: Status Code = Blank AND Master CCN Matches?
WHEN
The system validates the cargo record
THEN
The cargo record is considered valid if the database status code is blank (successful retrieval) AND the cargo's master manifest CCN matches the current master CCN being processed
Context: A cargo record has been validated as belonging to the master manifest CCN
GIVEN
A cargo record has been validated as belonging to the master manifest CCN
Applied to: Is Follower Manifest?
WHEN
The system checks the manifest type indicator
THEN
The cargo is identified as a follower manifest if it is NOT flagged as a master manifest
Context: A cargo record has been identified as a valid follower manifest
GIVEN
A cargo record has been identified as a valid follower manifest
Applied to: Store Follower CCN in Array
WHEN
The system stores the follower CCN
THEN
The follower manifest CCN key is stored in the follower array at the current index position AND the index is incremented by 1
Context: The follower manifest retrieval process has completed and the index has been decremented by 1
GIVEN
The follower manifest retrieval process has completed and the index has been decremented by 1
Applied to: Index <= 0?
WHEN
The system checks if any follower manifests were found
THEN
If the adjusted index is less than or equal to 0, exit the process as no follower manifests exist for this master
Context: At least one follower manifest CCN has been stored in the follower array
GIVEN
At least one follower manifest CCN has been stored in the follower array
Applied to: Initialize Loop Counter J to 1
WHEN
The system prepares to process each follower manifest
THEN
The loop counter J is set to 1 to begin processing from the first follower manifest in the array
Context: The system is iterating through the follower manifest array
GIVEN
The system is iterating through the follower manifest array
Applied to: Follower CCN Empty OR J > Index?
WHEN
The system checks the loop continuation condition
THEN
The loop continues if the follower CCN at position J is not empty (not spaces or low-values) AND the counter J has not exceeded the total number of followers (index)
Context: A follower manifest CCN exists at the current array position J
GIVEN
A follower manifest CCN exists at the current array position J
Applied to: Retrieve Follower Cargo by CCN
WHEN
The system retrieves the cargo record
THEN
The follower CCN is used as the key value to retrieve the cargo report segment from the database
Context: The system has attempted to retrieve a follower cargo record by CCN
GIVEN
The system has attempted to retrieve a follower cargo record by CCN
Applied to: Cargo Found?
WHEN
The system checks the retrieval result
THEN
The cargo is considered found if the cargo found indicator is set to true, otherwise skip to the next follower manifest
Context: A follower cargo record has been successfully retrieved from the database
GIVEN
A follower cargo record has been successfully retrieved from the database
Applied to: Set Release Information for Follower
WHEN
The system applies release information
THEN
The destination station numbers are cleared, release date is set to current machine date, release time is set to current machine time, release by is set to current user ID, current status is set to 'RELEASED', release status is set to 'R', release type is set to 'A', error/release status index is cleared, and error status is cleared
Context: Release information has been applied to the follower cargo record
GIVEN
Release information has been applied to the follower cargo record
Applied to: Build Release Message
WHEN
The system builds the release message
THEN
The message is formatted as 'EDI 350: RELEASE VIA DECON AT PORT' followed by the port code from the P4 segment (first 4 characters)
Context: The release message has been built for the follower manifest
GIVEN
The release message has been built for the follower manifest
Applied to: Set Release Reason with Deconsolidation Port
WHEN
The system sets the release reason
THEN
The release reason field is populated with 'DECONSOLIDATION AT' followed by the port code from the P4 segment (first 4 characters)
Context: The release reason has been set for the follower cargo record
GIVEN
The release reason has been set for the follower cargo record
Applied to: Log Release Message to Follower CCN
WHEN
The system logs the release message
THEN
The current follower CCN key is set as the current CCN key AND the release message is logged to the cargo information message log with current date, time, user ID, and action code
Context: The release message has been logged for the follower cargo
GIVEN
The release message has been logged for the follower cargo
Applied to: Save Follower Waybill Index
WHEN
The system prepares to process the US manifest
THEN
The follower's waybill key for index is saved to the waybill index variable AND the follower's equipment car ID is saved to the current car ID key variable
Context: The follower cargo waybill index and equipment car ID have been saved
GIVEN
The follower cargo waybill index and equipment car ID have been saved
Applied to: Process Associated US Manifest for Follower
WHEN
The system processes the US manifest
THEN
The system searches for US cargo records matching the equipment car ID and waybill number, and if found (not deleted and no train created), logs a message indicating the Canadian CCN was released by EDI 350 with the US CCN reference
Context: All release information has been applied to the follower cargo record and US manifest has been processed
GIVEN
All release information has been applied to the follower cargo record and US manifest has been processed
Applied to: Update Follower Cargo Record
WHEN
The system updates the database
THEN
The cargo report segment is replaced in the database with the updated follower cargo information
Context: The current follower manifest has been fully processed and updated
GIVEN
The current follower manifest has been fully processed and updated
Applied to: Increment Loop Counter J
WHEN
The system advances to the next follower
THEN
The loop counter J is incremented by 1 to point to the next follower CCN in the array
Context: All follower manifests in the array have been processed OR an empty follower CCN position was encountered
GIVEN
All follower manifests in the array have been processed OR an empty follower CCN position was encountered
Applied to: Restore Master Cargo Information
WHEN
The system completes follower processing
THEN
The saved master cargo segment is restored to the cargo report segment, the saved master waybill index is restored to the waybill index variable, and the saved master equipment car ID is restored to the current car ID key variable
R-GCCUSIO-cbl-00622 (+4) File: GCCUSIO.cbl Execute Waybill Index Search Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Waybill Index Search':
  • Context - a waybill index search operation is initiated:
    For Set Waybill PCB for Database Access:
    When the system prepares to access the waybill database, then the system sets the waybill pcb (gcus-pcb3) as the database access control block.
  • Context - a cargo record with waybill index information exists:
    For Extract Waybill Index Value from Cargo Record:
    When the system performs a waybill index search, then the system extracts the waybill index value from gcusrt-rt072-waybill-index and assigns it to gcuw-key-value.
  • Context - input parameters contain a search operator specification:
    For Set Search Operator from Input Parameters:
    When the system prepares a waybill index search, then the system assigns the operator from gcwusio-operator to gcuw-operator for the search criteria.
  • Context - waybill key value and operator are set:
    For Build Qualified SSA for Waybill Search:
    When the system builds the search criteria, then the system assigns gcuw-ssa-qual to ws-ssa-1 to create a qualified search specification.
  • Context - waybill search criteria and database access parameters are configured:
    For Execute Database Call with Waybill Index:
    When the system executes the waybill index search, then the system performs x1100-call-one-ssa to execute the database call with the waybill index search criteria.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill index search operation is initiated
GIVEN
A waybill index search operation is initiated
Applied to: Set Waybill PCB for Database Access
WHEN
The system prepares to access the waybill database
THEN
The system sets the waybill PCB (GCUS-PCB3) as the database access control block
Context: A cargo record with waybill index information exists
GIVEN
A cargo record with waybill index information exists
Applied to: Extract Waybill Index Value from Cargo Record
WHEN
The system performs a waybill index search
THEN
The system extracts the waybill index value from GCUSRT-RT072-WAYBILL-INDEX and assigns it to GCUW-KEY-VALUE
Context: Input parameters contain a search operator specification
GIVEN
Input parameters contain a search operator specification
Applied to: Set Search Operator from Input Parameters
WHEN
The system prepares a waybill index search
THEN
The system assigns the operator from GCWUSIO-OPERATOR to GCUW-OPERATOR for the search criteria
Context: Waybill key value and operator are set
GIVEN
Waybill key value and operator are set
Applied to: Build Qualified SSA for Waybill Search
WHEN
The system builds the search criteria
THEN
The system assigns GCUW-SSA-QUAL to WS-SSA-1 to create a qualified search specification
Context: Waybill search criteria and database access parameters are configured
GIVEN
Waybill search criteria and database access parameters are configured
Applied to: Execute Database Call with Waybill Index
WHEN
The system executes the waybill index search
THEN
The system performs X1100-CALL-ONE-SSA to execute the database call with the waybill index search criteria
R-GCCUSIO-cbl-00627 (+6) File: GCCUSIO.cbl Execute Database Search Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Database Search':
  • Context - a database operation needs to be executed:
    For Set Function Code:
    When the system prepares database call parameters, then the function code is set to the requested operation type (gu, gn, isrt, repl, dlet, ghu, zap).
  • Context - a database operation is being prepared for a specific segment type:
    For Set PCB Control Block:
    When the system sets up the database call parameters, then the appropriate pcb is assigned to the working storage pcb field based on the target segment.
  • Context - a database search operation is being prepared:
    For Set SSA Search Arguments:
    When the system determines if key values are provided for search criteria, then if key values are spaces for gu or gn operations, unqualified ssa is used, otherwise qualified ssa with key values is configured.
  • Context - database call parameters are prepared with function code, pcb, and ssa:
    For Execute CIMS Database Call:
    When the system executes the database operation, then the cims program is called with the communication area, function code, pcb, io area, and ssa parameters.
  • Context - a database operation has been executed through cims:
    For Database Call Successful?:
    When the system checks the operation result, then if cc-status-code is spaces, the operation is successful, otherwise it indicates an error or not found condition.
  • Context - a database retrieval operation completed successfully:
    For Return Retrieved Data:
    When data is returned from the database, then the retrieved segment data is available in the gcwusio-io-area for further processing.
  • Context - a database operation failed or returned not found:
    For Set Error Status:
    When the system processes the unsuccessful operation result, then the error status code is preserved in cc-status-code for the calling program to handle appropriately.
👨‍💻 Technical ACs (Gherkin)
Context: A database operation needs to be executed
GIVEN
A database operation needs to be executed
Applied to: Set Function Code
WHEN
The system prepares database call parameters
THEN
The function code is set to the requested operation type (GU, GN, ISRT, REPL, DLET, GHU, ZAP)
Context: A database operation is being prepared for a specific segment type
GIVEN
A database operation is being prepared for a specific segment type
Applied to: Set PCB Control Block
WHEN
The system sets up the database call parameters
THEN
The appropriate PCB is assigned to the working storage PCB field based on the target segment
Context: A database search operation is being prepared
GIVEN
A database search operation is being prepared
Applied to: Set SSA Search Arguments
WHEN
The system determines if key values are provided for search criteria
THEN
If key values are spaces for GU or GN operations, unqualified SSA is used, otherwise qualified SSA with key values is configured
Context: Database call parameters are prepared with function code, PCB, and SSA
GIVEN
Database call parameters are prepared with function code, PCB, and SSA
Applied to: Execute CIMS Database Call
WHEN
The system executes the database operation
THEN
The CIMS program is called with the communication area, function code, PCB, IO area, and SSA parameters
Context: A database operation has been executed through CIMS
GIVEN
A database operation has been executed through CIMS
Applied to: Database Call Successful?
WHEN
The system checks the operation result
THEN
If CC-STATUS-CODE is spaces, the operation is successful, otherwise it indicates an error or not found condition
Context: A database retrieval operation completed successfully
GIVEN
A database retrieval operation completed successfully
Applied to: Return Retrieved Data
WHEN
Data is returned from the database
THEN
The retrieved segment data is available in the GCWUSIO-IO-AREA for further processing
Context: A database operation failed or returned not found
GIVEN
A database operation failed or returned not found
Applied to: Set Error Status
WHEN
The system processes the unsuccessful operation result
THEN
The error status code is preserved in CC-STATUS-CODE for the calling program to handle appropriately
R-GCCUSIO-cbl-00634 (+5) File: GCCUSIO.cbl Execute Bond Index Search Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Bond Index Search':
  • Context - a cargo record with bond index information:
    For Bond Index Data Available?:
    When the system evaluates the bond index field for search operations, then the system identifies whether bond index data is available (not empty or spaces) or unavailable (empty or spaces).
  • Context - a cargo record where bond index field is not empty or spaces:
    For Set Bond Index Key Value:
    When the system prepares for bond index search operation, then the system sets the bond index value as the search key value for qualified search.
  • Context - a cargo record with valid bond index data and assigned search key value:
    For Set Qualified Search SSA:
    When the system configures search parameters for bond index lookup, then the system sets qualified ssa parameters for targeted bond index search.
  • Context - a cargo record where bond index field is empty or contains only spaces:
    For Set Empty Key Value:
    When the system prepares search parameters for bond index operation, then the system sets the search key value to spaces for unqualified search.
  • Context - a cargo record with empty bond index data and empty search key value:
    For Set Unqualified Search SSA:
    When the system configures search parameters for bond index lookup, then the system sets unqualified ssa parameters for broad bond index search.
  • Context - configured search parameters (either qualified or unqualified) for bond index lookup:
    For Execute Bond Index Database Call:
    When the system executes the bond index database search operation, then the system performs database call using the configured ssa parameters to retrieve matching bond records.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond index information
GIVEN
A cargo record with bond index information
Applied to: Bond Index Data Available?
WHEN
The system evaluates the bond index field for search operations
THEN
The system identifies whether bond index data is available (not empty or spaces) or unavailable (empty or spaces)
Context: A cargo record where bond index field is not empty or spaces
GIVEN
A cargo record where bond index field is not empty or spaces
Applied to: Set Bond Index Key Value
WHEN
The system prepares for bond index search operation
THEN
The system sets the bond index value as the search key value for qualified search
Context: A cargo record with valid bond index data and assigned search key value
GIVEN
A cargo record with valid bond index data and assigned search key value
Applied to: Set Qualified Search SSA
WHEN
The system configures search parameters for bond index lookup
THEN
The system sets qualified SSA parameters for targeted bond index search
Context: A cargo record where bond index field is empty or contains only spaces
GIVEN
A cargo record where bond index field is empty or contains only spaces
Applied to: Set Empty Key Value
WHEN
The system prepares search parameters for bond index operation
THEN
The system sets the search key value to spaces for unqualified search
Context: A cargo record with empty bond index data and empty search key value
GIVEN
A cargo record with empty bond index data and empty search key value
Applied to: Set Unqualified Search SSA
WHEN
The system configures search parameters for bond index lookup
THEN
The system sets unqualified SSA parameters for broad bond index search
Context: Configured search parameters (either qualified or unqualified) for bond index lookup
GIVEN
Configured search parameters (either qualified or unqualified) for bond index lookup
Applied to: Execute Bond Index Database Call
WHEN
The system executes the bond index database search operation
THEN
The system performs database call using the configured SSA parameters to retrieve matching bond records
R-GCX126-cbl-00639 (+6) File: GCX126R.cbl Retrieve First US Cargo Record by Car ID and Waybill Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve First US Cargo Record by Car ID and Waybill':
  • Context - a canadian cargo record is being processed with a valid equipment car id key and waybill index:
    For Set Car ID from Current Cargo Equipment:
    When the system prepares to search for associated us cargo records, then the system sets the us cargo search car id to the current cargo's equipment car id key, sets the us cargo search waybill index to the current cargo's waybill index, and initializes the us ccn key index to low values to start from the beginning of the index.
  • Context - the search parameters are initialized with car id, waybill index, and us ccn key set to low values, and the search operator is set to '>=':
    For Call Database to Get First US Cargo Record:
    When the system calls the database i/o module to retrieve us cargo using the car id and waybill index, then the system executes a gu (get unique) function against the us cargo segment with the specified search criteria and returns the first matching or next higher record.
  • Context - a database retrieval operation has been executed for us cargo:
    For Record Found?:
    When the system checks the database status code, then if the status code is blank (spaces), the record is found and processing continues; if the status code is not blank, no record exists and the end-of-database flag is set.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID and Waybill Match?:
    When the system compares the retrieved us cargo's car id index (first 12 characters) with the current cargo equipment car id key and compares the us cargo's waybill index with the current cargo's waybill index, then if both the car id (first 12 characters) and waybill index match exactly, the record is valid for processing; if either does not match, the end-of-database flag is set.
  • Context - a us cargo record has been retrieved and validated for car id and waybill match:
    For Cargo Deleted or TR Created?:
    When the system checks the us cargo's deletion status indicator and the train-created indicator, then if the cargo deletion status is 'd' (deleted) or the train-created-for-it indicator is 'y', the record is skipped and end-of-database flag is set; if both conditions are false, the us manifest found flag is set.
  • Context - a us cargo record exists that matches the car id and waybill, is not deleted, and does not have a train already created:
    For Mark US Manifest Found:
    When all validation checks pass successfully, then the system sets the us manifest found indicator to true, allowing the us cargo to be processed for release updates.
  • Context - the database retrieval operation has completed:
    For Mark End of Database:
    When any of the following conditions occur: database status is not blank, car id or waybill does not match, cargo is deleted, or train is already created, then the system sets the end-of-database flag to true, indicating no valid us cargo record is available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record is being processed with a valid equipment car ID key and waybill index
GIVEN
A Canadian cargo record is being processed with a valid equipment car ID key and waybill index
Applied to: Set Car ID from Current Cargo Equipment
WHEN
The system prepares to search for associated US cargo records
THEN
The system sets the US cargo search car ID to the current cargo's equipment car ID key, sets the US cargo search waybill index to the current cargo's waybill index, and initializes the US CCN key index to low values to start from the beginning of the index
Context: The search parameters are initialized with car ID, waybill index, and US CCN key set to low values, and the search operator is set to '>='
GIVEN
The search parameters are initialized with car ID, waybill index, and US CCN key set to low values, and the search operator is set to '>='
Applied to: Call Database to Get First US Cargo Record
WHEN
The system calls the database I/O module to retrieve US cargo using the car ID and waybill index
THEN
The system executes a GU (Get Unique) function against the US cargo segment with the specified search criteria and returns the first matching or next higher record
Context: A database retrieval operation has been executed for US cargo
GIVEN
A database retrieval operation has been executed for US cargo
Applied to: Record Found?
WHEN
The system checks the database status code
THEN
If the status code is blank (spaces), the record is found and processing continues; if the status code is not blank, no record exists and the end-of-database flag is set
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID and Waybill Match?
WHEN
The system compares the retrieved US cargo's car ID index (first 12 characters) with the current cargo equipment car ID key and compares the US cargo's waybill index with the current cargo's waybill index
THEN
If both the car ID (first 12 characters) and waybill index match exactly, the record is valid for processing; if either does not match, the end-of-database flag is set
Context: A US cargo record has been retrieved and validated for car ID and waybill match
GIVEN
A US cargo record has been retrieved and validated for car ID and waybill match
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks the US cargo's deletion status indicator and the train-created indicator
THEN
If the cargo deletion status is 'D' (deleted) or the train-created-for-it indicator is 'Y', the record is skipped and end-of-database flag is set; if both conditions are false, the US manifest found flag is set
Context: A US cargo record exists that matches the car ID and waybill, is not deleted, and does not have a train already created
GIVEN
A US cargo record exists that matches the car ID and waybill, is not deleted, and does not have a train already created
Applied to: Mark US Manifest Found
WHEN
All validation checks pass successfully
THEN
The system sets the US manifest found indicator to true, allowing the US cargo to be processed for release updates
Context: The database retrieval operation has completed
GIVEN
The database retrieval operation has completed
Applied to: Mark End of Database
WHEN
Any of the following conditions occur: database status is not blank, car ID or waybill does not match, cargo is deleted, or train is already created
THEN
The system sets the end-of-database flag to true, indicating no valid US cargo record is available for processing
R-GCCUSIO-cbl-00640 (+6) File: GCCUSIO.cbl SSA Parameters Built Successfully Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'SSA Parameters Built Successfully':
  • Context - a primary cargo segment (gcsusrt) operation is being processed and the ccn key field contains a valid value (not spaces):
    For Set Qualified SSA with CCN Key:
    When the system builds ssa parameters for database access, then the system creates a qualified ssa using the ccn key value for targeted record retrieval.
  • Context - a primary cargo segment (gcsusrt) operation is being processed and the ccn key field is empty or contains only spaces:
    For Set Unqualified SSA:
    When the system builds ssa parameters for database access, then the system creates an unqualified ssa for broader record access without key constraints.
  • Context - a secondary cargo segment (gcsa2rt) operation is being processed and the secondary key field contains a valid value (not spaces):
    For Set Qualified SSA with Secondary Key:
    When the system builds ssa parameters for database access, then the system creates a qualified ssa using the secondary key value for targeted record retrieval.
  • Context - a secondary cargo segment (gcsa2rt) retrieval operation (gu or gn) is being processed and the secondary key field is empty or contains only spaces:
    For Return Error - Key Required:
    When the system attempts to build ssa parameters for database access, then the system returns error code '0012' with message 'secn-key equal spaces'.
  • Context - a message segment (gcsa8rt) operation is being processed and the message key field contains a valid value (not spaces):
    For Set Qualified SSA with Message Key:
    When the system builds ssa parameters for database access, then the system creates a qualified ssa using the message key value for targeted record retrieval.
  • Context - a message segment (gcsa8rt) retrieval operation (gu or gn) is being processed and the message key field is empty or contains only spaces:
    For Return Error - Key Required:
    When the system attempts to build ssa parameters for database access, then the system returns error code '0012' with message 'gcsa8rt-key equal spaces'.
  • Context - a table segment (gcst2rt) operation is being processed:
    For Set Qualified SSA with Table Key:
    When the system builds ssa parameters for database access, then the system assigns the table key value and creates a qualified ssa for targeted table record retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A primary cargo segment (GCSUSRT) operation is being processed AND the CCN key field contains a valid value (not spaces)
GIVEN
A primary cargo segment (GCSUSRT) operation is being processed AND the CCN key field contains a valid value (not spaces)
Applied to: Set Qualified SSA with CCN Key
WHEN
The system builds SSA parameters for database access
THEN
The system creates a qualified SSA using the CCN key value for targeted record retrieval
Context: A primary cargo segment (GCSUSRT) operation is being processed AND the CCN key field is empty or contains only spaces
GIVEN
A primary cargo segment (GCSUSRT) operation is being processed AND the CCN key field is empty or contains only spaces
Applied to: Set Unqualified SSA
WHEN
The system builds SSA parameters for database access
THEN
The system creates an unqualified SSA for broader record access without key constraints
Context: A secondary cargo segment (GCSA2RT) operation is being processed AND the secondary key field contains a valid value (not spaces)
GIVEN
A secondary cargo segment (GCSA2RT) operation is being processed AND the secondary key field contains a valid value (not spaces)
Applied to: Set Qualified SSA with Secondary Key
WHEN
The system builds SSA parameters for database access
THEN
The system creates a qualified SSA using the secondary key value for targeted record retrieval
Context: A secondary cargo segment (GCSA2RT) retrieval operation (GU or GN) is being processed AND the secondary key field is empty or contains only spaces
GIVEN
A secondary cargo segment (GCSA2RT) retrieval operation (GU or GN) is being processed AND the secondary key field is empty or contains only spaces
Applied to: Return Error - Key Required
WHEN
The system attempts to build SSA parameters for database access
THEN
The system returns error code '0012' with message 'SECN-KEY EQUAL SPACES'
Context: A message segment (GCSA8RT) operation is being processed AND the message key field contains a valid value (not spaces)
GIVEN
A message segment (GCSA8RT) operation is being processed AND the message key field contains a valid value (not spaces)
Applied to: Set Qualified SSA with Message Key
WHEN
The system builds SSA parameters for database access
THEN
The system creates a qualified SSA using the message key value for targeted record retrieval
Context: A message segment (GCSA8RT) retrieval operation (GU or GN) is being processed AND the message key field is empty or contains only spaces
GIVEN
A message segment (GCSA8RT) retrieval operation (GU or GN) is being processed AND the message key field is empty or contains only spaces
Applied to: Return Error - Key Required
WHEN
The system attempts to build SSA parameters for database access
THEN
The system returns error code '0012' with message 'GCSA8RT-KEY EQUAL SPACES'
Context: A table segment (GCST2RT) operation is being processed
GIVEN
A table segment (GCST2RT) operation is being processed
Applied to: Set Qualified SSA with Table Key
WHEN
The system builds SSA parameters for database access
THEN
The system assigns the table key value and creates a qualified SSA for targeted table record retrieval
R-GCX126-cbl-00646 (+7) File: GCX126R.cbl Retrieve Next US Cargo Record by Car ID and Waybill Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Next US Cargo Record by Car ID and Waybill':
  • Context - a current cargo record exists with a car identification key and waybill index:
    For Set Search Parameters: - Car ID from Current Cargo - Waybill Index from Current Cargo - Operator: Greater Than:
    When the system prepares to retrieve the next us cargo record by car and waybill, then the search parameters are set with car id from current cargo's car identification key, waybill index from saved waybill index, function code set to get next, segment type set to us cargo, index type set to car-waybill, and operator set to greater than ('>') for sequential retrieval.
  • Context - search parameters are configured with car id, waybill index, get next function, us cargo segment type, car-waybill index type, and greater-than operator:
    For Call Database to Get Next US Cargo Record by Car/Waybill Index:
    When the database retrieval operation is invoked, then the system calls the cargo input/output module to retrieve the next us cargo record based on the car-waybill index.
  • Context - a database retrieval operation has been executed for the next us cargo record:
    For Database Status OK? - No - Not Found:
    When the database status code is not blank (indicating no record found or error condition), then the end-of-database flag is set to true to indicate no more records are available.
  • Context - a us cargo record has been successfully retrieved from the database with car identification index and waybill number index:
    For Car ID and Waybill Match Current Cargo?:
    When the system validates the retrieved record against the current cargo, then if the first 12 characters of the retrieved car identification index match the current cargo's car identification key and the waybill number index matches the saved waybill index, the validation passes; otherwise, the end-of-database flag is set to true.
  • Context - a us cargo record has been retrieved and validated for car id and waybill match:
    For Cargo Deleted?:
    When the system checks the cargo's deletion status, then if the cargo record has a deletion status indicator showing it is deleted, the record is skipped and processing continues to the next iteration; otherwise, proceed to check transfer receipt status.
  • Context - a us cargo record has been retrieved, validated for match, and confirmed as not deleted:
    For Transfer Receipt Created?:
    When the system checks if a transfer receipt exists for this cargo, then if the transfer receipt created indicator equals 'y', the record is skipped and processing continues to the next iteration; otherwise, the us manifest found flag is set to true.
  • Context - a us cargo record has been retrieved that matches car id and waybill, is not deleted, and has no transfer receipt created:
    For Set US Manifest Found Flag:
    When all validation checks pass successfully, then the us manifest found flag is set to true to indicate a valid matching record has been located.
  • Context - a us cargo record has been retrieved from the database:
    For Car ID and Waybill Match Current Cargo? - No - Different Cargo:
    When the first 12 characters of the car identification index do not match the current cargo's car identification key or the waybill number index does not match the saved waybill index, then the end-of-database flag is set to true to terminate the search loop.
👨‍💻 Technical ACs (Gherkin)
Context: A current cargo record exists with a car identification key and waybill index
GIVEN
A current cargo record exists with a car identification key and waybill index
Applied to: Set Search Parameters: - Car ID from Current Cargo - Waybill Index from Current Cargo - Operator: Greater Than
WHEN
The system prepares to retrieve the next US cargo record by car and waybill
THEN
The search parameters are set with car ID from current cargo's car identification key, waybill index from saved waybill index, function code set to Get Next, segment type set to US cargo, index type set to car-waybill, and operator set to greater than ('>') for sequential retrieval
Context: Search parameters are configured with car ID, waybill index, Get Next function, US cargo segment type, car-waybill index type, and greater-than operator
GIVEN
Search parameters are configured with car ID, waybill index, Get Next function, US cargo segment type, car-waybill index type, and greater-than operator
Applied to: Call Database to Get Next US Cargo Record by Car/Waybill Index
WHEN
The database retrieval operation is invoked
THEN
The system calls the cargo input/output module to retrieve the next US cargo record based on the car-waybill index
Context: A database retrieval operation has been executed for the next US cargo record
GIVEN
A database retrieval operation has been executed for the next US cargo record
Applied to: Database Status OK? - No - Not Found
WHEN
The database status code is not blank (indicating no record found or error condition)
THEN
The end-of-database flag is set to true to indicate no more records are available
Context: A US cargo record has been successfully retrieved from the database with car identification index and waybill number index
GIVEN
A US cargo record has been successfully retrieved from the database with car identification index and waybill number index
Applied to: Car ID and Waybill Match Current Cargo?
WHEN
The system validates the retrieved record against the current cargo
THEN
If the first 12 characters of the retrieved car identification index match the current cargo's car identification key AND the waybill number index matches the saved waybill index, the validation passes; otherwise, the end-of-database flag is set to true
Context: A US cargo record has been retrieved and validated for car ID and waybill match
GIVEN
A US cargo record has been retrieved and validated for car ID and waybill match
Applied to: Cargo Deleted?
WHEN
The system checks the cargo's deletion status
THEN
If the cargo record has a deletion status indicator showing it is deleted, the record is skipped and processing continues to the next iteration; otherwise, proceed to check transfer receipt status
Context: A US cargo record has been retrieved, validated for match, and confirmed as not deleted
GIVEN
A US cargo record has been retrieved, validated for match, and confirmed as not deleted
Applied to: Transfer Receipt Created?
WHEN
The system checks if a transfer receipt exists for this cargo
THEN
If the transfer receipt created indicator equals 'Y', the record is skipped and processing continues to the next iteration; otherwise, the US manifest found flag is set to true
Context: A US cargo record has been retrieved that matches car ID and waybill, is not deleted, and has no transfer receipt created
GIVEN
A US cargo record has been retrieved that matches car ID and waybill, is not deleted, and has no transfer receipt created
Applied to: Set US Manifest Found Flag
WHEN
All validation checks pass successfully
THEN
The US manifest found flag is set to true to indicate a valid matching record has been located
Context: A US cargo record has been retrieved from the database
GIVEN
A US cargo record has been retrieved from the database
Applied to: Car ID and Waybill Match Current Cargo? - No - Different Cargo
WHEN
The first 12 characters of the car identification index do not match the current cargo's car identification key OR the waybill number index does not match the saved waybill index
THEN
The end-of-database flag is set to true to terminate the search loop
R-GCCUSIO-cbl-00647 (+2) File: GCCUSIO.cbl Continue with Normal Processing Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Continue with Normal Processing':
  • Context - a request to retrieve secondary cargo data (gcsa2rt segment) with retrieval function codes (gu or gn):
    For Secondary Index Key Provided?:
    When the system checks if a secondary index key (gcwusio-index-secn-key) is provided in the request, then if secondary index key is provided, route to secondary index search processing, otherwise route to primary key search processing.
  • Context - a secondary index key (gcwusio-index-secn-key) is provided for secondary cargo data retrieval:
    For Use Secondary Index Search:
    When the system processes the secondary index search request, then set the secondary key value to gcb2-key-value, set the operator to gcb2-operator, use qualified ssa (gcb2-ssa-qual), set pcb to gca2-pcb2, and execute the database call.
  • Context - no secondary index key is provided for secondary cargo data retrieval and function code is gu or gn:
    For Build Primary Secondary SSA:
    When the system needs to build ssa for primary key search on secondary data, then if the secondary key (gcsuss00-key) is spaces, set error '0012' with message 'secn-key equal spaces', otherwise set gcsuss00-key to gca2-key-value, use qualified ssa (gca2-ssa-qual), and set pcb to gca2-pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve secondary cargo data (GCSA2RT segment) with retrieval function codes (GU or GN)
GIVEN
A request to retrieve secondary cargo data (GCSA2RT segment) with retrieval function codes (GU or GN)
Applied to: Secondary Index Key Provided?
WHEN
The system checks if a secondary index key (GCWUSIO-INDEX-SECN-KEY) is provided in the request
THEN
If secondary index key is provided, route to secondary index search processing, otherwise route to primary key search processing
Context: A secondary index key (GCWUSIO-INDEX-SECN-KEY) is provided for secondary cargo data retrieval
GIVEN
A secondary index key (GCWUSIO-INDEX-SECN-KEY) is provided for secondary cargo data retrieval
Applied to: Use Secondary Index Search
WHEN
The system processes the secondary index search request
THEN
Set the secondary key value to GCB2-KEY-VALUE, set the operator to GCB2-OPERATOR, use qualified SSA (GCB2-SSA-QUAL), set PCB to GCA2-PCB2, and execute the database call
Context: No secondary index key is provided for secondary cargo data retrieval and function code is GU or GN
GIVEN
No secondary index key is provided for secondary cargo data retrieval and function code is GU or GN
Applied to: Build Primary Secondary SSA
WHEN
The system needs to build SSA for primary key search on secondary data
THEN
If the secondary key (GCSUSS00-KEY) is spaces, set error '0012' with message 'SECN-KEY EQUAL SPACES', otherwise set GCSUSS00-KEY to GCA2-KEY-VALUE, use qualified SSA (GCA2-SSA-QUAL), and set PCB to GCA2-PCB
R-GCCUSIO-cbl-00650 (+4) File: GCCUSIO.cbl Processing Complete Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Processing Complete':
  • Context - a gcsa8rt segment delete operation is requested with function code 'dlet':
    For Delete Operation Completed:
    When the system processes the delete request, then the system retrieves the existing record first using 'ghu' function and if the record exists, deletes it using 'dlet' function with unqualified ssa.
  • Context - a gcsa8rt segment insert operation is requested with function code 'isrt':
    For Insert/Replace Operation Completed:
    When the system processes the insert request, then the system first attempts to retrieve existing record with 'ghu' function, and if record exists performs 'repl' operation, otherwise performs 'isrt' operation with the formatted segment data.
  • Context - a gcsa8rt insert or replace operation is being processed:
    For Insert/Replace Operation Completed:
    When the system prepares the segment data for database operation, then the system moves the gcsa8rt key to the segment key field and moves the saved io area data to the segment data field, then moves the complete formatted segment to the io area.
  • Context - a gcsa8rt segment retrieve operation is requested with function code 'gu':
    For Message Data Formatted for Return:
    When the system successfully retrieves the record, then the system moves the complete io area to a work segment, extracts only the data portion from the work segment, and moves the extracted data back to the io area for return.
  • Context - a gcsa8rt retrieve operation with function code 'gu' or 'gn' is requested:
    For Retrieve Operation Completed:
    When the system validates the input parameters, then if the gcsa8rt key equals spaces, the system sets error number '0012' and error message 'gcsa8rt-key equal spaces', otherwise builds qualified ssa with the key value.
👨‍💻 Technical ACs (Gherkin)
Context: A GCSA8RT segment delete operation is requested with function code 'DLET'
GIVEN
A GCSA8RT segment delete operation is requested with function code 'DLET'
Applied to: Delete Operation Completed
WHEN
The system processes the delete request
THEN
The system retrieves the existing record first using 'GHU' function and if the record exists, deletes it using 'DLET' function with unqualified SSA
Context: A GCSA8RT segment insert operation is requested with function code 'ISRT'
GIVEN
A GCSA8RT segment insert operation is requested with function code 'ISRT'
Applied to: Insert/Replace Operation Completed
WHEN
The system processes the insert request
THEN
The system first attempts to retrieve existing record with 'GHU' function, and if record exists performs 'REPL' operation, otherwise performs 'ISRT' operation with the formatted segment data
Context: A GCSA8RT insert or replace operation is being processed
GIVEN
A GCSA8RT insert or replace operation is being processed
Applied to: Insert/Replace Operation Completed
WHEN
The system prepares the segment data for database operation
THEN
The system moves the GCSA8RT key to the segment key field and moves the saved IO area data to the segment data field, then moves the complete formatted segment to the IO area
Context: A GCSA8RT segment retrieve operation is requested with function code 'GU'
GIVEN
A GCSA8RT segment retrieve operation is requested with function code 'GU'
Applied to: Message Data Formatted for Return
WHEN
The system successfully retrieves the record
THEN
The system moves the complete IO area to a work segment, extracts only the data portion from the work segment, and moves the extracted data back to the IO area for return
Context: A GCSA8RT retrieve operation with function code 'GU' or 'GN' is requested
GIVEN
A GCSA8RT retrieve operation with function code 'GU' or 'GN' is requested
Applied to: Retrieve Operation Completed
WHEN
The system validates the input parameters
THEN
If the GCSA8RT key equals spaces, the system sets error number '0012' and error message 'GCSA8RT-KEY EQUAL SPACES', otherwise builds qualified SSA with the key value
R-GCCUSIO-cbl-00655 (+4) File: GCCUSIO.cbl Call Table Lookup Service GCCTBIO Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Table Lookup Service GCCTBIO':
  • Context - a cargo record contains a location id in rt04-location-id-name field:
    For Set MC Table Parameters - Table ID: 'MC' - Sequence ID from Location:
    When the system needs to retrieve border station information for error processing, then the system sets up mc table lookup parameters with table id 'mc' and sequence id from the location field, calls gcctbio service, and if successful extracts the station number for border error indexing.
  • Context - a cargo record has a status change that requires external notification and contains waybill station information:
    For Set IH Table Parameters - Table ID: 'IH' - Sequence ID from Station:
    When the system processes ih notification in z2000-process-ih-notification, then the system sets up ih table lookup parameters with table id 'ih' and sequence id from the waybill station, calls gcctbio service, and if found processes the notification through gccih.
  • Context - any table lookup operation is required regardless of table type:
    For Set Generic Table Parameters - Function Code: 'GU' - Clear Return Flags:
    When the system initiates a table lookup through z1900-get-table-segment, then the system sets function code to 'gu' (get unique), clears all return flags and secondary pcb flags, and prepares standard calling parameters for the gcctbio service.
  • Context - a table lookup operation has been performed and gcctbio returns success flag '0':
    For Extract Station Information - Station Number - Border Station Data:
    When the system processes the returned table segment data, then the system extracts the relevant business data from ws-table-segment into the appropriate fields such as station numbers for mc tables or notification settings for ih tables.
  • Context - a table lookup operation is performed through gcctbio service:
    For Set Return Flag to Not Found:
    When the table lookup returns a non-zero return flag indicating the table entry was not found, then the system continues processing without the table data and does not perform operations that depend on the missing table information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record contains a location ID in RT04-LOCATION-ID-NAME field
GIVEN
A cargo record contains a location ID in RT04-LOCATION-ID-NAME field
Applied to: Set MC Table Parameters - Table ID: 'MC' - Sequence ID from Location
WHEN
The system needs to retrieve border station information for error processing
THEN
The system sets up MC table lookup parameters with table ID 'MC' and sequence ID from the location field, calls GCCTBIO service, and if successful extracts the station number for border error indexing
Context: A cargo record has a status change that requires external notification and contains waybill station information
GIVEN
A cargo record has a status change that requires external notification and contains waybill station information
Applied to: Set IH Table Parameters - Table ID: 'IH' - Sequence ID from Station
WHEN
The system processes IH notification in Z2000-PROCESS-IH-NOTIFICATION
THEN
The system sets up IH table lookup parameters with table ID 'IH' and sequence ID from the waybill station, calls GCCTBIO service, and if found processes the notification through GCCIH
Context: Any table lookup operation is required regardless of table type
GIVEN
Any table lookup operation is required regardless of table type
Applied to: Set Generic Table Parameters - Function Code: 'GU' - Clear Return Flags
WHEN
The system initiates a table lookup through Z1900-GET-TABLE-SEGMENT
THEN
The system sets function code to 'GU' (Get Unique), clears all return flags and secondary PCB flags, and prepares standard calling parameters for the GCCTBIO service
Context: A table lookup operation has been performed and GCCTBIO returns success flag '0'
GIVEN
A table lookup operation has been performed and GCCTBIO returns success flag '0'
Applied to: Extract Station Information - Station Number - Border Station Data
WHEN
The system processes the returned table segment data
THEN
The system extracts the relevant business data from WS-TABLE-SEGMENT into the appropriate fields such as station numbers for MC tables or notification settings for IH tables
Context: A table lookup operation is performed through GCCTBIO service
GIVEN
A table lookup operation is performed through GCCTBIO service
Applied to: Set Return Flag to Not Found
WHEN
The table lookup returns a non-zero return flag indicating the table entry was not found
THEN
The system continues processing without the table data and does not perform operations that depend on the missing table information
R-GCCUSIO-cbl-00660 (+9) File: GCCUSIO.cbl Call Table Lookup Service Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Table Lookup Service':
  • Context - a table lookup operation is requested:
    For Initialize Table Lookup Parameters:
    When the system prepares to call the table lookup service, then all table lookup parameters are cleared to spaces and flags are reset to ensure clean initialization.
  • Context - a table lookup operation is being configured:
    For Set Function Code to 'GU':
    When the system sets the operation type for table access, then the function code is set to 'gu' to indicate a unique record retrieval operation.
  • Context - a station information lookup is required:
    For Set Table ID to 'MC':
    When the system configures the table identifier, then the table id is set to 'mc' to target the station master table.
  • Context - a cargo record contains a location id:
    For Set Sequence ID from Location:
    When the system prepares to lookup station information, then the location id from the cargo record is used as the sequence key for table search.
  • Context - a table lookup operation is about to be executed:
    For Clear Return Flag:
    When the system prepares the return status indicator, then the return flag is cleared to spaces to enable proper success/failure detection.
  • Context - all table lookup parameters are properly configured:
    For Call GCCTBIO Table Service:
    When the system executes the table lookup operation, then the gcctbio service is called with the function code, table identifiers, and search keys to retrieve the requested data.
  • Context - a table lookup operation has been executed:
    For Return Flag = '0'?:
    When the system evaluates the operation result, then if the return flag equals '0', the lookup is considered successful, otherwise it indicates the record was not found.
  • Context - a table lookup operation returned successfully with return flag '0':
    For Extract Station Information:
    When the system processes the retrieved table data, then station information is extracted from the table segment for use in subsequent processing.
  • Context - table data has been successfully retrieved and station information extracted:
    For Move Table Segment to Working Storage:
    When the system prepares to process the station data, then the table segment is moved to the mc segment working storage area for further processing.
  • Context - mc table segment data is available in working storage:
    For Extract Station Number:
    When the system needs the station number for cargo processing, then the station number is extracted from the mc table segment data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A table lookup operation is requested
GIVEN
A table lookup operation is requested
Applied to: Initialize Table Lookup Parameters
WHEN
The system prepares to call the table lookup service
THEN
All table lookup parameters are cleared to spaces and flags are reset to ensure clean initialization
Context: A table lookup operation is being configured
GIVEN
A table lookup operation is being configured
Applied to: Set Function Code to 'GU'
WHEN
The system sets the operation type for table access
THEN
The function code is set to 'GU' to indicate a unique record retrieval operation
Context: A station information lookup is required
GIVEN
A station information lookup is required
Applied to: Set Table ID to 'MC'
WHEN
The system configures the table identifier
THEN
The table ID is set to 'MC' to target the station master table
Context: A cargo record contains a location ID
GIVEN
A cargo record contains a location ID
Applied to: Set Sequence ID from Location
WHEN
The system prepares to lookup station information
THEN
The location ID from the cargo record is used as the sequence key for table search
Context: A table lookup operation is about to be executed
GIVEN
A table lookup operation is about to be executed
Applied to: Clear Return Flag
WHEN
The system prepares the return status indicator
THEN
The return flag is cleared to spaces to enable proper success/failure detection
Context: All table lookup parameters are properly configured
GIVEN
All table lookup parameters are properly configured
Applied to: Call GCCTBIO Table Service
WHEN
The system executes the table lookup operation
THEN
The GCCTBIO service is called with the function code, table identifiers, and search keys to retrieve the requested data
Context: A table lookup operation has been executed
GIVEN
A table lookup operation has been executed
Applied to: Return Flag = '0'?
WHEN
The system evaluates the operation result
THEN
If the return flag equals '0', the lookup is considered successful, otherwise it indicates the record was not found
Context: A table lookup operation returned successfully with return flag '0'
GIVEN
A table lookup operation returned successfully with return flag '0'
Applied to: Extract Station Information
WHEN
The system processes the retrieved table data
THEN
Station information is extracted from the table segment for use in subsequent processing
Context: Table data has been successfully retrieved and station information extracted
GIVEN
Table data has been successfully retrieved and station information extracted
Applied to: Move Table Segment to Working Storage
WHEN
The system prepares to process the station data
THEN
The table segment is moved to the MC segment working storage area for further processing
Context: MC table segment data is available in working storage
GIVEN
MC table segment data is available in working storage
Applied to: Extract Station Number
WHEN
The system needs the station number for cargo processing
THEN
The station number is extracted from the MC table segment data structure
R-GCX126-cbl-00666 (+15) File: GCX126R.cbl Process Each Follower Manifest Release Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Each Follower Manifest Release':
  • Context - a follower manifest array exists with potential follower ccns:
    For Initialize Follower Array Index J = 1:
    When the system begins processing follower manifests for a master manifest release, then the array index j is initialized to 1 to start processing from the first follower manifest.
  • Context - the follower manifest array with index j and a maximum limit of 100 follower manifests:
    For Follower Manifest Available?:
    When the system checks if more follower manifests need to be processed, then processing continues if the follower manifest at index j is not spaces or low-values and j is less than or equal to the total number of followers and j does not exceed 100.
  • Context - a follower manifest array with index j pointing to a valid entry:
    For Get Follower CCN from Array:
    When the system needs to process a specific follower manifest, then the follower ccn at array position j is moved to the cargo lookup key fields (ccrt-ssaq and a2rt-ssaq).
  • Context - a follower manifest ccn has been retrieved from the array:
    For 16: Lookup Cargo by Follower CCN:
    When the system performs a cargo lookup using the follower ccn, then the cargo record is retrieved from gcsccrt table using ghu operation and cargo status switches are set to indicate if cargo was found, deleted, or has other status conditions.
  • Context - a cargo lookup has been performed for the follower manifest ccn:
    For Cargo Found?:
    When the system evaluates the cargo lookup result, then processing continues if cargo is found (ws-cargo-found is true) and cargo is not deleted and cargo is not returned and waybill matches (if applicable), otherwise skip to next follower.
  • Context - a valid cargo record exists for the follower manifest and the v9 segment contains a notice reason code:
    For Notice Reason Type?:
    When the system determines the type of release message to create, then if v9-02-released is true, process as standard release, otherwise if v9-02-decon is true, process as deconsolidation release.
  • Context - the follower manifest has a standard release notice reason code (v9-02-released) and x4 segment contains release reference id and p4 segment contains port code:
    For Build Release Message with Release Reference and Port:
    When the system builds the release message for logging, then the message 'edi 350: release : ' is concatenated with x4-01-cbsa-rel-ref-id (first 15 characters) and ' at port ' and p4-01-port-cde (first 4 characters) into ws-gcx105-info-msg.
    For Set Release Reason with Release Reference and Port:
    When the system updates the cargo release reason field, then x4-01-cbsa-rel-ref-id (first 15 characters) and '/' and p4-01-port-cde (first 4 characters) are concatenated into gccc-release-reason.
  • Context - the follower manifest has a deconsolidation notice reason code (v9-02-decon) and p4 segment contains port code:
    For Build Decon Release Message with Port:
    When the system builds the deconsolidation release message for logging, then the message 'edi 350: release via decon at port ' is concatenated with p4-01-port-cde (first 4 characters) into ws-gcx105-info-msg.
    For Set Release Reason with Deconsolidation Port:
    When the system updates the cargo release reason field, then the text 'deconsolidation at ' is concatenated with p4-01-port-cde (first 4 characters) into gccc-release-reason.
  • Context - a release message has been built in ws-gcx105-info-msg and the follower cargo ccn is in ws-current-ccn-key:
    For 42: Log Cargo Information Message:
    When the system logs the release information, then a gct1051e log entry is created with current machine date in gcx105-date, current machine time in gcx105-time, follower ccn in gcx105-train-or-us-ccn, cargo type set to ca-cargo, action code set to log-use-input-message, and the release message in gcx105-message.
  • Context - a follower manifest has been released and the cargo record contains equipment car id and waybill number:
    For 31: Process Associated US Manifest:
    When the system searches for associated us cargo manifest, then the system retrieves us cargo from gcsusrt table using equipment car id and waybill number and if a matching us cargo is found that is not deleted and has no train created, a log entry is created with message 'cdn ccn rlsed by edi 350: ' concatenated with the canadian follower ccn.
  • Context - all release information has been set in the follower cargo segment (gccc-cargo-report-segment) including release date, time, user, status, type, and reason:
    For 43: Update Cargo Record:
    When the system updates the follower cargo record, then the cargo record is replaced in gcsccrt table using repl operation with the updated cargo segment data.
  • Context - the current follower manifest has been processed (whether successfully or skipped):
    For Increment Array Index J:
    When the system prepares to process the next follower manifest, then the array index j is incremented by 1.
  • Context - the array index j has been incremented and there is a follower manifest array with potential entries:
    For More Followers or Max 100 Reached?:
    When the system evaluates whether to continue the processing loop, then the loop continues if the follower manifest at index j is not spaces or low-values and j is less than or equal to the total number of followers and j does not exceed 100, otherwise the loop terminates.
  • Context - all follower manifests in the array have been processed or the maximum limit of 100 has been reached or no more valid follower ccns exist in the array:
    For End Process Follower Manifests:
    When the system completes the follower manifest processing loop, then control returns to the calling procedure and the follower manifest processing section exits.
👨‍💻 Technical ACs (Gherkin)
Context: A follower manifest array exists with potential follower CCNs
GIVEN
A follower manifest array exists with potential follower CCNs
Applied to: Initialize Follower Array Index J = 1
WHEN
The system begins processing follower manifests for a master manifest release
THEN
The array index J is initialized to 1 to start processing from the first follower manifest
Context: The follower manifest array with index J and a maximum limit of 100 follower manifests
GIVEN
The follower manifest array with index J and a maximum limit of 100 follower manifests
Applied to: Follower Manifest Available?
WHEN
The system checks if more follower manifests need to be processed
THEN
Processing continues if the follower manifest at index J is not spaces or low-values AND J is less than or equal to the total number of followers AND J does not exceed 100
Context: A follower manifest array with index J pointing to a valid entry
GIVEN
A follower manifest array with index J pointing to a valid entry
Applied to: Get Follower CCN from Array
WHEN
The system needs to process a specific follower manifest
THEN
The follower CCN at array position J is moved to the cargo lookup key fields (CCRT-SSAQ and A2RT-SSAQ)
Context: A follower manifest CCN has been retrieved from the array
GIVEN
A follower manifest CCN has been retrieved from the array
Applied to: 16: Lookup Cargo by Follower CCN
WHEN
The system performs a cargo lookup using the follower CCN
THEN
The cargo record is retrieved from GCSCCRT table using GHU operation AND cargo status switches are set to indicate if cargo was found, deleted, or has other status conditions
Context: A cargo lookup has been performed for the follower manifest CCN
GIVEN
A cargo lookup has been performed for the follower manifest CCN
Applied to: Cargo Found?
WHEN
The system evaluates the cargo lookup result
THEN
Processing continues if cargo is found (WS-CARGO-FOUND is true) AND cargo is not deleted AND cargo is not returned AND waybill matches (if applicable), otherwise skip to next follower
Context: A valid cargo record exists for the follower manifest AND the V9 segment contains a notice reason code
GIVEN
A valid cargo record exists for the follower manifest AND the V9 segment contains a notice reason code
Applied to: Notice Reason Type?
WHEN
The system determines the type of release message to create
THEN
If V9-02-RELEASED is true, process as standard release, otherwise if V9-02-DECON is true, process as deconsolidation release
Context: The follower manifest has a standard release notice reason code (V9-02-RELEASED) AND X4 segment contains release reference ID AND P4 segment contains port code
GIVEN
The follower manifest has a standard release notice reason code (V9-02-RELEASED) AND X4 segment contains release reference ID AND P4 segment contains port code
Applied to: Build Release Message with Release Reference and Port
WHEN
The system builds the release message for logging
THEN
The message 'EDI 350: RELEASE : ' is concatenated with X4-01-CBSA-REL-REF-ID (first 15 characters) and ' AT PORT ' and P4-01-PORT-CDE (first 4 characters) into WS-GCX105-INFO-MSG
Applied to: Set Release Reason with Release Reference and Port
WHEN
The system updates the cargo release reason field
THEN
X4-01-CBSA-REL-REF-ID (first 15 characters) and '/' and P4-01-PORT-CDE (first 4 characters) are concatenated into GCCC-RELEASE-REASON
Context: The follower manifest has a deconsolidation notice reason code (V9-02-DECON) AND P4 segment contains port code
GIVEN
The follower manifest has a deconsolidation notice reason code (V9-02-DECON) AND P4 segment contains port code
Applied to: Build Decon Release Message with Port
WHEN
The system builds the deconsolidation release message for logging
THEN
The message 'EDI 350: RELEASE VIA DECON AT PORT ' is concatenated with P4-01-PORT-CDE (first 4 characters) into WS-GCX105-INFO-MSG
Applied to: Set Release Reason with Deconsolidation Port
WHEN
The system updates the cargo release reason field
THEN
The text 'DECONSOLIDATION AT ' is concatenated with P4-01-PORT-CDE (first 4 characters) into GCCC-RELEASE-REASON
Context: A release message has been built in WS-GCX105-INFO-MSG AND the follower cargo CCN is in WS-CURRENT-CCN-KEY
GIVEN
A release message has been built in WS-GCX105-INFO-MSG AND the follower cargo CCN is in WS-CURRENT-CCN-KEY
Applied to: 42: Log Cargo Information Message
WHEN
The system logs the release information
THEN
A GCT1051E log entry is created with current machine date in GCX105-DATE, current machine time in GCX105-TIME, follower CCN in GCX105-TRAIN-OR-US-CCN, cargo type set to CA-CARGO, action code set to LOG-USE-INPUT-MESSAGE, and the release message in GCX105-MESSAGE
Context: A follower manifest has been released AND the cargo record contains equipment car ID and waybill number
GIVEN
A follower manifest has been released AND the cargo record contains equipment car ID and waybill number
Applied to: 31: Process Associated US Manifest
WHEN
The system searches for associated US cargo manifest
THEN
The system retrieves US cargo from GCSUSRT table using equipment car ID and waybill number AND if a matching US cargo is found that is not deleted and has no train created, a log entry is created with message 'CDN CCN RLSED BY EDI 350: ' concatenated with the Canadian follower CCN
Context: All release information has been set in the follower cargo segment (GCCC-CARGO-REPORT-SEGMENT) including release date, time, user, status, type, and reason
GIVEN
All release information has been set in the follower cargo segment (GCCC-CARGO-REPORT-SEGMENT) including release date, time, user, status, type, and reason
Applied to: 43: Update Cargo Record
WHEN
The system updates the follower cargo record
THEN
The cargo record is replaced in GCSCCRT table using REPL operation with the updated cargo segment data
Context: The current follower manifest has been processed (whether successfully or skipped)
GIVEN
The current follower manifest has been processed (whether successfully or skipped)
Applied to: Increment Array Index J
WHEN
The system prepares to process the next follower manifest
THEN
The array index J is incremented by 1
Context: The array index J has been incremented AND there is a follower manifest array with potential entries
GIVEN
The array index J has been incremented AND there is a follower manifest array with potential entries
Applied to: More Followers or Max 100 Reached?
WHEN
The system evaluates whether to continue the processing loop
THEN
The loop continues if the follower manifest at index J is not spaces or low-values AND J is less than or equal to the total number of followers AND J does not exceed 100, otherwise the loop terminates
Context: All follower manifests in the array have been processed OR the maximum limit of 100 has been reached OR no more valid follower CCNs exist in the array
GIVEN
All follower manifests in the array have been processed OR the maximum limit of 100 has been reached OR no more valid follower CCNs exist in the array
Applied to: End Process Follower Manifests
WHEN
The system completes the follower manifest processing loop
THEN
Control returns to the calling procedure and the follower manifest processing section exits
R-GCCUSIO-cbl-00670 (+9) File: GCCUSIO.cbl Retrieve N9 Reference Data Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve N9 Reference Data':
  • Context - a cargo control number (ccn) exists in the primary cargo record:
    For Build Secondary Cargo Key with CCN:
    When the system needs to retrieve n9 reference data for iron highway notification, then the system builds a secondary cargo key using the ccn from the primary record.
  • Context - the system is preparing to retrieve n9 reference data from secondary cargo records:
    For Set Record Type to '02':
    When building the access key for secondary cargo data, then the system sets the record type to '02' to identify n9 reference data segments.
  • Context - the system has identified the record type as '02' for n9 reference data:
    For Set Sequence Number to '0001':
    When accessing n9 reference segments in secondary cargo data, then the system sets the sequence number to '0001' to retrieve the first n9 segment.
  • Context - a complete secondary cargo key has been built with ccn, record type '02', and sequence '0001':
    For Retrieve Secondary Cargo Record GCSUSS02:
    When the system executes the retrieval operation for n9 reference data, then the system attempts to read the gcsuss02 secondary cargo record using the qualified key.
  • Context - the system has attempted to retrieve the secondary cargo record with n9 data:
    For Record Found?:
    When the retrieval operation completes, then the system checks if the record was found successfully to determine n9 data availability.
  • Context - n9 reference data record has been successfully retrieved:
    For Initialize N9 Counter to Zero:
    When the system begins processing n9 reference segments, then the system initializes the n9 counter to zero to start processing from the first segment.
  • Context - n9 reference data is available and the counter is initialized:
    For Loop Through 20 N9 Reference Segments:
    When processing n9 reference segments for shipment identification, then the system loops through exactly 20 n9 reference segments to examine each one.
  • Context - the system is processing an n9 reference segment:
    For Reference Qualifier = 'CN'?:
    When examining the reference number qualifier in the current segment, then the system checks if the qualifier equals 'cn' to identify shipment id data.
  • Context - an n9 reference segment has qualifier 'cn' indicating shipment id data:
    For Extract Shipment ID from Reference Number:
    When processing the reference number field of the segment, then the system extracts the reference number value as the shipment id.
  • Context - a shipment id has been extracted from an n9 reference segment with qualifier 'cn':
    For Store Shipment ID for Iron Highway:
    When preparing data for iron highway notification, then the system stores the shipment id in the iron highway notification data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo control number (CCN) exists in the primary cargo record
GIVEN
A cargo control number (CCN) exists in the primary cargo record
Applied to: Build Secondary Cargo Key with CCN
WHEN
The system needs to retrieve N9 reference data for Iron Highway notification
THEN
The system builds a secondary cargo key using the CCN from the primary record
Context: The system is preparing to retrieve N9 reference data from secondary cargo records
GIVEN
The system is preparing to retrieve N9 reference data from secondary cargo records
Applied to: Set Record Type to '02'
WHEN
Building the access key for secondary cargo data
THEN
The system sets the record type to '02' to identify N9 reference data segments
Context: The system has identified the record type as '02' for N9 reference data
GIVEN
The system has identified the record type as '02' for N9 reference data
Applied to: Set Sequence Number to '0001'
WHEN
Accessing N9 reference segments in secondary cargo data
THEN
The system sets the sequence number to '0001' to retrieve the first N9 segment
Context: A complete secondary cargo key has been built with CCN, record type '02', and sequence '0001'
GIVEN
A complete secondary cargo key has been built with CCN, record type '02', and sequence '0001'
Applied to: Retrieve Secondary Cargo Record GCSUSS02
WHEN
The system executes the retrieval operation for N9 reference data
THEN
The system attempts to read the GCSUSS02 secondary cargo record using the qualified key
Context: The system has attempted to retrieve the secondary cargo record with N9 data
GIVEN
The system has attempted to retrieve the secondary cargo record with N9 data
Applied to: Record Found?
WHEN
The retrieval operation completes
THEN
The system checks if the record was found successfully to determine N9 data availability
Context: N9 reference data record has been successfully retrieved
GIVEN
N9 reference data record has been successfully retrieved
Applied to: Initialize N9 Counter to Zero
WHEN
The system begins processing N9 reference segments
THEN
The system initializes the N9 counter to zero to start processing from the first segment
Context: N9 reference data is available and the counter is initialized
GIVEN
N9 reference data is available and the counter is initialized
Applied to: Loop Through 20 N9 Reference Segments
WHEN
Processing N9 reference segments for shipment identification
THEN
The system loops through exactly 20 N9 reference segments to examine each one
Context: The system is processing an N9 reference segment
GIVEN
The system is processing an N9 reference segment
Applied to: Reference Qualifier = 'CN'?
WHEN
Examining the reference number qualifier in the current segment
THEN
The system checks if the qualifier equals 'CN' to identify shipment ID data
Context: An N9 reference segment has qualifier 'CN' indicating shipment ID data
GIVEN
An N9 reference segment has qualifier 'CN' indicating shipment ID data
Applied to: Extract Shipment ID from Reference Number
WHEN
Processing the reference number field of the segment
THEN
The system extracts the reference number value as the shipment ID
Context: A shipment ID has been extracted from an N9 reference segment with qualifier 'CN'
GIVEN
A shipment ID has been extracted from an N9 reference segment with qualifier 'CN'
Applied to: Store Shipment ID for Iron Highway
WHEN
Preparing data for Iron Highway notification
THEN
The system stores the shipment ID in the Iron Highway notification data structure
R-GCCUSIO-cbl-00680 (+12) File: GCCUSIO.cbl Proceed with Iron Highway Notification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Proceed with Iron Highway Notification':
  • Context - a cargo record is being processed for iron highway notification:
    For Check if Both Descriptions Empty:
    When both rt21 us cargo short description is spaces and rt10b cp cargo status description is spaces, then skip iron highway notification processing and exit.
    For Check if Status is RELEASE:
    When rt21 us cargo short description equals 'release', then skip iron highway notification processing and exit.
    For Station Table Found?:
    When iron highway station table lookup returns error flag not equal to '0', then skip iron highway notification processing and exit.
  • Context - a cargo record has empty us cargo short description:
    For Check if SENT Status with Empty Description:
    When rt21 us cargo short description is spaces and rt10b cp cargo status description equals 'sent ', then set the saved status to rt10b cp cargo status description for notification.
  • Context - a cargo record is being processed for status notification and the status is not deleted or release:
    For Compare Current vs Previous Status:
    When the saved status equals the current rt21 us cargo short description, then skip iron highway notification processing and exit.
  • Context - a cargo record requires iron highway notification:
    For Lookup Iron Highway Station Table:
    When processing iron highway notification for a cargo record, then lookup table 'ih' using saved waybill station as sequence id to get station configuration.
  • Context - iron highway station configuration is found for the cargo:
    For Extract N9 Reference Numbers:
    When processing n9 reference data for the cargo ccn key, then extract shipment id from n9 reference qualifier 'cn' and store in iron highway message.
  • Context - a cargo record requires iron highway notification and station configuration exists:
    For Set Status to DELETED:
    When rt10b cp cargo status description equals 'deleted', then set saved status to 'deleted' and set iron highway ccn status to 'deleted'.
  • Context - a cargo record requires iron highway notification and station configuration exists and status is not deleted:
    For Set Status to RELEASE:
    When rt10b cp cargo status description equals 'release', then set saved status to 'release' and set iron highway ccn status to 'release'.
  • Context - a cargo record requires iron highway notification and station configuration exists and status is not deleted or release:
    For Set Status to SENT:
    When rt21 us cargo short description is spaces and rt10b cp cargo status description equals 'sent ', then set iron highway ccn status to 'sent'.
  • Context - a cargo record requires iron highway notification and station configuration exists and status is not deleted or release and condition for sent status is not met:
    For Set Status from US Cargo Description:
    When processing status determination for iron highway notification, then set saved status to rt11 us cargo status and set iron highway ccn status to rt21 us cargo short description.
  • Context - a cargo record has been determined to require iron highway notification with valid status:
    For Prepare Iron Highway Message:
    When preparing the iron highway notification message, then set record type to 'uc' and set car id from saved car number and set waybill from saved waybill number and set ccn from cargo ccn key.
  • Context - iron highway notification message is prepared with all required cargo information:
    For Call Iron Highway Interface GCCIH:
    When sending the notification to iron highway system, then call external program 'gccih' with common control block and iron highway message structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for Iron Highway notification
GIVEN
A cargo record is being processed for Iron Highway notification
Applied to: Check if Both Descriptions Empty
WHEN
Both RT21 US cargo short description is spaces AND RT10B CP cargo status description is spaces
THEN
Skip Iron Highway notification processing and exit
Applied to: Check if Status is RELEASE
WHEN
RT21 US cargo short description equals 'RELEASE'
THEN
Skip Iron Highway notification processing and exit
Applied to: Station Table Found?
WHEN
Iron Highway station table lookup returns error flag not equal to '0'
THEN
Skip Iron Highway notification processing and exit
Context: A cargo record has empty US cargo short description
GIVEN
A cargo record has empty US cargo short description
Applied to: Check if SENT Status with Empty Description
WHEN
RT21 US cargo short description is spaces AND RT10B CP cargo status description equals 'SENT '
THEN
Set the saved status to RT10B CP cargo status description for notification
Context: A cargo record is being processed for status notification AND the status is not DELETED or RELEASE
GIVEN
A cargo record is being processed for status notification AND the status is not DELETED or RELEASE
Applied to: Compare Current vs Previous Status
WHEN
The saved status equals the current RT21 US cargo short description
THEN
Skip Iron Highway notification processing and exit
Context: A cargo record requires Iron Highway notification
GIVEN
A cargo record requires Iron Highway notification
Applied to: Lookup Iron Highway Station Table
WHEN
Processing Iron Highway notification for a cargo record
THEN
Lookup table 'IH' using saved waybill station as sequence ID to get station configuration
Context: Iron Highway station configuration is found for the cargo
GIVEN
Iron Highway station configuration is found for the cargo
Applied to: Extract N9 Reference Numbers
WHEN
Processing N9 reference data for the cargo CCN key
THEN
Extract shipment ID from N9 reference qualifier 'CN' and store in Iron Highway message
Context: A cargo record requires Iron Highway notification AND station configuration exists
GIVEN
A cargo record requires Iron Highway notification AND station configuration exists
Applied to: Set Status to DELETED
WHEN
RT10B CP cargo status description equals 'DELETED'
THEN
Set saved status to 'DELETED' AND set Iron Highway CCN status to 'DELETED'
Context: A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED
GIVEN
A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED
Applied to: Set Status to RELEASE
WHEN
RT10B CP cargo status description equals 'RELEASE'
THEN
Set saved status to 'RELEASE' AND set Iron Highway CCN status to 'RELEASE'
Context: A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED or RELEASE
GIVEN
A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED or RELEASE
Applied to: Set Status to SENT
WHEN
RT21 US cargo short description is spaces AND RT10B CP cargo status description equals 'SENT '
THEN
Set Iron Highway CCN status to 'SENT'
Context: A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED or RELEASE AND condition for SENT status is not met
GIVEN
A cargo record requires Iron Highway notification AND station configuration exists AND status is not DELETED or RELEASE AND condition for SENT status is not met
Applied to: Set Status from US Cargo Description
WHEN
Processing status determination for Iron Highway notification
THEN
Set saved status to RT11 US cargo status AND set Iron Highway CCN status to RT21 US cargo short description
Context: A cargo record has been determined to require Iron Highway notification with valid status
GIVEN
A cargo record has been determined to require Iron Highway notification with valid status
Applied to: Prepare Iron Highway Message
WHEN
Preparing the Iron Highway notification message
THEN
Set record type to 'UC' AND set car ID from saved car number AND set waybill from saved waybill number AND set CCN from cargo CCN key
Context: Iron Highway notification message is prepared with all required cargo information
GIVEN
Iron Highway notification message is prepared with all required cargo information
Applied to: Call Iron Highway Interface GCCIH
WHEN
Sending the notification to Iron Highway system
THEN
Call external program 'GCCIH' with common control block and Iron Highway message structure
R-GCX126-cbl-00682 (+9) File: GCX126R.cbl Handle Email Send Error Scenarios Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Email Send Error Scenarios':
  • Context - an email notification has been prepared with from usercode, destination filename, to usercode, copy usercode, subject, keywords, and report content:
    For Email Sent Successfully:
    When the emcsend2 service returns emi-no-errors status indicating successful email delivery, then the system purges the ims alternate pcb message queue and completes the email send process successfully.
  • Context - an email notification is being sent with a from usercode:
    For FROM User Not Found Error:
    When the emcsend2 service returns emi-from-not-found status indicating the from usercode does not exist in the system, then the system sets error message 'emi - invalid merlin from' and aborts the program execution.
  • Context - an email notification is being sent with a destination filename:
    For Invalid Filename Error:
    When the emcsend2 service returns emi-filename-invalid status indicating the destination filename is not valid, then the system sets error message 'emi - invalid merlin filename' and aborts the program execution.
  • Context - an email notification fails with emi-to-or-copy-not-found status and the invalid recipient usercode is identified:
    For Resend Failed Email to OM01247:
    When the email type is unrlse and to usercode at position 2 is invalid, or for other email types to usercode at position 1 is invalid, then the system saves the invalid merlin id, clears the to usercode, sets to usercode to 'om01247', sets destination filename to 'in', and resends the email notification.
  • Context - an email was successfully rerouted to default user om01247 after initial recipient was not found and the resend returned emi-no-errors status:
    For Resend Email with Reroute Notice:
    When the system prepares a new email with subject containing the invalid merlin id and message 'invalid merlin to - report reroute', then the system sends the reroute notification email to om01247 with destination filename 'in' and purges the ims message queue upon successful delivery.
  • Context - an email was rerouted to default user om01247 after initial recipient was not found:
    For Abort with Invalid TO/COPY Error:
    When the resend attempt returns emi-to-or-copy-not-found status indicating even the default recipient om01247 is invalid, then the system sets error message 'emi - invalid merlin to or copy' and aborts the program execution.
  • Context - an email is being rerouted to default user om01247 after initial recipient was not found:
    For FROM User Not Found Error:
    When the resend attempt returns emi-from-not-found status indicating the from usercode does not exist, then the system sets error message 'emi - invalid merlin from' and aborts the program execution.
    For Invalid Filename Error:
    When the resend attempt returns emi-filename-invalid status indicating the destination filename is not valid, then the system sets error message 'emi - invalid merlin filename' and aborts the program execution.
  • Context - an email notification fails with emi-to-or-copy-not-found status:
    For Resend Failed Email to OM01247:
    When the email type is 88-z110-mrln-type-is-unrlse, then the system saves the to usercode at position 2 as the invalid merlin id, otherwise saves the to usercode at position 1 as the invalid merlin id.
  • Context - an email notification has been processed through emcsend2 service:
    For End Email Send Process:
    When the email send process completes (either successfully or after successful reroute), then the system increments the machine format sequence number by 1 for tracking purposes.
👨‍💻 Technical ACs (Gherkin)
Context: An email notification has been prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and report content
GIVEN
An email notification has been prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and report content
Applied to: Email Sent Successfully
WHEN
The EMCSEND2 service returns EMI-NO-ERRORS status indicating successful email delivery
THEN
The system purges the IMS alternate PCB message queue and completes the email send process successfully
Context: An email notification is being sent with a FROM usercode
GIVEN
An email notification is being sent with a FROM usercode
Applied to: FROM User Not Found Error
WHEN
The EMCSEND2 service returns EMI-FROM-NOT-FOUND status indicating the FROM usercode does not exist in the system
THEN
The system sets error message 'EMI - INVALID MERLIN FROM' and aborts the program execution
Context: An email notification is being sent with a destination filename
GIVEN
An email notification is being sent with a destination filename
Applied to: Invalid Filename Error
WHEN
The EMCSEND2 service returns EMI-FILENAME-INVALID status indicating the destination filename is not valid
THEN
The system sets error message 'EMI - INVALID MERLIN FILENAME' and aborts the program execution
Context: An email notification fails with EMI-TO-OR-COPY-NOT-FOUND status and the invalid recipient usercode is identified
GIVEN
An email notification fails with EMI-TO-OR-COPY-NOT-FOUND status and the invalid recipient usercode is identified
Applied to: Resend Failed Email to OM01247
WHEN
The email type is UNRLSE and TO usercode at position 2 is invalid, or for other email types TO usercode at position 1 is invalid
THEN
The system saves the invalid Merlin ID, clears the TO usercode, sets TO usercode to 'OM01247', sets destination filename to 'IN', and resends the email notification
Context: An email was successfully rerouted to default user OM01247 after initial recipient was not found and the resend returned EMI-NO-ERRORS status
GIVEN
An email was successfully rerouted to default user OM01247 after initial recipient was not found and the resend returned EMI-NO-ERRORS status
Applied to: Resend Email with Reroute Notice
WHEN
The system prepares a new email with subject containing the invalid Merlin ID and message 'INVALID MERLIN TO - REPORT REROUTE'
THEN
The system sends the reroute notification email to OM01247 with destination filename 'IN' and purges the IMS message queue upon successful delivery
Context: An email was rerouted to default user OM01247 after initial recipient was not found
GIVEN
An email was rerouted to default user OM01247 after initial recipient was not found
Applied to: Abort with Invalid TO/COPY Error
WHEN
The resend attempt returns EMI-TO-OR-COPY-NOT-FOUND status indicating even the default recipient OM01247 is invalid
THEN
The system sets error message 'EMI - INVALID MERLIN TO OR COPY' and aborts the program execution
Context: An email is being rerouted to default user OM01247 after initial recipient was not found
GIVEN
An email is being rerouted to default user OM01247 after initial recipient was not found
Applied to: FROM User Not Found Error
WHEN
The resend attempt returns EMI-FROM-NOT-FOUND status indicating the FROM usercode does not exist
THEN
The system sets error message 'EMI - INVALID MERLIN FROM' and aborts the program execution
Applied to: Invalid Filename Error
WHEN
The resend attempt returns EMI-FILENAME-INVALID status indicating the destination filename is not valid
THEN
The system sets error message 'EMI - INVALID MERLIN FILENAME' and aborts the program execution
Context: An email notification fails with EMI-TO-OR-COPY-NOT-FOUND status
GIVEN
An email notification fails with EMI-TO-OR-COPY-NOT-FOUND status
Applied to: Resend Failed Email to OM01247
WHEN
The email type is 88-Z110-MRLN-TYPE-IS-UNRLSE
THEN
The system saves the TO usercode at position 2 as the invalid Merlin ID, otherwise saves the TO usercode at position 1 as the invalid Merlin ID
Context: An email notification has been processed through EMCSEND2 service
GIVEN
An email notification has been processed through EMCSEND2 service
Applied to: End Email Send Process
WHEN
The email send process completes (either successfully or after successful reroute)
THEN
The system increments the machine format sequence number by 1 for tracking purposes
R-GCX126-cbl-00692 (+6) File: GCX126R.cbl Validate US Cargo Record Match Criteria Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate US Cargo Record Match Criteria':
  • Context - a us cargo record has been retrieved with a car id number index:
    For Car ID Matches Current Car ID?:
    When the system compares the first 12 characters of the us cargo car id number index with the current car id key, then if the car ids do not match, set end of database flag and stop validation; if they match, continue to waybill validation.
  • Context - the us cargo record's car id matches the current car id:
    For Waybill Index Matches Saved Waybill?:
    When the system compares the us cargo waybill number index with the saved waybill index, then if the waybill numbers do not match, set end of database flag and stop validation; if they match, continue to cargo status validation.
  • Context - the us cargo record matches both car id and waybill number criteria:
    For Cargo Deleted?:
    When the system checks if the us cargo record has a deleted status indicator, then if the cargo is deleted, continue searching for next record without setting us manifest found flag; if not deleted, proceed to train creation check.
  • Context - the us cargo record is not deleted and matches car id and waybill criteria:
    For TR Created for Cargo?:
    When the system checks if the train created indicator equals 'y', then if train record exists (indicator = 'y'), continue searching for next record without setting us manifest found flag; if no train record exists, set us manifest found flag.
  • Context - the us cargo record matches car id and waybill, is not deleted, and has no existing train record:
    For Set US Manifest Found:
    When all validation criteria are satisfied, then set the us manifest found indicator to true to enable further processing of this us cargo record.
  • Context - a us cargo record has been retrieved during search:
    For Set End of Database:
    When either the car id does not match the current car id or the waybill number does not match the saved waybill index, then set the end of database flag to true to terminate the search process.
  • Context - the us cargo record matches car id and waybill criteria:
    For Continue Search:
    When the cargo is either marked as deleted or has a train record already created (indicator = 'y'), then continue to the next iteration of the search without setting the us manifest found flag.
👨‍💻 Technical ACs (Gherkin)
Context: A US cargo record has been retrieved with a car ID number index
GIVEN
A US cargo record has been retrieved with a car ID number index
Applied to: Car ID Matches Current Car ID?
WHEN
The system compares the first 12 characters of the US cargo car ID number index with the current car ID key
THEN
If the car IDs do not match, set end of database flag and stop validation; if they match, continue to waybill validation
Context: The US cargo record's car ID matches the current car ID
GIVEN
The US cargo record's car ID matches the current car ID
Applied to: Waybill Index Matches Saved Waybill?
WHEN
The system compares the US cargo waybill number index with the saved waybill index
THEN
If the waybill numbers do not match, set end of database flag and stop validation; if they match, continue to cargo status validation
Context: The US cargo record matches both car ID and waybill number criteria
GIVEN
The US cargo record matches both car ID and waybill number criteria
Applied to: Cargo Deleted?
WHEN
The system checks if the US cargo record has a deleted status indicator
THEN
If the cargo is deleted, continue searching for next record without setting US manifest found flag; if not deleted, proceed to train creation check
Context: The US cargo record is not deleted and matches car ID and waybill criteria
GIVEN
The US cargo record is not deleted and matches car ID and waybill criteria
Applied to: TR Created for Cargo?
WHEN
The system checks if the train created indicator equals 'Y'
THEN
If train record exists (indicator = 'Y'), continue searching for next record without setting US manifest found flag; if no train record exists, set US manifest found flag
Context: The US cargo record matches car ID and waybill, is not deleted, and has no existing train record
GIVEN
The US cargo record matches car ID and waybill, is not deleted, and has no existing train record
Applied to: Set US Manifest Found
WHEN
All validation criteria are satisfied
THEN
Set the US manifest found indicator to true to enable further processing of this US cargo record
Context: A US cargo record has been retrieved during search
GIVEN
A US cargo record has been retrieved during search
Applied to: Set End of Database
WHEN
Either the car ID does not match the current car ID or the waybill number does not match the saved waybill index
THEN
Set the end of database flag to true to terminate the search process
Context: The US cargo record matches car ID and waybill criteria
GIVEN
The US cargo record matches car ID and waybill criteria
Applied to: Continue Search
WHEN
The cargo is either marked as deleted or has a train record already created (indicator = 'Y')
THEN
Continue to the next iteration of the search without setting the US manifest found flag
R-GCCUSIO-cbl-00693 (+13) File: GCCUSIO.cbl Insert/Update GCSB1RT Record Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Insert/Update GCSB1RT Record':
  • Context - a cargo record exists in the system:
    For Delete GCSB1RT Record:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status and no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then the cargo status record should be deleted from gcsb1rt table.
  • Context - a cargo record exists with a gcsb1rt status record:
    For Clear Error Index Fields:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status, then the error origin index, error destination index, and error border index fields should be cleared to spaces.
    For Clear Hold Index Fields:
    When the cargo has no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then the held destination index and held border index fields should be cleared to spaces.
  • Context - a cargo gcsb1rt record exists with error fields cleared:
    For Delete GCSB1RT Record:
    When the held destination index is spaces and the held border index is spaces, then the gcsb1rt record should be deleted.
    For Update GCSB1RT Record:
    When the held destination index is not spaces or the held border index is not spaces, then the gcsb1rt record should be updated with the current field values.
  • Context - a cargo gcsb1rt record exists with hold fields cleared:
    For Delete GCSB1RT Record:
    When the error destination index is spaces and the error origin index is spaces and the error border index is spaces, then the gcsb1rt record should be deleted.
    For Update Existing GCSB1RT Record:
    When the error destination index is not spaces or the error origin index is not spaces or the error border index is not spaces, then the gcsb1rt record should be updated with the current field values.
  • Context - a cargo record has error or pending status conditions:
    For Populate Error Index Fields:
    When the cargo has cp cargo error status or cp cargo pending status or us cargo error status, then the error origin index should be set to origin station number, error destination index should be set to destination station number, error border index should be set to border station number from mc table lookup, and all error code fields should be set to 'e'.
  • Context - a cargo record has error conditions and no existing gcsb1rt record:
    For Create New GCSB1RT Record:
    When the gcsb1rt record retrieval returns not found status, then a new gcsb1rt record should be inserted with the cargo ccn key and populated error index fields.
  • Context - a cargo record has error conditions and an existing gcsb1rt record is found:
    For Update Existing GCSB1RT Record:
    When the gcsb1rt record retrieval returns successful status, then the existing gcsb1rt record should be updated with the populated error index fields.
  • Context - a cargo record has hold status conditions:
    For Populate Hold Index Fields:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold destination status or us cargo pre-hold destination status or us cargo hold fda status, then the held destination index should be set to destination station number and held destination cargo should be set to cargo ccn key.
  • Context - a cargo record has border hold status conditions:
    For Populate Hold Index Fields:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold border status or us cargo pre-hold border status or us cargo hold fda status, then the held border index should be set to border station number from mc table lookup and held border cargo should be set to cargo ccn key.
  • Context - a cargo record has hold conditions and no existing gcsb1rt record:
    For Create New GCSB1RT Record:
    When the gcsb1rt record retrieval returns not found status, then a new gcsb1rt record should be inserted with the cargo ccn key and populated hold index fields.
  • Context - a cargo record has hold conditions and an existing gcsb1rt record is found:
    For Update Existing GCSB1RT Record:
    When the gcsb1rt record retrieval returns successful status, then the existing gcsb1rt record should be updated with the populated hold index fields.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Delete GCSB1RT Record
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status AND no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
The cargo status record should be deleted from GCSB1RT table
Context: A cargo record exists with a GCSB1RT status record
GIVEN
A cargo record exists with a GCSB1RT status record
Applied to: Clear Error Index Fields
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status
THEN
The error origin index, error destination index, and error border index fields should be cleared to spaces
Applied to: Clear Hold Index Fields
WHEN
The cargo has no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
The held destination index and held border index fields should be cleared to spaces
Context: A cargo GCSB1RT record exists with error fields cleared
GIVEN
A cargo GCSB1RT record exists with error fields cleared
Applied to: Delete GCSB1RT Record
WHEN
The held destination index is spaces AND the held border index is spaces
THEN
The GCSB1RT record should be deleted
Applied to: Update GCSB1RT Record
WHEN
The held destination index is not spaces OR the held border index is not spaces
THEN
The GCSB1RT record should be updated with the current field values
Context: A cargo GCSB1RT record exists with hold fields cleared
GIVEN
A cargo GCSB1RT record exists with hold fields cleared
Applied to: Delete GCSB1RT Record
WHEN
The error destination index is spaces AND the error origin index is spaces AND the error border index is spaces
THEN
The GCSB1RT record should be deleted
Applied to: Update Existing GCSB1RT Record
WHEN
The error destination index is not spaces OR the error origin index is not spaces OR the error border index is not spaces
THEN
The GCSB1RT record should be updated with the current field values
Context: A cargo record has error or pending status conditions
GIVEN
A cargo record has error or pending status conditions
Applied to: Populate Error Index Fields
WHEN
The cargo has CP cargo error status OR CP cargo pending status OR US cargo error status
THEN
The error origin index should be set to origin station number, error destination index should be set to destination station number, error border index should be set to border station number from MC table lookup, and all error code fields should be set to 'E'
Context: A cargo record has error conditions and no existing GCSB1RT record
GIVEN
A cargo record has error conditions and no existing GCSB1RT record
Applied to: Create New GCSB1RT Record
WHEN
The GCSB1RT record retrieval returns not found status
THEN
A new GCSB1RT record should be inserted with the cargo CCN key and populated error index fields
Context: A cargo record has error conditions and an existing GCSB1RT record is found
GIVEN
A cargo record has error conditions and an existing GCSB1RT record is found
Applied to: Update Existing GCSB1RT Record
WHEN
The GCSB1RT record retrieval returns successful status
THEN
The existing GCSB1RT record should be updated with the populated error index fields
Context: A cargo record has hold status conditions
GIVEN
A cargo record has hold status conditions
Applied to: Populate Hold Index Fields
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold destination status OR US cargo pre-hold destination status OR US cargo hold FDA status
THEN
The held destination index should be set to destination station number and held destination cargo should be set to cargo CCN key
Context: A cargo record has border hold status conditions
GIVEN
A cargo record has border hold status conditions
Applied to: Populate Hold Index Fields
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold border status OR US cargo pre-hold border status OR US cargo hold FDA status
THEN
The held border index should be set to border station number from MC table lookup and held border cargo should be set to cargo CCN key
Context: A cargo record has hold conditions and no existing GCSB1RT record
GIVEN
A cargo record has hold conditions and no existing GCSB1RT record
Applied to: Create New GCSB1RT Record
WHEN
The GCSB1RT record retrieval returns not found status
THEN
A new GCSB1RT record should be inserted with the cargo CCN key and populated hold index fields
Context: A cargo record has hold conditions and an existing GCSB1RT record is found
GIVEN
A cargo record has hold conditions and an existing GCSB1RT record is found
Applied to: Update Existing GCSB1RT Record
WHEN
The GCSB1RT record retrieval returns successful status
THEN
The existing GCSB1RT record should be updated with the populated hold index fields
R-GCX126-cbl-00699 (+8) File: GCX126R.cbl Search Next US Cargo Record Until Match Found Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Next US Cargo Record Until Match Found':
  • Context - a current cargo record with equipment car id and waybill index:
    For Set Search Parameters: Car ID from current cargo, Waybill index from current cargo, Set status to GEGB:
    When initiating a search for matching us cargo records, then the search parameters are set with car id from current cargo equipment key, waybill index from saved waybill index, and search function set to get next with car-waybill index.
  • Context - search parameters are configured with car id, waybill index, segment type gcsusrt, function get next, and index type car-waybill:
    For Call Get Next US Cargo by Car and Waybill Index:
    When the us cargo retrieval function is invoked, then the system calls gccusio to retrieve the next us cargo record matching the car and waybill criteria.
  • Context - a database call to retrieve us cargo has been executed:
    For Database Status OK?:
    When the database status code is not blank (indicating an error or no records found), then set the end of database flag to true and exit the search process.
  • Context - the database retrieval operation returned a non-blank status code:
    For Set End of Database Flag:
    When processing the error condition, then set the end of file flag to true to stop further search iterations.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID and Waybill Match Current Cargo?:
    When comparing the retrieved record's car id (first 12 characters) and waybill index against the current cargo's car id key and saved waybill index, then if both car id and waybill index match, proceed to check cargo status; otherwise, set end of database flag to indicate no match found.
  • Context - a us cargo record that matches the car id and waybill criteria:
    For Cargo Deleted OR TR Created?:
    When checking the cargo's deletion status indicator or train creation flag, then if cargo is marked as deleted or train created flag equals 'y', skip this record and continue search; otherwise, mark as valid us manifest found.
  • Context - a us cargo record that matches car id and waybill, is not deleted, and has no train created:
    For Set US Manifest Found Flag:
    When all validation checks pass successfully, then set the us manifest found flag to true to indicate a valid match has been located.
  • Context - a us cargo record has been retrieved but its car id or waybill index does not match the current cargo:
    For Set End of Database Flag No Match Found:
    When the comparison of car id and waybill fails, then set the end of file flag to true to stop the search as no matching record exists.
  • Context - a us cargo record that matches car id and waybill but is either deleted or has a train created:
    For Continue Search Skip This Record:
    When the cargo status check determines the record should be skipped, then continue to the next iteration of the search without setting the found flag, allowing the loop to retrieve the next record.
👨‍💻 Technical ACs (Gherkin)
Context: A current cargo record with equipment car ID and waybill index
GIVEN
A current cargo record with equipment car ID and waybill index
Applied to: Set Search Parameters: Car ID from current cargo, Waybill index from current cargo, Set status to GEGB
WHEN
Initiating a search for matching US cargo records
THEN
The search parameters are set with car ID from current cargo equipment key, waybill index from saved waybill index, and search function set to Get Next with Car-Waybill index
Context: Search parameters are configured with car ID, waybill index, segment type GCSUSRT, function Get Next, and index type Car-Waybill
GIVEN
Search parameters are configured with car ID, waybill index, segment type GCSUSRT, function Get Next, and index type Car-Waybill
Applied to: Call Get Next US Cargo by Car and Waybill Index
WHEN
The US cargo retrieval function is invoked
THEN
The system calls GCCUSIO to retrieve the next US cargo record matching the car and waybill criteria
Context: A database call to retrieve US cargo has been executed
GIVEN
A database call to retrieve US cargo has been executed
Applied to: Database Status OK?
WHEN
The database status code is not blank (indicating an error or no records found)
THEN
Set the end of database flag to true and exit the search process
Context: The database retrieval operation returned a non-blank status code
GIVEN
The database retrieval operation returned a non-blank status code
Applied to: Set End of Database Flag
WHEN
Processing the error condition
THEN
Set the end of file flag to true to stop further search iterations
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID and Waybill Match Current Cargo?
WHEN
Comparing the retrieved record's car ID (first 12 characters) and waybill index against the current cargo's car ID key and saved waybill index
THEN
If both car ID and waybill index match, proceed to check cargo status; otherwise, set end of database flag to indicate no match found
Context: A US cargo record that matches the car ID and waybill criteria
GIVEN
A US cargo record that matches the car ID and waybill criteria
Applied to: Cargo Deleted OR TR Created?
WHEN
Checking the cargo's deletion status indicator or train creation flag
THEN
If cargo is marked as deleted OR train created flag equals 'Y', skip this record and continue search; otherwise, mark as valid US manifest found
Context: A US cargo record that matches car ID and waybill, is not deleted, and has no train created
GIVEN
A US cargo record that matches car ID and waybill, is not deleted, and has no train created
Applied to: Set US Manifest Found Flag
WHEN
All validation checks pass successfully
THEN
Set the US manifest found flag to true to indicate a valid match has been located
Context: A US cargo record has been retrieved but its car ID or waybill index does not match the current cargo
GIVEN
A US cargo record has been retrieved but its car ID or waybill index does not match the current cargo
Applied to: Set End of Database Flag No Match Found
WHEN
The comparison of car ID and waybill fails
THEN
Set the end of file flag to true to stop the search as no matching record exists
Context: A US cargo record that matches car ID and waybill but is either deleted or has a train created
GIVEN
A US cargo record that matches car ID and waybill but is either deleted or has a train created
Applied to: Continue Search Skip This Record
WHEN
The cargo status check determines the record should be skipped
THEN
Continue to the next iteration of the search without setting the found flag, allowing the loop to retrieve the next record
R-GCCUSIO-cbl-00707 (+5) File: GCCUSIO.cbl Delete GCSB1RT Index Record Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Delete GCSB1RT Index Record':
  • Context - a cargo ccn key is provided and an index record exists in gcsb1rt:
    For Delete Index Record from Database:
    When the delete gcsb1rt index record process is executed and the record is found, then the system deletes the index record from gcsb1rt database.
  • Context - a delete gcsb1rt index record process is initiated:
    For Initialize GCSB1RT Record to Spaces:
    When the process begins, then the system clears all fields in the gcsb1rt record structure.
  • Context - a primary cargo record with a ccn key exists:
    For Set Cargo Key from Primary Record:
    When the delete gcsb1rt index record process needs to identify the target record, then the system sets the cargo key value from the primary record's ccn key.
  • Context - a cargo key is set for index record identification:
    For Attempt to Retrieve Existing Index Record:
    When the system needs to verify if the index record exists, then the system attempts to retrieve the existing index record using the cargo key.
  • Context - a delete gcsb1rt index record process is executed:
    For Clear Status Code:
    When the index record is not found in the database, then the system clears the status code to indicate no error condition.
  • Context - an index record exists in gcsb1rt database:
    For Delete Index Record from Database:
    When the record has been successfully retrieved and verified, then the system executes the delete operation to remove the record from the database.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo CCN key is provided and an index record exists in GCSB1RT
GIVEN
A cargo CCN key is provided and an index record exists in GCSB1RT
Applied to: Delete Index Record from Database
WHEN
The delete GCSB1RT index record process is executed and the record is found
THEN
The system deletes the index record from GCSB1RT database
Context: A delete GCSB1RT index record process is initiated
GIVEN
A delete GCSB1RT index record process is initiated
Applied to: Initialize GCSB1RT Record to Spaces
WHEN
The process begins
THEN
The system clears all fields in the GCSB1RT record structure
Context: A primary cargo record with a CCN key exists
GIVEN
A primary cargo record with a CCN key exists
Applied to: Set Cargo Key from Primary Record
WHEN
The delete GCSB1RT index record process needs to identify the target record
THEN
The system sets the cargo key value from the primary record's CCN key
Context: A cargo key is set for index record identification
GIVEN
A cargo key is set for index record identification
Applied to: Attempt to Retrieve Existing Index Record
WHEN
The system needs to verify if the index record exists
THEN
The system attempts to retrieve the existing index record using the cargo key
Context: A delete GCSB1RT index record process is executed
GIVEN
A delete GCSB1RT index record process is executed
Applied to: Clear Status Code
WHEN
The index record is not found in the database
THEN
The system clears the status code to indicate no error condition
Context: An index record exists in GCSB1RT database
GIVEN
An index record exists in GCSB1RT database
Applied to: Delete Index Record from Database
WHEN
The record has been successfully retrieved and verified
THEN
The system executes the delete operation to remove the record from the database
R-GCX126-cbl-00708 (+8) File: GCX126R.cbl Call GCCTBIO to Read GCSTBRT Table Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call GCCTBIO to Read GCSTBRT Table':
  • Context - the system needs to route edi 350 notifications to merlin users:
    For Call GCCTBIO to Read GCSTBRT Table:
    When the system calls gcctbio to retrieve the administrative configuration with table id 'ad-table-id' and sequence id 'adminid', then if the configuration record is found (return flag equals '0'), the system extracts the merlin user code from gcstbrt-ad-dc-p-merlin-1 field and sets the admin segment found indicator to true; otherwise, the system continues without the administrative configuration.
  • Context - the system is preparing to retrieve administrative configuration data:
    For Set Function Code to GU - Get Unique:
    When the initialization process begins, then the system sets the function code to 'gu' (get unique), clears all key values (gcstbrt-key-value, gcstbdp-key-value), clears the return flag (gcctbio-return-flag), clears the segment data (gcstbrt-ad-segment), and clears all control flags (second-pcb-flag, unqual-ssa-flag).
  • Context - the system has initialized the table access parameters:
    For Set Table ID to AD-TABLE-ID:
    When the table identifier needs to be specified, then the system sets gcstbrt-key-table-id to the value of ad-table-id constant.
  • Context - the table identifier has been set to ad-table-id:
    For Set Sequence ID to 'ADMINID':
    When the specific record within the administrative table needs to be identified, then the system sets gcstbrt-key-seqid to 'adminid'.
  • Context - all table access parameters have been initialized with function code 'gu', table id 'ad-table-id', and sequence id 'adminid':
    For Call GCCTBIO Program:
    When the system calls gcctbio program with parameters cccom, second-pcb-flag, unqual-ssa-flag, gcctbio-func-code, gcstbrt-lit, gcstbrt-key-value, gcstbdp-key-value, ws-table-segment, and gcctbio-return-flag, then the gcctbio program executes the database operation and returns the result in gcctbio-return-flag with the retrieved data in ws-table-segment if successful.
  • Context - the gcctbio program has completed execution:
    For Return Flag = '0'?:
    When the system checks the gcctbio-return-flag value, then if gcctbio-return-flag equals '0', the retrieval was successful and processing continues to extract configuration data; otherwise, the system proceeds without administrative configuration.
  • Context - the administrative configuration record was successfully retrieved (gcctbio-return-flag equals '0'):
    For Move Table Segment to GCSTBRT-AD-SEGMENT:
    When the system processes the retrieved data, then the system moves the contents of ws-table-segment to gcstbrt-ad-segment.
  • Context - the administrative segment data has been successfully loaded into gcstbrt-ad-segment:
    For Extract Merlin User Code from Admin Config:
    When the system extracts the merlin routing information, then the system moves the value from gcstbrt-ad-dc-p-merlin-1 to ws-emi-to-usercode for use in message routing.
  • Context - the merlin user code has been successfully extracted from the administrative configuration:
    For Set Admin Segment Found Flag:
    When the system completes the administrative configuration retrieval process, then the system sets the condition name 88-ad-segment-found to true, indicating that valid administrative configuration is available.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to route EDI 350 notifications to Merlin users
GIVEN
The system needs to route EDI 350 notifications to Merlin users
Applied to: Call GCCTBIO to Read GCSTBRT Table
WHEN
The system calls GCCTBIO to retrieve the administrative configuration with Table ID 'AD-TABLE-ID' and Sequence ID 'ADMINID'
THEN
If the configuration record is found (return flag equals '0'), the system extracts the Merlin user code from GCSTBRT-AD-DC-P-MERLIN-1 field and sets the admin segment found indicator to true; otherwise, the system continues without the administrative configuration
Context: The system is preparing to retrieve administrative configuration data
GIVEN
The system is preparing to retrieve administrative configuration data
Applied to: Set Function Code to GU - Get Unique
WHEN
The initialization process begins
THEN
The system sets the function code to 'GU' (Get Unique), clears all key values (GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE), clears the return flag (GCCTBIO-RETURN-FLAG), clears the segment data (GCSTBRT-AD-SEGMENT), and clears all control flags (SECOND-PCB-FLAG, UNQUAL-SSA-FLAG)
Context: The system has initialized the table access parameters
GIVEN
The system has initialized the table access parameters
Applied to: Set Table ID to AD-TABLE-ID
WHEN
The table identifier needs to be specified
THEN
The system sets GCSTBRT-KEY-TABLE-ID to the value of AD-TABLE-ID constant
Context: The table identifier has been set to AD-TABLE-ID
GIVEN
The table identifier has been set to AD-TABLE-ID
Applied to: Set Sequence ID to 'ADMINID'
WHEN
The specific record within the administrative table needs to be identified
THEN
The system sets GCSTBRT-KEY-SEQID to 'ADMINID'
Context: All table access parameters have been initialized with function code 'GU', table ID 'AD-TABLE-ID', and sequence ID 'ADMINID'
GIVEN
All table access parameters have been initialized with function code 'GU', table ID 'AD-TABLE-ID', and sequence ID 'ADMINID'
Applied to: Call GCCTBIO Program
WHEN
The system calls GCCTBIO program with parameters CCCOM, SECOND-PCB-FLAG, UNQUAL-SSA-FLAG, GCCTBIO-FUNC-CODE, GCSTBRT-LIT, GCSTBRT-KEY-VALUE, GCSTBDP-KEY-VALUE, WS-TABLE-SEGMENT, and GCCTBIO-RETURN-FLAG
THEN
The GCCTBIO program executes the database operation and returns the result in GCCTBIO-RETURN-FLAG with the retrieved data in WS-TABLE-SEGMENT if successful
Context: The GCCTBIO program has completed execution
GIVEN
The GCCTBIO program has completed execution
Applied to: Return Flag = '0'?
WHEN
The system checks the GCCTBIO-RETURN-FLAG value
THEN
If GCCTBIO-RETURN-FLAG equals '0', the retrieval was successful and processing continues to extract configuration data; otherwise, the system proceeds without administrative configuration
Context: The administrative configuration record was successfully retrieved (GCCTBIO-RETURN-FLAG equals '0')
GIVEN
The administrative configuration record was successfully retrieved (GCCTBIO-RETURN-FLAG equals '0')
Applied to: Move Table Segment to GCSTBRT-AD-SEGMENT
WHEN
The system processes the retrieved data
THEN
The system moves the contents of WS-TABLE-SEGMENT to GCSTBRT-AD-SEGMENT
Context: The administrative segment data has been successfully loaded into GCSTBRT-AD-SEGMENT
GIVEN
The administrative segment data has been successfully loaded into GCSTBRT-AD-SEGMENT
Applied to: Extract Merlin User Code from Admin Config
WHEN
The system extracts the Merlin routing information
THEN
The system moves the value from GCSTBRT-AD-DC-P-MERLIN-1 to WS-EMI-TO-USERCODE for use in message routing
Context: The Merlin user code has been successfully extracted from the administrative configuration
GIVEN
The Merlin user code has been successfully extracted from the administrative configuration
Applied to: Set Admin Segment Found Flag
WHEN
The system completes the administrative configuration retrieval process
THEN
The system sets the condition name 88-AD-SEGMENT-FOUND to true, indicating that valid administrative configuration is available
R-GCCUSIO-cbl-00713 (+4) File: GCCUSIO.cbl Determine Index Database Action Required Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Index Database Action Required':
  • Context - a cargo record exists in the system:
    For Cargo has Error or Hold Status?:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status and no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then delete the cargo from the status index table and exit processing.
    For Cargo has Both Error and Hold Status?:
    When the cargo has cp cargo error status or cp cargo pending status or us cargo error status, then retrieve the current status index record, populate all error index fields with origin station, border station, and destination station information, and if the status record exists then update it, otherwise create a new status record.
    For Cargo has Both Error and Hold Status?:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold border status or us cargo pre-hold border status or us cargo hold destination status or us cargo pre-hold destination status or us cargo hold fda status, then retrieve the current status index record, populate hold index fields with destination and border station information, and if the status record exists then update it, otherwise create a new status record.
  • Context - a cargo record exists with potential error and hold statuses:
    For Cargo has Error Status Only?:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status, then retrieve the current status index record, clear all error index fields, and if no hold index fields remain then delete the status record, otherwise update the status record.
    For Cargo has Hold Status Only?:
    When the cargo has no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then retrieve the current status index record and if found, clear all hold index fields, and if no error index fields remain then delete the status record, otherwise update the status record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Cargo has Error or Hold Status?
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status AND no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
Delete the cargo from the status index table and exit processing
Applied to: Cargo has Both Error and Hold Status?
WHEN
The cargo has CP cargo error status OR CP cargo pending status OR US cargo error status
THEN
Retrieve the current status index record, populate all error index fields with origin station, border station, and destination station information, and if the status record exists then update it, otherwise create a new status record
Applied to: Cargo has Both Error and Hold Status?
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold border status OR US cargo pre-hold border status OR US cargo hold destination status OR US cargo pre-hold destination status OR US cargo hold FDA status
THEN
Retrieve the current status index record, populate hold index fields with destination and border station information, and if the status record exists then update it, otherwise create a new status record
Context: A cargo record exists with potential error and hold statuses
GIVEN
A cargo record exists with potential error and hold statuses
Applied to: Cargo has Error Status Only?
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status
THEN
Retrieve the current status index record, clear all error index fields, and if no hold index fields remain then delete the status record, otherwise update the status record
Applied to: Cargo has Hold Status Only?
WHEN
The cargo has no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
Retrieve the current status index record and if found, clear all hold index fields, and if no error index fields remain then delete the status record, otherwise update the status record
R-GCX126-cbl-00717 (+3) File: GCX126R.cbl Calculate: Segments = Data Length Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Calculate: Segments = Data Length':
  • Context - an edi 350 message has been retrieved from the mq queue with a specific data length (w03-datalen), a known message header length (ws-mqs-len-header), and a known single entry length (ws-mqs-len-of-1-entry):
    For Calculate: Segments = Data Length - Header Length / Entry Length:
    When the system calculates the number of message segments, then the number of segments (ws-max-mqs-entries) is calculated as: (data length minus header length) divided by entry length, rounded to the nearest whole number.
  • Context - the calculated number of message segments (ws-max-mqs-entries) has been determined and a maximum allowed segment count (cst-max-mqs-entries) is defined:
    For Segments > Maximum Allowed?:
    When the calculated number of segments exceeds the maximum allowed segment count, then the number of segments to process (ws-max-mqs-entries) is set to the maximum allowed value (cst-max-mqs-entries).
  • Context - the system needs to process an edi 350 message structure:
    For Get Header Length:
    When initializing message processing parameters, then the header length (ws-mqs-len-header) is set to the length of the mqs-message-header structure.
  • Context - the system needs to process an edi 350 message with multiple data entries:
    For Get Single Entry Length:
    When initializing message processing parameters, then the single entry length (ws-mqs-len-of-1-entry) is set to the length of one mqs-table-entry structure.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI 350 message has been retrieved from the MQ queue with a specific data length (W03-DATALEN), a known message header length (WS-MQS-LEN-HEADER), and a known single entry length (WS-MQS-LEN-OF-1-ENTRY)
GIVEN
An EDI 350 message has been retrieved from the MQ queue with a specific data length (W03-DATALEN), a known message header length (WS-MQS-LEN-HEADER), and a known single entry length (WS-MQS-LEN-OF-1-ENTRY)
Applied to: Calculate: Segments = Data Length - Header Length / Entry Length
WHEN
The system calculates the number of message segments
THEN
The number of segments (WS-MAX-MQS-ENTRIES) is calculated as: (Data Length minus Header Length) divided by Entry Length, rounded to the nearest whole number
Context: The calculated number of message segments (WS-MAX-MQS-ENTRIES) has been determined and a maximum allowed segment count (CST-MAX-MQS-ENTRIES) is defined
GIVEN
The calculated number of message segments (WS-MAX-MQS-ENTRIES) has been determined and a maximum allowed segment count (CST-MAX-MQS-ENTRIES) is defined
Applied to: Segments > Maximum Allowed?
WHEN
The calculated number of segments exceeds the maximum allowed segment count
THEN
The number of segments to process (WS-MAX-MQS-ENTRIES) is set to the maximum allowed value (CST-MAX-MQS-ENTRIES)
Context: The system needs to process an EDI 350 message structure
GIVEN
The system needs to process an EDI 350 message structure
Applied to: Get Header Length
WHEN
Initializing message processing parameters
THEN
The header length (WS-MQS-LEN-HEADER) is set to the length of the MQS-MESSAGE-HEADER structure
Context: The system needs to process an EDI 350 message with multiple data entries
GIVEN
The system needs to process an EDI 350 message with multiple data entries
Applied to: Get Single Entry Length
WHEN
Initializing message processing parameters
THEN
The single entry length (WS-MQS-LEN-OF-1-ENTRY) is set to the length of one MQS-TABLE-ENTRY structure
R-GCCUSIO-cbl-00718 (+8) File: GCCUSIO.cbl Retrieve Existing GCSB1RT Index Record Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Existing GCSB1RT Index Record':
  • Context - a gcsb1rt record area exists in memory:
    For Clear GCSB1RT Record Area:
    When the system needs to retrieve an existing gcsb1rt index record, then the gcsb1rt record area is cleared to spaces to ensure no residual data affects the retrieval operation.
  • Context - a primary cargo record (gcusrt) exists with a us-ccn-key:
    For Set Cargo Key from Primary Record:
    When the system needs to search for the corresponding gcsb1rt index record, then the us-ccn-key from the primary cargo record is copied to the gcsb1rt key field (gcb1-key-value) to establish the search criteria.
  • Context - the system is preparing to retrieve a gcsb1rt index record:
    For Set Database Status to Accept 'GE':
    When the database call is about to be executed, then the database acceptance status is set to 'ge' to allow the system to handle the case where the record is not found without treating it as an error.
  • Context - the system needs to retrieve and potentially update a gcsb1rt index record:
    For Set Function Code to 'GHU':
    When the database function code is being set for the retrieval operation, then the function code is set to 'ghu' (get hold unique) to retrieve the record with exclusive access for potential updates.
  • Context - the search key, function code, and database status are properly configured:
    For Call Database with Qualified Search:
    When the system executes the database retrieval operation, then the database is called using the cims interface with the function code, pcb, gcsb1rt record area, and qualified ssa to retrieve the specific index record.
  • Context - a database retrieval operation for gcsb1rt index record has been executed:
    For Record Found?:
    When the system checks the database status code returned from the operation, then if the status code is spaces (blank), the record was found; if the status code is not spaces, the record was not found.
  • Context - the database retrieval operation returned a status code of spaces (successful):
    For Set Found Flag to TRUE:
    When the system processes the successful retrieval result, then the sw-gcsb1rt-found flag is set to true to indicate that the gcsb1rt index record exists and was successfully retrieved.
  • Context - the database retrieval operation returned a non-space status code (record not found):
    For Set Not Found Flag to TRUE:
    When the system processes the unsuccessful retrieval result, then the sw-gcsb1rt-not-found flag is set to true to indicate that the gcsb1rt index record does not exist in the database.
  • Context - the gcsb1rt index record was not found and the not found flag has been set:
    For Clear Database Status:
    When the system completes processing the not found condition, then the database status code is cleared to spaces to reset the status for subsequent operations.
👨‍💻 Technical ACs (Gherkin)
Context: A GCSB1RT record area exists in memory
GIVEN
A GCSB1RT record area exists in memory
Applied to: Clear GCSB1RT Record Area
WHEN
The system needs to retrieve an existing GCSB1RT index record
THEN
The GCSB1RT record area is cleared to spaces to ensure no residual data affects the retrieval operation
Context: A primary cargo record (GCUSRT) exists with a US-CCN-KEY
GIVEN
A primary cargo record (GCUSRT) exists with a US-CCN-KEY
Applied to: Set Cargo Key from Primary Record
WHEN
The system needs to search for the corresponding GCSB1RT index record
THEN
The US-CCN-KEY from the primary cargo record is copied to the GCSB1RT key field (GCB1-KEY-VALUE) to establish the search criteria
Context: The system is preparing to retrieve a GCSB1RT index record
GIVEN
The system is preparing to retrieve a GCSB1RT index record
Applied to: Set Database Status to Accept 'GE'
WHEN
The database call is about to be executed
THEN
The database acceptance status is set to 'GE' to allow the system to handle the case where the record is not found without treating it as an error
Context: The system needs to retrieve and potentially update a GCSB1RT index record
GIVEN
The system needs to retrieve and potentially update a GCSB1RT index record
Applied to: Set Function Code to 'GHU'
WHEN
The database function code is being set for the retrieval operation
THEN
The function code is set to 'GHU' (Get Hold Unique) to retrieve the record with exclusive access for potential updates
Context: The search key, function code, and database status are properly configured
GIVEN
The search key, function code, and database status are properly configured
Applied to: Call Database with Qualified Search
WHEN
The system executes the database retrieval operation
THEN
The database is called using the CIMS interface with the function code, PCB, GCSB1RT record area, and qualified SSA to retrieve the specific index record
Context: A database retrieval operation for GCSB1RT index record has been executed
GIVEN
A database retrieval operation for GCSB1RT index record has been executed
Applied to: Record Found?
WHEN
The system checks the database status code returned from the operation
THEN
If the status code is spaces (blank), the record was found; if the status code is not spaces, the record was not found
Context: The database retrieval operation returned a status code of spaces (successful)
GIVEN
The database retrieval operation returned a status code of spaces (successful)
Applied to: Set Found Flag to TRUE
WHEN
The system processes the successful retrieval result
THEN
The SW-GCSB1RT-FOUND flag is set to TRUE to indicate that the GCSB1RT index record exists and was successfully retrieved
Context: The database retrieval operation returned a non-space status code (record not found)
GIVEN
The database retrieval operation returned a non-space status code (record not found)
Applied to: Set Not Found Flag to TRUE
WHEN
The system processes the unsuccessful retrieval result
THEN
The SW-GCSB1RT-NOT-FOUND flag is set to TRUE to indicate that the GCSB1RT index record does not exist in the database
Context: The GCSB1RT index record was not found and the not found flag has been set
GIVEN
The GCSB1RT index record was not found and the not found flag has been set
Applied to: Clear Database Status
WHEN
The system completes processing the not found condition
THEN
The database status code is cleared to spaces to reset the status for subsequent operations
R-GCX126-cbl-00721 (+10) File: GCX126R.cbl Verify Train Exists in System Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Verify Train Exists in System':
  • Context - an x4 segment is being processed with entry type code '992' in a conventional 350 message:
    For Receive Train ID from X4 Segment:
    When the system extracts the related document id from position 1 to 25 of the x4-04-rel-doc-id field, then the extracted train id is stored as the search key for train record lookup.
  • Context - a train id has been extracted from the x4 segment related document id (positions 1-25):
    For Set Train ID as Search Key:
    When the system prepares to search for the train record in the database, then the train id is moved to the b4-key-value field for database query.
  • Context - the b4-key-value contains a valid train id from the x4 segment:
    For Call Database to Retrieve Train Record:
    When the system executes the z5000-gu-b4-train procedure, then a database get unique operation is performed on the train root segment using the provided train id.
  • Context - a database retrieval operation has been executed for a train id:
    For Train Record Found?:
    When the system checks the status code returned from the database operation, then if the status code is blank (spaces), the train record is found; otherwise, the train record is not found.
    For Set Train Not Found Status:
    When the status code returned from the database operation is not blank (not spaces), then the system determines that the train record does not exist and proceeds to error handling.
  • Context - a train record has been successfully retrieved from the database with a blank status code:
    For Set Train Found Status:
    When the system processes the found train record, then the system logs an arrival acknowledgment message with action code 'zzz', the train id, and the message '350 ack - arrival ack at border' by spawning the gct1051e process.
  • Context - a train record was not found in the database:
    For Prepare Error Report:
    When the system begins error notification preparation, then the first detail line of the merlin report is cleared to spaces to prepare for the error message.
  • Context - an error report is being prepared for a train not found in the system:
    For Add Train ID to Error Message:
    When the system constructs the error message, then the message 'unknown train entry in edi 350 ' concatenated with the train id (positions 1-25 of x4-04-rel-doc-id) is placed in the first detail line of the merlin report.
  • Context - the primary error message with the train id has been constructed:
    For Add 'Train Not Found' Message:
    When the system adds supplementary error information, then the message 'this crn was not found.' is placed in the third detail line of the merlin report and the line counter is set to 4.
  • Context - an error report has been prepared with the unknown train details:
    For Route Error to Merlin System:
    When the system routes the error notification, then the error type is set to 'unknown', and the z110-prep-emcsend procedure is executed to send the notification to the merlin system.
  • Context - an x4 segment with entry type '992' is being processed in a conventional 350 message:
    For Verify Train Exists in System:
    When the related document id (positions 1-25) matches the previously processed train id stored in ws-prev-crn, then the system skips all train verification and processing steps and continues to the next segment.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment is being processed with entry type code '992' in a CONVENTIONAL 350 message
GIVEN
An X4 segment is being processed with entry type code '992' in a CONVENTIONAL 350 message
Applied to: Receive Train ID from X4 Segment
WHEN
The system extracts the related document ID from position 1 to 25 of the X4-04-REL-DOC-ID field
THEN
The extracted train ID is stored as the search key for train record lookup
Context: A train ID has been extracted from the X4 segment related document ID (positions 1-25)
GIVEN
A train ID has been extracted from the X4 segment related document ID (positions 1-25)
Applied to: Set Train ID as Search Key
WHEN
The system prepares to search for the train record in the database
THEN
The train ID is moved to the B4-KEY-VALUE field for database query
Context: The B4-KEY-VALUE contains a valid train ID from the X4 segment
GIVEN
The B4-KEY-VALUE contains a valid train ID from the X4 segment
Applied to: Call Database to Retrieve Train Record
WHEN
The system executes the Z5000-GU-B4-TRAIN procedure
THEN
A database GET UNIQUE operation is performed on the train root segment using the provided train ID
Context: A database retrieval operation has been executed for a train ID
GIVEN
A database retrieval operation has been executed for a train ID
Applied to: Train Record Found?
WHEN
The system checks the status code returned from the database operation
THEN
If the status code is blank (spaces), the train record is found; otherwise, the train record is not found
Applied to: Set Train Not Found Status
WHEN
The status code returned from the database operation is not blank (not spaces)
THEN
The system determines that the train record does not exist and proceeds to error handling
Context: A train record has been successfully retrieved from the database with a blank status code
GIVEN
A train record has been successfully retrieved from the database with a blank status code
Applied to: Set Train Found Status
WHEN
The system processes the found train record
THEN
The system logs an arrival acknowledgment message with action code 'ZZZ', the train ID, and the message '350 ACK - ARRIVAL ACK AT BORDER' by spawning the GCT1051E process
Context: A train record was not found in the database
GIVEN
A train record was not found in the database
Applied to: Prepare Error Report
WHEN
The system begins error notification preparation
THEN
The first detail line of the Merlin report is cleared to spaces to prepare for the error message
Context: An error report is being prepared for a train not found in the system
GIVEN
An error report is being prepared for a train not found in the system
Applied to: Add Train ID to Error Message
WHEN
The system constructs the error message
THEN
The message 'UNKNOWN TRAIN ENTRY IN EDI 350 ' concatenated with the train ID (positions 1-25 of X4-04-REL-DOC-ID) is placed in the first detail line of the Merlin report
Context: The primary error message with the train ID has been constructed
GIVEN
The primary error message with the train ID has been constructed
Applied to: Add 'Train Not Found' Message
WHEN
The system adds supplementary error information
THEN
The message 'THIS CRN WAS NOT FOUND.' is placed in the third detail line of the Merlin report and the line counter is set to 4
Context: An error report has been prepared with the unknown train details
GIVEN
An error report has been prepared with the unknown train details
Applied to: Route Error to Merlin System
WHEN
The system routes the error notification
THEN
The error type is set to 'UNKNOWN', and the Z110-PREP-EMCSEND procedure is executed to send the notification to the Merlin system
Context: An X4 segment with entry type '992' is being processed in a CONVENTIONAL 350 message
GIVEN
An X4 segment with entry type '992' is being processed in a CONVENTIONAL 350 message
Applied to: Verify Train Exists in System
WHEN
The related document ID (positions 1-25) matches the previously processed train ID stored in WS-PREV-CRN
THEN
The system skips all train verification and processing steps and continues to the next segment
R-GCCUSIO-cbl-00727 (+3) File: GCCUSIO.cbl Create New Index Record Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create New Index Record':
  • Context - a primary cargo record exists with a valid us-ccn-key:
    For Set Cargo Key from Primary Record:
    When the system needs to create a new gcsb1rt index record, then the cargo key field in the index record must be populated with the us-ccn-key from the primary cargo record.
  • Context - the system is preparing to create a new gcsb1rt index record:
    For Clear Database Status Flags:
    When the database operation is about to be initiated, then the database accept status must be cleared to spaces to ensure proper processing.
  • Context - the system needs to create a new gcsb1rt index record:
    For Set Function Code to ISRT:
    When the database function code is being set, then the function code must be set to 'isrt' to indicate an insert operation.
  • Context - the cargo key is set, database status is cleared, and function code is set to isrt:
    For Call Database Insert Operation:
    When the system executes the database insert operation, then the cims interface must be called with the common control block, function code, pcb, gcsb1rt record, and unqualified ssa to insert the new index record.
👨‍💻 Technical ACs (Gherkin)
Context: A primary cargo record exists with a valid US-CCN-KEY
GIVEN
A primary cargo record exists with a valid US-CCN-KEY
Applied to: Set Cargo Key from Primary Record
WHEN
The system needs to create a new GCSB1RT index record
THEN
The cargo key field in the index record must be populated with the US-CCN-KEY from the primary cargo record
Context: The system is preparing to create a new GCSB1RT index record
GIVEN
The system is preparing to create a new GCSB1RT index record
Applied to: Clear Database Status Flags
WHEN
The database operation is about to be initiated
THEN
The database accept status must be cleared to spaces to ensure proper processing
Context: The system needs to create a new GCSB1RT index record
GIVEN
The system needs to create a new GCSB1RT index record
Applied to: Set Function Code to ISRT
WHEN
The database function code is being set
THEN
The function code must be set to 'ISRT' to indicate an insert operation
Context: The cargo key is set, database status is cleared, and function code is set to ISRT
GIVEN
The cargo key is set, database status is cleared, and function code is set to ISRT
Applied to: Call Database Insert Operation
WHEN
The system executes the database insert operation
THEN
The CIMS interface must be called with the common control block, function code, PCB, GCSB1RT record, and unqualified SSA to insert the new index record
R-GCCUSIO-cbl-00731 (+3) File: GCCUSIO.cbl Update Existing Index Record Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Existing Index Record':
  • Context - an index record update operation is being performed on gcsb1rt:
    For Set Accept Status to GE:
    When the system prepares to update an existing index record, then the accept status must be set to 'ge' to indicate successful processing expectation.
  • Context - an existing index record needs to be updated in gcsb1rt:
    For Set Function Code to REPL:
    When the system prepares the database operation, then the function code must be set to 'repl' to perform a replace operation.
  • Context - the function code is set to 'repl' and accept status is set to 'ge':
    For Call IMS Database with REPL Function:
    When the system executes the database call using cims with repl function code, pcb, gcsb1rt record, and unqualified ssa, then the database management system processes the replace operation on the gcsb1rt index record.
  • Context - a replace operation has been executed on the gcsb1rt index record:
    For Update Successful?:
    When the system checks the cc-status-code after the database operation, then if cc-status-code equals spaces then the update is successful, otherwise the update failed.
👨‍💻 Technical ACs (Gherkin)
Context: An index record update operation is being performed on GCSB1RT
GIVEN
An index record update operation is being performed on GCSB1RT
Applied to: Set Accept Status to GE
WHEN
The system prepares to update an existing index record
THEN
The accept status must be set to 'GE' to indicate successful processing expectation
Context: An existing index record needs to be updated in GCSB1RT
GIVEN
An existing index record needs to be updated in GCSB1RT
Applied to: Set Function Code to REPL
WHEN
The system prepares the database operation
THEN
The function code must be set to 'REPL' to perform a replace operation
Context: The function code is set to 'REPL' and accept status is set to 'GE'
GIVEN
The function code is set to 'REPL' and accept status is set to 'GE'
Applied to: Call IMS Database with REPL Function
WHEN
The system executes the database call using CIMS with REPL function code, PCB, GCSB1RT record, and unqualified SSA
THEN
The database management system processes the replace operation on the GCSB1RT index record
Context: A replace operation has been executed on the GCSB1RT index record
GIVEN
A replace operation has been executed on the GCSB1RT index record
Applied to: Update Successful?
WHEN
The system checks the CC-STATUS-CODE after the database operation
THEN
If CC-STATUS-CODE equals SPACES then the update is successful, otherwise the update failed
R-GCX126-cbl-00732 (+18) File: GCX126R.cbl Update Cargo Border Arrival Status Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Cargo Border Arrival Status':
  • Context - an x4 segment contains a cbsa release reference id in position 1-25:
    For Retrieve Cargo Record by CCN from X4 Segment:
    When the system processes the x4 segment for border arrival acknowledgment, then the system retrieves the cargo record using the cbsa release reference id as the ccn key.
  • Context - a cargo retrieval operation has been performed using the ccn from x4 segment:
    For Cargo Found?:
    When the system checks the cargo record status, then if cargo is found and not deleted, proceed with border arrival update; otherwise, skip the update process.
  • Context - a valid cargo record has been retrieved and confirmed to exist:
    For Set Border Arrival Acknowledgment Flag:
    When the system processes the border arrival acknowledgment, then the system sets the border arrival acknowledgment flag to true on the cargo record.
  • Context - the border arrival acknowledgment flag has been set on the cargo record:
    For Log Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the system logs the border arrival event, then the system creates a log entry with message '350 ack - arrival ack at border' including the ccn and current date/time.
  • Context - the cargo record has been updated with border arrival acknowledgment flag:
    For Update Cargo Record in Database:
    When the system commits the changes, then the system replaces the cargo record in the database with the updated border arrival status.
  • Context - a cargo record has been successfully updated with border arrival acknowledgment:
    For Is Master Manifest?:
    When the system evaluates the manifest type, then if the cargo is a master manifest, proceed to retrieve and update all associated follower manifests; otherwise, complete the process.
  • Context - the cargo record is identified as a master manifest:
    For Retrieve All Follower Manifests for Master CCN:
    When the system initiates follower manifest retrieval, then the system retrieves all follower manifests where the master manifest ccn matches the current cargo ccn, up to a maximum of 100 followers.
  • Context - follower manifests are being retrieved for a master manifest:
    For More Followers? Max 100:
    When the system checks for the next follower manifest, then if more follower manifests exist and the count is less than or equal to 100, continue processing; otherwise, complete the follower processing.
  • Context - there are more follower manifests to process and the maximum limit has not been reached:
    For Get Next Follower Manifest CCN:
    When the system advances to the next follower, then the system retrieves the ccn of the next follower manifest from the follower manifest array.
  • Context - a follower manifest ccn has been identified:
    For Retrieve Follower Cargo Record:
    When the system retrieves the follower cargo record, then the system performs a cargo retrieval operation using the follower ccn as the key.
  • Context - a follower cargo retrieval operation has been performed:
    For Follower Cargo Found?:
    When the system checks the follower cargo record status, then if the follower cargo is found and not deleted, proceed with border arrival update; otherwise, skip to the next follower.
  • Context - a valid follower cargo record has been retrieved and confirmed to exist:
    For Set Border Arrival Flag for Follower:
    When the system processes the border arrival acknowledgment for the follower, then the system sets the border arrival acknowledgment flag to true on the follower cargo record.
  • Context - the border arrival acknowledgment flag has been set on the follower cargo record:
    For Log Arrival Message for Follower CCN:
    When the system logs the border arrival event for the follower, then the system creates a log entry with message '350 ack - arrival ack at border' including the follower ccn and current date/time.
  • Context - the follower cargo record has been updated with border arrival acknowledgment flag:
    For Update Follower Cargo Record:
    When the system commits the changes for the follower, then the system replaces the follower cargo record in the database with the updated border arrival status.
  • Context - a ccn (cargo control number) is provided in the ccrt-ssaq key value and a2rt-ssaq key value:
    For Retrieve Cargo Record by CCN:
    When the system performs a get hold unique operation on the cargo database using the ccn key, then the cargo record segment (gccc-cargo-report-segment) is retrieved if it exists, and the cargo status switches are set to indicate whether the cargo was found, deleted, or has other status conditions.
  • Context - a cargo retrieval operation has been performed using the ccn:
    For Cargo Found?:
    When the system evaluates the cargo status switches after the database call, then if ws-cargo-found is true, the system proceeds with border arrival updates; otherwise, the process terminates without updates.
  • Context - a valid cargo record exists in the database:
    For Set Border Arrival Acknowledgment Flag:
    When the system processes a border arrival acknowledgment from the edi 350 message, then the gccc-border-arrival-ack flag is set to true in the cargo record segment.
  • Context - a cargo record has been identified for border arrival acknowledgment and the current ccn key is stored in ws-current-ccn-key:
    For Log Message: '350 ACK - ARRIVAL ACK AT BORDER':
    When the system prepares to log the border arrival event, then the message '350 ack - arrival ack at border' is moved to ws-gcx105-info-msg, the log information is populated with current machine date, time, user id, and ccn, the action code is set to log-use-input-message, the cargo type is set to gcx105-ca-cargo, and the gct1051e transaction is spawned to create the log entry.
  • Context - the cargo record segment (gccc-cargo-report-segment) has been updated with the border arrival acknowledgment flag:
    For Update Cargo Record in Database:
    When the system executes the replace operation, then the cims program is called with repl function code, gccc-pcb, and gccc-cargo-report-segment to update the cargo record in the database, and the accept status is cleared.
👨‍💻 Technical ACs (Gherkin)
Context: An X4 segment contains a CBSA Release Reference ID in position 1-25
GIVEN
An X4 segment contains a CBSA Release Reference ID in position 1-25
Applied to: Retrieve Cargo Record by CCN from X4 Segment
WHEN
The system processes the X4 segment for border arrival acknowledgment
THEN
The system retrieves the cargo record using the CBSA Release Reference ID as the CCN key
Context: A cargo retrieval operation has been performed using the CCN from X4 segment
GIVEN
A cargo retrieval operation has been performed using the CCN from X4 segment
Applied to: Cargo Found?
WHEN
The system checks the cargo record status
THEN
If cargo is found and not deleted, proceed with border arrival update; otherwise, skip the update process
Context: A valid cargo record has been retrieved and confirmed to exist
GIVEN
A valid cargo record has been retrieved and confirmed to exist
Applied to: Set Border Arrival Acknowledgment Flag
WHEN
The system processes the border arrival acknowledgment
THEN
The system sets the border arrival acknowledgment flag to TRUE on the cargo record
Context: The border arrival acknowledgment flag has been set on the cargo record
GIVEN
The border arrival acknowledgment flag has been set on the cargo record
Applied to: Log Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The system logs the border arrival event
THEN
The system creates a log entry with message '350 ACK - ARRIVAL ACK AT BORDER' including the CCN and current date/time
Context: The cargo record has been updated with border arrival acknowledgment flag
GIVEN
The cargo record has been updated with border arrival acknowledgment flag
Applied to: Update Cargo Record in Database
WHEN
The system commits the changes
THEN
The system replaces the cargo record in the database with the updated border arrival status
Context: A cargo record has been successfully updated with border arrival acknowledgment
GIVEN
A cargo record has been successfully updated with border arrival acknowledgment
Applied to: Is Master Manifest?
WHEN
The system evaluates the manifest type
THEN
If the cargo is a master manifest, proceed to retrieve and update all associated follower manifests; otherwise, complete the process
Context: The cargo record is identified as a master manifest
GIVEN
The cargo record is identified as a master manifest
Applied to: Retrieve All Follower Manifests for Master CCN
WHEN
The system initiates follower manifest retrieval
THEN
The system retrieves all follower manifests where the master manifest CCN matches the current cargo CCN, up to a maximum of 100 followers
Context: Follower manifests are being retrieved for a master manifest
GIVEN
Follower manifests are being retrieved for a master manifest
Applied to: More Followers? Max 100
WHEN
The system checks for the next follower manifest
THEN
If more follower manifests exist and the count is less than or equal to 100, continue processing; otherwise, complete the follower processing
Context: There are more follower manifests to process and the maximum limit has not been reached
GIVEN
There are more follower manifests to process and the maximum limit has not been reached
Applied to: Get Next Follower Manifest CCN
WHEN
The system advances to the next follower
THEN
The system retrieves the CCN of the next follower manifest from the follower manifest array
Context: A follower manifest CCN has been identified
GIVEN
A follower manifest CCN has been identified
Applied to: Retrieve Follower Cargo Record
WHEN
The system retrieves the follower cargo record
THEN
The system performs a cargo retrieval operation using the follower CCN as the key
Context: A follower cargo retrieval operation has been performed
GIVEN
A follower cargo retrieval operation has been performed
Applied to: Follower Cargo Found?
WHEN
The system checks the follower cargo record status
THEN
If the follower cargo is found and not deleted, proceed with border arrival update; otherwise, skip to the next follower
Context: A valid follower cargo record has been retrieved and confirmed to exist
GIVEN
A valid follower cargo record has been retrieved and confirmed to exist
Applied to: Set Border Arrival Flag for Follower
WHEN
The system processes the border arrival acknowledgment for the follower
THEN
The system sets the border arrival acknowledgment flag to TRUE on the follower cargo record
Context: The border arrival acknowledgment flag has been set on the follower cargo record
GIVEN
The border arrival acknowledgment flag has been set on the follower cargo record
Applied to: Log Arrival Message for Follower CCN
WHEN
The system logs the border arrival event for the follower
THEN
The system creates a log entry with message '350 ACK - ARRIVAL ACK AT BORDER' including the follower CCN and current date/time
Context: The follower cargo record has been updated with border arrival acknowledgment flag
GIVEN
The follower cargo record has been updated with border arrival acknowledgment flag
Applied to: Update Follower Cargo Record
WHEN
The system commits the changes for the follower
THEN
The system replaces the follower cargo record in the database with the updated border arrival status
Context: A CCN (Cargo Control Number) is provided in the CCRT-SSAQ key value and A2RT-SSAQ key value
GIVEN
A CCN (Cargo Control Number) is provided in the CCRT-SSAQ key value and A2RT-SSAQ key value
Applied to: Retrieve Cargo Record by CCN
WHEN
The system performs a Get Hold Unique operation on the cargo database using the CCN key
THEN
The cargo record segment (GCCC-CARGO-REPORT-SEGMENT) is retrieved if it exists, and the cargo status switches are set to indicate whether the cargo was found, deleted, or has other status conditions
Context: A cargo retrieval operation has been performed using the CCN
GIVEN
A cargo retrieval operation has been performed using the CCN
Applied to: Cargo Found?
WHEN
The system evaluates the cargo status switches after the database call
THEN
If WS-CARGO-FOUND is true, the system proceeds with border arrival updates; otherwise, the process terminates without updates
Context: A valid cargo record exists in the database
GIVEN
A valid cargo record exists in the database
Applied to: Set Border Arrival Acknowledgment Flag
WHEN
The system processes a border arrival acknowledgment from the EDI 350 message
THEN
The GCCC-BORDER-ARRIVAL-ACK flag is set to true in the cargo record segment
Context: A cargo record has been identified for border arrival acknowledgment and the current CCN key is stored in WS-CURRENT-CCN-KEY
GIVEN
A cargo record has been identified for border arrival acknowledgment and the current CCN key is stored in WS-CURRENT-CCN-KEY
Applied to: Log Message: '350 ACK - ARRIVAL ACK AT BORDER'
WHEN
The system prepares to log the border arrival event
THEN
The message '350 ACK - ARRIVAL ACK AT BORDER' is moved to WS-GCX105-INFO-MSG, the log information is populated with current machine date, time, user ID, and CCN, the action code is set to LOG-USE-INPUT-MESSAGE, the cargo type is set to GCX105-CA-CARGO, and the GCT1051E transaction is spawned to create the log entry
Context: The cargo record segment (GCCC-CARGO-REPORT-SEGMENT) has been updated with the border arrival acknowledgment flag
GIVEN
The cargo record segment (GCCC-CARGO-REPORT-SEGMENT) has been updated with the border arrival acknowledgment flag
Applied to: Update Cargo Record in Database
WHEN
The system executes the replace operation
THEN
The CIMS program is called with REPL function code, GCCC-PCB, and GCCC-CARGO-REPORT-SEGMENT to update the cargo record in the database, and the accept status is cleared
R-GCCUSIO-cbl-00735 (+7) File: GCCUSIO.cbl Check for Existing Hold Index Record Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check for Existing Hold Index Record':
  • Context - a hold index record search is about to be performed:
    For Clear GCSB1RT Record Area:
    When the system prepares to check for existing hold index records, then the gcsb1rt record area must be cleared to spaces.
  • Context - a primary cargo record exists with a ccn key:
    For Set Cargo Key from Primary Record:
    When the system needs to search for hold index records, then the cargo ccn key from the primary record must be copied to the hold index search key.
  • Context - a hold index record search is being performed:
    For Set Accept Status to 'GE':
    When the system prepares the database call parameters, then the accept status must be set to 'ge' to handle both found and not found scenarios.
  • Context - a hold index record needs to be retrieved for processing:
    For Set Function Code to 'GHU':
    When the system prepares the database function code, then the function code must be set to 'ghu' for get hold unique operation.
  • Context - the search parameters are set with cargo key, function code, and accept status:
    For Call Database with Qualified Search:
    When the system executes the database search, then a qualified search must be performed against the gcsb1rt database using the prepared parameters.
  • Context - a database search for hold index records has been executed:
    For Record Found?:
    When the system evaluates the search results, then if the status code is spaces, the record exists; otherwise, the record does not exist.
  • Context - a hold index record search has been executed:
    For Set Hold Index Record Found Flag:
    When the database returns a status code of spaces indicating success, then the system must set the hold index record found flag to true.
    For Set Hold Index Record Not Found Flag:
    When the database returns a status code other than spaces indicating record not found, then the system must set the hold index record not found flag to true.
👨‍💻 Technical ACs (Gherkin)
Context: A hold index record search is about to be performed
GIVEN
A hold index record search is about to be performed
Applied to: Clear GCSB1RT Record Area
WHEN
The system prepares to check for existing hold index records
THEN
The GCSB1RT record area must be cleared to spaces
Context: A primary cargo record exists with a CCN key
GIVEN
A primary cargo record exists with a CCN key
Applied to: Set Cargo Key from Primary Record
WHEN
The system needs to search for hold index records
THEN
The cargo CCN key from the primary record must be copied to the hold index search key
Context: A hold index record search is being performed
GIVEN
A hold index record search is being performed
Applied to: Set Accept Status to 'GE'
WHEN
The system prepares the database call parameters
THEN
The accept status must be set to 'GE' to handle both found and not found scenarios
Context: A hold index record needs to be retrieved for processing
GIVEN
A hold index record needs to be retrieved for processing
Applied to: Set Function Code to 'GHU'
WHEN
The system prepares the database function code
THEN
The function code must be set to 'GHU' for Get Hold Unique operation
Context: The search parameters are set with cargo key, function code, and accept status
GIVEN
The search parameters are set with cargo key, function code, and accept status
Applied to: Call Database with Qualified Search
WHEN
The system executes the database search
THEN
A qualified search must be performed against the GCSB1RT database using the prepared parameters
Context: A database search for hold index records has been executed
GIVEN
A database search for hold index records has been executed
Applied to: Record Found?
WHEN
The system evaluates the search results
THEN
If the status code is spaces, the record exists; otherwise, the record does not exist
Context: A hold index record search has been executed
GIVEN
A hold index record search has been executed
Applied to: Set Hold Index Record Found Flag
WHEN
The database returns a status code of spaces indicating success
THEN
The system must set the hold index record found flag to true
Applied to: Set Hold Index Record Not Found Flag
WHEN
The database returns a status code other than spaces indicating record not found
THEN
The system must set the hold index record not found flag to true
R-GCCUSIO-cbl-00743 (+4) File: GCCUSIO.cbl Create New Hold Index Record Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create New Hold Index Record':
  • Context - a cargo record has hold status conditions detected:
    For Check Hold Type:
    When the system evaluates the specific hold status types (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, hold-d, pr-h-de, holdfda), then the system identifies whether destination hold fields, border hold fields, or both need to be populated.
  • Context - a cargo record has destination hold status (hold, holdpcs, pr-hpcs, hold-d, pr-h-de, or holdfda):
    For Set Destination Hold Index Fields:
    When the system processes hold field population, then the system sets the destination station number to the held destination key and sets the cargo ccn key to the held destination cargo key.
  • Context - a cargo record has border hold status (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, or holdfda):
    For Set Border Hold Index Fields:
    When the system processes hold field population, then the system retrieves the border station number from mc table lookup and sets it to the held border key, and sets the cargo ccn key to the held border cargo key.
  • Context - a cargo record requires border hold index fields and has a location id:
    For Use Border Station Number from MC Table:
    When the system needs to determine the border station number, then the system calls table lookup service to retrieve mc table segment using the cargo location id and extracts the station number if lookup is successful.
  • Context - hold index fields have been populated for a cargo record:
    For Create New GCSB1RT Hold Index Record:
    When the system needs to persist the hold index information, then the system checks if a status record exists, and if found updates it with hold fields, otherwise inserts a new status record with the hold index information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has hold status conditions detected
GIVEN
A cargo record has hold status conditions detected
Applied to: Check Hold Type
WHEN
The system evaluates the specific hold status types (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLD-D, PR-H-DE, HOLDFDA)
THEN
The system identifies whether destination hold fields, border hold fields, or both need to be populated
Context: A cargo record has destination hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA)
GIVEN
A cargo record has destination hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, or HOLDFDA)
Applied to: Set Destination Hold Index Fields
WHEN
The system processes hold field population
THEN
The system sets the destination station number to the held destination key and sets the cargo CCN key to the held destination cargo key
Context: A cargo record has border hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA)
GIVEN
A cargo record has border hold status (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, or HOLDFDA)
Applied to: Set Border Hold Index Fields
WHEN
The system processes hold field population
THEN
The system retrieves the border station number from MC table lookup and sets it to the held border key, and sets the cargo CCN key to the held border cargo key
Context: A cargo record requires border hold index fields and has a location ID
GIVEN
A cargo record requires border hold index fields and has a location ID
Applied to: Use Border Station Number from MC Table
WHEN
The system needs to determine the border station number
THEN
The system calls table lookup service to retrieve MC table segment using the cargo location ID and extracts the station number if lookup is successful
Context: Hold index fields have been populated for a cargo record
GIVEN
Hold index fields have been populated for a cargo record
Applied to: Create New GCSB1RT Hold Index Record
WHEN
The system needs to persist the hold index information
THEN
The system checks if a status record exists, and if found updates it with hold fields, otherwise inserts a new status record with the hold index information
R-GCX126-cbl-00746 (+14) File: GCX126R.cbl Get Next Cargo Record Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Next Cargo Record':
  • Context - a request to retrieve the next us cargo record from the database:
    For Set Accept Status to 'GEGB':
    When the system prepares to execute a get next operation, then the system sets accept status to 'gegb', segment type to gcsusrt, function to gn (get next), index type to car-wb (car id and waybill), and operator to '>' (greater than).
  • Context - query parameters are set with accept status 'gegb', segment gcsusrt, function gn, index car-wb, and operator '>':
    For Call GCCUSIO to Get Next Record:
    When the system calls gccusio program, then the system retrieves the next us cargo record from gcsusrt table based on car id and waybill index.
  • Context - a database query has been executed to retrieve the next us cargo record:
    For Status Code = Spaces?:
    When the system checks the status code returned from the query, then if status code equals spaces, the query was successful and processing continues; otherwise, set end of database flag to indicate no more records available.
  • Context - a us cargo record has been successfully retrieved from the database with current car id key and saved waybill index:
    For Car ID and Waybill Match?:
    When the system compares the retrieved record's car id (first 12 characters) and waybill number against the current processing context, then if both car id (first 12 characters of rt073-car-id-num-index) equals current car id key and rt073-wb-num-index equals saved waybill index, the record matches and processing continues; otherwise, set end of database flag to indicate no matching records found.
  • Context - a matching us cargo record has been found based on car id and waybill:
    For Cargo Deleted or TR Created?:
    When the system checks the cargo record's deletion status and train creation indicator, then if cargo is marked as deleted (rt10-cpcargo-deleted is true) or train has already been created for it (tr-created-for-it equals 'y'), skip this record and continue to next; otherwise, set us manifest found flag to indicate a valid record has been located.
  • Context - a database query to retrieve the next us cargo record has been executed:
    For Set End of Database Flag:
    When the status code returned is not spaces (indicating an error or end of data), then the system sets the end of database flag to true to stop further record retrieval attempts.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Set End of Database Flag:
    When the retrieved record's car id (first 12 characters) does not equal current car id key or waybill number does not equal saved waybill index, then the system sets the end of database flag to true to stop further record retrieval attempts as no more matching records exist.
  • Context - a us cargo record matches the current car id and waybill and is not deleted and does not have a train created for it:
    For Set US Manifest Found Flag:
    When the system completes all validation checks successfully, then the system sets the us manifest found flag to true to indicate a valid record is available for processing.
  • Context - a current equipment car id and waybill number are available for search:
    For Call GCCUSIO to Get Next US Cargo:
    When the system requests the next us cargo record using the car id and waybill index with greater than operator, then the system retrieves the next sequential us cargo record from the database.
  • Context - a us cargo record retrieval operation has been executed:
    For Status Code = Spaces?:
    When the system checks the operation status code, then if status code is spaces, the retrieval was successful and processing continues; otherwise, the end of database is reached.
  • Context - a us cargo record retrieval operation has failed with non-space status code:
    For Set End of Database Flag:
    When the system processes the failed retrieval result, then the end of database flag is set to true indicating no more records exist.
  • Context - a us cargo record has been successfully retrieved and current equipment car id (first 12 characters) and waybill number are known:
    For Car ID and Waybill Match Current?:
    When the system compares the retrieved record's car id (first 12 characters) and waybill number against current values, then if both car id and waybill match, the record is valid for processing; otherwise, it indicates end of matching records.
  • Context - a us cargo record has been retrieved but its equipment car id or waybill number does not match current search criteria:
    For Set End of Database Flag:
    When the system detects the mismatch in equipment or waybill, then the end of database flag is set to true indicating no more matching records exist.
  • Context - a us cargo record has been retrieved that matches equipment and waybill criteria:
    For Cargo Deleted or TR Created?:
    When the system checks if the cargo is marked as deleted or has train created indicator set to 'y', then if cargo is deleted or train created indicator is 'y', the record is skipped; otherwise, it is marked as found for processing.
  • Context - a us cargo record has been retrieved that matches equipment and waybill, is not deleted, and does not have train created:
    For Set US Manifest Found Flag:
    When the system completes all validation checks successfully, then the us manifest found flag is set to true indicating a valid record is available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve the next US cargo record from the database
GIVEN
A request to retrieve the next US cargo record from the database
Applied to: Set Accept Status to 'GEGB'
WHEN
The system prepares to execute a Get Next operation
THEN
The system sets Accept Status to 'GEGB', Segment Type to GCSUSRT, Function to GN (Get Next), Index Type to CAR-WB (Car ID and Waybill), and Operator to '>' (greater than)
Context: Query parameters are set with Accept Status 'GEGB', Segment GCSUSRT, Function GN, Index CAR-WB, and Operator '>'
GIVEN
Query parameters are set with Accept Status 'GEGB', Segment GCSUSRT, Function GN, Index CAR-WB, and Operator '>'
Applied to: Call GCCUSIO to Get Next Record
WHEN
The system calls GCCUSIO program
THEN
The system retrieves the next US cargo record from GCSUSRT table based on Car ID and Waybill index
Context: A database query has been executed to retrieve the next US cargo record
GIVEN
A database query has been executed to retrieve the next US cargo record
Applied to: Status Code = Spaces?
WHEN
The system checks the status code returned from the query
THEN
If status code equals spaces, the query was successful and processing continues; otherwise, set End of Database flag to indicate no more records available
Context: A US cargo record has been successfully retrieved from the database with current Car ID key and saved Waybill index
GIVEN
A US cargo record has been successfully retrieved from the database with current Car ID key and saved Waybill index
Applied to: Car ID and Waybill Match?
WHEN
The system compares the retrieved record's Car ID (first 12 characters) and Waybill number against the current processing context
THEN
If both Car ID (first 12 characters of RT073-CAR-ID-NUM-INDEX) equals current Car ID key AND RT073-WB-NUM-INDEX equals saved Waybill index, the record matches and processing continues; otherwise, set End of Database flag to indicate no matching records found
Context: A matching US cargo record has been found based on Car ID and Waybill
GIVEN
A matching US cargo record has been found based on Car ID and Waybill
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks the cargo record's deletion status and train creation indicator
THEN
If cargo is marked as deleted (RT10-CPCARGO-DELETED is true) OR train has already been created for it (TR-CREATED-FOR-IT equals 'Y'), skip this record and continue to next; otherwise, set US Manifest Found flag to indicate a valid record has been located
Context: A database query to retrieve the next US cargo record has been executed
GIVEN
A database query to retrieve the next US cargo record has been executed
Applied to: Set End of Database Flag
WHEN
The status code returned is not spaces (indicating an error or end of data)
THEN
The system sets the End of Database flag to true to stop further record retrieval attempts
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Set End of Database Flag
WHEN
The retrieved record's Car ID (first 12 characters) does not equal current Car ID key OR Waybill number does not equal saved Waybill index
THEN
The system sets the End of Database flag to true to stop further record retrieval attempts as no more matching records exist
Context: A US cargo record matches the current Car ID and Waybill AND is not deleted AND does not have a train created for it
GIVEN
A US cargo record matches the current Car ID and Waybill AND is not deleted AND does not have a train created for it
Applied to: Set US Manifest Found Flag
WHEN
The system completes all validation checks successfully
THEN
The system sets the US Manifest Found flag to true to indicate a valid record is available for processing
Context: A current equipment car ID and waybill number are available for search
GIVEN
A current equipment car ID and waybill number are available for search
Applied to: Call GCCUSIO to Get Next US Cargo
WHEN
The system requests the next US cargo record using the car ID and waybill index with greater than operator
THEN
The system retrieves the next sequential US cargo record from the database
Context: A US cargo record retrieval operation has been executed
GIVEN
A US cargo record retrieval operation has been executed
Applied to: Status Code = Spaces?
WHEN
The system checks the operation status code
THEN
If status code is spaces, the retrieval was successful and processing continues; otherwise, the end of database is reached
Context: A US cargo record retrieval operation has failed with non-space status code
GIVEN
A US cargo record retrieval operation has failed with non-space status code
Applied to: Set End of Database Flag
WHEN
The system processes the failed retrieval result
THEN
The end of database flag is set to true indicating no more records exist
Context: A US cargo record has been successfully retrieved and current equipment car ID (first 12 characters) and waybill number are known
GIVEN
A US cargo record has been successfully retrieved and current equipment car ID (first 12 characters) and waybill number are known
Applied to: Car ID and Waybill Match Current?
WHEN
The system compares the retrieved record's car ID (first 12 characters) and waybill number against current values
THEN
If both car ID and waybill match, the record is valid for processing; otherwise, it indicates end of matching records
Context: A US cargo record has been retrieved but its equipment car ID or waybill number does not match current search criteria
GIVEN
A US cargo record has been retrieved but its equipment car ID or waybill number does not match current search criteria
Applied to: Set End of Database Flag
WHEN
The system detects the mismatch in equipment or waybill
THEN
The end of database flag is set to true indicating no more matching records exist
Context: A US cargo record has been retrieved that matches equipment and waybill criteria
GIVEN
A US cargo record has been retrieved that matches equipment and waybill criteria
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks if the cargo is marked as deleted or has train created indicator set to 'Y'
THEN
If cargo is deleted or train created indicator is 'Y', the record is skipped; otherwise, it is marked as found for processing
Context: A US cargo record has been retrieved that matches equipment and waybill, is not deleted, and does not have train created
GIVEN
A US cargo record has been retrieved that matches equipment and waybill, is not deleted, and does not have train created
Applied to: Set US Manifest Found Flag
WHEN
The system completes all validation checks successfully
THEN
The US manifest found flag is set to true indicating a valid record is available for processing
R-GCCUSIO-cbl-00748 (+2) File: GCCUSIO.cbl Update Existing Hold Index Record Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Existing Hold Index Record':
  • Context - an existing hold index record needs to be updated in gcsb1rt table:
    For Set Function Code to 'REPL':
    When the system processes a hold index record update operation, then the function code must be set to 'repl' to enable record replacement.
  • Context - a hold index record update operation is being processed:
    For Set Accept Status to 'GE':
    When the system prepares to update the gcsb1rt record, then the accept status must be set to 'ge' before executing the database call.
  • Context - the function code is set to 'repl' and accept status is set to 'ge':
    For Call CIMS with Replace Function:
    When the system needs to update an existing hold index record, then the system must call cims with the function code, pcb, gcsb1rt record, and unqualified ssa to execute the replace operation.
👨‍💻 Technical ACs (Gherkin)
Context: An existing hold index record needs to be updated in GCSB1RT table
GIVEN
An existing hold index record needs to be updated in GCSB1RT table
Applied to: Set Function Code to 'REPL'
WHEN
The system processes a hold index record update operation
THEN
The function code must be set to 'REPL' to enable record replacement
Context: A hold index record update operation is being processed
GIVEN
A hold index record update operation is being processed
Applied to: Set Accept Status to 'GE'
WHEN
The system prepares to update the GCSB1RT record
THEN
The accept status must be set to 'GE' before executing the database call
Context: The function code is set to 'REPL' and accept status is set to 'GE'
GIVEN
The function code is set to 'REPL' and accept status is set to 'GE'
Applied to: Call CIMS with Replace Function
WHEN
The system needs to update an existing hold index record
THEN
The system must call CIMS with the function code, PCB, GCSB1RT record, and unqualified SSA to execute the replace operation
R-GCCUSIO-cbl-00751 (+1) File: GCCUSIO.cbl Set Car ID Index Key from Primary Record Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Car ID Index Key from Primary Record':
  • Context - a cargo record is being processed for index field updates:
    For Is Cargo Record Deleted?:
    When the cargo record has a deleted status indicator set to true, then the system skips all car id index field setting operations and exits the process.
  • Context - a cargo record is active and not marked as deleted:
    For Extract Equipment Car ID from Primary Record:
    When the system processes the cargo record for index field updates, then the equipment car identifier from the primary record is copied to the car id index field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for index field updates
GIVEN
A cargo record is being processed for index field updates
Applied to: Is Cargo Record Deleted?
WHEN
The cargo record has a deleted status indicator set to true
THEN
The system skips all car ID index field setting operations and exits the process
Context: A cargo record is active and not marked as deleted
GIVEN
A cargo record is active and not marked as deleted
Applied to: Extract Equipment Car ID from Primary Record
WHEN
The system processes the cargo record for index field updates
THEN
The equipment car identifier from the primary record is copied to the car ID index field
R-GCCUSIO-cbl-00753 (+10) File: GCCUSIO.cbl Extract Waybill Index Value from Cargo Record Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Waybill Index Value from Cargo Record':
  • Context - a cargo record is being processed for waybill index extraction:
    For Is Cargo Record Deleted?:
    When the cargo record has a deleted status indicator (88-gcusrt-rt10-cpcargo-deleted is true), then the system skips all waybill index processing and exits the extraction process.
  • Context - a cargo record is active and not deleted:
    For Extract Road Number from RT082-ROAD-NUM & Extract Station Number from RT082-STN-NUM & Extract Waybill Number from RT082-WB-NUM & Extract Waybill Date from RT082-WB-DTE:
    When the system processes waybill index extraction, then the road number from gcusrt-rt082-road-num is extracted and prepared for index population and the station number from gcusrt-rt082-stn-num is extracted and prepared for index population and the waybill number from gcusrt-rt082-wb-num is extracted and prepared for index population and the waybill date from gcusrt-rt082-wb-dte is extracted and prepared for index population.
  • Context - the road number has been extracted from rt082-road-num:
    For Populate RT072-ROAD-INDEX with Road Number:
    When the system populates waybill index fields, then the extracted road number is moved to gcusrt-rt072-road-index.
  • Context - the station number has been extracted from rt082-stn-num:
    For Populate RT072-STN-INDEX with Station Number:
    When the system populates waybill index fields, then the extracted station number is moved to gcusrt-rt072-stn-index.
  • Context - the waybill number has been extracted from rt082-wb-num:
    For Populate RT072-WB-INDEX with Waybill Number:
    When the system populates waybill index fields, then the extracted waybill number is moved to gcusrt-rt072-wb-index.
  • Context - the waybill date has been extracted from rt082-wb-dte:
    For Populate RT072-WB-DTE-INDEX with Waybill Date:
    When the system populates waybill index fields, then the extracted waybill date is moved to gcusrt-rt072-wb-dte-index.
  • Context - all individual waybill components have been populated in rt072 fields:
    For Create Complete Waybill Index RT072-WB-NUM-INDEX:
    When the system creates the complete waybill index, then the rt072-wb-num-index field contains the complete waybill index structure for primary reference.
  • Context - the complete waybill index rt072-wb-num-index has been created:
    For Copy Waybill Index to RT073-WB-NUM-INDEX for Cross-Reference:
    When the system establishes cross-reference indexing, then the waybill index is copied from gcusrt-rt072-wb-num-index to gcusrt-rt073-wb-num-index.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for waybill index extraction
GIVEN
A cargo record is being processed for waybill index extraction
Applied to: Is Cargo Record Deleted?
WHEN
The cargo record has a deleted status indicator (88-GCUSRT-RT10-CPCARGO-DELETED is true)
THEN
The system skips all waybill index processing and exits the extraction process
Context: A cargo record is active and not deleted
GIVEN
A cargo record is active and not deleted
Applied to: Extract Road Number from RT082-ROAD-NUM & Extract Station Number from RT082-STN-NUM & Extract Waybill Number from RT082-WB-NUM & Extract Waybill Date from RT082-WB-DTE
WHEN
The system processes waybill index extraction
THEN
The road number from GCUSRT-RT082-ROAD-NUM is extracted and prepared for index population AND The station number from GCUSRT-RT082-STN-NUM is extracted and prepared for index population AND The waybill number from GCUSRT-RT082-WB-NUM is extracted and prepared for index population AND The waybill date from GCUSRT-RT082-WB-DTE is extracted and prepared for index population
Context: The road number has been extracted from RT082-ROAD-NUM
GIVEN
The road number has been extracted from RT082-ROAD-NUM
Applied to: Populate RT072-ROAD-INDEX with Road Number
WHEN
The system populates waybill index fields
THEN
The extracted road number is moved to GCUSRT-RT072-ROAD-INDEX
Context: The station number has been extracted from RT082-STN-NUM
GIVEN
The station number has been extracted from RT082-STN-NUM
Applied to: Populate RT072-STN-INDEX with Station Number
WHEN
The system populates waybill index fields
THEN
The extracted station number is moved to GCUSRT-RT072-STN-INDEX
Context: The waybill number has been extracted from RT082-WB-NUM
GIVEN
The waybill number has been extracted from RT082-WB-NUM
Applied to: Populate RT072-WB-INDEX with Waybill Number
WHEN
The system populates waybill index fields
THEN
The extracted waybill number is moved to GCUSRT-RT072-WB-INDEX
Context: The waybill date has been extracted from RT082-WB-DTE
GIVEN
The waybill date has been extracted from RT082-WB-DTE
Applied to: Populate RT072-WB-DTE-INDEX with Waybill Date
WHEN
The system populates waybill index fields
THEN
The extracted waybill date is moved to GCUSRT-RT072-WB-DTE-INDEX
Context: All individual waybill components have been populated in RT072 fields
GIVEN
All individual waybill components have been populated in RT072 fields
Applied to: Create Complete Waybill Index RT072-WB-NUM-INDEX
WHEN
The system creates the complete waybill index
THEN
The RT072-WB-NUM-INDEX field contains the complete waybill index structure for primary reference
Context: The complete waybill index RT072-WB-NUM-INDEX has been created
GIVEN
The complete waybill index RT072-WB-NUM-INDEX has been created
Applied to: Copy Waybill Index to RT073-WB-NUM-INDEX for Cross-Reference
WHEN
The system establishes cross-reference indexing
THEN
The waybill index is copied from GCUSRT-RT072-WB-NUM-INDEX to GCUSRT-RT073-WB-NUM-INDEX
R-GCX126-cbl-00754 (+13) File: GCX126R.cbl Get Next Cargo Record Using Master CCN Key Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Next Cargo Record Using Master CCN Key':
  • Context - a master manifest cargo record is being processed:
    For Set Accept Status to 'GEGB':
    When the system needs to retrieve all associated follower manifests, then the database access status is set to 'gegb' to enable hierarchical navigation through cargo records.
  • Context - a master manifest cargo record with a valid ccn key is currently loaded:
    For Set Master CCN Key from Current Cargo:
    When the system prepares to search for follower manifests, then the master manifest's ccn key is stored as the search reference key for subsequent follower manifest retrieval.
  • Context - the system is about to search for follower manifests:
    For Initialize Follower Manifest Array:
    When the follower manifest collection process begins, then the follower manifest array is initialized to spaces to ensure no residual data from previous processing.
  • Context - the follower manifest search is about to begin:
    For Set Follower Not End of DB Flag:
    When the system initializes the database navigation state, then the end-of-database flag is set to 'not end of db' to allow record retrieval to proceed.
  • Context - the follower manifest array has been initialized:
    For Set Index I to 1:
    When the system prepares to store follower manifest ccns, then the array index counter is set to 1 to point to the first available storage position.
  • Context - the system is in the process of collecting follower manifests and the current array index position and database status are known:
    For End of DB OR Index > 100?:
    When the system checks if more follower manifests can be retrieved, then the search continues if the end of database has not been reached and the array index is 100 or less, otherwise the search terminates.
  • Context - the database access is initialized with 'gegb' status and the master ccn key is set and the search should continue:
    For Call CIMS with GN Function to Get Next Cargo Record:
    When the system requests the next cargo record, then the database management system retrieves the next cargo record in the hierarchy using the gn (get next) function with the master ccn qualification.
  • Context - a database call to retrieve the next cargo record has been executed:
    For Status Code = Blank?:
    When the system evaluates the database operation result, then if the status code is blank (spaces), the retrieval was successful and processing continues, otherwise the end-of-database flag is set.
  • Context - a cargo record has been successfully retrieved from the database and the master ccn key is known:
    For Master CCN Matches Current CCN?:
    When the system validates the cargo record's master manifest association, then if the retrieved cargo's master manifest ccn matches the stored master ccn key, the record is validated for further processing, otherwise the end-of-database flag is set.
  • Context - a cargo record has been retrieved and validated as belonging to the current master manifest:
    For Is Follower Manifest?:
    When the system checks the cargo record's manifest type, then if the cargo is a follower manifest, its ccn is stored in the array, if it is a master manifest, it is skipped and the loop continues.
  • Context - a cargo record has been identified as a follower manifest and the current array index is within capacity (1-100):
    For Store Follower CCN in Array at Index I:
    When the system stores the follower manifest information, then the follower manifest's ccn key is stored in the array at the position indicated by the current index value.
  • Context - a follower manifest ccn has been successfully stored in the array:
    For Increment Index I by 1:
    When the system prepares for the next follower manifest, then the array index counter is incremented by 1 to point to the next available storage position.
  • Context - either the database retrieval returned a non-blank status code or the retrieved cargo's master ccn does not match the current master ccn:
    For Set Follower End of DB Flag:
    When the system determines that no more valid follower manifests can be retrieved, then the end-of-database flag is set to 'end of db' to terminate the search loop.
  • Context - either the end-of-database has been reached or the array capacity limit of 100 has been reached or all follower manifests have been collected:
    For End: Return to Calling Process:
    When the follower manifest search loop terminates, then control returns to the calling process with the follower manifest array containing all collected follower ccns (up to 100 entries).
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest cargo record is being processed
GIVEN
A master manifest cargo record is being processed
Applied to: Set Accept Status to 'GEGB'
WHEN
The system needs to retrieve all associated follower manifests
THEN
The database access status is set to 'GEGB' to enable hierarchical navigation through cargo records
Context: A master manifest cargo record with a valid CCN key is currently loaded
GIVEN
A master manifest cargo record with a valid CCN key is currently loaded
Applied to: Set Master CCN Key from Current Cargo
WHEN
The system prepares to search for follower manifests
THEN
The master manifest's CCN key is stored as the search reference key for subsequent follower manifest retrieval
Context: The system is about to search for follower manifests
GIVEN
The system is about to search for follower manifests
Applied to: Initialize Follower Manifest Array
WHEN
The follower manifest collection process begins
THEN
The follower manifest array is initialized to spaces to ensure no residual data from previous processing
Context: The follower manifest search is about to begin
GIVEN
The follower manifest search is about to begin
Applied to: Set Follower Not End of DB Flag
WHEN
The system initializes the database navigation state
THEN
The end-of-database flag is set to 'Not End of DB' to allow record retrieval to proceed
Context: The follower manifest array has been initialized
GIVEN
The follower manifest array has been initialized
Applied to: Set Index I to 1
WHEN
The system prepares to store follower manifest CCNs
THEN
The array index counter is set to 1 to point to the first available storage position
Context: The system is in the process of collecting follower manifests AND the current array index position and database status are known
GIVEN
The system is in the process of collecting follower manifests AND the current array index position and database status are known
Applied to: End of DB OR Index > 100?
WHEN
The system checks if more follower manifests can be retrieved
THEN
The search continues if the end of database has not been reached AND the array index is 100 or less, otherwise the search terminates
Context: The database access is initialized with 'GEGB' status AND the master CCN key is set AND the search should continue
GIVEN
The database access is initialized with 'GEGB' status AND the master CCN key is set AND the search should continue
Applied to: Call CIMS with GN Function to Get Next Cargo Record
WHEN
The system requests the next cargo record
THEN
The database management system retrieves the next cargo record in the hierarchy using the GN (Get Next) function with the master CCN qualification
Context: A database call to retrieve the next cargo record has been executed
GIVEN
A database call to retrieve the next cargo record has been executed
Applied to: Status Code = Blank?
WHEN
The system evaluates the database operation result
THEN
If the status code is blank (spaces), the retrieval was successful and processing continues, otherwise the end-of-database flag is set
Context: A cargo record has been successfully retrieved from the database AND the master CCN key is known
GIVEN
A cargo record has been successfully retrieved from the database AND the master CCN key is known
Applied to: Master CCN Matches Current CCN?
WHEN
The system validates the cargo record's master manifest association
THEN
If the retrieved cargo's master manifest CCN matches the stored master CCN key, the record is validated for further processing, otherwise the end-of-database flag is set
Context: A cargo record has been retrieved AND validated as belonging to the current master manifest
GIVEN
A cargo record has been retrieved AND validated as belonging to the current master manifest
Applied to: Is Follower Manifest?
WHEN
The system checks the cargo record's manifest type
THEN
If the cargo is a follower manifest, its CCN is stored in the array, if it is a master manifest, it is skipped and the loop continues
Context: A cargo record has been identified as a follower manifest AND the current array index is within capacity (1-100)
GIVEN
A cargo record has been identified as a follower manifest AND the current array index is within capacity (1-100)
Applied to: Store Follower CCN in Array at Index I
WHEN
The system stores the follower manifest information
THEN
The follower manifest's CCN key is stored in the array at the position indicated by the current index value
Context: A follower manifest CCN has been successfully stored in the array
GIVEN
A follower manifest CCN has been successfully stored in the array
Applied to: Increment Index I by 1
WHEN
The system prepares for the next follower manifest
THEN
The array index counter is incremented by 1 to point to the next available storage position
Context: Either the database retrieval returned a non-blank status code OR the retrieved cargo's master CCN does not match the current master CCN
GIVEN
Either the database retrieval returned a non-blank status code OR the retrieved cargo's master CCN does not match the current master CCN
Applied to: Set Follower End of DB Flag
WHEN
The system determines that no more valid follower manifests can be retrieved
THEN
The end-of-database flag is set to 'End of DB' to terminate the search loop
Context: Either the end-of-database has been reached OR the array capacity limit of 100 has been reached OR all follower manifests have been collected
GIVEN
Either the end-of-database has been reached OR the array capacity limit of 100 has been reached OR all follower manifests have been collected
Applied to: End: Return to Calling Process
WHEN
The follower manifest search loop terminates
THEN
Control returns to the calling process with the follower manifest array containing all collected follower CCNs (up to 100 entries)
R-GCCUSIO-cbl-00764 (+5) File: GCCUSIO.cbl Bond Index Data Available? Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bond Index Data Available?':
  • Context - a cargo record with bond index field (gcusrt-rt074-bond-index) and bond search operator (gcwusio-operator):
    For Bond Index Data Available?:
    When the system processes a bond index search request, then if bond index is not empty, use qualified search with bond number as key value, otherwise use unqualified search with empty key value.
  • Context - a cargo record with non-empty bond index field (gcusrt-rt074-bond-index) and search operator (gcwusio-operator):
    For Set Bond Index Key Value:
    When the system prepares for qualified bond index search, then set the bond index value to gcub-key-value and assign the operator to gcub-operator.
  • Context - a cargo record with empty bond index field (gcusrt-rt074-bond-index equals spaces):
    For Set Empty Bond Index Key:
    When the system prepares for unqualified bond index search, then set spaces to gcub-key-value for the search operation.
  • Context - bond index key value is set with actual bond number and qualified search parameters are prepared:
    For Use Qualified Search with Bond Number:
    When the system executes the bond index search, then use gcub-ssa-qual for qualified search with the specific bond number.
  • Context - bond index key value is set to spaces and unqualified search parameters are prepared:
    For Use Unqualified Search:
    When the system executes the bond index search, then use gcub-ssa-unqual for unqualified search without specific bond criteria.
  • Context - search parameters are set with either qualified or unqualified search criteria and pcb5 is assigned to ws-pcb:
    For Execute Bond Index Search:
    When the system executes the bond index search operation, then perform x1100-call-one-ssa to execute the database search with the prepared parameters.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record with bond index field (GCUSRT-RT074-BOND-INDEX) and bond search operator (GCWUSIO-OPERATOR)
GIVEN
A cargo record with bond index field (GCUSRT-RT074-BOND-INDEX) and bond search operator (GCWUSIO-OPERATOR)
Applied to: Bond Index Data Available?
WHEN
The system processes a bond index search request
THEN
If bond index is not empty, use qualified search with bond number as key value, otherwise use unqualified search with empty key value
Context: A cargo record with non-empty bond index field (GCUSRT-RT074-BOND-INDEX) and search operator (GCWUSIO-OPERATOR)
GIVEN
A cargo record with non-empty bond index field (GCUSRT-RT074-BOND-INDEX) and search operator (GCWUSIO-OPERATOR)
Applied to: Set Bond Index Key Value
WHEN
The system prepares for qualified bond index search
THEN
Set the bond index value to GCUB-KEY-VALUE and assign the operator to GCUB-OPERATOR
Context: A cargo record with empty bond index field (GCUSRT-RT074-BOND-INDEX equals SPACES)
GIVEN
A cargo record with empty bond index field (GCUSRT-RT074-BOND-INDEX equals SPACES)
Applied to: Set Empty Bond Index Key
WHEN
The system prepares for unqualified bond index search
THEN
Set SPACES to GCUB-KEY-VALUE for the search operation
Context: Bond index key value is set with actual bond number and qualified search parameters are prepared
GIVEN
Bond index key value is set with actual bond number and qualified search parameters are prepared
Applied to: Use Qualified Search with Bond Number
WHEN
The system executes the bond index search
THEN
Use GCUB-SSA-QUAL for qualified search with the specific bond number
Context: Bond index key value is set to SPACES and unqualified search parameters are prepared
GIVEN
Bond index key value is set to SPACES and unqualified search parameters are prepared
Applied to: Use Unqualified Search
WHEN
The system executes the bond index search
THEN
Use GCUB-SSA-UNQUAL for unqualified search without specific bond criteria
Context: Search parameters are set with either qualified or unqualified search criteria and PCB5 is assigned to WS-PCB
GIVEN
Search parameters are set with either qualified or unqualified search criteria and PCB5 is assigned to WS-PCB
Applied to: Execute Bond Index Search
WHEN
The system executes the bond index search operation
THEN
Perform X1100-CALL-ONE-SSA to execute the database search with the prepared parameters
R-GCX126-cbl-00768 (+10) File: GCX126R.cbl Retrieve Follower Cargo Record by CCN Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Follower Cargo Record by CCN':
  • Context - a master manifest ccn has been identified for processing:
    For Initialize Loop Counter I = 1:
    When the system begins to retrieve follower manifests, then the loop counter i is set to 1 and the follower manifest array is initialized to spaces.
  • Context - the system is ready to retrieve the next follower manifest record:
    For Set Accept Status to 'GEGB':
    When database access is initiated, then the accept status is set to 'gegb' to enable get next operation.
  • Context - the accept status is set to 'gegb' and the master ccn key is positioned:
    For Call CIMS with GN Function:
    When the cims program is called with gn (get next) function using pcb7 and qualified ssa for master ccn, then the next cargo report segment is retrieved into the cargo report segment area.
  • Context - a database get next operation has been executed:
    For Status Code = Blank?:
    When the status code is evaluated, then if status code is blank (spaces), continue processing; otherwise set end of database flag to true.
  • Context - a cargo record has been successfully retrieved from the database:
    For Master CCN Matches Saved CCN?:
    When the master manifest ccn field of the retrieved record is compared to the saved ccn, then if the master manifest ccn equals the saved ccn, continue processing; otherwise set end of database flag to true.
  • Context - a cargo record with matching master ccn has been retrieved:
    For Is Follower Manifest?:
    When the manifest type indicator is evaluated, then if the record is a follower manifest (not a master), store its ccn; if it is a master manifest, skip and continue to next record.
  • Context - a follower manifest record has been identified:
    For Store Follower CCN in Array Position I:
    When the ccn needs to be stored for later processing, then the cargo ccn key is moved to the follower manifest array at position i.
  • Context - a follower manifest ccn has been stored in the array:
    For Increment Counter I:
    When the system prepares to retrieve the next follower manifest, then the counter i is incremented by 1.
  • Context - the system is processing follower manifests in a loop:
    For I > 100 or End of Database?:
    When the loop termination conditions are evaluated, then if counter i exceeds 100 or the end of database flag is true, exit the loop; otherwise continue retrieving next record.
  • Context - either the database status code is not blank or the master ccn does not match the saved ccn:
    For Set End of Database Flag:
    When the error or mismatch condition is detected, then the end of database flag is set to true to terminate the retrieval loop.
  • Context - the loop has processed all available follower manifests or reached the maximum limit of 100 or encountered end of database:
    For End Loop:
    When the loop termination point is reached, then the counter i is decremented by 1 to reflect the actual count of follower manifests retrieved.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest CCN has been identified for processing
GIVEN
A master manifest CCN has been identified for processing
Applied to: Initialize Loop Counter I = 1
WHEN
The system begins to retrieve follower manifests
THEN
The loop counter I is set to 1 and the follower manifest array is initialized to spaces
Context: The system is ready to retrieve the next follower manifest record
GIVEN
The system is ready to retrieve the next follower manifest record
Applied to: Set Accept Status to 'GEGB'
WHEN
Database access is initiated
THEN
The accept status is set to 'GEGB' to enable Get Next operation
Context: The accept status is set to 'GEGB' and the master CCN key is positioned
GIVEN
The accept status is set to 'GEGB' and the master CCN key is positioned
Applied to: Call CIMS with GN Function
WHEN
The CIMS program is called with GN (Get Next) function using PCB7 and qualified SSA for master CCN
THEN
The next cargo report segment is retrieved into the cargo report segment area
Context: A database Get Next operation has been executed
GIVEN
A database Get Next operation has been executed
Applied to: Status Code = Blank?
WHEN
The status code is evaluated
THEN
If status code is blank (spaces), continue processing; otherwise set end of database flag to true
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Master CCN Matches Saved CCN?
WHEN
The master manifest CCN field of the retrieved record is compared to the saved CCN
THEN
If the master manifest CCN equals the saved CCN, continue processing; otherwise set end of database flag to true
Context: A cargo record with matching master CCN has been retrieved
GIVEN
A cargo record with matching master CCN has been retrieved
Applied to: Is Follower Manifest?
WHEN
The manifest type indicator is evaluated
THEN
If the record is a follower manifest (not a master), store its CCN; if it is a master manifest, skip and continue to next record
Context: A follower manifest record has been identified
GIVEN
A follower manifest record has been identified
Applied to: Store Follower CCN in Array Position I
WHEN
The CCN needs to be stored for later processing
THEN
The cargo CCN key is moved to the follower manifest array at position I
Context: A follower manifest CCN has been stored in the array
GIVEN
A follower manifest CCN has been stored in the array
Applied to: Increment Counter I
WHEN
The system prepares to retrieve the next follower manifest
THEN
The counter I is incremented by 1
Context: The system is processing follower manifests in a loop
GIVEN
The system is processing follower manifests in a loop
Applied to: I > 100 or End of Database?
WHEN
The loop termination conditions are evaluated
THEN
If counter I exceeds 100 OR the end of database flag is true, exit the loop; otherwise continue retrieving next record
Context: Either the database status code is not blank OR the master CCN does not match the saved CCN
GIVEN
Either the database status code is not blank OR the master CCN does not match the saved CCN
Applied to: Set End of Database Flag
WHEN
The error or mismatch condition is detected
THEN
The end of database flag is set to true to terminate the retrieval loop
Context: The loop has processed all available follower manifests OR reached the maximum limit of 100 OR encountered end of database
GIVEN
The loop has processed all available follower manifests OR reached the maximum limit of 100 OR encountered end of database
Applied to: End Loop
WHEN
The loop termination point is reached
THEN
The counter I is decremented by 1 to reflect the actual count of follower manifests retrieved
R-GCCUSIO-cbl-00770 (+2) File: GCCUSIO.cbl Primary Key Available? Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Primary Key Available?':
  • Context - a cargo database operation is being performed with a specific function code and primary key (us-ccn-key):
    For Primary Key Available?:
    When the function code is gu (get unique) or gn (get next) and the primary key us-ccn-key contains spaces, then the system uses unqualified ssa for browse operation and sets primary pcb for database access.
  • Context - a cargo database operation is being performed with function code gu (get unique) or gn (get next):
    For Primary Key Available?:
    When the primary key us-ccn-key is not spaces and contains a valid cargo control number, then the system uses qualified ssa with the primary key value and sets primary pcb for targeted database access.
  • Context - a cargo database operation is being performed:
    For Primary Key Available?:
    When the function code is not gu (get unique) or gn (get next) but is isrt (insert), repl (replace), dlet (delete), or zap, then the system proceeds directly to database access without primary key validation checks.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo database operation is being performed with a specific function code and primary key (US-CCN-KEY)
GIVEN
A cargo database operation is being performed with a specific function code and primary key (US-CCN-KEY)
Applied to: Primary Key Available?
WHEN
The function code is GU (Get Unique) or GN (Get Next) and the primary key US-CCN-KEY contains spaces
THEN
The system uses unqualified SSA for browse operation and sets primary PCB for database access
Context: A cargo database operation is being performed with function code GU (Get Unique) or GN (Get Next)
GIVEN
A cargo database operation is being performed with function code GU (Get Unique) or GN (Get Next)
Applied to: Primary Key Available?
WHEN
The primary key US-CCN-KEY is not spaces and contains a valid cargo control number
THEN
The system uses qualified SSA with the primary key value and sets primary PCB for targeted database access
Context: A cargo database operation is being performed
GIVEN
A cargo database operation is being performed
Applied to: Primary Key Available?
WHEN
The function code is not GU (Get Unique) or GN (Get Next) but is ISRT (Insert), REPL (Replace), DLET (Delete), or ZAP
THEN
The system proceeds directly to database access without primary key validation checks
R-GCCUSIO-cbl-00773 File: GCCUSIO.cbl Secondary Key Available?
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Secondary Key Available?':
  • Context - a secondary database processing request is received:
    For Secondary Key Available?:
    When the system checks if secondary key index flag (gcwusio-index-secn-key) is set to true, then if secondary key index is available, use secondary key index search with gca2-pcb2 and build qualified ssa with gcsuss00-key mapped to gcb2-key-value, otherwise use primary key direct access with gca2-pcb and build qualified ssa with gcsuss00-key mapped to gca2-key-value.
👨‍💻 Technical ACs (Gherkin)
Context: A secondary database processing request is received
GIVEN
A secondary database processing request is received
Applied to: Secondary Key Available?
WHEN
The system checks if secondary key index flag (GCWUSIO-INDEX-SECN-KEY) is set to true
THEN
If secondary key index is available, use secondary key index search with GCA2-PCB2 and build qualified SSA with GCSUSS00-KEY mapped to GCB2-KEY-VALUE, otherwise use primary key direct access with GCA2-PCB and build qualified SSA with GCSUSS00-KEY mapped to GCA2-KEY-VALUE
R-GCCUSIO-cbl-00774 File: GCCUSIO.cbl Message Key Available?
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Message Key Available?':
  • Context - a request to process gcsa8rt segment with get unique or get next function code:
    For Message Key Available?:
    When the system checks if the gcsa8rt key field is empty (contains only spaces), then if the key is empty, set error code '0012' and error message 'gcsa8rt-key equal spaces', otherwise allow processing to continue.
👨‍💻 Technical ACs (Gherkin)
Context: A request to process GCSA8RT segment with Get Unique or Get Next function code
GIVEN
A request to process GCSA8RT segment with Get Unique or Get Next function code
Applied to: Message Key Available?
WHEN
The system checks if the GCSA8RT key field is empty (contains only spaces)
THEN
If the key is empty, set error code '0012' and error message 'GCSA8RT-KEY EQUAL SPACES', otherwise allow processing to continue
R-GCCUSIO-cbl-00775 (+7) File: GCCUSIO.cbl Extract Station Information Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Station Information':
  • Context - a request to extract station information is initiated:
    For Initialize Table Request Parameters:
    When the system prepares for table lookup, then all table request parameters are cleared including key values and control flags.
  • Context - station information lookup is being prepared:
    For Set Function Code to 'GU':
    When the system configures the database operation type, then the function code is set to 'gu' for unique record retrieval.
  • Context - a station information lookup is required:
    For Set Table ID to 'MC':
    When the system selects the appropriate data source, then the table id is set to 'mc' to access the station master table.
  • Context - cargo location id is available from the cargo record:
    For Set Station Sequence ID from Location:
    When the system prepares to search for station information, then the location id is used as the sequence id search key for the mc table lookup.
  • Context - table lookup parameters are being prepared:
    For Clear Return Flag:
    When the system initializes control flags, then the return flag is cleared to spaces for proper status detection.
  • Context - all table lookup parameters are properly configured:
    For Call Table Lookup Service:
    When the system executes the station information retrieval, then the table lookup service is called with function code, table id, and search key.
  • Context - table lookup service has been executed:
    For Station Found?:
    When the system evaluates the lookup result, then if return flag equals '0' then station information was found successfully, otherwise station was not found.
  • Context - station information was successfully found in mc table:
    For Extract Station Number from MC Segment:
    When the system processes the retrieved station data, then the station number is extracted from the mc segment for use in border location processing.
👨‍💻 Technical ACs (Gherkin)
Context: A request to extract station information is initiated
GIVEN
A request to extract station information is initiated
Applied to: Initialize Table Request Parameters
WHEN
The system prepares for table lookup
THEN
All table request parameters are cleared including key values and control flags
Context: Station information lookup is being prepared
GIVEN
Station information lookup is being prepared
Applied to: Set Function Code to 'GU'
WHEN
The system configures the database operation type
THEN
The function code is set to 'GU' for unique record retrieval
Context: A station information lookup is required
GIVEN
A station information lookup is required
Applied to: Set Table ID to 'MC'
WHEN
The system selects the appropriate data source
THEN
The table ID is set to 'MC' to access the station master table
Context: Cargo location ID is available from the cargo record
GIVEN
Cargo location ID is available from the cargo record
Applied to: Set Station Sequence ID from Location
WHEN
The system prepares to search for station information
THEN
The location ID is used as the sequence ID search key for the MC table lookup
Context: Table lookup parameters are being prepared
GIVEN
Table lookup parameters are being prepared
Applied to: Clear Return Flag
WHEN
The system initializes control flags
THEN
The return flag is cleared to spaces for proper status detection
Context: All table lookup parameters are properly configured
GIVEN
All table lookup parameters are properly configured
Applied to: Call Table Lookup Service
WHEN
The system executes the station information retrieval
THEN
The table lookup service is called with function code, table ID, and search key
Context: Table lookup service has been executed
GIVEN
Table lookup service has been executed
Applied to: Station Found?
WHEN
The system evaluates the lookup result
THEN
If return flag equals '0' then station information was found successfully, otherwise station was not found
Context: Station information was successfully found in MC table
GIVEN
Station information was successfully found in MC table
Applied to: Extract Station Number from MC Segment
WHEN
The system processes the retrieved station data
THEN
The station number is extracted from the MC segment for use in border location processing
R-GCX126-cbl-00779 File: GCX126R.cbl Initialize All Status Flags to Space
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize All Status Flags to Space':
  • Context - the system is about to evaluate cargo status switches:
    For Initialize All Status Flags to Space:
    When the cargo status flag initialization process is invoked, then all four cargo status switches (ws-switch1-cargo, ws-switch2-cargo, ws-switch3-cargo, ws-switch4-cargo) are set to space character to clear any previous status indicators.
👨‍💻 Technical ACs (Gherkin)
Context: The system is about to evaluate cargo status switches
GIVEN
The system is about to evaluate cargo status switches
Applied to: Initialize All Status Flags to Space
WHEN
The cargo status flag initialization process is invoked
THEN
All four cargo status switches (WS-SWITCH1-CARGO, WS-SWITCH2-CARGO, WS-SWITCH3-CARGO, WS-SWITCH4-CARGO) are set to space character to clear any previous status indicators
R-GCX126-cbl-00780 (+12) File: GCX126R.cbl Execute Database Search on US Cargo Table Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Database Search on US Cargo Table':
  • Context - a canadian cargo record is being processed with an equipment car id and waybill index:
    For Set Search Parameters:
    When the system prepares to search for associated us cargo records, then the search parameters are initialized with the current cargo's equipment car id in the car id number index field and the saved waybill index in the waybill number index field.
  • Context - the car id and waybill search parameters are set:
    For Set US CCN Key to Low Values:
    When the system needs to search for all us cargo records matching the equipment and waybill, then the us ccn key index field is set to low values to start the search from the beginning of the range.
  • Context - search parameters for car id, waybill, and us ccn are initialized:
    For Set Function to GU - Get Unique:
    When the system executes the initial database search, then the function code is set to gu (get unique) to retrieve the first matching record.
  • Context - the database function is set to get unique:
    For Set Index Type to CAR-WB:
    When the system needs to specify which index to use for the search, then the index type is set to car-wb (car-waybill composite index).
  • Context - the search index is set to car-wb and search keys are initialized:
    For Set Operator to Greater Than or Equal:
    When the system defines the comparison logic for the database search, then the operator is set to '>=' (greater than or equal) to include exact matches and subsequent records.
  • Context - all search parameters are configured with segment type gcsusrt, function gu, index car-wb, operator '>=', car id, waybill index, and us ccn key:
    For Call GCCUSIO to Search US Cargo:
    When the system executes the database search, then the gccusio module is called with the control communication area, search parameters, and us cargo segment structure to retrieve matching records.
  • Context - the gccusio database search has been executed:
    For Database Status OK?:
    When the system evaluates the result of the search operation, then if the status code is spaces (blank), the search is successful; otherwise, an error occurred.
  • Context - the database search returned a non-blank status code indicating an error or end of data:
    For Set End of Database Flag:
    When the system processes the search failure, then the end-of-database flag (ws-eof) is set to true to stop further search attempts.
  • Context - a us cargo record was successfully retrieved from the database:
    For Car ID and Waybill Match?:
    When the system validates the retrieved record, then the system checks if the first 12 characters of the car id number index equals the current cargo's equipment car id and the waybill number index equals the saved waybill index; if both match, the record is valid; otherwise, it indicates end of matching records.
  • Context - a us cargo record was retrieved but the car id or waybill number does not match the search criteria:
    For Car ID and Waybill Match? - No Match:
    When the system detects the mismatch, then the end-of-database flag (ws-eof) is set to true to terminate the search process.
  • Context - a us cargo record matches the equipment car id and waybill number:
    For Cargo Deleted or TR Created?:
    When the system evaluates the record's processing eligibility, then if the cargo deletion status indicator shows deleted or the train-created-for-it flag equals 'y', the record should be skipped; otherwise, it is eligible for processing.
  • Context - a matching us cargo record is found with deletion status set or train-created flag equals 'y':
    For Cargo Deleted or TR Created? - Yes - Skip:
    When the system processes the validation result, then the system continues without setting the us manifest found flag, allowing the search to proceed to the next record.
  • Context - a us cargo record matches the equipment car id and waybill number and is not deleted and does not have train-created flag set to 'y':
    For Set US Manifest Found Flag:
    When the system confirms the record is valid for processing, then the us manifest found flag (ws-us-mfst-found) is set to true to indicate a valid matching record has been located.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record is being processed with an equipment car ID and waybill index
GIVEN
A Canadian cargo record is being processed with an equipment car ID and waybill index
Applied to: Set Search Parameters
WHEN
The system prepares to search for associated US cargo records
THEN
The search parameters are initialized with the current cargo's equipment car ID in the car ID number index field and the saved waybill index in the waybill number index field
Context: The car ID and waybill search parameters are set
GIVEN
The car ID and waybill search parameters are set
Applied to: Set US CCN Key to Low Values
WHEN
The system needs to search for all US cargo records matching the equipment and waybill
THEN
The US CCN key index field is set to low values to start the search from the beginning of the range
Context: Search parameters for car ID, waybill, and US CCN are initialized
GIVEN
Search parameters for car ID, waybill, and US CCN are initialized
Applied to: Set Function to GU - Get Unique
WHEN
The system executes the initial database search
THEN
The function code is set to GU (Get Unique) to retrieve the first matching record
Context: The database function is set to Get Unique
GIVEN
The database function is set to Get Unique
Applied to: Set Index Type to CAR-WB
WHEN
The system needs to specify which index to use for the search
THEN
The index type is set to CAR-WB (Car-Waybill composite index)
Context: The search index is set to CAR-WB and search keys are initialized
GIVEN
The search index is set to CAR-WB and search keys are initialized
Applied to: Set Operator to Greater Than or Equal
WHEN
The system defines the comparison logic for the database search
THEN
The operator is set to '>=' (greater than or equal) to include exact matches and subsequent records
Context: All search parameters are configured with segment type GCSUSRT, function GU, index CAR-WB, operator '>=', car ID, waybill index, and US CCN key
GIVEN
All search parameters are configured with segment type GCSUSRT, function GU, index CAR-WB, operator '>=', car ID, waybill index, and US CCN key
Applied to: Call GCCUSIO to Search US Cargo
WHEN
The system executes the database search
THEN
The GCCUSIO module is called with the control communication area, search parameters, and US cargo segment structure to retrieve matching records
Context: The GCCUSIO database search has been executed
GIVEN
The GCCUSIO database search has been executed
Applied to: Database Status OK?
WHEN
The system evaluates the result of the search operation
THEN
If the status code is spaces (blank), the search is successful; otherwise, an error occurred
Context: The database search returned a non-blank status code indicating an error or end of data
GIVEN
The database search returned a non-blank status code indicating an error or end of data
Applied to: Set End of Database Flag
WHEN
The system processes the search failure
THEN
The end-of-database flag (WS-EOF) is set to TRUE to stop further search attempts
Context: A US cargo record was successfully retrieved from the database
GIVEN
A US cargo record was successfully retrieved from the database
Applied to: Car ID and Waybill Match?
WHEN
The system validates the retrieved record
THEN
The system checks if the first 12 characters of the car ID number index equals the current cargo's equipment car ID AND the waybill number index equals the saved waybill index; if both match, the record is valid; otherwise, it indicates end of matching records
Context: A US cargo record was retrieved but the car ID or waybill number does not match the search criteria
GIVEN
A US cargo record was retrieved but the car ID or waybill number does not match the search criteria
Applied to: Car ID and Waybill Match? - No Match
WHEN
The system detects the mismatch
THEN
The end-of-database flag (WS-EOF) is set to TRUE to terminate the search process
Context: A US cargo record matches the equipment car ID and waybill number
GIVEN
A US cargo record matches the equipment car ID and waybill number
Applied to: Cargo Deleted or TR Created?
WHEN
The system evaluates the record's processing eligibility
THEN
If the cargo deletion status indicator shows deleted OR the train-created-for-it flag equals 'Y', the record should be skipped; otherwise, it is eligible for processing
Context: A matching US cargo record is found with deletion status set OR train-created flag equals 'Y'
GIVEN
A matching US cargo record is found with deletion status set OR train-created flag equals 'Y'
Applied to: Cargo Deleted or TR Created? - Yes - Skip
WHEN
The system processes the validation result
THEN
The system continues without setting the US manifest found flag, allowing the search to proceed to the next record
Context: A US cargo record matches the equipment car ID and waybill number AND is not deleted AND does not have train-created flag set to 'Y'
GIVEN
A US cargo record matches the equipment car ID and waybill number AND is not deleted AND does not have train-created flag set to 'Y'
Applied to: Set US Manifest Found Flag
WHEN
The system confirms the record is valid for processing
THEN
The US manifest found flag (WS-US-MFST-FOUND) is set to TRUE to indicate a valid matching record has been located
R-GCCUSIO-cbl-00783 (+9) File: GCCUSIO.cbl Loop Through 20 N9 Reference Segments Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Loop Through 20 N9 Reference Segments':
  • Context - a cargo control number (ccn) exists in the primary cargo record:
    For Build Secondary Key with CCN + Record Type '02' + Sequence '0001':
    When the system needs to retrieve n9 reference segments from secondary cargo data, then the system builds a composite key using the ccn, record type '02', and sequence '0001'.
  • Context - a composite key has been built for n9 reference segment lookup:
    For Retrieve First N9 Segment from GCSA2RT:
    When the system executes a database retrieval operation against secondary cargo data, then the system retrieves the first n9 reference segment if it exists.
  • Context - a database retrieval operation has been executed for n9 reference segments:
    For N9 Segment Found?:
    When the system checks the operation result status, then if segments are found, continue with n9 processing, otherwise skip n9 processing entirely.
  • Context - n9 reference segments have been successfully retrieved:
    For Initialize N9 Counter to Zero:
    When the system begins processing individual n9 reference entries, then the system initializes a counter to zero to track the current n9 entry position.
  • Context - n9 reference processing is in progress:
    For Increment N9 Counter:
    When the system moves to examine the next n9 reference entry, then the system increments the n9 counter by one.
  • Context - n9 reference entries are being processed sequentially:
    For Counter <= 20?:
    When the system checks the current counter value, then if counter is 20 or less, continue processing, otherwise terminate n9 processing.
  • Context - an n9 reference entry is being processed:
    For Check Reference Number Qualifier:
    When the system examines the reference number qualifier field, then the system reads the qualifier value to determine reference type.
  • Context - an n9 reference entry qualifier has been examined:
    For Qualifier = 'CN'?:
    When the system compares the qualifier value to 'cn', then if qualifier equals 'cn', process as customer number reference, otherwise continue to next entry.
  • Context - an n9 reference entry has qualifier 'cn':
    For Extract Shipment ID from Reference Number:
    When the system processes the reference number field, then the system extracts the reference number value as the shipment identification number.
  • Context - a shipment identification number has been extracted from an n9 reference entry:
    For Store Shipment ID for Iron Highway Notification:
    When the system needs to prepare data for iron highway notification, then the system stores the shipment id in the notification data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo control number (CCN) exists in the primary cargo record
GIVEN
A cargo control number (CCN) exists in the primary cargo record
Applied to: Build Secondary Key with CCN + Record Type '02' + Sequence '0001'
WHEN
The system needs to retrieve N9 reference segments from secondary cargo data
THEN
The system builds a composite key using the CCN, record type '02', and sequence '0001'
Context: A composite key has been built for N9 reference segment lookup
GIVEN
A composite key has been built for N9 reference segment lookup
Applied to: Retrieve First N9 Segment from GCSA2RT
WHEN
The system executes a database retrieval operation against secondary cargo data
THEN
The system retrieves the first N9 reference segment if it exists
Context: A database retrieval operation has been executed for N9 reference segments
GIVEN
A database retrieval operation has been executed for N9 reference segments
Applied to: N9 Segment Found?
WHEN
The system checks the operation result status
THEN
If segments are found, continue with N9 processing, otherwise skip N9 processing entirely
Context: N9 reference segments have been successfully retrieved
GIVEN
N9 reference segments have been successfully retrieved
Applied to: Initialize N9 Counter to Zero
WHEN
The system begins processing individual N9 reference entries
THEN
The system initializes a counter to zero to track the current N9 entry position
Context: N9 reference processing is in progress
GIVEN
N9 reference processing is in progress
Applied to: Increment N9 Counter
WHEN
The system moves to examine the next N9 reference entry
THEN
The system increments the N9 counter by one
Context: N9 reference entries are being processed sequentially
GIVEN
N9 reference entries are being processed sequentially
Applied to: Counter <= 20?
WHEN
The system checks the current counter value
THEN
If counter is 20 or less, continue processing, otherwise terminate N9 processing
Context: An N9 reference entry is being processed
GIVEN
An N9 reference entry is being processed
Applied to: Check Reference Number Qualifier
WHEN
The system examines the reference number qualifier field
THEN
The system reads the qualifier value to determine reference type
Context: An N9 reference entry qualifier has been examined
GIVEN
An N9 reference entry qualifier has been examined
Applied to: Qualifier = 'CN'?
WHEN
The system compares the qualifier value to 'CN'
THEN
If qualifier equals 'CN', process as customer number reference, otherwise continue to next entry
Context: An N9 reference entry has qualifier 'CN'
GIVEN
An N9 reference entry has qualifier 'CN'
Applied to: Extract Shipment ID from Reference Number
WHEN
The system processes the reference number field
THEN
The system extracts the reference number value as the shipment identification number
Context: A shipment identification number has been extracted from an N9 reference entry
GIVEN
A shipment identification number has been extracted from an N9 reference entry
Applied to: Store Shipment ID for Iron Highway Notification
WHEN
The system needs to prepare data for Iron Highway notification
THEN
The system stores the shipment ID in the notification data structure
R-GCCUSIO-cbl-00793 (+4) File: GCCUSIO.cbl Determine Final Status Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine Final Status':
  • Context - a cargo record exists with cp cargo status description and us cargo status description:
    For Determine Final Status:
    When the system needs to determine the final status for notification processing, then the system should set the final status to deleted if cargo status is deleted, or release if cargo status is release, or sent if us cargo description is empty and cp status is sent, or use the us cargo short description as the final status.
  • Context - a cargo record has a current us cargo status and a previously saved status from prior notification:
    For Does US Cargo Description Match Saved Status?:
    When the current us cargo status matches the saved status from previous notification, then the system should skip sending the notification to avoid duplicate status updates.
  • Context - a cargo record has empty us cargo short description and cp cargo status description is sent:
    For Is US Cargo Description Empty AND CP Status is SENT?:
    When the system determines the final status for notification, then the system should use sent as the final status for the notification.
  • Context - a cargo record has cp cargo status description set to deleted:
    For Is Cargo Status DELETED?:
    When the system determines the final status for notification, then the system should set the final status to deleted and use this for the notification regardless of other status values.
  • Context - a cargo record has cp cargo status description set to release and is not deleted:
    For Is Cargo Status RELEASE?:
    When the system determines the final status for notification, then the system should set the final status to release and use this for the notification.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with CP cargo status description and US cargo status description
GIVEN
A cargo record exists with CP cargo status description and US cargo status description
Applied to: Determine Final Status
WHEN
The system needs to determine the final status for notification processing
THEN
The system should set the final status to DELETED if cargo status is DELETED, or RELEASE if cargo status is RELEASE, or SENT if US cargo description is empty and CP status is SENT, or use the US cargo short description as the final status
Context: A cargo record has a current US cargo status and a previously saved status from prior notification
GIVEN
A cargo record has a current US cargo status and a previously saved status from prior notification
Applied to: Does US Cargo Description Match Saved Status?
WHEN
The current US cargo status matches the saved status from previous notification
THEN
The system should skip sending the notification to avoid duplicate status updates
Context: A cargo record has empty US cargo short description and CP cargo status description is SENT
GIVEN
A cargo record has empty US cargo short description and CP cargo status description is SENT
Applied to: Is US Cargo Description Empty AND CP Status is SENT?
WHEN
The system determines the final status for notification
THEN
The system should use SENT as the final status for the notification
Context: A cargo record has CP cargo status description set to DELETED
GIVEN
A cargo record has CP cargo status description set to DELETED
Applied to: Is Cargo Status DELETED?
WHEN
The system determines the final status for notification
THEN
The system should set the final status to DELETED and use this for the notification regardless of other status values
Context: A cargo record has CP cargo status description set to RELEASE and is not DELETED
GIVEN
A cargo record has CP cargo status description set to RELEASE and is not DELETED
Applied to: Is Cargo Status RELEASE?
WHEN
The system determines the final status for notification
THEN
The system should set the final status to RELEASE and use this for the notification
R-GCX126-cbl-00793 (+10) File: GCX126R.cbl Get Next Follower Manifest Using Master CCN Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Next Follower Manifest Using Master CCN':
  • Context - a master manifest needs to have its follower manifests identified:
    For Initialize Loop Counter I = 1, Set Not End of DB Flag:
    When the follower manifest collection process begins, then the loop counter i is set to 1 and the end-of-database flag is set to indicate more records may exist.
  • Context - the system is ready to retrieve the next follower manifest record:
    For Set Accept Status to 'GEGB':
    When database access is initiated, then the accept status is set to 'gegb' to enable get next with browse capability.
  • Context - the master manifest ccn key is available in gcb0rt-ccn-key and the database access mode is set to 'gegb':
    For Call IMS GN Function Using Master CCN Key:
    When the ims get next function is called with pcb7 using the ccrt-b0rt-ssaq qualified search, then the next cargo report segment is retrieved into gccc-cargo-report-segment.
  • Context - a get next operation has been executed to retrieve a cargo record:
    For IMS Status Code = Blank?:
    When the ims status code is evaluated, then if status code is blank (spaces), the retrieval was successful and processing continues to validate the record or if status code is not blank, an error occurred and the end-of-database flag is set and loop processing terminates.
  • Context - a cargo record has been successfully retrieved from the database and the saved master ccn is available in ws-save-ccn:
    For Master CCN Matches?:
    When the master manifest ccn of the retrieved cargo (gccc-master-mfst-ccn) is compared to the saved master ccn, then if the master manifest ccn matches the saved ccn, the cargo belongs to this master and processing continues to check if it is a follower or if the master manifest ccn does not match, the cargo belongs to a different master and the end-of-database flag is set and loop processing terminates.
  • Context - a cargo record has been retrieved that belongs to the correct master manifest:
    For Is Follower Manifest?:
    When the cargo manifest type indicator (gccc-follower-mfst) is evaluated, then if the cargo is identified as a follower manifest, its ccn is stored in the follower array and the loop counter is incremented or if the cargo is the master manifest itself, it is skipped and the loop continues to the next record.
  • Context - a cargo record has been confirmed as a follower manifest of the current master:
    For Store Follower CCN in Array Position I:
    When the follower manifest is being recorded, then the follower manifest ccn (gccc-ccn-key) is stored in the follower manifest array at position i (ws-follower-mani(i)).
  • Context - a follower manifest ccn has been stored in the array at position i:
    For Increment Counter I:
    When the counter is incremented, then the loop counter i is increased by 1 to point to the next available array position.
  • Context - follower manifests are being collected in an array with maximum capacity of 100:
    For Counter I > 100?:
    When the loop counter i is evaluated after incrementing, then if counter i exceeds 100, the end-of-database flag is set and loop processing terminates to prevent array overflow or if counter i is 100 or less, the loop continues to retrieve the next record.
  • Context - one of the following conditions has occurred: database retrieval error or retrieved cargo belongs to different master or maximum capacity of 100 followers reached:
    For Set End of DB Flag:
    When the end-of-database flag is set, then the flag ws-follower-end-of-db is set to true and the loop will terminate on next iteration.
  • Context - the follower manifest collection loop has completed due to end-of-database flag or maximum iterations reached:
    For End Loop:
    When loop processing ends, then the loop counter i is decremented by 1 to reflect the actual count of follower manifests collected and if the count is zero or negative, processing exits immediately or if follower manifests were collected, they are available in the ws-follower-mani array for further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A master manifest needs to have its follower manifests identified
GIVEN
A master manifest needs to have its follower manifests identified
Applied to: Initialize Loop Counter I = 1, Set Not End of DB Flag
WHEN
The follower manifest collection process begins
THEN
The loop counter I is set to 1 AND the end-of-database flag is set to indicate more records may exist
Context: The system is ready to retrieve the next follower manifest record
GIVEN
The system is ready to retrieve the next follower manifest record
Applied to: Set Accept Status to 'GEGB'
WHEN
Database access is initiated
THEN
The accept status is set to 'GEGB' to enable Get Next with Browse capability
Context: The master manifest CCN key is available in GCB0RT-CCN-KEY AND the database access mode is set to 'GEGB'
GIVEN
The master manifest CCN key is available in GCB0RT-CCN-KEY AND the database access mode is set to 'GEGB'
Applied to: Call IMS GN Function Using Master CCN Key
WHEN
The IMS Get Next function is called with PCB7 using the CCRT-B0RT-SSAQ qualified search
THEN
The next cargo report segment is retrieved into GCCC-CARGO-REPORT-SEGMENT
Context: A Get Next operation has been executed to retrieve a cargo record
GIVEN
A Get Next operation has been executed to retrieve a cargo record
Applied to: IMS Status Code = Blank?
WHEN
The IMS status code is evaluated
THEN
If status code is blank (spaces), the retrieval was successful AND processing continues to validate the record OR If status code is not blank, an error occurred AND the end-of-database flag is set AND loop processing terminates
Context: A cargo record has been successfully retrieved from the database AND the saved master CCN is available in WS-SAVE-CCN
GIVEN
A cargo record has been successfully retrieved from the database AND the saved master CCN is available in WS-SAVE-CCN
Applied to: Master CCN Matches?
WHEN
The master manifest CCN of the retrieved cargo (GCCC-MASTER-MFST-CCN) is compared to the saved master CCN
THEN
If the master manifest CCN matches the saved CCN, the cargo belongs to this master AND processing continues to check if it is a follower OR If the master manifest CCN does not match, the cargo belongs to a different master AND the end-of-database flag is set AND loop processing terminates
Context: A cargo record has been retrieved that belongs to the correct master manifest
GIVEN
A cargo record has been retrieved that belongs to the correct master manifest
Applied to: Is Follower Manifest?
WHEN
The cargo manifest type indicator (GCCC-FOLLOWER-MFST) is evaluated
THEN
If the cargo is identified as a follower manifest, its CCN is stored in the follower array AND the loop counter is incremented OR If the cargo is the master manifest itself, it is skipped AND the loop continues to the next record
Context: A cargo record has been confirmed as a follower manifest of the current master
GIVEN
A cargo record has been confirmed as a follower manifest of the current master
Applied to: Store Follower CCN in Array Position I
WHEN
The follower manifest is being recorded
THEN
The follower manifest CCN (GCCC-CCN-KEY) is stored in the follower manifest array at position I (WS-FOLLOWER-MANI(I))
Context: A follower manifest CCN has been stored in the array at position I
GIVEN
A follower manifest CCN has been stored in the array at position I
Applied to: Increment Counter I
WHEN
The counter is incremented
THEN
The loop counter I is increased by 1 to point to the next available array position
Context: Follower manifests are being collected in an array with maximum capacity of 100
GIVEN
Follower manifests are being collected in an array with maximum capacity of 100
Applied to: Counter I > 100?
WHEN
The loop counter I is evaluated after incrementing
THEN
If counter I exceeds 100, the end-of-database flag is set AND loop processing terminates to prevent array overflow OR If counter I is 100 or less, the loop continues to retrieve the next record
Context: One of the following conditions has occurred: database retrieval error OR retrieved cargo belongs to different master OR maximum capacity of 100 followers reached
GIVEN
One of the following conditions has occurred: database retrieval error OR retrieved cargo belongs to different master OR maximum capacity of 100 followers reached
Applied to: Set End of DB Flag
WHEN
The end-of-database flag is set
THEN
The flag WS-FOLLOWER-END-OF-DB is set to TRUE AND the loop will terminate on next iteration
Context: The follower manifest collection loop has completed due to end-of-database flag OR maximum iterations reached
GIVEN
The follower manifest collection loop has completed due to end-of-database flag OR maximum iterations reached
Applied to: End Loop
WHEN
Loop processing ends
THEN
The loop counter I is decremented by 1 to reflect the actual count of follower manifests collected AND if the count is zero or negative, processing exits immediately OR if follower manifests were collected, they are available in the WS-FOLLOWER-MANI array for further processing
R-GCCUSIO-cbl-00798 (+12) File: GCCUSIO.cbl Check Cargo Status for Index Requirements Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Cargo Status for Index Requirements':
  • Context - a cargo record exists in the system:
    For Delete Index Database Record - No Index Requirements:
    When the cargo does not have error status (rt10-cpcargo-error, rt10-cpcargo-pending, rt11-uscargo-error) and the cargo does not have hold status (rt11-uscargo-hold, rt11-uscargo-holdpcs, rt11-uscargo-pr-hpcs, rt11-uscargo-hold-b, rt11-uscargo-pr-h-bo, rt11-uscargo-hold-d, rt11-uscargo-pr-h-de, rt11-uscargo-holdfda), then the system deletes the cargo index record from gcsb1rt database.
  • Context - a cargo record exists with an index record in gcsb1rt:
    For Clear Error Index Fields - Keep Hold Index Fields:
    When the cargo does not have error status (rt10-cpcargo-error, rt10-cpcargo-pending, rt11-uscargo-error) and the cargo has hold status, then the system clears error origin index, error destination index, and error border index fields to spaces while keeping hold index fields intact.
    For Clear Hold Index Fields - Keep Error Index Fields:
    When the cargo does not have hold status (rt11-uscargo-hold, rt11-uscargo-holdpcs, rt11-uscargo-pr-hpcs, rt11-uscargo-hold-b, rt11-uscargo-pr-h-bo, rt11-uscargo-hold-d, rt11-uscargo-pr-h-de, rt11-uscargo-holdfda) and the cargo has error status, then the system clears held destination index and held border index fields to spaces while keeping error index fields intact.
  • Context - error index fields have been cleared from a cargo index record:
    For Delete Index Database Record:
    When both held destination index and held border index fields are empty, then the system deletes the entire cargo index record from gcsb1rt database.
    For Update Index Database Record:
    When either held destination index or held border index fields contain data, then the system updates the existing cargo index record in gcsb1rt database with the cleared error fields.
  • Context - hold index fields have been cleared from a cargo index record:
    For Delete Index Database Record:
    When error destination index, error origin index, and error border index fields are all empty, then the system deletes the entire cargo index record from gcsb1rt database.
    For Update Index Database Record:
    When any of error destination index, error origin index, or error border index fields contain data, then the system updates the existing cargo index record in gcsb1rt database with the cleared hold fields.
  • Context - a cargo record has error status (rt10-cpcargo-error, rt10-cpcargo-pending, or rt11-uscargo-error):
    For Populate Error Index Fields - Origin Station, Border Station, Destination Station:
    When the system processes the cargo for index requirements, then the system populates error code origin as 'e', error origin with origin station number, error origin cargo with ccn key, error code border as 'e', error border with border station number from mc table lookup, error border cargo with ccn key, error code destination as 'e', error destination with destination station number, and error destination cargo with ccn key.
  • Context - a cargo index record already exists in gcsb1rt database and cargo has error status:
    For Update Existing Index Record:
    When error index fields have been populated, then the system updates the existing cargo index record in gcsb1rt database with the error information.
  • Context - no cargo index record exists in gcsb1rt database and cargo has error status:
    For Create New Index Record:
    When error index fields have been populated, then the system creates a new cargo index record in gcsb1rt database with the error information.
  • Context - a cargo record has hold status (rt11-uscargo-hold, rt11-uscargo-holdpcs, rt11-uscargo-pr-hpcs, rt11-uscargo-hold-b, rt11-uscargo-pr-h-bo, rt11-uscargo-hold-d, rt11-uscargo-pr-h-de, or rt11-uscargo-holdfda):
    For Populate Hold Index Fields - Destination Station, Border Station:
    When the system processes the cargo for index requirements, then the system populates held destination with destination station number and held destination cargo with ccn key for destination holds (hold, holdpcs, pr-hpcs, hold-d, pr-h-de, holdfda), and populates held border with border station number from mc table lookup and held border cargo with ccn key for border holds (hold, holdpcs, pr-hpcs, hold-b, pr-h-bo, holdfda).
  • Context - a cargo index record already exists in gcsb1rt database and cargo has hold status:
    For Update Existing Index Record:
    When hold index fields have been populated, then the system updates the existing cargo index record in gcsb1rt database with the hold information.
  • Context - no cargo index record exists in gcsb1rt database and cargo has hold status:
    For Create New Index Record:
    When hold index fields have been populated, then the system creates a new cargo index record in gcsb1rt database with the hold information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Delete Index Database Record - No Index Requirements
WHEN
The cargo does not have error status (RT10-CPCARGO-ERROR, RT10-CPCARGO-PENDING, RT11-USCARGO-ERROR) AND the cargo does not have hold status (RT11-USCARGO-HOLD, RT11-USCARGO-HOLDPCS, RT11-USCARGO-PR-HPCS, RT11-USCARGO-HOLD-B, RT11-USCARGO-PR-H-BO, RT11-USCARGO-HOLD-D, RT11-USCARGO-PR-H-DE, RT11-USCARGO-HOLDFDA)
THEN
The system deletes the cargo index record from GCSB1RT database
Context: A cargo record exists with an index record in GCSB1RT
GIVEN
A cargo record exists with an index record in GCSB1RT
Applied to: Clear Error Index Fields - Keep Hold Index Fields
WHEN
The cargo does not have error status (RT10-CPCARGO-ERROR, RT10-CPCARGO-PENDING, RT11-USCARGO-ERROR) AND the cargo has hold status
THEN
The system clears error origin index, error destination index, and error border index fields to spaces while keeping hold index fields intact
Applied to: Clear Hold Index Fields - Keep Error Index Fields
WHEN
The cargo does not have hold status (RT11-USCARGO-HOLD, RT11-USCARGO-HOLDPCS, RT11-USCARGO-PR-HPCS, RT11-USCARGO-HOLD-B, RT11-USCARGO-PR-H-BO, RT11-USCARGO-HOLD-D, RT11-USCARGO-PR-H-DE, RT11-USCARGO-HOLDFDA) AND the cargo has error status
THEN
The system clears held destination index and held border index fields to spaces while keeping error index fields intact
Context: Error index fields have been cleared from a cargo index record
GIVEN
Error index fields have been cleared from a cargo index record
Applied to: Delete Index Database Record
WHEN
Both held destination index and held border index fields are empty
THEN
The system deletes the entire cargo index record from GCSB1RT database
Applied to: Update Index Database Record
WHEN
Either held destination index or held border index fields contain data
THEN
The system updates the existing cargo index record in GCSB1RT database with the cleared error fields
Context: Hold index fields have been cleared from a cargo index record
GIVEN
Hold index fields have been cleared from a cargo index record
Applied to: Delete Index Database Record
WHEN
Error destination index, error origin index, and error border index fields are all empty
THEN
The system deletes the entire cargo index record from GCSB1RT database
Applied to: Update Index Database Record
WHEN
Any of error destination index, error origin index, or error border index fields contain data
THEN
The system updates the existing cargo index record in GCSB1RT database with the cleared hold fields
Context: A cargo record has error status (RT10-CPCARGO-ERROR, RT10-CPCARGO-PENDING, or RT11-USCARGO-ERROR)
GIVEN
A cargo record has error status (RT10-CPCARGO-ERROR, RT10-CPCARGO-PENDING, or RT11-USCARGO-ERROR)
Applied to: Populate Error Index Fields - Origin Station, Border Station, Destination Station
WHEN
The system processes the cargo for index requirements
THEN
The system populates error code origin as 'E', error origin with origin station number, error origin cargo with CCN key, error code border as 'E', error border with border station number from MC table lookup, error border cargo with CCN key, error code destination as 'E', error destination with destination station number, and error destination cargo with CCN key
Context: A cargo index record already exists in GCSB1RT database AND cargo has error status
GIVEN
A cargo index record already exists in GCSB1RT database AND cargo has error status
Applied to: Update Existing Index Record
WHEN
Error index fields have been populated
THEN
The system updates the existing cargo index record in GCSB1RT database with the error information
Context: No cargo index record exists in GCSB1RT database AND cargo has error status
GIVEN
No cargo index record exists in GCSB1RT database AND cargo has error status
Applied to: Create New Index Record
WHEN
Error index fields have been populated
THEN
The system creates a new cargo index record in GCSB1RT database with the error information
Context: A cargo record has hold status (RT11-USCARGO-HOLD, RT11-USCARGO-HOLDPCS, RT11-USCARGO-PR-HPCS, RT11-USCARGO-HOLD-B, RT11-USCARGO-PR-H-BO, RT11-USCARGO-HOLD-D, RT11-USCARGO-PR-H-DE, or RT11-USCARGO-HOLDFDA)
GIVEN
A cargo record has hold status (RT11-USCARGO-HOLD, RT11-USCARGO-HOLDPCS, RT11-USCARGO-PR-HPCS, RT11-USCARGO-HOLD-B, RT11-USCARGO-PR-H-BO, RT11-USCARGO-HOLD-D, RT11-USCARGO-PR-H-DE, or RT11-USCARGO-HOLDFDA)
Applied to: Populate Hold Index Fields - Destination Station, Border Station
WHEN
The system processes the cargo for index requirements
THEN
The system populates held destination with destination station number and held destination cargo with CCN key for destination holds (HOLD, HOLDPCS, PR-HPCS, HOLD-D, PR-H-DE, HOLDFDA), and populates held border with border station number from MC table lookup and held border cargo with CCN key for border holds (HOLD, HOLDPCS, PR-HPCS, HOLD-B, PR-H-BO, HOLDFDA)
Context: A cargo index record already exists in GCSB1RT database AND cargo has hold status
GIVEN
A cargo index record already exists in GCSB1RT database AND cargo has hold status
Applied to: Update Existing Index Record
WHEN
Hold index fields have been populated
THEN
The system updates the existing cargo index record in GCSB1RT database with the hold information
Context: No cargo index record exists in GCSB1RT database AND cargo has hold status
GIVEN
No cargo index record exists in GCSB1RT database AND cargo has hold status
Applied to: Create New Index Record
WHEN
Hold index fields have been populated
THEN
The system creates a new cargo index record in GCSB1RT database with the hold information
R-GCX126-cbl-00804 (+10) File: GCX126R.cbl Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Release Information: Clear Destination Station, Set Release Date/Time, Set Release By User, Set Status to RELEASED, Clear Error Fields':
  • Context - a cargo record exists in the system with destination station information:
    For Clear Destination Station Number:
    When the system initiates the release information setup process, then the destination station number field is cleared to spaces.
  • Context - a cargo record exists in the system with destination station index information:
    For Clear Destination Station Index:
    When the system initiates the release information setup process, then the destination station index field is cleared to spaces.
  • Context - a cargo record is being processed for release:
    For Set Release Date to Current Machine Date & Set Release Time to Current Machine Time & Set Release By to Current User ID & Initialize Release Reason to Spaces & Clear Error/Release Status Index & Clear Error Status:
    When the system sets release information, then the release date is set to the current machine date from the system and the release time is set to the current machine time from the system and the release by field is set to the current user id from the system and the release reason field is initialized to spaces and the error or release status index field is cleared to spaces and the error status field is cleared to spaces.
  • Context - a cargo record is being processed for customs release:
    For Set Current Status to 'RELEASED' & Set Release Status to 'R':
    When the system sets release information, then the current status field is set to 'released' and the release status indicator is set to 'r'.
  • Context - a cargo record is being processed for customs release via edi 350 message:
    For Set Release Type to 'A':
    When the system sets release information, then the release type is set to 'a' indicating automatic release.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system with destination station information
GIVEN
A cargo record exists in the system with destination station information
Applied to: Clear Destination Station Number
WHEN
The system initiates the release information setup process
THEN
The destination station number field is cleared to spaces
Context: A cargo record exists in the system with destination station index information
GIVEN
A cargo record exists in the system with destination station index information
Applied to: Clear Destination Station Index
WHEN
The system initiates the release information setup process
THEN
The destination station index field is cleared to spaces
Context: A cargo record is being processed for release
GIVEN
A cargo record is being processed for release
Applied to: Set Release Date to Current Machine Date & Set Release Time to Current Machine Time & Set Release By to Current User ID & Initialize Release Reason to Spaces & Clear Error/Release Status Index & Clear Error Status
WHEN
The system sets release information
THEN
The release date is set to the current machine date from the system AND The release time is set to the current machine time from the system AND The release by field is set to the current user ID from the system AND The release reason field is initialized to spaces AND The error or release status index field is cleared to spaces AND The error status field is cleared to spaces
Context: A cargo record is being processed for customs release
GIVEN
A cargo record is being processed for customs release
Applied to: Set Current Status to 'RELEASED' & Set Release Status to 'R'
WHEN
The system sets release information
THEN
The current status field is set to 'RELEASED' AND The release status indicator is set to 'R'
Context: A cargo record is being processed for customs release via EDI 350 message
GIVEN
A cargo record is being processed for customs release via EDI 350 message
Applied to: Set Release Type to 'A'
WHEN
The system sets release information
THEN
The release type is set to 'A' indicating automatic release
R-GCX126-cbl-00815 (+14) File: GCX126R.cbl Process Associated US Manifest: Find US Cargo by Car ID and Waybill, Log Release to US CCN Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Associated US Manifest: Find US Cargo by Car ID and Waybill, Log Release to US CCN':
  • Context - a canadian cargo record has been processed for release or deconsolidation:
    For Initialize US Manifest Search Flags:
    When the system initiates the us manifest search process, then the us manifest not found flag is set to true and the not end-of-file flag is set to true.
  • Context - a canadian cargo record with equipment car id and waybill index exists:
    For Set Search Keys: Car ID and Waybill Index:
    When the system prepares to search for us cargo, then the us cargo search key is set to the current equipment car id and the us cargo waybill search key is set to the saved waybill index.
  • Context - us cargo search keys are set with car id and waybill index:
    For Retrieve US Cargo Record by Car ID and Waybill:
    When the system executes the initial us cargo retrieval using gu function with car-wb index and >= operator, then the system retrieves the first us cargo record matching or exceeding the search criteria.
  • Context - a us cargo retrieval operation has been executed:
    For US Cargo Status?:
    When the system checks the database status code, then if status code is not spaces, set end-of-file flag to true and exit the search process.
  • Context - a us cargo record has been successfully retrieved:
    For Car ID and Waybill Match?:
    When the system compares the us cargo car id (first 12 characters) with current car id key and compares the us cargo waybill index with saved waybill index, then if car id first 12 characters match current car id key and waybill index matches saved waybill index, proceed to check deletion status else set end-of-file flag to true.
  • Context - a matching us cargo record by car id and waybill has been found:
    For Cargo Deleted or TR Created?:
    When the system checks the cargo deletion status indicator and train created indicator, then if cargo is marked as deleted or train created indicator equals 'y', continue to get next record else set us manifest found flag to true.
  • Context - a us cargo record exists that matches car id and waybill and is not deleted and does not have a train created:
    For Set US Manifest Found Flag:
    When the system completes validation checks, then the us manifest found flag is set to true.
  • Context - the current us cargo record does not meet criteria (deleted or train created):
    For Get Next US Cargo Record:
    When the system executes gn function with car-wb index and > operator, then the system retrieves the next us cargo record in sequence.
  • Context - a get-next us cargo retrieval operation has been executed:
    For US Cargo Status?:
    When the system checks the database status code, then if status code is not spaces, set end-of-file flag to true and proceed to check found flag.
  • Context - a next us cargo record has been successfully retrieved:
    For Car ID and Waybill Match?:
    When the system compares the us cargo car id (first 12 characters) with current car id key and compares the us cargo waybill index with saved waybill index, then if car id first 12 characters match current car id key and waybill index matches saved waybill index, proceed to check deletion status else set end-of-file flag to true.
  • Context - a next matching us cargo record by car id and waybill has been found:
    For Cargo Deleted or TR Created?:
    When the system checks the cargo deletion status indicator and train created indicator, then if cargo is marked as deleted or train created indicator equals 'y', continue to get next record else set us manifest found flag to true.
  • Context - a next us cargo record exists that matches car id and waybill and is not deleted and does not have a train created:
    For Set US Manifest Found Flag:
    When the system completes validation checks, then the us manifest found flag is set to true.
  • Context - the us manifest search process has completed all retrieval and validation steps:
    For US Manifest Found?:
    When the system checks the us manifest found flag, then if us manifest found flag is false (not found), exit the process else proceed to prepare log entry.
  • Context - a valid us manifest record has been found:
    For Prepare Log Entry: Current Date/Time, US CCN, Action Code: LOG-USE-INPUT-MESSAGE, Message: CDN CCN RLSED BY EDI 350:
    When the system prepares the log entry, then the log date is set to current machine century concatenated with current machine date and the log time is set to current machine time and the action code is set to log-use-input-message and the us ccn key is set as the train or us ccn identifier and the cargo type indicator is set to us cargo and the message is set to 'cdn ccn rlsed by edi 350: ' concatenated with the canadian ccn key.
  • Context - the log entry has been prepared with date, time, us ccn, action code, and release message:
    For Spawn GCT1051E Transaction to Log Release Message:
    When the system invokes the gct1051e logging process, then a log transaction is created recording the canadian cargo release notification for the associated us cargo.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record has been processed for release or deconsolidation
GIVEN
A Canadian cargo record has been processed for release or deconsolidation
Applied to: Initialize US Manifest Search Flags
WHEN
The system initiates the US manifest search process
THEN
The US manifest not found flag is set to true AND the not end-of-file flag is set to true
Context: A Canadian cargo record with equipment car ID and waybill index exists
GIVEN
A Canadian cargo record with equipment car ID and waybill index exists
Applied to: Set Search Keys: Car ID and Waybill Index
WHEN
The system prepares to search for US cargo
THEN
The US cargo search key is set to the current equipment car ID AND the US cargo waybill search key is set to the saved waybill index
Context: US cargo search keys are set with car ID and waybill index
GIVEN
US cargo search keys are set with car ID and waybill index
Applied to: Retrieve US Cargo Record by Car ID and Waybill
WHEN
The system executes the initial US cargo retrieval using GU function with CAR-WB index and >= operator
THEN
The system retrieves the first US cargo record matching or exceeding the search criteria
Context: A US cargo retrieval operation has been executed
GIVEN
A US cargo retrieval operation has been executed
Applied to: US Cargo Status?
WHEN
The system checks the database status code
THEN
If status code is not spaces, set end-of-file flag to true and exit the search process
Context: A US cargo record has been successfully retrieved
GIVEN
A US cargo record has been successfully retrieved
Applied to: Car ID and Waybill Match?
WHEN
The system compares the US cargo car ID (first 12 characters) with current car ID key AND compares the US cargo waybill index with saved waybill index
THEN
If car ID first 12 characters match current car ID key AND waybill index matches saved waybill index, proceed to check deletion status ELSE set end-of-file flag to true
Context: A matching US cargo record by car ID and waybill has been found
GIVEN
A matching US cargo record by car ID and waybill has been found
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks the cargo deletion status indicator AND train created indicator
THEN
If cargo is marked as deleted OR train created indicator equals 'Y', continue to get next record ELSE set US manifest found flag to true
Context: A US cargo record exists that matches car ID and waybill AND is not deleted AND does not have a train created
GIVEN
A US cargo record exists that matches car ID and waybill AND is not deleted AND does not have a train created
Applied to: Set US Manifest Found Flag
WHEN
The system completes validation checks
THEN
The US manifest found flag is set to true
Context: The current US cargo record does not meet criteria (deleted or train created)
GIVEN
The current US cargo record does not meet criteria (deleted or train created)
Applied to: Get Next US Cargo Record
WHEN
The system executes GN function with CAR-WB index and > operator
THEN
The system retrieves the next US cargo record in sequence
Context: A get-next US cargo retrieval operation has been executed
GIVEN
A get-next US cargo retrieval operation has been executed
Applied to: US Cargo Status?
WHEN
The system checks the database status code
THEN
If status code is not spaces, set end-of-file flag to true and proceed to check found flag
Context: A next US cargo record has been successfully retrieved
GIVEN
A next US cargo record has been successfully retrieved
Applied to: Car ID and Waybill Match?
WHEN
The system compares the US cargo car ID (first 12 characters) with current car ID key AND compares the US cargo waybill index with saved waybill index
THEN
If car ID first 12 characters match current car ID key AND waybill index matches saved waybill index, proceed to check deletion status ELSE set end-of-file flag to true
Context: A next matching US cargo record by car ID and waybill has been found
GIVEN
A next matching US cargo record by car ID and waybill has been found
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks the cargo deletion status indicator AND train created indicator
THEN
If cargo is marked as deleted OR train created indicator equals 'Y', continue to get next record ELSE set US manifest found flag to true
Context: A next US cargo record exists that matches car ID and waybill AND is not deleted AND does not have a train created
GIVEN
A next US cargo record exists that matches car ID and waybill AND is not deleted AND does not have a train created
Applied to: Set US Manifest Found Flag
WHEN
The system completes validation checks
THEN
The US manifest found flag is set to true
Context: The US manifest search process has completed all retrieval and validation steps
GIVEN
The US manifest search process has completed all retrieval and validation steps
Applied to: US Manifest Found?
WHEN
The system checks the US manifest found flag
THEN
If US manifest found flag is false (not found), exit the process ELSE proceed to prepare log entry
Context: A valid US manifest record has been found
GIVEN
A valid US manifest record has been found
Applied to: Prepare Log Entry: Current Date/Time, US CCN, Action Code: LOG-USE-INPUT-MESSAGE, Message: CDN CCN RLSED BY EDI 350
WHEN
The system prepares the log entry
THEN
The log date is set to current machine century concatenated with current machine date AND the log time is set to current machine time AND the action code is set to LOG-USE-INPUT-MESSAGE AND the US CCN key is set as the train or US CCN identifier AND the cargo type indicator is set to US cargo AND the message is set to 'CDN CCN RLSED BY EDI 350: ' concatenated with the Canadian CCN key
Context: The log entry has been prepared with date, time, US CCN, action code, and release message
GIVEN
The log entry has been prepared with date, time, US CCN, action code, and release message
Applied to: Spawn GCT1051E Transaction to Log Release Message
WHEN
The system invokes the GCT1051E logging process
THEN
A log transaction is created recording the Canadian cargo release notification for the associated US cargo
R-GCCUSIO-cbl-00825 (+6) File: GCCUSIO.cbl Cargo has Error or Hold Status? Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo has Error or Hold Status?':
  • Context - a cargo record exists in the system:
    For Delete GCSB1RT Index Record:
    When the cargo has no cp cargo error status and no cp cargo pending status and no us cargo error status and no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status, then the system deletes the cargo record from the gcsb1rt status index table.
    For Continue Processing Error Conditions:
    When the cargo has cp cargo error status or cp cargo pending status or us cargo error status, then the system retrieves the current gcsb1rt record and fills error fields with origin station, border station, and destination station information and if gcsb1rt record exists then replaces the record else inserts a new gcsb1rt record.
    For Continue Processing Hold Conditions:
    When the cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold border status or us cargo pre-hold border status or us cargo hold destination status or us cargo pre-hold destination status or us cargo hold fda status, then the system retrieves the current gcsb1rt record and fills held fields with destination and border information and if gcsb1rt record exists then replaces the record else inserts a new gcsb1rt record.
  • Context - a cargo record is being processed for status index updates:
    For Has Error Status? & Has Hold Status?:
    When the system evaluates cargo status conditions, then the system identifies if cargo has cp cargo error status or cp cargo pending status or us cargo error status and the system identifies if cargo has us cargo hold status or us cargo hold pcs status or us cargo pre-hold pcs status or us cargo hold border status or us cargo pre-hold border status or us cargo hold destination status or us cargo pre-hold destination status or us cargo hold fda status.
  • Context - a cargo record has no cp cargo error status and no cp cargo pending status and no us cargo error status but has hold conditions:
    For Continue Processing Error Conditions:
    When the system processes the cargo status update, then the system retrieves the current gcsb1rt record and clears error origin index and clears error destination index and clears error border index and if no held destination index exists and no held border index exists then deletes the gcsb1rt record else replaces the gcsb1rt record.
  • Context - a cargo record has no us cargo hold status and no us cargo hold pcs status and no us cargo pre-hold pcs status and no us cargo hold border status and no us cargo pre-hold border status and no us cargo hold destination status and no us cargo pre-hold destination status and no us cargo hold fda status but has error conditions:
    For Continue Processing Hold Conditions:
    When the system processes the cargo status update, then the system retrieves the current gcsb1rt record and if record is found then clears held destination index and clears held border index and if no error destination index exists and no error origin index exists and no error border index exists then deletes the gcsb1rt record else replaces the gcsb1rt record.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists in the system
GIVEN
A cargo record exists in the system
Applied to: Delete GCSB1RT Index Record
WHEN
The cargo has no CP cargo error status AND no CP cargo pending status AND no US cargo error status AND no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status
THEN
The system deletes the cargo record from the GCSB1RT status index table
Applied to: Continue Processing Error Conditions
WHEN
The cargo has CP cargo error status OR CP cargo pending status OR US cargo error status
THEN
The system retrieves the current GCSB1RT record AND fills error fields with origin station, border station, and destination station information AND if GCSB1RT record exists then replaces the record else inserts a new GCSB1RT record
Applied to: Continue Processing Hold Conditions
WHEN
The cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold border status OR US cargo pre-hold border status OR US cargo hold destination status OR US cargo pre-hold destination status OR US cargo hold FDA status
THEN
The system retrieves the current GCSB1RT record AND fills held fields with destination and border information AND if GCSB1RT record exists then replaces the record else inserts a new GCSB1RT record
Context: A cargo record is being processed for status index updates
GIVEN
A cargo record is being processed for status index updates
Applied to: Has Error Status? & Has Hold Status?
WHEN
The system evaluates cargo status conditions
THEN
The system identifies if cargo has CP cargo error status OR CP cargo pending status OR US cargo error status AND The system identifies if cargo has US cargo hold status OR US cargo hold PCS status OR US cargo pre-hold PCS status OR US cargo hold border status OR US cargo pre-hold border status OR US cargo hold destination status OR US cargo pre-hold destination status OR US cargo hold FDA status
Context: A cargo record has no CP cargo error status AND no CP cargo pending status AND no US cargo error status but has hold conditions
GIVEN
A cargo record has no CP cargo error status AND no CP cargo pending status AND no US cargo error status but has hold conditions
Applied to: Continue Processing Error Conditions
WHEN
The system processes the cargo status update
THEN
The system retrieves the current GCSB1RT record AND clears error origin index AND clears error destination index AND clears error border index AND if no held destination index exists AND no held border index exists then deletes the GCSB1RT record else replaces the GCSB1RT record
Context: A cargo record has no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status but has error conditions
GIVEN
A cargo record has no US cargo hold status AND no US cargo hold PCS status AND no US cargo pre-hold PCS status AND no US cargo hold border status AND no US cargo pre-hold border status AND no US cargo hold destination status AND no US cargo pre-hold destination status AND no US cargo hold FDA status but has error conditions
Applied to: Continue Processing Hold Conditions
WHEN
The system processes the cargo status update
THEN
The system retrieves the current GCSB1RT record AND if record is found then clears held destination index AND clears held border index AND if no error destination index exists AND no error origin index exists AND no error border index exists then deletes the GCSB1RT record else replaces the GCSB1RT record
R-GCCUSIO-cbl-00832 (+2) File: GCCUSIO.cbl Check Hold Type Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Hold Type':
  • Context - a cargo record exists with hold status conditions:
    For Set Destination Hold Index:
    When the cargo status is uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-d or uscargo-pr-h-de or uscargo-holdfda, then set the destination station number from cargo record to held destination key and set the cargo ccn key to held destination cargo key.
  • Context - a cargo record exists with hold status conditions and mc table lookup is successful:
    For Set Border Hold Index:
    When the cargo status is uscargo-hold or uscargo-holdpcs or uscargo-pr-hpcs or uscargo-hold-b or uscargo-pr-h-bo or uscargo-holdfda and table lookup returns success flag '0', then set the mc station number from table segment to held border key and set the cargo ccn key to held border cargo key.
  • Context - a cargo record with location id exists:
    For Lookup Border Station from MC Table:
    When border hold processing is required for the cargo, then call table lookup service with function code 'gu', table id 'mc', and cargo location id as sequence id to retrieve station number information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with hold status conditions
GIVEN
A cargo record exists with hold status conditions
Applied to: Set Destination Hold Index
WHEN
The cargo status is USCARGO-HOLD OR USCARGO-HOLDPCS OR USCARGO-PR-HPCS OR USCARGO-HOLD-D OR USCARGO-PR-H-DE OR USCARGO-HOLDFDA
THEN
Set the destination station number from cargo record to held destination key AND set the cargo CCN key to held destination cargo key
Context: A cargo record exists with hold status conditions AND MC table lookup is successful
GIVEN
A cargo record exists with hold status conditions AND MC table lookup is successful
Applied to: Set Border Hold Index
WHEN
The cargo status is USCARGO-HOLD OR USCARGO-HOLDPCS OR USCARGO-PR-HPCS OR USCARGO-HOLD-B OR USCARGO-PR-H-BO OR USCARGO-HOLDFDA AND table lookup returns success flag '0'
THEN
Set the MC station number from table segment to held border key AND set the cargo CCN key to held border cargo key
Context: A cargo record with location ID exists
GIVEN
A cargo record with location ID exists
Applied to: Lookup Border Station from MC Table
WHEN
Border hold processing is required for the cargo
THEN
Call table lookup service with function code 'GU', table ID 'MC', and cargo location ID as sequence ID to retrieve station number information
R-GCX126-cbl-00837 (+9) File: GCX126R.cbl Set Release Information for Follower Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Release Information for Follower':
  • Context - a cargo record is being processed for release or deconsolidation:
    For Clear Destination Station & Set Release Date to Current Date & Set Release Time to Current Time & Set Release By User to Current User ID & Set Current Status to 'RELEASED' & Set Release Status to 'R' & Initialize Release Reason & Clear Error Status Index & Clear Error Status Field:
    When the release information is being set, then the destination station number index field is set to spaces and the destination station number for index field is set to spaces and the cargo release date field is set to the current machine date from the system and the cargo release time field is set to the current machine time from the system and the cargo release by field is set to the current acf2 user id from the system and the cargo current status field is set to the literal value 'released' and the cargo release status field is set to the code 'r' indicating released status and the cargo release reason field is set to spaces and the cargo error or release status index field is set to spaces and the cargo error status field is set to spaces.
  • Context - a cargo record is being processed for release or deconsolidation via edi 350 message:
    For Set Release Type to 'A':
    When the release information is being set, then the cargo release type field is set to the code 'a' indicating automatic release.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed for release or deconsolidation
GIVEN
A cargo record is being processed for release or deconsolidation
Applied to: Clear Destination Station & Set Release Date to Current Date & Set Release Time to Current Time & Set Release By User to Current User ID & Set Current Status to 'RELEASED' & Set Release Status to 'R' & Initialize Release Reason & Clear Error Status Index & Clear Error Status Field
WHEN
The release information is being set
THEN
The destination station number index field is set to spaces AND the destination station number for index field is set to spaces AND The cargo release date field is set to the current machine date from the system AND The cargo release time field is set to the current machine time from the system AND The cargo release by field is set to the current ACF2 user ID from the system AND The cargo current status field is set to the literal value 'RELEASED' AND The cargo release status field is set to the code 'R' indicating released status AND The cargo release reason field is set to spaces AND The cargo error or release status index field is set to spaces AND The cargo error status field is set to spaces
Context: A cargo record is being processed for release or deconsolidation via EDI 350 message
GIVEN
A cargo record is being processed for release or deconsolidation via EDI 350 message
Applied to: Set Release Type to 'A'
WHEN
The release information is being set
THEN
The cargo release type field is set to the code 'A' indicating automatic release
R-GCX126-cbl-00847 (+9) File: GCX126R.cbl Process Associated US Manifest for Follower Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Associated US Manifest for Follower':
  • Context - a follower manifest cargo record is being processed for release:
    For Set Car ID and Waybill from Follower Manifest:
    When the system prepares to search for associated us cargo records, then the equipment car identifier is extracted from the current cargo record's equipment car field and the waybill number is extracted from the saved waybill index field for use in the us cargo search.
  • Context - an equipment car identifier and waybill number have been extracted from the canadian cargo record:
    For Retrieve US Cargo by Car ID and Waybill:
    When the system searches for the associated us cargo manifest, then the system retrieves the us cargo record where the car identifier index matches the equipment car identifier and the waybill number index matches the waybill number, using a greater-than-or-equal-to search operator, and sets an end-of-database indicator if no record is found or if the retrieved record does not match the search criteria.
  • Context - a us cargo retrieval operation has been performed using equipment car identifier and waybill number:
    For US Cargo Found?:
    When the system evaluates the search results, then if the end-of-database indicator is set, the system concludes no us cargo was found and terminates processing; otherwise, the system proceeds to validate the retrieved cargo record.
  • Context - a us cargo record has been successfully retrieved matching the equipment car identifier and waybill number:
    For Cargo Deleted or TR Created?:
    When the system validates the cargo record status, then if the cargo record has a deleted status indicator or if the train-created-for-it field equals 'y', the system skips processing this cargo and terminates; otherwise, the system proceeds to log the release information.
  • Context - a valid us cargo record has been identified for release logging:
    For Prepare Log Message:
    When the system prepares to create a log entry, then the log input structure is cleared to spaces, the security byte is set to high-value, the sending transaction is set to 'gct1261e', and the user identifier is set to the current session's user identifier.
  • Context - the log information structure has been initialized and the canadian cargo control number is available from the current cargo record:
    For Build Message: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN:
    When the system builds the log message content, then the log message is constructed by concatenating the text 'cdn ccn rlsed by edi 350: ' with the canadian cargo control number key from the current cargo record.
  • Context - the log message has been constructed and the us cargo record contains the us cargo control number:
    For Set Log Details: Date/Time from System, Action Code: LOG-USE-INPUT-MESSAGE, US CCN as Reference, Type: US Cargo:
    When the system completes the log entry details, then the log date is set to the current machine century concatenated with the current machine date, the log time is set to the current machine time, the action code is set to log-use-input-message, the train or us cargo control number field is set to the us cargo control number key from the retrieved record, and the cargo type indicator is set to us cargo.
  • Context - all log entry fields have been populated with the us cargo release information:
    For Spawn GCT1051E Transaction to Log Message:
    When the system executes the log entry creation process, then if the log message is not spaces or low-values, the system replaces all spaces in the date with zeroes, replaces all spaces in the time with '1', moves the log input to the gct1051e message structure, changes the alternate program communication block, calls the write message log function with the message code, message content, message length and module name, and purges the alternate program communication block.
  • Context - a us cargo record has been retrieved that either has a deleted status or has the train-created-for-it indicator set to 'y':
    For No Action - Skip This US Cargo:
    When the system evaluates whether to process the cargo, then the system performs no logging or update operations and proceeds to the end of the us manifest processing routine.
  • Context - either no us cargo was found, the us cargo was invalid and skipped, or the us cargo release has been successfully logged:
    For End: US Manifest Processing Complete:
    When the system reaches the end of the us manifest processing routine, then the system exits the us manifest processing section and returns control to the follower manifest processing loop.
👨‍💻 Technical ACs (Gherkin)
Context: A follower manifest cargo record is being processed for release
GIVEN
A follower manifest cargo record is being processed for release
Applied to: Set Car ID and Waybill from Follower Manifest
WHEN
The system prepares to search for associated US cargo records
THEN
The equipment car identifier is extracted from the current cargo record's equipment car field and the waybill number is extracted from the saved waybill index field for use in the US cargo search
Context: An equipment car identifier and waybill number have been extracted from the Canadian cargo record
GIVEN
An equipment car identifier and waybill number have been extracted from the Canadian cargo record
Applied to: Retrieve US Cargo by Car ID and Waybill
WHEN
The system searches for the associated US cargo manifest
THEN
The system retrieves the US cargo record where the car identifier index matches the equipment car identifier and the waybill number index matches the waybill number, using a greater-than-or-equal-to search operator, and sets an end-of-database indicator if no record is found or if the retrieved record does not match the search criteria
Context: A US cargo retrieval operation has been performed using equipment car identifier and waybill number
GIVEN
A US cargo retrieval operation has been performed using equipment car identifier and waybill number
Applied to: US Cargo Found?
WHEN
The system evaluates the search results
THEN
If the end-of-database indicator is set, the system concludes no US cargo was found and terminates processing; otherwise, the system proceeds to validate the retrieved cargo record
Context: A US cargo record has been successfully retrieved matching the equipment car identifier and waybill number
GIVEN
A US cargo record has been successfully retrieved matching the equipment car identifier and waybill number
Applied to: Cargo Deleted or TR Created?
WHEN
The system validates the cargo record status
THEN
If the cargo record has a deleted status indicator or if the train-created-for-it field equals 'Y', the system skips processing this cargo and terminates; otherwise, the system proceeds to log the release information
Context: A valid US cargo record has been identified for release logging
GIVEN
A valid US cargo record has been identified for release logging
Applied to: Prepare Log Message
WHEN
The system prepares to create a log entry
THEN
The log input structure is cleared to spaces, the security byte is set to high-value, the sending transaction is set to 'GCT1261E', and the user identifier is set to the current session's user identifier
Context: The log information structure has been initialized and the Canadian cargo control number is available from the current cargo record
GIVEN
The log information structure has been initialized and the Canadian cargo control number is available from the current cargo record
Applied to: Build Message: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN
WHEN
The system builds the log message content
THEN
The log message is constructed by concatenating the text 'CDN CCN RLSED BY EDI 350: ' with the Canadian cargo control number key from the current cargo record
Context: The log message has been constructed and the US cargo record contains the US cargo control number
GIVEN
The log message has been constructed and the US cargo record contains the US cargo control number
Applied to: Set Log Details: Date/Time from System, Action Code: LOG-USE-INPUT-MESSAGE, US CCN as Reference, Type: US Cargo
WHEN
The system completes the log entry details
THEN
The log date is set to the current machine century concatenated with the current machine date, the log time is set to the current machine time, the action code is set to LOG-USE-INPUT-MESSAGE, the train or US cargo control number field is set to the US cargo control number key from the retrieved record, and the cargo type indicator is set to US cargo
Context: All log entry fields have been populated with the US cargo release information
GIVEN
All log entry fields have been populated with the US cargo release information
Applied to: Spawn GCT1051E Transaction to Log Message
WHEN
The system executes the log entry creation process
THEN
If the log message is not spaces or low-values, the system replaces all spaces in the date with zeroes, replaces all spaces in the time with '1', moves the log input to the GCT1051E message structure, changes the alternate program communication block, calls the write message log function with the message code, message content, message length and module name, and purges the alternate program communication block
Context: A US cargo record has been retrieved that either has a deleted status or has the train-created-for-it indicator set to 'Y'
GIVEN
A US cargo record has been retrieved that either has a deleted status or has the train-created-for-it indicator set to 'Y'
Applied to: No Action - Skip This US Cargo
WHEN
The system evaluates whether to process the cargo
THEN
The system performs no logging or update operations and proceeds to the end of the US manifest processing routine
Context: Either no US cargo was found, the US cargo was invalid and skipped, or the US cargo release has been successfully logged
GIVEN
Either no US cargo was found, the US cargo was invalid and skipped, or the US cargo release has been successfully logged
Applied to: End: US Manifest Processing Complete
WHEN
The system reaches the end of the US manifest processing routine
THEN
The system exits the US manifest processing section and returns control to the follower manifest processing loop
R-GCX126-cbl-00857 (+11) File: GCX126R.cbl Call Database to Get First US Cargo Record Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Database to Get First US Cargo Record':
  • Context - a cargo record is being processed with a current equipment car identifier key:
    For Set Car ID from Current Cargo:
    When the system prepares to search for associated us cargo records, then the us cargo search car identifier index is populated with the current cargo's equipment car identifier key.
  • Context - a waybill index has been saved from the current cargo processing:
    For Set Waybill Index from Saved Waybill:
    When the system prepares to search for associated us cargo records, then the us cargo search waybill number index is populated with the saved waybill index value.
  • Context - the system is preparing to search for us cargo records by car identifier and waybill:
    For Set US CCN Key to Low Values:
    When the search parameters are being initialized, then the us ccn key index is set to low values to start the search from the lowest possible ccn.
  • Context - the system needs to retrieve us cargo records from the database:
    For Set Database Status to 'GEGB':
    When database access parameters are being configured, then the database accept status is set to 'gegb' to enable get and browse operations.
  • Context - the system is initiating a search for us cargo records:
    For Set Function to GU - Get Unique:
    When the database function type is being configured, then the function code is set to gu (get unique) to retrieve the first matching record.
  • Context - the system needs to search us cargo records by equipment and waybill:
    For Set Index Type to Car-Waybill:
    When the database index type is being specified, then the index type is set to car-waybill to use the composite index for the search.
  • Context - the system is configuring a database search with specific car and waybill criteria:
    For Set Operator to '>=':
    When the search operator is being defined, then the operator is set to '>=' to include the starting point and all subsequent records in the index.
  • Context - all search parameters are configured with car identifier, waybill index, function code gu, index type car-waybill, and operator '>=':
    For Call GCCUSIO to Retrieve US Cargo:
    When the system executes the database retrieval operation, then the gccusio module is called with the configured parameters to retrieve the us cargo record into the gcsusrt segment.
  • Context - a database call has been executed to retrieve a us cargo record:
    For Database Status OK?:
    When the database status code is not spaces (indicating an error or no records found), then the end-of-database flag is set to true and processing continues to completion.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID and Waybill Match?:
    When the system validates the retrieved record's car identifier (first 12 characters) against the current cargo's car identifier key and the waybill number index against the saved waybill index, then if both the car identifier and waybill match, continue validation; otherwise set the end-of-database flag to true.
  • Context - a us cargo record has been retrieved and validated for car identifier and waybill match:
    For Cargo Deleted or TR Created?:
    When the system checks if the cargo is marked as deleted or if a train has already been created for it (tr-created-for-it = 'y'), then if either condition is true, skip setting the us manifest found flag and proceed to completion; otherwise continue to set the found flag.
  • Context - a us cargo record has been retrieved that matches the car identifier and waybill, is not deleted, and does not have a train already created:
    For Set US Manifest Found Flag:
    When all validation checks pass successfully, then the us manifest found flag is set to true to indicate a valid record is available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record is being processed with a current equipment car identifier key
GIVEN
A cargo record is being processed with a current equipment car identifier key
Applied to: Set Car ID from Current Cargo
WHEN
The system prepares to search for associated US cargo records
THEN
The US cargo search car identifier index is populated with the current cargo's equipment car identifier key
Context: A waybill index has been saved from the current cargo processing
GIVEN
A waybill index has been saved from the current cargo processing
Applied to: Set Waybill Index from Saved Waybill
WHEN
The system prepares to search for associated US cargo records
THEN
The US cargo search waybill number index is populated with the saved waybill index value
Context: The system is preparing to search for US cargo records by car identifier and waybill
GIVEN
The system is preparing to search for US cargo records by car identifier and waybill
Applied to: Set US CCN Key to Low Values
WHEN
The search parameters are being initialized
THEN
The US CCN key index is set to low values to start the search from the lowest possible CCN
Context: The system needs to retrieve US cargo records from the database
GIVEN
The system needs to retrieve US cargo records from the database
Applied to: Set Database Status to 'GEGB'
WHEN
Database access parameters are being configured
THEN
The database accept status is set to 'GEGB' to enable get and browse operations
Context: The system is initiating a search for US cargo records
GIVEN
The system is initiating a search for US cargo records
Applied to: Set Function to GU - Get Unique
WHEN
The database function type is being configured
THEN
The function code is set to GU (Get Unique) to retrieve the first matching record
Context: The system needs to search US cargo records by equipment and waybill
GIVEN
The system needs to search US cargo records by equipment and waybill
Applied to: Set Index Type to Car-Waybill
WHEN
The database index type is being specified
THEN
The index type is set to Car-Waybill to use the composite index for the search
Context: The system is configuring a database search with specific car and waybill criteria
GIVEN
The system is configuring a database search with specific car and waybill criteria
Applied to: Set Operator to '>='
WHEN
The search operator is being defined
THEN
The operator is set to '>=' to include the starting point and all subsequent records in the index
Context: All search parameters are configured with car identifier, waybill index, function code GU, index type Car-Waybill, and operator '>='
GIVEN
All search parameters are configured with car identifier, waybill index, function code GU, index type Car-Waybill, and operator '>='
Applied to: Call GCCUSIO to Retrieve US Cargo
WHEN
The system executes the database retrieval operation
THEN
The GCCUSIO module is called with the configured parameters to retrieve the US cargo record into the GCSUSRT segment
Context: A database call has been executed to retrieve a US cargo record
GIVEN
A database call has been executed to retrieve a US cargo record
Applied to: Database Status OK?
WHEN
The database status code is not spaces (indicating an error or no records found)
THEN
The end-of-database flag is set to true and processing continues to completion
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID and Waybill Match?
WHEN
The system validates the retrieved record's car identifier (first 12 characters) against the current cargo's car identifier key AND the waybill number index against the saved waybill index
THEN
If both the car identifier and waybill match, continue validation; otherwise set the end-of-database flag to true
Context: A US cargo record has been retrieved and validated for car identifier and waybill match
GIVEN
A US cargo record has been retrieved and validated for car identifier and waybill match
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks if the cargo is marked as deleted OR if a train has already been created for it (TR-CREATED-FOR-IT = 'Y')
THEN
If either condition is true, skip setting the US manifest found flag and proceed to completion; otherwise continue to set the found flag
Context: A US cargo record has been retrieved that matches the car identifier and waybill, is not deleted, and does not have a train already created
GIVEN
A US cargo record has been retrieved that matches the car identifier and waybill, is not deleted, and does not have a train already created
Applied to: Set US Manifest Found Flag
WHEN
All validation checks pass successfully
THEN
The US manifest found flag is set to true to indicate a valid record is available for processing
R-GCX126-cbl-00869 (+6) File: GCX126R.cbl Call Database to Get Next US Cargo Record by Car/Waybill Index Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Database to Get Next US Cargo Record by Car/Waybill Index':
  • Context - a request to retrieve the next us cargo record by car and waybill index:
    For Set Accept Status to 'GEGB':
    When the system prepares to call the database access routine, then the accept status is set to 'gegb', segment type is set to gcsusrt, function code is set to get next (gn), index type is set to car/waybill, and operator is set to '>' for sequential retrieval.
  • Context - database call parameters are configured with accept status 'gegb', segment gcsusrt, function gn, car/waybill index, and operator '>':
    For Call GCCUSIO to Read Next Record:
    When the gccusio routine is called with the parameter block and us cargo segment, then the system retrieves the next us cargo record from the gcsusrt table based on the car/waybill index position.
  • Context - the database call to retrieve next us cargo record has completed:
    For Database Status OK?:
    When the database status code is not blank (indicating an error or end of data), then the end-of-database flag is set to true and processing terminates.
  • Context - a us cargo record has been successfully retrieved from the database with car id index and waybill number index:
    For Car ID and Waybill Match?:
    When the system compares the first 12 characters of the retrieved car id index with the current equipment car id key and compares the retrieved waybill number index with the saved waybill index, then if both car id (first 12 characters) and waybill number match, continue validation; otherwise set end-of-database flag to true.
  • Context - a us cargo record matches the car id and waybill number criteria:
    For Cargo Deleted or TR Created?:
    When the system checks if the cargo delete status indicator is set to deleted or the train-created-for-it indicator is 'y', then if either condition is true, skip this record and continue to next; otherwise set us manifest found flag to true.
  • Context - a us cargo record matches car id and waybill number and is not deleted and does not have a train created for it:
    For Set US Manifest Found Flag:
    When all validation checks pass successfully, then the us manifest found flag is set to true indicating a valid matching record has been located.
  • Context - a us cargo record has been retrieved from the database:
    For Set End-of-Database Flag:
    When the car id (first 12 characters) does not match the current equipment car id key or the waybill number index does not match the saved waybill index, then the end-of-database flag is set to true to terminate the search loop.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve the next US cargo record by car and waybill index
GIVEN
A request to retrieve the next US cargo record by car and waybill index
Applied to: Set Accept Status to 'GEGB'
WHEN
The system prepares to call the database access routine
THEN
The accept status is set to 'GEGB', segment type is set to GCSUSRT, function code is set to Get Next (GN), index type is set to Car/Waybill, and operator is set to '>' for sequential retrieval
Context: Database call parameters are configured with accept status 'GEGB', segment GCSUSRT, function GN, car/waybill index, and operator '>'
GIVEN
Database call parameters are configured with accept status 'GEGB', segment GCSUSRT, function GN, car/waybill index, and operator '>'
Applied to: Call GCCUSIO to Read Next Record
WHEN
The GCCUSIO routine is called with the parameter block and US cargo segment
THEN
The system retrieves the next US cargo record from the GCSUSRT table based on the car/waybill index position
Context: The database call to retrieve next US cargo record has completed
GIVEN
The database call to retrieve next US cargo record has completed
Applied to: Database Status OK?
WHEN
The database status code is not blank (indicating an error or end of data)
THEN
The end-of-database flag is set to true and processing terminates
Context: A US cargo record has been successfully retrieved from the database with car ID index and waybill number index
GIVEN
A US cargo record has been successfully retrieved from the database with car ID index and waybill number index
Applied to: Car ID and Waybill Match?
WHEN
The system compares the first 12 characters of the retrieved car ID index with the current equipment car ID key AND compares the retrieved waybill number index with the saved waybill index
THEN
If both car ID (first 12 characters) and waybill number match, continue validation; otherwise set end-of-database flag to true
Context: A US cargo record matches the car ID and waybill number criteria
GIVEN
A US cargo record matches the car ID and waybill number criteria
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks if the cargo delete status indicator is set to deleted OR the train-created-for-it indicator is 'Y'
THEN
If either condition is true, skip this record and continue to next; otherwise set US manifest found flag to true
Context: A US cargo record matches car ID and waybill number AND is not deleted AND does not have a train created for it
GIVEN
A US cargo record matches car ID and waybill number AND is not deleted AND does not have a train created for it
Applied to: Set US Manifest Found Flag
WHEN
All validation checks pass successfully
THEN
The US manifest found flag is set to true indicating a valid matching record has been located
Context: A US cargo record has been retrieved from the database
GIVEN
A US cargo record has been retrieved from the database
Applied to: Set End-of-Database Flag
WHEN
The car ID (first 12 characters) does not match the current equipment car ID key OR the waybill number index does not match the saved waybill index
THEN
The end-of-database flag is set to true to terminate the search loop
R-GCX126-cbl-00876 (+11) File: GCX126R.cbl Get Next Cargo Record Using Master CCN Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Next Cargo Record Using Master CCN':
  • Context - the system needs to retrieve the next cargo record from the database:
    For Set Status Code to 'GEGB':
    When preparing to call the database with get next function, then the status code is set to 'gegb' to indicate get next operation with proper positioning.
  • Context - the database status code is set to 'gegb' and the master ccn key is positioned in the qualified ssa:
    For Call IMS Database with GN Function:
    When the system executes the database call with gn function for pcb7 and cargo report segment using qualified ssa for b0rt, then the next cargo record is retrieved into the cargo report segment and the database status code is updated to reflect the result.
  • Context - a database get next call has been executed to retrieve a cargo record:
    For Status Code = Blank?:
    When the system checks the database status code, then if the status code equals blank (spaces), the record was successfully retrieved and processing continues; otherwise, the end of database flag is set.
  • Context - a cargo record has been successfully retrieved from the database:
    For Check Master Manifest CCN Match:
    When the system compares the master manifest ccn from the cargo record against the saved input ccn, then the system determines if the retrieved record belongs to the same master manifest hierarchy for further processing.
  • Context - the master manifest ccn from the cargo record and the saved input ccn are available for comparison:
    For Master CCN Matches Input CCN?:
    When the system evaluates if the master manifest ccn equals the saved input ccn, then if they match, continue checking the manifest type; if they do not match, set the end of database flag to stop processing.
  • Context - a cargo record has been retrieved that belongs to the same master manifest ccn:
    For Is Master Manifest?:
    When the system checks if the cargo record is identified as a master manifest, then if it is a master manifest, skip this record and continue to the next; if not, check if it is a follower manifest.
  • Context - a cargo record has been retrieved that is not a master manifest but belongs to the same master manifest ccn:
    For Is Follower Manifest?:
    When the system checks if the cargo record is identified as a follower manifest, then if it is a follower manifest, store its ccn in the follower array and increment the index; if not, skip this record and continue to the next.
  • Context - a cargo record has been identified as a follower manifest belonging to the current master manifest:
    For Store Follower CCN in Array:
    When the system stores the ccn key from the cargo record, then the follower manifest ccn is placed in the follower manifest array at the current index position.
  • Context - a follower manifest ccn has been stored in the follower manifest array:
    For Increment Array Index:
    When the system increments the array index counter, then the array index is increased by 1 to point to the next available position in the follower manifest array.
  • Context - either the database status code indicates no more records, or the master manifest ccn does not match the input ccn:
    For Set End of Database Flag:
    When the system determines that database traversal should stop, then the end of database flag is set to true to terminate the retrieval loop.
  • Context - the current cargo record is either a master manifest or not a follower manifest:
    For Continue to Next Record:
    When the system determines the current record should be skipped, then control returns to the caller to continue the loop and retrieve the next cargo record.
  • Context - either the end of database flag has been set or a record has been processed:
    For End: Return to Caller:
    When the procedure completes its execution, then control returns to the calling procedure with the follower manifest array populated with all valid follower ccns found, or with the end of database flag set if no more records exist.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to retrieve the next cargo record from the database
GIVEN
The system needs to retrieve the next cargo record from the database
Applied to: Set Status Code to 'GEGB'
WHEN
Preparing to call the database with Get Next function
THEN
The status code is set to 'GEGB' to indicate Get Next operation with proper positioning
Context: The database status code is set to 'GEGB' and the master CCN key is positioned in the qualified SSA
GIVEN
The database status code is set to 'GEGB' and the master CCN key is positioned in the qualified SSA
Applied to: Call IMS Database with GN Function
WHEN
The system executes the database call with GN function for PCB7 and cargo report segment using qualified SSA for B0RT
THEN
The next cargo record is retrieved into the cargo report segment and the database status code is updated to reflect the result
Context: A database Get Next call has been executed to retrieve a cargo record
GIVEN
A database Get Next call has been executed to retrieve a cargo record
Applied to: Status Code = Blank?
WHEN
The system checks the database status code
THEN
If the status code equals blank (spaces), the record was successfully retrieved and processing continues; otherwise, the end of database flag is set
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Check Master Manifest CCN Match
WHEN
The system compares the master manifest CCN from the cargo record against the saved input CCN
THEN
The system determines if the retrieved record belongs to the same master manifest hierarchy for further processing
Context: The master manifest CCN from the cargo record and the saved input CCN are available for comparison
GIVEN
The master manifest CCN from the cargo record and the saved input CCN are available for comparison
Applied to: Master CCN Matches Input CCN?
WHEN
The system evaluates if the master manifest CCN equals the saved input CCN
THEN
If they match, continue checking the manifest type; if they do not match, set the end of database flag to stop processing
Context: A cargo record has been retrieved that belongs to the same master manifest CCN
GIVEN
A cargo record has been retrieved that belongs to the same master manifest CCN
Applied to: Is Master Manifest?
WHEN
The system checks if the cargo record is identified as a master manifest
THEN
If it is a master manifest, skip this record and continue to the next; if not, check if it is a follower manifest
Context: A cargo record has been retrieved that is not a master manifest but belongs to the same master manifest CCN
GIVEN
A cargo record has been retrieved that is not a master manifest but belongs to the same master manifest CCN
Applied to: Is Follower Manifest?
WHEN
The system checks if the cargo record is identified as a follower manifest
THEN
If it is a follower manifest, store its CCN in the follower array and increment the index; if not, skip this record and continue to the next
Context: A cargo record has been identified as a follower manifest belonging to the current master manifest
GIVEN
A cargo record has been identified as a follower manifest belonging to the current master manifest
Applied to: Store Follower CCN in Array
WHEN
The system stores the CCN key from the cargo record
THEN
The follower manifest CCN is placed in the follower manifest array at the current index position
Context: A follower manifest CCN has been stored in the follower manifest array
GIVEN
A follower manifest CCN has been stored in the follower manifest array
Applied to: Increment Array Index
WHEN
The system increments the array index counter
THEN
The array index is increased by 1 to point to the next available position in the follower manifest array
Context: Either the database status code indicates no more records, or the master manifest CCN does not match the input CCN
GIVEN
Either the database status code indicates no more records, or the master manifest CCN does not match the input CCN
Applied to: Set End of Database Flag
WHEN
The system determines that database traversal should stop
THEN
The end of database flag is set to TRUE to terminate the retrieval loop
Context: The current cargo record is either a master manifest or not a follower manifest
GIVEN
The current cargo record is either a master manifest or not a follower manifest
Applied to: Continue to Next Record
WHEN
The system determines the current record should be skipped
THEN
Control returns to the caller to continue the loop and retrieve the next cargo record
Context: Either the end of database flag has been set or a record has been processed
GIVEN
Either the end of database flag has been set or a record has been processed
Applied to: End: Return to Caller
WHEN
The procedure completes its execution
THEN
Control returns to the calling procedure with the follower manifest array populated with all valid follower CCNs found, or with the end of database flag set if no more records exist
R-GCX126-cbl-00888 (+13) File: GCX126R.cbl 16: Lookup Cargo by Follower CCN Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '16: Lookup Cargo by Follower CCN':
  • Context - a follower manifest ccn is available for cargo lookup:
    For Lookup Cargo by Follower CCN:
    When the system attempts to retrieve the cargo record using the follower ccn as the search key, then the system retrieves the cargo report segment and secondary segment if the cargo exists, or indicates cargo not found if the ccn does not match any existing cargo record.
  • Context - a follower manifest ccn exists in the follower manifest array:
    For Move Follower CCN to Search Key:
    When the system prepares to search for the cargo record, then the follower ccn is moved to both the primary cargo search key (ccrt-ssaq) and secondary cargo search key (a2rt-ssaq).
  • Context - the cargo search key contains a valid follower ccn:
    For Call CIMS with GHU Function:
    When the system invokes the database access function with ghu operation, then the system attempts to retrieve the cargo report segment (gccc-cargo-report-segment) from the cargo database (gccc-pcb) using the qualified search argument.
  • Context - the database retrieval operation for cargo has completed:
    For Status Code = Spaces?:
    When the system checks the database operation status code, then if the status code is spaces (blank), the cargo record exists; otherwise, the cargo record does not exist in the database.
  • Context - the database status code indicates successful cargo retrieval (status code is spaces):
    For Set Cargo Found Flag:
    When the system processes the successful database response, then the cargo found indicator (ws-cargo-found) is set to true to indicate the cargo record exists.
  • Context - the primary cargo report segment has been successfully retrieved:
    For Read Cargo Secondary Segment:
    When the system attempts to read the cargo secondary segment using ghu function, then the system retrieves the cargo secondary segment (gcsccs52) from the secondary cargo database (gca2-pcb) using the secondary search key.
  • Context - the secondary segment retrieval operation has completed:
    For Secondary Status = GE?:
    When the system evaluates the secondary segment database status code, then if the status code equals 'ge' (segment not found), the secondary segment does not exist; otherwise, the secondary segment is available.
  • Context - the secondary segment retrieval returned status code 'ge' indicating no secondary segment exists:
    For Clear Secondary Segment:
    When the system processes the missing secondary segment condition, then the secondary segment data structure (gcsccs52) is cleared to spaces to prevent processing of invalid data.
  • Context - the database status code indicates unsuccessful cargo retrieval (status code is not spaces):
    For Set Cargo Not Found Flag:
    When the system processes the failed database response, then the cargo not found indicator (ws-cargo-not-found) is set to true to indicate the cargo record does not exist.
  • Context - a cargo record has been successfully retrieved from the database:
    For Lookup Cargo by Follower CCN:
    When the system evaluates the cargo deletion status field, then if the deletion status equals 'd', the cargo deleted indicator (ws-cargo-deleted) is set to true; otherwise, the cargo is considered active.
  • Context - a cargo record has been retrieved and a waybill index filter is provided (not blank):
    For Lookup Cargo by Follower CCN:
    When the system compares the cargo's waybill key with the saved waybill index, then if the waybill keys do not match, the cargo not waybill indicator (ws-cargo-not-wb) is set to true; otherwise, the waybill matches and processing continues.
  • Context - a cargo record has been successfully retrieved and is not deleted:
    For Lookup Cargo by Follower CCN:
    When the system evaluates the cargo return status indicator, then if the cargo status indicates return (gccc-status-return is true), the cargo returned indicator (ws-cargo-returned) is set to true.
    For Lookup Cargo by Follower CCN:
    When the system checks the cargo release status field, then if the release status equals 'r', the cargo released indicator (ws-cargo-released) is set to true.
    For Lookup Cargo by Follower CCN:
    When the system examines the cargo train identification field, then if the cp train id is not spaces (blank), the cargo on train indicator (ws-cargo-on-a-train) is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A follower manifest CCN is available for cargo lookup
GIVEN
A follower manifest CCN is available for cargo lookup
Applied to: Lookup Cargo by Follower CCN
WHEN
The system attempts to retrieve the cargo record using the follower CCN as the search key
THEN
The system retrieves the cargo report segment and secondary segment if the cargo exists, or indicates cargo not found if the CCN does not match any existing cargo record
Context: A follower manifest CCN exists in the follower manifest array
GIVEN
A follower manifest CCN exists in the follower manifest array
Applied to: Move Follower CCN to Search Key
WHEN
The system prepares to search for the cargo record
THEN
The follower CCN is moved to both the primary cargo search key (CCRT-SSAQ) and secondary cargo search key (A2RT-SSAQ)
Context: The cargo search key contains a valid follower CCN
GIVEN
The cargo search key contains a valid follower CCN
Applied to: Call CIMS with GHU Function
WHEN
The system invokes the database access function with GHU operation
THEN
The system attempts to retrieve the cargo report segment (GCCC-CARGO-REPORT-SEGMENT) from the cargo database (GCCC-PCB) using the qualified search argument
Context: The database retrieval operation for cargo has completed
GIVEN
The database retrieval operation for cargo has completed
Applied to: Status Code = Spaces?
WHEN
The system checks the database operation status code
THEN
If the status code is spaces (blank), the cargo record exists; otherwise, the cargo record does not exist in the database
Context: The database status code indicates successful cargo retrieval (status code is spaces)
GIVEN
The database status code indicates successful cargo retrieval (status code is spaces)
Applied to: Set Cargo Found Flag
WHEN
The system processes the successful database response
THEN
The cargo found indicator (WS-CARGO-FOUND) is set to true to indicate the cargo record exists
Context: The primary cargo report segment has been successfully retrieved
GIVEN
The primary cargo report segment has been successfully retrieved
Applied to: Read Cargo Secondary Segment
WHEN
The system attempts to read the cargo secondary segment using GHU function
THEN
The system retrieves the cargo secondary segment (GCSCCS52) from the secondary cargo database (GCA2-PCB) using the secondary search key
Context: The secondary segment retrieval operation has completed
GIVEN
The secondary segment retrieval operation has completed
Applied to: Secondary Status = GE?
WHEN
The system evaluates the secondary segment database status code
THEN
If the status code equals 'GE' (segment not found), the secondary segment does not exist; otherwise, the secondary segment is available
Context: The secondary segment retrieval returned status code 'GE' indicating no secondary segment exists
GIVEN
The secondary segment retrieval returned status code 'GE' indicating no secondary segment exists
Applied to: Clear Secondary Segment
WHEN
The system processes the missing secondary segment condition
THEN
The secondary segment data structure (GCSCCS52) is cleared to spaces to prevent processing of invalid data
Context: The database status code indicates unsuccessful cargo retrieval (status code is not spaces)
GIVEN
The database status code indicates unsuccessful cargo retrieval (status code is not spaces)
Applied to: Set Cargo Not Found Flag
WHEN
The system processes the failed database response
THEN
The cargo not found indicator (WS-CARGO-NOT-FOUND) is set to true to indicate the cargo record does not exist
Context: A cargo record has been successfully retrieved from the database
GIVEN
A cargo record has been successfully retrieved from the database
Applied to: Lookup Cargo by Follower CCN
WHEN
The system evaluates the cargo deletion status field
THEN
If the deletion status equals 'D', the cargo deleted indicator (WS-CARGO-DELETED) is set to true; otherwise, the cargo is considered active
Context: A cargo record has been retrieved and a waybill index filter is provided (not blank)
GIVEN
A cargo record has been retrieved and a waybill index filter is provided (not blank)
Applied to: Lookup Cargo by Follower CCN
WHEN
The system compares the cargo's waybill key with the saved waybill index
THEN
If the waybill keys do not match, the cargo not waybill indicator (WS-CARGO-NOT-WB) is set to true; otherwise, the waybill matches and processing continues
Context: A cargo record has been successfully retrieved and is not deleted
GIVEN
A cargo record has been successfully retrieved and is not deleted
Applied to: Lookup Cargo by Follower CCN
WHEN
The system evaluates the cargo return status indicator
THEN
If the cargo status indicates return (GCCC-STATUS-RETURN is true), the cargo returned indicator (WS-CARGO-RETURNED) is set to true
Applied to: Lookup Cargo by Follower CCN
WHEN
The system checks the cargo release status field
THEN
If the release status equals 'R', the cargo released indicator (WS-CARGO-RELEASED) is set to true
Applied to: Lookup Cargo by Follower CCN
WHEN
The system examines the cargo train identification field
THEN
If the CP train ID is not spaces (blank), the cargo on train indicator (WS-CARGO-ON-A-TRAIN) is set to true
R-GCX126-cbl-00902 (+14) File: GCX126R.cbl 31: Process Associated US Manifest Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '31: Process Associated US Manifest':
  • Context - a canadian cargo record has been processed with release or deconsolidation status:
    For Initialize US Manifest Search Flags:
    When the system begins searching for associated us manifest records, then the us manifest found flag is set to not found and the end-of-database flag is set to not end of db to enable iterative search.
  • Context - the current equipment car id key and saved waybill index are available from the canadian cargo record:
    For Retrieve US Cargo by Car ID and Waybill:
    When the system initiates us cargo search, then the system retrieves the first us cargo record from gcsusrt table where car id number index matches the current equipment car id key and waybill number index matches the saved waybill index using gu (get unique) function with '>=' operator on the car-waybill index.
  • Context - a database retrieval operation has been performed for us cargo:
    For Cargo Status Check:
    When the database status code is not spaces (indicating record not found or error), then the end-of-database flag is set to true and processing exits the us manifest search without creating any log entries.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Car ID and Waybill Match?:
    When the system validates the retrieved record, then if the us cargo car id number index (first 12 characters) equals the current equipment car id key and the us cargo waybill number index equals the saved waybill index, continue processing; otherwise set end-of-database flag to true and exit.
  • Context - a us cargo record has been retrieved and validated for car id and waybill match:
    For Cargo Deleted or TR Created?:
    When the system checks the cargo record status, then if the cargo delete status indicator shows deleted or the train-created-for-it field equals 'y', skip this record and retrieve the next us cargo record; otherwise mark the us manifest as found.
  • Context - the current us cargo record is deleted or has train created:
    For Get Next US Cargo Record:
    When the system needs to find the next valid us cargo record, then the system retrieves the next us cargo record from gcsusrt table using gn (get next) function with '>' operator on the car-waybill index and re-validates car id and waybill match.
  • Context - a us cargo record has been retrieved that matches car id and waybill and is not deleted and does not have train created:
    For Set US Manifest Found Flag:
    When the system validates all conditions are met, then the us manifest found flag is set to true to proceed with logging.
  • Context - a valid us manifest has been found:
    For Prepare Log Information:
    When the system prepares to create a log entry, then the log input structure is cleared to spaces, the security byte is set to high-value, the sending transaction is set to 'gct1261e', and the acf2 user id is set from the common control area.
  • Context - the log header information has been prepared:
    For Build Log Date from Machine Date:
    When the system builds the log date field, then the log date is constructed by concatenating the machine century (cc) and machine date (yymmdd) from the common control area into the gcx105 date field.
  • Context - the log date has been built:
    For Set Log Time from Machine Time:
    When the system sets the log time field, then the log time is set to the machine time (hhmmss) from the common control area.
  • Context - the log date and time have been set:
    For Set Action Code to Input Message:
    When the system assigns the action code, then the action code is set to the value of log-use-input-message constant.
  • Context - the action code has been set:
    For Set US CCN as Target:
    When the system identifies the target cargo, then the train-or-us-ccn field in the log entry is set to the us cargo ccn key from the retrieved gcsusrt record.
  • Context - the us ccn has been set as the target identifier:
    For Set Cargo Type to US Cargo:
    When the system designates the cargo type, then the cargo type indicator is set to us-cargo (as opposed to canadian cargo or train).
  • Context - the cargo type has been designated as us cargo:
    For Build Message: 'CDN CCN RLSED BY EDI 350' + Canadian CCN:
    When the system builds the log message text, then the message field is populated by concatenating the literal text 'cdn ccn rlsed by edi 350: ' with the canadian cargo ccn key from the saved cargo report segment.
  • Context - the complete log entry has been built with date, time, action code, us ccn, cargo type, and message text:
    For Spawn GCT1051E Transaction to Log Message:
    When the system submits the log entry, then the gct1051e transaction is spawned by calling the z300-spawn-gct1051e routine which validates the message is not blank, replaces spaces with appropriate values in date and time fields, moves the input to the message structure, changes the alternate pcb, calls writmsgl to write the message, and purges the alternate pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record has been processed with release or deconsolidation status
GIVEN
A Canadian cargo record has been processed with release or deconsolidation status
Applied to: Initialize US Manifest Search Flags
WHEN
The system begins searching for associated US manifest records
THEN
The US manifest found flag is set to NOT FOUND and the end-of-database flag is set to NOT END OF DB to enable iterative search
Context: The current equipment car ID key and saved waybill index are available from the Canadian cargo record
GIVEN
The current equipment car ID key and saved waybill index are available from the Canadian cargo record
Applied to: Retrieve US Cargo by Car ID and Waybill
WHEN
The system initiates US cargo search
THEN
The system retrieves the first US cargo record from GCSUSRT table where car ID number index matches the current equipment car ID key and waybill number index matches the saved waybill index using GU (Get Unique) function with '>=' operator on the car-waybill index
Context: A database retrieval operation has been performed for US cargo
GIVEN
A database retrieval operation has been performed for US cargo
Applied to: Cargo Status Check
WHEN
The database status code is not SPACES (indicating record not found or error)
THEN
The end-of-database flag is set to TRUE and processing exits the US manifest search without creating any log entries
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Car ID and Waybill Match?
WHEN
The system validates the retrieved record
THEN
If the US cargo car ID number index (first 12 characters) equals the current equipment car ID key AND the US cargo waybill number index equals the saved waybill index, continue processing; otherwise set end-of-database flag to TRUE and exit
Context: A US cargo record has been retrieved and validated for car ID and waybill match
GIVEN
A US cargo record has been retrieved and validated for car ID and waybill match
Applied to: Cargo Deleted or TR Created?
WHEN
The system checks the cargo record status
THEN
If the cargo delete status indicator shows DELETED OR the train-created-for-it field equals 'Y', skip this record and retrieve the next US cargo record; otherwise mark the US manifest as found
Context: The current US cargo record is deleted or has train created
GIVEN
The current US cargo record is deleted or has train created
Applied to: Get Next US Cargo Record
WHEN
The system needs to find the next valid US cargo record
THEN
The system retrieves the next US cargo record from GCSUSRT table using GN (Get Next) function with '>' operator on the car-waybill index and re-validates car ID and waybill match
Context: A US cargo record has been retrieved that matches car ID and waybill AND is not deleted AND does not have train created
GIVEN
A US cargo record has been retrieved that matches car ID and waybill AND is not deleted AND does not have train created
Applied to: Set US Manifest Found Flag
WHEN
The system validates all conditions are met
THEN
The US manifest found flag is set to TRUE to proceed with logging
Context: A valid US manifest has been found
GIVEN
A valid US manifest has been found
Applied to: Prepare Log Information
WHEN
The system prepares to create a log entry
THEN
The log input structure is cleared to SPACES, the security byte is set to HIGH-VALUE, the sending transaction is set to 'GCT1261E', and the ACF2 user ID is set from the common control area
Context: The log header information has been prepared
GIVEN
The log header information has been prepared
Applied to: Build Log Date from Machine Date
WHEN
The system builds the log date field
THEN
The log date is constructed by concatenating the machine century (CC) and machine date (YYMMDD) from the common control area into the GCX105 date field
Context: The log date has been built
GIVEN
The log date has been built
Applied to: Set Log Time from Machine Time
WHEN
The system sets the log time field
THEN
The log time is set to the machine time (HHMMSS) from the common control area
Context: The log date and time have been set
GIVEN
The log date and time have been set
Applied to: Set Action Code to Input Message
WHEN
The system assigns the action code
THEN
The action code is set to the value of LOG-USE-INPUT-MESSAGE constant
Context: The action code has been set
GIVEN
The action code has been set
Applied to: Set US CCN as Target
WHEN
The system identifies the target cargo
THEN
The train-or-US-CCN field in the log entry is set to the US cargo CCN key from the retrieved GCSUSRT record
Context: The US CCN has been set as the target identifier
GIVEN
The US CCN has been set as the target identifier
Applied to: Set Cargo Type to US Cargo
WHEN
The system designates the cargo type
THEN
The cargo type indicator is set to US-CARGO (as opposed to Canadian cargo or train)
Context: The cargo type has been designated as US cargo
GIVEN
The cargo type has been designated as US cargo
Applied to: Build Message: 'CDN CCN RLSED BY EDI 350' + Canadian CCN
WHEN
The system builds the log message text
THEN
The message field is populated by concatenating the literal text 'CDN CCN RLSED BY EDI 350: ' with the Canadian cargo CCN key from the saved cargo report segment
Context: The complete log entry has been built with date, time, action code, US CCN, cargo type, and message text
GIVEN
The complete log entry has been built with date, time, action code, US CCN, cargo type, and message text
Applied to: Spawn GCT1051E Transaction to Log Message
WHEN
The system submits the log entry
THEN
The GCT1051E transaction is spawned by calling the Z300-SPAWN-GCT1051E routine which validates the message is not blank, replaces spaces with appropriate values in date and time fields, moves the input to the message structure, changes the alternate PCB, calls WRITMSGL to write the message, and purges the alternate PCB
R-GCX126-cbl-00917 (+7) File: GCX126R.cbl Call EMCSEND2 to Send Email Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call EMCSEND2 to Send Email':
  • Context - email parameters are prepared with from usercode, destination filename, to usercode, copy usercode, subject, keywords, and message report content:
    For Call EMCSEND2 to Send Email:
    When emcsend2 program is called with these parameters, then the email is sent through the emcsend2 interface and return status flag is populated.
  • Context - emcsend2 return status indicates no errors (emi-no-errors):
    For Purge IMS Message Queue:
    When email send operation completes successfully, then ims message queue is purged using purg function against alternate pcb.
  • Context - emcsend2 return status is emi-from-not-found:
    For From User Not Found?:
    When email send operation fails due to invalid sender usercode, then system abends with error message 'emi - invalid merlin from'.
  • Context - emcsend2 return status is emi-to-or-copy-not-found:
    For To/Copy User Not Found?:
    When email send operation fails due to invalid recipient usercode, then save the bad merlin id, reset to usercode to spaces, set to usercodes(01) to 'om01247', and set destination filename to 'in'.
  • Context - email parameters have been reset with to usercode as 'om01247' and destination as 'in':
    For Resend Failed Email:
    When resend operation is performed, then emcsend2 is called again with updated parameters and return status is evaluated.
  • Context - resend operation completed with emi-no-errors status:
    For Resend Successful?:
    When email was successfully rerouted to default recipient, then clear subject, build new subject with bad merlin id and message 'invalid merlin to - report reroute', and resend notification.
  • Context - emcsend2 return status is emi-filename-invalid:
    For Filename Invalid?:
    When email send operation fails due to invalid destination filename, then system abends with error message 'emi - invalid merlin filename'.
  • Context - email send operation has completed (successfully or with handled errors):
    For Increment Machine Sequence Number:
    When processing reaches the end of email send routine, then add 1 to ws-fmt-machine-seq counter.
👨‍💻 Technical ACs (Gherkin)
Context: Email parameters are prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and message report content
GIVEN
Email parameters are prepared with FROM usercode, destination filename, TO usercode, COPY usercode, subject, keywords, and message report content
Applied to: Call EMCSEND2 to Send Email
WHEN
EMCSEND2 program is called with these parameters
THEN
The email is sent through the EMCSEND2 interface and return status flag is populated
Context: EMCSEND2 return status indicates no errors (EMI-NO-ERRORS)
GIVEN
EMCSEND2 return status indicates no errors (EMI-NO-ERRORS)
Applied to: Purge IMS Message Queue
WHEN
Email send operation completes successfully
THEN
IMS message queue is purged using PURG function against alternate PCB
Context: EMCSEND2 return status is EMI-FROM-NOT-FOUND
GIVEN
EMCSEND2 return status is EMI-FROM-NOT-FOUND
Applied to: From User Not Found?
WHEN
Email send operation fails due to invalid sender usercode
THEN
System abends with error message 'EMI - INVALID MERLIN FROM'
Context: EMCSEND2 return status is EMI-TO-OR-COPY-NOT-FOUND
GIVEN
EMCSEND2 return status is EMI-TO-OR-COPY-NOT-FOUND
Applied to: To/Copy User Not Found?
WHEN
Email send operation fails due to invalid recipient usercode
THEN
Save the bad Merlin ID, reset TO usercode to spaces, set TO usercodes(01) to 'OM01247', and set destination filename to 'IN'
Context: Email parameters have been reset with TO usercode as 'OM01247' and destination as 'IN'
GIVEN
Email parameters have been reset with TO usercode as 'OM01247' and destination as 'IN'
Applied to: Resend Failed Email
WHEN
Resend operation is performed
THEN
EMCSEND2 is called again with updated parameters and return status is evaluated
Context: Resend operation completed with EMI-NO-ERRORS status
GIVEN
Resend operation completed with EMI-NO-ERRORS status
Applied to: Resend Successful?
WHEN
Email was successfully rerouted to default recipient
THEN
Clear subject, build new subject with bad Merlin ID and message 'INVALID MERLIN TO - REPORT REROUTE', and resend notification
Context: EMCSEND2 return status is EMI-FILENAME-INVALID
GIVEN
EMCSEND2 return status is EMI-FILENAME-INVALID
Applied to: Filename Invalid?
WHEN
Email send operation fails due to invalid destination filename
THEN
System abends with error message 'EMI - INVALID MERLIN FILENAME'
Context: Email send operation has completed (successfully or with handled errors)
GIVEN
Email send operation has completed (successfully or with handled errors)
Applied to: Increment Machine Sequence Number
WHEN
Processing reaches the end of email send routine
THEN
Add 1 to WS-FMT-MACHINE-SEQ counter
R-GCX126-cbl-00925 (+5) File: GCX126R.cbl 40:Resend Failed Email to OM01247 Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for '40:Resend Failed Email to OM01247':
  • Context - an email notification has failed to send because the intended recipient usercode was not found in the system:
    For Resend Failed Email to OM01247:
    When the system attempts to resend the notification, then the system clears the to usercode field, sets the to usercode to 'om01247', sets the destination filename to 'in', calls the email sending service (emcsend2) with the original subject, keywords, and message content, and increments the machine sequence number by 1.
  • Context - the email resend operation to om01247 has been attempted:
    For Send Successful?:
    When the email send service returns a status indicating no errors occurred, then the system purges the ims alternate message queue.
    For Abend - Invalid FROM Usercode:
    When the email send service returns a status indicating the from usercode was not found, then the system sets the error message to 'emi - invalid merlin from' and terminates processing abnormally.
    For Abend - Invalid TO/COPY Usercode:
    When the email send service returns a status indicating the to or copy usercode was not found, then the system sets the error message to 'emi - invalid merlin to or copy' and terminates processing abnormally.
    For Abend - Invalid Filename:
    When the email send service returns a status indicating the filename is invalid, then the system sets the error message to 'emi - invalid merlin filename' and terminates processing abnormally.
  • Context - the email notification has been successfully resent to om01247 and the message queue has been purged:
    For Increment Machine Sequence Number:
    When the resend operation completes, then the system adds 1 to the formatted machine sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: An email notification has failed to send because the intended recipient usercode was not found in the system
GIVEN
An email notification has failed to send because the intended recipient usercode was not found in the system
Applied to: Resend Failed Email to OM01247
WHEN
The system attempts to resend the notification
THEN
The system clears the TO usercode field, sets the TO usercode to 'OM01247', sets the destination filename to 'IN', calls the email sending service (EMCSEND2) with the original subject, keywords, and message content, and increments the machine sequence number by 1
Context: The email resend operation to OM01247 has been attempted
GIVEN
The email resend operation to OM01247 has been attempted
Applied to: Send Successful?
WHEN
The email send service returns a status indicating no errors occurred
THEN
The system purges the IMS alternate message queue
Applied to: Abend - Invalid FROM Usercode
WHEN
The email send service returns a status indicating the FROM usercode was not found
THEN
The system sets the error message to 'EMI - INVALID MERLIN FROM' and terminates processing abnormally
Applied to: Abend - Invalid TO/COPY Usercode
WHEN
The email send service returns a status indicating the TO or COPY usercode was not found
THEN
The system sets the error message to 'EMI - INVALID MERLIN TO OR COPY' and terminates processing abnormally
Applied to: Abend - Invalid Filename
WHEN
The email send service returns a status indicating the filename is invalid
THEN
The system sets the error message to 'EMI - INVALID MERLIN FILENAME' and terminates processing abnormally
Context: The email notification has been successfully resent to OM01247 and the message queue has been purged
GIVEN
The email notification has been successfully resent to OM01247 and the message queue has been purged
Applied to: Increment Machine Sequence Number
WHEN
The resend operation completes
THEN
The system adds 1 to the formatted machine sequence number
R-GCX126-cbl-00931 (+6) File: GCX126R.cbl Call Get Next US Cargo by Car and Waybill Index Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Get Next US Cargo by Car and Waybill Index':
  • Context - a request to retrieve the next us cargo record by car and waybill index:
    For Set Database Status Code to 'GEGB', Set Segment Type to GCSUSRT, Set Function to Get Next - GN, Set Index Type to Car-Waybill, Set Operator to Greater Than:
    When the system prepares the database call parameters, then the database status code is set to 'gegb', the segment type is set to gcsusrt, the function is set to get next (gn), the index type is set to car-waybill, and the operator is set to greater than ('>') for sequential retrieval.
  • Context - database call parameters are configured with status code 'gegb', segment type gcsusrt, function get next, index type car-waybill, and operator greater than:
    For Call GCCUSIO to Retrieve Next US Cargo Record:
    When the gccusio program is called with the configured parameters and us cargo segment, then the system retrieves the next us cargo record from the database and returns the database status code.
  • Context - a database call has been executed to retrieve the next us cargo record:
    For Database Status OK? - No - Error Status:
    When the database status code is not equal to spaces (indicating an error or end-of-data condition), then the end-of-database flag is set to true and processing terminates for this retrieval attempt.
  • Context - a us cargo record has been successfully retrieved from the database with a valid status:
    For Car ID and Waybill Match Current Values? - Yes - Match Found:
    When the system compares the retrieved cargo's car id (first 12 characters) with the current equipment car id key and the waybill number index with the saved waybill index, then if both the car id and waybill number match the current values, the system proceeds to validate the cargo deletion and train creation status; otherwise, the end-of-database flag is set to true.
    For Car ID and Waybill Match Current Values? - No - Different Car/Waybill:
    When either the retrieved cargo's car id (first 12 characters) does not match the current equipment car id key or the waybill number index does not match the saved waybill index, then the end-of-database flag is set to true, terminating the search for matching us cargo records.
  • Context - a us cargo record has been retrieved that matches the current car id and waybill number:
    For Cargo Deleted or TR Created? - Yes - Skip Record:
    When the cargo record has a deletion status indicator set or the train-created-for-it flag is set to 'y', then the system continues to the next record without setting the us manifest found flag.
    For Cargo Deleted or TR Created? - No - Valid Cargo:
    When the cargo record does not have a deletion status indicator set and the train-created-for-it flag is not set to 'y', then the us manifest found flag is set to true, indicating a valid us cargo record has been located.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve the next US cargo record by car and waybill index
GIVEN
A request to retrieve the next US cargo record by car and waybill index
Applied to: Set Database Status Code to 'GEGB', Set Segment Type to GCSUSRT, Set Function to Get Next - GN, Set Index Type to Car-Waybill, Set Operator to Greater Than
WHEN
The system prepares the database call parameters
THEN
The database status code is set to 'GEGB', the segment type is set to GCSUSRT, the function is set to Get Next (GN), the index type is set to Car-Waybill, and the operator is set to greater than ('>') for sequential retrieval
Context: Database call parameters are configured with status code 'GEGB', segment type GCSUSRT, function Get Next, index type Car-Waybill, and operator greater than
GIVEN
Database call parameters are configured with status code 'GEGB', segment type GCSUSRT, function Get Next, index type Car-Waybill, and operator greater than
Applied to: Call GCCUSIO to Retrieve Next US Cargo Record
WHEN
The GCCUSIO program is called with the configured parameters and US cargo segment
THEN
The system retrieves the next US cargo record from the database and returns the database status code
Context: A database call has been executed to retrieve the next US cargo record
GIVEN
A database call has been executed to retrieve the next US cargo record
Applied to: Database Status OK? - No - Error Status
WHEN
The database status code is not equal to spaces (indicating an error or end-of-data condition)
THEN
The end-of-database flag is set to true and processing terminates for this retrieval attempt
Context: A US cargo record has been successfully retrieved from the database with a valid status
GIVEN
A US cargo record has been successfully retrieved from the database with a valid status
Applied to: Car ID and Waybill Match Current Values? - Yes - Match Found
WHEN
The system compares the retrieved cargo's car ID (first 12 characters) with the current equipment car ID key and the waybill number index with the saved waybill index
THEN
If both the car ID and waybill number match the current values, the system proceeds to validate the cargo deletion and train creation status; otherwise, the end-of-database flag is set to true
Applied to: Car ID and Waybill Match Current Values? - No - Different Car/Waybill
WHEN
Either the retrieved cargo's car ID (first 12 characters) does not match the current equipment car ID key or the waybill number index does not match the saved waybill index
THEN
The end-of-database flag is set to true, terminating the search for matching US cargo records
Context: A US cargo record has been retrieved that matches the current car ID and waybill number
GIVEN
A US cargo record has been retrieved that matches the current car ID and waybill number
Applied to: Cargo Deleted or TR Created? - Yes - Skip Record
WHEN
The cargo record has a deletion status indicator set or the train-created-for-it flag is set to 'Y'
THEN
The system continues to the next record without setting the US manifest found flag
Applied to: Cargo Deleted or TR Created? - No - Valid Cargo
WHEN
The cargo record does not have a deletion status indicator set and the train-created-for-it flag is not set to 'Y'
THEN
The US manifest found flag is set to true, indicating a valid US cargo record has been located
R-GCX126-cbl-00938 (+8) File: GCX126R.cbl Set Search Parameters Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Search Parameters':
  • Context - a current cargo record with equipment car id and waybill index:
    For Set Search Parameters:
    When preparing to search for associated us cargo records, then set search parameters with car id from current cargo key, waybill index from saved waybill, us ccn key to low-values, database accept status to 'gegb', segment type to gcsusrt, function to get unique (gu), index type to car-wb (car-waybill), and operator to greater than or equal ('>=').
  • Context - current cargo equipment car id key is available in ws-current-carid-key:
    For Set Car ID from Current Cargo:
    When initializing search parameters for us cargo lookup, then move ws-current-carid-key to gcusrt-rt073-car-id-num-index to use as the car id search criterion.
  • Context - saved waybill index is available in save-waybill-index:
    For Set Waybill Index from Current Cargo:
    When initializing search parameters for us cargo lookup, then move save-waybill-index to gcusrt-rt073-wb-num-index to use as the waybill search criterion.
  • Context - us cargo search is being initialized:
    For Set US CCN to LOW-VALUES:
    When setting up the us ccn key parameter, then move low-values to gcusrt-rt073-us-ccn-key-index to start search from the beginning of matching records.
  • Context - database operation is being prepared for us cargo search:
    For Set Accept Status to 'GEGB':
    When setting database control parameters, then move 'gegb' to cc-accept-status to indicate get with status code ge and gb.
  • Context - database search parameters are being configured:
    For Set Segment Type to GCSUSRT:
    When specifying which segment type to retrieve, then set gcwusio-seg-gcsusrt to true to indicate us cargo report segment (gcsusrt) should be accessed.
  • Context - database operation type needs to be specified:
    For Set Function to GU - Get Unique:
    When configuring the database function for us cargo search, then set gcwusio-func-gu to true to indicate get unique (gu) operation should be performed.
  • Context - database index selection is required for search optimization:
    For Set Index Type to CAR-WB:
    When specifying which index to use for us cargo lookup, then set gcwusio-index-car-wb to true to indicate car-waybill index should be used for the search.
  • Context - search comparison logic needs to be defined:
    For Set Operator to '>=':
    When setting the operator for database record matching, then move '>=' to gcwusio-operator to retrieve records with keys greater than or equal to the search criteria.
👨‍💻 Technical ACs (Gherkin)
Context: A current cargo record with equipment car ID and waybill index
GIVEN
A current cargo record with equipment car ID and waybill index
Applied to: Set Search Parameters
WHEN
Preparing to search for associated US cargo records
THEN
Set search parameters with car ID from current cargo key, waybill index from saved waybill, US CCN key to LOW-VALUES, database accept status to 'GEGB', segment type to GCSUSRT, function to Get Unique (GU), index type to CAR-WB (Car-Waybill), and operator to greater than or equal ('>=')
Context: Current cargo equipment car ID key is available in WS-CURRENT-CARID-KEY
GIVEN
Current cargo equipment car ID key is available in WS-CURRENT-CARID-KEY
Applied to: Set Car ID from Current Cargo
WHEN
Initializing search parameters for US cargo lookup
THEN
Move WS-CURRENT-CARID-KEY to GCUSRT-RT073-CAR-ID-NUM-INDEX to use as the car ID search criterion
Context: Saved waybill index is available in SAVE-WAYBILL-INDEX
GIVEN
Saved waybill index is available in SAVE-WAYBILL-INDEX
Applied to: Set Waybill Index from Current Cargo
WHEN
Initializing search parameters for US cargo lookup
THEN
Move SAVE-WAYBILL-INDEX to GCUSRT-RT073-WB-NUM-INDEX to use as the waybill search criterion
Context: US cargo search is being initialized
GIVEN
US cargo search is being initialized
Applied to: Set US CCN to LOW-VALUES
WHEN
Setting up the US CCN key parameter
THEN
Move LOW-VALUES to GCUSRT-RT073-US-CCN-KEY-INDEX to start search from the beginning of matching records
Context: Database operation is being prepared for US cargo search
GIVEN
Database operation is being prepared for US cargo search
Applied to: Set Accept Status to 'GEGB'
WHEN
Setting database control parameters
THEN
Move 'GEGB' to CC-ACCEPT-STATUS to indicate Get with status code GE and GB
Context: Database search parameters are being configured
GIVEN
Database search parameters are being configured
Applied to: Set Segment Type to GCSUSRT
WHEN
Specifying which segment type to retrieve
THEN
Set GCWUSIO-SEG-GCSUSRT to TRUE to indicate US cargo report segment (GCSUSRT) should be accessed
Context: Database operation type needs to be specified
GIVEN
Database operation type needs to be specified
Applied to: Set Function to GU - Get Unique
WHEN
Configuring the database function for US cargo search
THEN
Set GCWUSIO-FUNC-GU to TRUE to indicate Get Unique (GU) operation should be performed
Context: Database index selection is required for search optimization
GIVEN
Database index selection is required for search optimization
Applied to: Set Index Type to CAR-WB
WHEN
Specifying which index to use for US cargo lookup
THEN
Set GCWUSIO-INDEX-CAR-WB to TRUE to indicate Car-Waybill index should be used for the search
Context: Search comparison logic needs to be defined
GIVEN
Search comparison logic needs to be defined
Applied to: Set Operator to '>='
WHEN
Setting the operator for database record matching
THEN
Move '>=' to GCWUSIO-OPERATOR to retrieve records with keys greater than or equal to the search criteria
R-GCX126-cbl-00947 (+7) File: GCX126R.cbl Prepare Log Entry: Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Log Entry:':
  • Context - ['a canadian cargo has been released via edi 350 message', 'a corresponding us cargo manifest exists with matching equipment car id and waybill number', 'the us cargo is not deleted and no train has been created for it', 'the system has current machine date and time available']:
    For Prepare Log Entry: - Current Date/Time - US CCN - Action Code: LOG-USE-INPUT-MESSAGE - Message: CDN CCN RLSED BY EDI 350:
    When ['the system processes the us manifest associated with the released canadian cargo'], then ['extract current machine century and date in ccyymmdd format', 'extract current machine time in hhmmss format', 'set the action code to log-use-input-message', 'set the target identifier to the us cargo control number', 'set the cargo type indicator to us-cargo', "build the log message by concatenating 'cdn ccn rlsed by edi 350: ' with the canadian cargo control number", 'populate the gcx105 log structure with date, time, action code, us ccn, cargo type, and message', 'invoke the gct1051e transaction to create the log entry'].
  • Context - ['the system has access to current machine century (cc-machine-century)', 'the system has access to current machine date (cc-machine-date-x)']:
    For Format Date: CCYYMMDD:
    When ['preparing to log us cargo release information'], then ['concatenate cc-machine-century and cc-machine-date-x', 'store the result in gcx105-date field in ccyymmdd format'].
  • Context - ['the system has access to current machine time (cc-machine-time-x)']:
    For Format Time: HHMMSS:
    When ['preparing to log us cargo release information'], then ['move cc-machine-time-x to gcx105-time field in hhmmss format'].
  • Context - ['a us cargo log entry is being prepared']:
    For Set Action Code to LOG-USE-INPUT-MESSAGE:
    When ['setting the action code for the log entry'], then ['set gcx105-action-code to log-use-input-message'].
  • Context - ['a us cargo manifest has been retrieved (gcusrt-us-ccn-key)', 'the us cargo control number is available']:
    For Set US CCN as Target:
    When ['preparing the log entry for us cargo release'], then ['move gcusrt-us-ccn-key to gcx105-train-or-us-ccn field'].
  • Context - ['a log entry is being created for us cargo']:
    For Set Cargo Type Flag to US-CARGO:
    When ['setting the cargo type indicator'], then ['set gcx105-us-cargo flag to true'].
  • Context - ['the canadian cargo control number (gccc-ccn-key) is available', 'a us cargo release is being logged']:
    For Build Message Text and Concatenate: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN:
    When ['building the log message text'], then ["concatenate the literal text 'cdn ccn rlsed by edi 350: ' with gccc-ccn-key", 'store the concatenated message in gcx105-message field'].
  • Context - ['gcx105 log structure is fully populated with date, time, action code, us ccn, cargo type, and message', 'all required log information has been prepared']:
    For Call GCT1051E Transaction to Log Entry:
    When ['ready to create the log entry'], then ['call z300-spawn-gct1051e procedure to create the log entry'].
👨‍💻 Technical ACs (Gherkin)
Context: ['A Canadian cargo has been released via EDI 350 message', 'A corresponding US cargo manifest exists with matching equipment car ID and waybill number', 'The US cargo is not deleted and no train has been created for it', 'The system has current machine date and time available']
GIVEN
['A Canadian cargo has been released via EDI 350 message', 'A corresponding US cargo manifest exists with matching equipment car ID and waybill number', 'The US cargo is not deleted and no train has been created for it', 'The system has current machine date and time available']
Applied to: Prepare Log Entry: - Current Date/Time - US CCN - Action Code: LOG-USE-INPUT-MESSAGE - Message: CDN CCN RLSED BY EDI 350
WHEN
['The system processes the US manifest associated with the released Canadian cargo']
THEN
['Extract current machine century and date in CCYYMMDD format', 'Extract current machine time in HHMMSS format', 'Set the action code to LOG-USE-INPUT-MESSAGE', 'Set the target identifier to the US cargo control number', 'Set the cargo type indicator to US-CARGO', "Build the log message by concatenating 'CDN CCN RLSED BY EDI 350: ' with the Canadian cargo control number", 'Populate the GCX105 log structure with date, time, action code, US CCN, cargo type, and message', 'Invoke the GCT1051E transaction to create the log entry']
Context: ['The system has access to current machine century (CC-MACHINE-CENTURY)', 'The system has access to current machine date (CC-MACHINE-DATE-X)']
GIVEN
['The system has access to current machine century (CC-MACHINE-CENTURY)', 'The system has access to current machine date (CC-MACHINE-DATE-X)']
Applied to: Format Date: CCYYMMDD
WHEN
['Preparing to log US cargo release information']
THEN
['Concatenate CC-MACHINE-CENTURY and CC-MACHINE-DATE-X', 'Store the result in GCX105-DATE field in CCYYMMDD format']
Context: ['The system has access to current machine time (CC-MACHINE-TIME-X)']
GIVEN
['The system has access to current machine time (CC-MACHINE-TIME-X)']
Applied to: Format Time: HHMMSS
WHEN
['Preparing to log US cargo release information']
THEN
['Move CC-MACHINE-TIME-X to GCX105-TIME field in HHMMSS format']
Context: ['A US cargo log entry is being prepared']
GIVEN
['A US cargo log entry is being prepared']
Applied to: Set Action Code to LOG-USE-INPUT-MESSAGE
WHEN
['Setting the action code for the log entry']
THEN
['Set GCX105-ACTION-CODE to LOG-USE-INPUT-MESSAGE']
Context: ['A US cargo manifest has been retrieved (GCUSRT-US-CCN-KEY)', 'The US cargo control number is available']
GIVEN
['A US cargo manifest has been retrieved (GCUSRT-US-CCN-KEY)', 'The US cargo control number is available']
Applied to: Set US CCN as Target
WHEN
['Preparing the log entry for US cargo release']
THEN
['Move GCUSRT-US-CCN-KEY to GCX105-TRAIN-OR-US-CCN field']
Context: ['A log entry is being created for US cargo']
GIVEN
['A log entry is being created for US cargo']
Applied to: Set Cargo Type Flag to US-CARGO
WHEN
['Setting the cargo type indicator']
THEN
['Set GCX105-US-CARGO flag to TRUE']
Context: ['The Canadian cargo control number (GCCC-CCN-KEY) is available', 'A US cargo release is being logged']
GIVEN
['The Canadian cargo control number (GCCC-CCN-KEY) is available', 'A US cargo release is being logged']
Applied to: Build Message Text and Concatenate: 'CDN CCN RLSED BY EDI 350: ' + Canadian CCN
WHEN
['Building the log message text']
THEN
["Concatenate the literal text 'CDN CCN RLSED BY EDI 350: ' with GCCC-CCN-KEY", 'Store the concatenated message in GCX105-MESSAGE field']
Context: ['GCX105 log structure is fully populated with date, time, action code, US CCN, cargo type, and message', 'All required log information has been prepared']
GIVEN
['GCX105 log structure is fully populated with date, time, action code, US CCN, cargo type, and message', 'All required log information has been prepared']
Applied to: Call GCT1051E Transaction to Log Entry
WHEN
['Ready to create the log entry']
THEN
['Call Z300-SPAWN-GCT1051E procedure to create the log entry']
R-GCX126-cbl-00955 (+7) File: GCX126R.cbl Prepare Log Message Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Log Message':
  • Context - a log message needs to be prepared for the gct1051e transaction:
    For Initialize GCX105 Input Structure:
    When the log message preparation process begins, then the gcx105 input structure is cleared to spaces to ensure no residual data remains.
  • Context - the log message structure has been initialized:
    For Set Security Byte to HIGH-VALUE:
    When security attributes need to be set for the log entry, then the security byte in gcx105 structure is set to high-value to indicate system-level security.
  • Context - the log message is being prepared by the gct1261e program:
    For Set Sending Transaction = 'GCT1261E':
    When the sending transaction identifier needs to be recorded, then the sending transaction field in gcx105 structure is set to 'gct1261e'.
  • Context - the current user id is available in the cccom control block:
    For Set ACF2 User ID from CCCOM:
    When user identification needs to be captured for the log entry, then the acf2 user id from cccom is copied to the gcx105 acf2-id field.
  • Context - the date field in gcx105 structure may contain spaces:
    For Replace Spaces with Zeroes in Date:
    When the date field is being prepared for logging, then all space characters in the gcx105 date field are replaced with zeroes to ensure numeric consistency.
  • Context - the time field in gcx105 structure may contain spaces:
    For Replace Spaces with '1' in Time:
    When the time field is being prepared for logging, then all space characters in the gcx105 time field are replaced with '1' to ensure data consistency.
  • Context - the gcx105 input structure has been fully populated with log information:
    For Format Message for GCT1051E:
    When the message needs to be formatted for the gct1051e transaction, then the gcx105 input data is moved to the gct1051e message structure for subsequent logging operations.
  • Context - a log message is being prepared for the gct1051e transaction:
    For Format Message for GCT1051E:
    When the message content in gcx105-message is spaces or low-values, then the log message preparation process is terminated without further processing.
👨‍💻 Technical ACs (Gherkin)
Context: A log message needs to be prepared for the GCT1051E transaction
GIVEN
A log message needs to be prepared for the GCT1051E transaction
Applied to: Initialize GCX105 Input Structure
WHEN
The log message preparation process begins
THEN
The GCX105 input structure is cleared to spaces to ensure no residual data remains
Context: The log message structure has been initialized
GIVEN
The log message structure has been initialized
Applied to: Set Security Byte to HIGH-VALUE
WHEN
Security attributes need to be set for the log entry
THEN
The security byte in GCX105 structure is set to HIGH-VALUE to indicate system-level security
Context: The log message is being prepared by the GCT1261E program
GIVEN
The log message is being prepared by the GCT1261E program
Applied to: Set Sending Transaction = 'GCT1261E'
WHEN
The sending transaction identifier needs to be recorded
THEN
The sending transaction field in GCX105 structure is set to 'GCT1261E'
Context: The current user ID is available in the CCCOM control block
GIVEN
The current user ID is available in the CCCOM control block
Applied to: Set ACF2 User ID from CCCOM
WHEN
User identification needs to be captured for the log entry
THEN
The ACF2 user ID from CCCOM is copied to the GCX105 ACF2-ID field
Context: The date field in GCX105 structure may contain spaces
GIVEN
The date field in GCX105 structure may contain spaces
Applied to: Replace Spaces with Zeroes in Date
WHEN
The date field is being prepared for logging
THEN
All space characters in the GCX105 date field are replaced with zeroes to ensure numeric consistency
Context: The time field in GCX105 structure may contain spaces
GIVEN
The time field in GCX105 structure may contain spaces
Applied to: Replace Spaces with '1' in Time
WHEN
The time field is being prepared for logging
THEN
All space characters in the GCX105 time field are replaced with '1' to ensure data consistency
Context: The GCX105 input structure has been fully populated with log information
GIVEN
The GCX105 input structure has been fully populated with log information
Applied to: Format Message for GCT1051E
WHEN
The message needs to be formatted for the GCT1051E transaction
THEN
The GCX105 input data is moved to the GCT1051E message structure for subsequent logging operations
Context: A log message is being prepared for the GCT1051E transaction
GIVEN
A log message is being prepared for the GCT1051E transaction
Applied to: Format Message for GCT1051E
WHEN
The message content in GCX105-MESSAGE is spaces or low-values
THEN
The log message preparation process is terminated without further processing
R-GCX126-cbl-00963 File: GCX126R.cbl Set Accept Status to 'GEGB'
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Accept Status to 'GEGB'':
  • Context - the system needs to perform a database get next operation on cargo records:
    For Set Accept Status to 'GEGB':
    When the accept status is being configured for the database call, then the accept status field is set to 'gegb' to indicate get next with good status and browse mode.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to perform a database Get Next operation on cargo records
GIVEN
The system needs to perform a database Get Next operation on cargo records
Applied to: Set Accept Status to 'GEGB'
WHEN
The accept status is being configured for the database call
THEN
The accept status field is set to 'GEGB' to indicate Get Next with Good status and Browse mode
R-GCX126-cbl-00964 (+4) File: GCX126R.cbl Prepare Log Information Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Log Information':
  • Context - a cargo event or status change needs to be logged to the audit trail:
    For Clear GCX105 Input Area:
    When the log information preparation process is initiated, then the system shall clear the gcx105 input area to remove any previous data, set the security byte to high-value to indicate secure logging, set the sending transaction identifier to 'gct1261e' to identify the source program, and populate the acf2 user id from the current session context (cccom) to track who initiated the action.
  • Context - a new log entry needs to be created for a cargo event:
    For Clear GCX105 Input Area:
    When the log preparation process begins, then the system shall initialize the gcx105-input area to spaces, removing all previous content.
  • Context - a log entry structure is being prepared:
    For Set Security Byte to HIGH-VALUE:
    When security parameters are being set, then the system shall set the gcx105-security-byte to high-value to indicate this is a secure, system-generated log entry.
  • Context - a log entry is being created from the edi 350 processing program:
    For Set Sending Transaction to 'GCT1261E':
    When the source transaction identifier needs to be recorded, then the system shall set the gcx105-sending-transaction field to 'gct1261e' to identify this program as the source of the log entry.
  • Context - a log entry is being prepared and the current user session is active:
    For Set ACF2 User ID from CCCOM:
    When user identification needs to be recorded, then the system shall populate the gcx105-acf2-id field with the cc-acf2-userid value from the cccom control block to record who initiated the logged action.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo event or status change needs to be logged to the audit trail
GIVEN
A cargo event or status change needs to be logged to the audit trail
Applied to: Clear GCX105 Input Area
WHEN
The log information preparation process is initiated
THEN
The system shall clear the GCX105 input area to remove any previous data, set the security byte to HIGH-VALUE to indicate secure logging, set the sending transaction identifier to 'GCT1261E' to identify the source program, and populate the ACF2 user ID from the current session context (CCCOM) to track who initiated the action
Context: A new log entry needs to be created for a cargo event
GIVEN
A new log entry needs to be created for a cargo event
Applied to: Clear GCX105 Input Area
WHEN
The log preparation process begins
THEN
The system shall initialize the GCX105-INPUT area to spaces, removing all previous content
Context: A log entry structure is being prepared
GIVEN
A log entry structure is being prepared
Applied to: Set Security Byte to HIGH-VALUE
WHEN
Security parameters are being set
THEN
The system shall set the GCX105-SECURITY-BYTE to HIGH-VALUE to indicate this is a secure, system-generated log entry
Context: A log entry is being created from the EDI 350 processing program
GIVEN
A log entry is being created from the EDI 350 processing program
Applied to: Set Sending Transaction to 'GCT1261E'
WHEN
The source transaction identifier needs to be recorded
THEN
The system shall set the GCX105-SENDING-TRANSACTION field to 'GCT1261E' to identify this program as the source of the log entry
Context: A log entry is being prepared and the current user session is active
GIVEN
A log entry is being prepared and the current user session is active
Applied to: Set ACF2 User ID from CCCOM
WHEN
User identification needs to be recorded
THEN
The system shall populate the GCX105-ACF2-ID field with the CC-ACF2-USERID value from the CCCOM control block to record who initiated the logged action
R-GCX126-cbl-00969 (+9) File: GCX126R.cbl Call EMCSEND2 with Email Parameters Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call EMCSEND2 with Email Parameters':
  • Context - the system needs to send an email notification via emcsend2:
    For Call CCISCOM to Setup ISCOM:
    When the email sending process is initiated, then the system calls cciscom program with cccom and iscom parameters to setup the communication context.
  • Context - the communication context is established and email parameters are prepared including from user code (emi-from-usercode), destination filename (emi-destination-filename), to user code (emi-to-usercode), copy user code (emi-copy-usercode), subject (emi-subject), keywords (emi-keywords), report content (mrln-350-report), return status flag (emi-return-status-flag), segment numbers (emi-seg-no1, emi-seg-no2), and item type (emi-item-type):
    For Call EMCSEND2 with Parameters: From User Code, Destination Filename, To User Code, Copy User Code, Subject, Keywords, Report Content, Return Status Flag, Segment Numbers, Item Type:
    When the system invokes emcsend2 program, then the email is sent with all specified parameters and the return status flag is populated with the result.
  • Context - the emcsend2 program has completed sending the email:
    For Call ISCCCOM to Restore CCCOM:
    When the email sending operation finishes, then the system calls iscccom program with iscom and cccom parameters to restore the original communication context.
  • Context - the emcsend2 return status flag indicates no errors (emi-no-errors):
    For No Errors: Purge IMS Message Queue:
    When the email sending completes successfully, then the system calls cims program with purg function code and alt-pcb to purge the message from the queue.
  • Context - the emcsend2 return status flag indicates sender not found (emi-from-not-found):
    For From User Not Found: Set Error Message 'EMI - INVALID MERLIN FROM':
    When the email sending fails due to invalid sender user code, then the system sets error message to 'emi - invalid merlin from' in cccom error message field and calls cerr program to abort.
  • Context - the emcsend2 return status flag indicates recipient not found (emi-to-or-copy-not-found) and the message type is unrelease (88-z110-mrln-type-is-unrlse):
    For To/Copy User Not Found: Identify Bad Merlin ID:
    When the email sending fails due to invalid recipient, then the system moves emi-to-usercodes(02) to ws-bad-merlin-id, clears emi-to-usercode, sets emi-to-usercodes(01) to 'om01247', sets emi-destination-filename to 'in', and performs z116-resend-merlin.
  • Context - the emcsend2 return status flag indicates recipient not found (emi-to-or-copy-not-found) and the message type is not unrelease:
    For To/Copy User Not Found: Identify Bad Merlin ID:
    When the email sending fails due to invalid recipient, then the system moves emi-to-usercodes(01) to ws-bad-merlin-id, clears emi-to-usercode, sets emi-to-usercodes(01) to 'om01247', sets emi-destination-filename to 'in', and performs z116-resend-merlin.
  • Context - the resend operation completed successfully (emi-no-errors after z116-resend-merlin):
    For Resend Failed Email to OM01247 with Reroute Notification:
    When the email has been rerouted to default user, then the system clears emi-subject, builds a new subject message containing ws-bad-merlin-id and text 'invalid merlin to - report reroute', and performs z116-resend-merlin again to send the notification.
  • Context - the emcsend2 return status flag indicates invalid filename (emi-filename-invalid):
    For Filename Invalid: Set Error Message 'EMI - INVALID MERLIN FILENAME':
    When the email sending fails due to invalid destination filename, then the system sets error message to 'emi - invalid merlin filename' in cccom error message field and calls cerr program to abort.
  • Context - the email sending process has completed (either successfully purged or successfully rerouted):
    For Increment Machine Sequence Number:
    When the email operation finishes, then the system adds 1 to ws-fmt-machine-seq.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to send an email notification via EMCSEND2
GIVEN
The system needs to send an email notification via EMCSEND2
Applied to: Call CCISCOM to Setup ISCOM
WHEN
The email sending process is initiated
THEN
The system calls CCISCOM program with CCCOM and ISCOM parameters to setup the communication context
Context: The communication context is established and email parameters are prepared including From User Code (EMI-FROM-USERCODE), Destination Filename (EMI-DESTINATION-FILENAME), To User Code (EMI-TO-USERCODE), Copy User Code (EMI-COPY-USERCODE), Subject (EMI-SUBJECT), Keywords (EMI-KEYWORDS), Report Content (MRLN-350-REPORT), Return Status Flag (EMI-RETURN-STATUS-FLAG), Segment Numbers (EMI-SEG-NO1, EMI-SEG-NO2), and Item Type (EMI-ITEM-TYPE)
GIVEN
The communication context is established and email parameters are prepared including From User Code (EMI-FROM-USERCODE), Destination Filename (EMI-DESTINATION-FILENAME), To User Code (EMI-TO-USERCODE), Copy User Code (EMI-COPY-USERCODE), Subject (EMI-SUBJECT), Keywords (EMI-KEYWORDS), Report Content (MRLN-350-REPORT), Return Status Flag (EMI-RETURN-STATUS-FLAG), Segment Numbers (EMI-SEG-NO1, EMI-SEG-NO2), and Item Type (EMI-ITEM-TYPE)
Applied to: Call EMCSEND2 with Parameters: From User Code, Destination Filename, To User Code, Copy User Code, Subject, Keywords, Report Content, Return Status Flag, Segment Numbers, Item Type
WHEN
The system invokes EMCSEND2 program
THEN
The email is sent with all specified parameters and the return status flag is populated with the result
Context: The EMCSEND2 program has completed sending the email
GIVEN
The EMCSEND2 program has completed sending the email
Applied to: Call ISCCCOM to Restore CCCOM
WHEN
The email sending operation finishes
THEN
The system calls ISCCCOM program with ISCOM and CCCOM parameters to restore the original communication context
Context: The EMCSEND2 return status flag indicates no errors (EMI-NO-ERRORS)
GIVEN
The EMCSEND2 return status flag indicates no errors (EMI-NO-ERRORS)
Applied to: No Errors: Purge IMS Message Queue
WHEN
The email sending completes successfully
THEN
The system calls CIMS program with PURG function code and ALT-PCB to purge the message from the queue
Context: The EMCSEND2 return status flag indicates sender not found (EMI-FROM-NOT-FOUND)
GIVEN
The EMCSEND2 return status flag indicates sender not found (EMI-FROM-NOT-FOUND)
Applied to: From User Not Found: Set Error Message 'EMI - INVALID MERLIN FROM'
WHEN
The email sending fails due to invalid sender user code
THEN
The system sets error message to 'EMI - INVALID MERLIN FROM' in CCCOM error message field and calls CERR program to abort
Context: The EMCSEND2 return status flag indicates recipient not found (EMI-TO-OR-COPY-NOT-FOUND) and the message type is unrelease (88-Z110-MRLN-TYPE-IS-UNRLSE)
GIVEN
The EMCSEND2 return status flag indicates recipient not found (EMI-TO-OR-COPY-NOT-FOUND) and the message type is unrelease (88-Z110-MRLN-TYPE-IS-UNRLSE)
Applied to: To/Copy User Not Found: Identify Bad Merlin ID
WHEN
The email sending fails due to invalid recipient
THEN
The system moves EMI-TO-USERCODES(02) to WS-BAD-MERLIN-ID, clears EMI-TO-USERCODE, sets EMI-TO-USERCODES(01) to 'OM01247', sets EMI-DESTINATION-FILENAME to 'IN', and performs Z116-RESEND-MERLIN
Context: The EMCSEND2 return status flag indicates recipient not found (EMI-TO-OR-COPY-NOT-FOUND) and the message type is not unrelease
GIVEN
The EMCSEND2 return status flag indicates recipient not found (EMI-TO-OR-COPY-NOT-FOUND) and the message type is not unrelease
Applied to: To/Copy User Not Found: Identify Bad Merlin ID
WHEN
The email sending fails due to invalid recipient
THEN
The system moves EMI-TO-USERCODES(01) to WS-BAD-MERLIN-ID, clears EMI-TO-USERCODE, sets EMI-TO-USERCODES(01) to 'OM01247', sets EMI-DESTINATION-FILENAME to 'IN', and performs Z116-RESEND-MERLIN
Context: The resend operation completed successfully (EMI-NO-ERRORS after Z116-RESEND-MERLIN)
GIVEN
The resend operation completed successfully (EMI-NO-ERRORS after Z116-RESEND-MERLIN)
Applied to: Resend Failed Email to OM01247 with Reroute Notification
WHEN
The email has been rerouted to default user
THEN
The system clears EMI-SUBJECT, builds a new subject message containing WS-BAD-MERLIN-ID and text 'INVALID MERLIN TO - REPORT REROUTE', and performs Z116-RESEND-MERLIN again to send the notification
Context: The EMCSEND2 return status flag indicates invalid filename (EMI-FILENAME-INVALID)
GIVEN
The EMCSEND2 return status flag indicates invalid filename (EMI-FILENAME-INVALID)
Applied to: Filename Invalid: Set Error Message 'EMI - INVALID MERLIN FILENAME'
WHEN
The email sending fails due to invalid destination filename
THEN
The system sets error message to 'EMI - INVALID MERLIN FILENAME' in CCCOM error message field and calls CERR program to abort
Context: The email sending process has completed (either successfully purged or successfully rerouted)
GIVEN
The email sending process has completed (either successfully purged or successfully rerouted)
Applied to: Increment Machine Sequence Number
WHEN
The email operation finishes
THEN
The system adds 1 to WS-FMT-MACHINE-SEQ
R-GCX126-cbl-00979 (+9) File: GCX126R.cbl Call EMCSEND2 to Resend Email Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call EMCSEND2 to Resend Email':
  • Context - an email notification has failed to send to the primary recipient:
    For Call EMCSEND2 to Resend Email:
    When the resend process is initiated, then the system clears the to usercode field, sets to usercode to 'om01247', sets destination filename to 'in', and calls emcsend2 with the updated parameters.
  • Context - an email has been successfully resent via emcsend2 with no errors:
    For Purge IMS Message Queue:
    When the email send operation completes with emi-no-errors status, then the system calls cims with purg function to purge the alternate pcb message queue.
  • Context - an email resend operation has completed (successfully or with error):
    For Increment Machine Sequence Number:
    When the resend process finishes, then the system adds 1 to ws-fmt-machine-seq to increment the sequence number.
  • Context - an email resend is attempted via emcsend2:
    For Abend: Invalid FROM Usercode:
    When emcsend2 returns emi-from-not-found status, then the system sets error message to 'emi - invalid merlin from' and performs z900-abend to terminate processing.
    For Abend: Invalid TO/COPY Usercode:
    When emcsend2 returns emi-to-or-copy-not-found status, then the system sets error message to 'emi - invalid merlin to or copy' and performs z900-abend to terminate processing.
    For Abend: Invalid Filename:
    When emcsend2 returns emi-filename-invalid status, then the system sets error message to 'emi - invalid merlin filename' and performs z900-abend to terminate processing.
  • Context - an email notification needs to be resent:
    For Clear TO Usercode Field:
    When the resend process begins, then the system moves spaces to emi-to-usercode to clear the field.
  • Context - the to usercode field has been cleared:
    For Set TO Usercode to OM01247:
    When setting up the resend parameters, then the system moves 'om01247' to emi-to-usercodes(01) as the default recipient.
  • Context - the recipient has been set to the default usercode:
    For Set Destination Filename to IN:
    When configuring the destination for resend, then the system moves 'in' to emi-destination-filename.
  • Context - all resend parameters have been configured (to usercode = om01247, destination = in):
    For Call EMCSEND2 with Updated Parameters:
    When ready to resend the email, then the system calls emcsend2 passing iscom, emi-from-usercode, emi-destination-filename, emi-to-usercode, emi-copy-usercode, emi-subject, emi-keywords, mrln-350-report, emi-return-status-flag, emi-seg-no1, emi-seg-no2, and emi-item-type parameters.
👨‍💻 Technical ACs (Gherkin)
Context: An email notification has failed to send to the primary recipient
GIVEN
An email notification has failed to send to the primary recipient
Applied to: Call EMCSEND2 to Resend Email
WHEN
The resend process is initiated
THEN
The system clears the TO usercode field, sets TO usercode to 'OM01247', sets destination filename to 'IN', and calls EMCSEND2 with the updated parameters
Context: An email has been successfully resent via EMCSEND2 with no errors
GIVEN
An email has been successfully resent via EMCSEND2 with no errors
Applied to: Purge IMS Message Queue
WHEN
The email send operation completes with EMI-NO-ERRORS status
THEN
The system calls CIMS with PURG function to purge the alternate PCB message queue
Context: An email resend operation has completed (successfully or with error)
GIVEN
An email resend operation has completed (successfully or with error)
Applied to: Increment Machine Sequence Number
WHEN
The resend process finishes
THEN
The system adds 1 to WS-FMT-MACHINE-SEQ to increment the sequence number
Context: An email resend is attempted via EMCSEND2
GIVEN
An email resend is attempted via EMCSEND2
Applied to: Abend: Invalid FROM Usercode
WHEN
EMCSEND2 returns EMI-FROM-NOT-FOUND status
THEN
The system sets error message to 'EMI - INVALID MERLIN FROM' and performs Z900-ABEND to terminate processing
Applied to: Abend: Invalid TO/COPY Usercode
WHEN
EMCSEND2 returns EMI-TO-OR-COPY-NOT-FOUND status
THEN
The system sets error message to 'EMI - INVALID MERLIN TO OR COPY' and performs Z900-ABEND to terminate processing
Applied to: Abend: Invalid Filename
WHEN
EMCSEND2 returns EMI-FILENAME-INVALID status
THEN
The system sets error message to 'EMI - INVALID MERLIN FILENAME' and performs Z900-ABEND to terminate processing
Context: An email notification needs to be resent
GIVEN
An email notification needs to be resent
Applied to: Clear TO Usercode Field
WHEN
The resend process begins
THEN
The system moves SPACES to EMI-TO-USERCODE to clear the field
Context: The TO usercode field has been cleared
GIVEN
The TO usercode field has been cleared
Applied to: Set TO Usercode to OM01247
WHEN
Setting up the resend parameters
THEN
The system moves 'OM01247' to EMI-TO-USERCODES(01) as the default recipient
Context: The recipient has been set to the default usercode
GIVEN
The recipient has been set to the default usercode
Applied to: Set Destination Filename to IN
WHEN
Configuring the destination for resend
THEN
The system moves 'IN' to EMI-DESTINATION-FILENAME
Context: All resend parameters have been configured (TO usercode = OM01247, destination = IN)
GIVEN
All resend parameters have been configured (TO usercode = OM01247, destination = IN)
Applied to: Call EMCSEND2 with Updated Parameters
WHEN
Ready to resend the email
THEN
The system calls EMCSEND2 passing ISCOM, EMI-FROM-USERCODE, EMI-DESTINATION-FILENAME, EMI-TO-USERCODE, EMI-COPY-USERCODE, EMI-SUBJECT, EMI-KEYWORDS, MRLN-350-REPORT, EMI-RETURN-STATUS-FLAG, EMI-SEG-NO1, EMI-SEG-NO2, and EMI-ITEM-TYPE parameters
R-GCX126-cbl-00989 (+9) File: GCX126R.cbl Call GCCUSIO to Execute Database Search Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call GCCUSIO to Execute Database Search':
  • Context - a canadian cargo record is being processed with a current equipment car id key and a saved waybill index:
    For Set Car ID from Current Key, Set Waybill Index from Saved Value, Set US CCN Key to Low Values:
    When the system prepares to search for associated us cargo records, then the search parameters are initialized with the equipment car id from the current key, the waybill number from the saved index, and the us ccn key is set to its lowest possible value to enable range searching.
  • Context - the system needs to find the first us cargo record matching equipment car id and waybill number:
    For Set Function to GU - Get Unique, Set Index Type to CAR-WB, Set Operator to '>=' - Greater/Equal:
    When performing the initial database search operation, then the database function is set to get unique (gu), the index type is set to equipment-waybill (car-wb), and the search operator is set to greater-than-or-equal-to (>=) to find the first matching or next available record.
  • Context - the system has already retrieved an initial us cargo record and needs to find subsequent records:
    For Set Function to GN - Get Next, Set Index Type to CAR-WB, Set Operator to '>' - Greater Than:
    When performing a follow-up database search operation, then the database function is set to get next (gn), the index type is set to equipment-waybill (car-wb), and the search operator is set to greater-than (>) to find the next sequential record.
  • Context - all search parameters are configured including segment type gcsusrt, function type (gu or gn), index type car-wb, and search operator:
    For Call GCCUSIO with Parameters:
    When the system executes the database search, then the gccusio program is called with the control communication area, search parameters, and us cargo segment structure to retrieve matching records.
  • Context - a database search operation has been executed for us cargo records:
    For Database Status OK?, Set End of Database Flag:
    When the database operation returns a non-successful status code indicating no records found or an error condition, then the end-of-database flag is set to true to indicate no more records are available and processing should terminate the search loop.
  • Context - a us cargo record has been successfully retrieved from the database:
    For Verify Car ID Matches Current Key, Verify Waybill Matches Saved Index, Keys Match?:
    When the system validates the retrieved record against search criteria, then the equipment car id from the retrieved record (first 12 characters) is compared to the current equipment car id key and the waybill number from the retrieved record is compared to the saved waybill index, and both must match exactly for the record to be considered valid.
  • Context - a us cargo record has been retrieved but either the equipment car id or waybill number does not match the search criteria:
    For Keys Match?, Set End of Database Flag:
    When the key validation check fails, then the end-of-database flag is set to true to terminate the search loop, as records are indexed and sorted, indicating no further matching records will be found.
  • Context - a us cargo record has been retrieved that matches equipment and waybill criteria:
    For Cargo Deleted?, Continue to Next Record:
    When the cargo record has a deletion status indicator set to deleted, then the record is skipped without setting the us manifest found flag, and processing continues to allow searching for the next record.
  • Context - a us cargo record has been retrieved that matches equipment and waybill criteria and is not deleted:
    For TR Created?, Continue to Next Record:
    When the cargo record has the train-created indicator set to 'y' (yes), then the record is skipped without setting the us manifest found flag, and processing continues to allow searching for the next record.
  • Context - a us cargo record has been retrieved that matches equipment car id and waybill number, is not marked as deleted, and does not have a train record already created:
    For Set US Manifest Found Flag:
    When all validation checks pass successfully, then the us manifest found flag is set to true to indicate a valid associated us cargo record has been located and is ready for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian cargo record is being processed with a current equipment car ID key and a saved waybill index
GIVEN
A Canadian cargo record is being processed with a current equipment car ID key and a saved waybill index
Applied to: Set Car ID from Current Key, Set Waybill Index from Saved Value, Set US CCN Key to Low Values
WHEN
The system prepares to search for associated US cargo records
THEN
The search parameters are initialized with the equipment car ID from the current key, the waybill number from the saved index, and the US CCN key is set to its lowest possible value to enable range searching
Context: The system needs to find the first US cargo record matching equipment car ID and waybill number
GIVEN
The system needs to find the first US cargo record matching equipment car ID and waybill number
Applied to: Set Function to GU - Get Unique, Set Index Type to CAR-WB, Set Operator to '>=' - Greater/Equal
WHEN
Performing the initial database search operation
THEN
The database function is set to Get Unique (GU), the index type is set to equipment-waybill (CAR-WB), and the search operator is set to greater-than-or-equal-to (>=) to find the first matching or next available record
Context: The system has already retrieved an initial US cargo record and needs to find subsequent records
GIVEN
The system has already retrieved an initial US cargo record and needs to find subsequent records
Applied to: Set Function to GN - Get Next, Set Index Type to CAR-WB, Set Operator to '>' - Greater Than
WHEN
Performing a follow-up database search operation
THEN
The database function is set to Get Next (GN), the index type is set to equipment-waybill (CAR-WB), and the search operator is set to greater-than (>) to find the next sequential record
Context: All search parameters are configured including segment type GCSUSRT, function type (GU or GN), index type CAR-WB, and search operator
GIVEN
All search parameters are configured including segment type GCSUSRT, function type (GU or GN), index type CAR-WB, and search operator
Applied to: Call GCCUSIO with Parameters
WHEN
The system executes the database search
THEN
The GCCUSIO program is called with the control communication area, search parameters, and US cargo segment structure to retrieve matching records
Context: A database search operation has been executed for US cargo records
GIVEN
A database search operation has been executed for US cargo records
Applied to: Database Status OK?, Set End of Database Flag
WHEN
The database operation returns a non-successful status code indicating no records found or an error condition
THEN
The end-of-database flag is set to TRUE to indicate no more records are available and processing should terminate the search loop
Context: A US cargo record has been successfully retrieved from the database
GIVEN
A US cargo record has been successfully retrieved from the database
Applied to: Verify Car ID Matches Current Key, Verify Waybill Matches Saved Index, Keys Match?
WHEN
The system validates the retrieved record against search criteria
THEN
The equipment car ID from the retrieved record (first 12 characters) is compared to the current equipment car ID key AND the waybill number from the retrieved record is compared to the saved waybill index, and both must match exactly for the record to be considered valid
Context: A US cargo record has been retrieved but either the equipment car ID or waybill number does not match the search criteria
GIVEN
A US cargo record has been retrieved but either the equipment car ID or waybill number does not match the search criteria
Applied to: Keys Match?, Set End of Database Flag
WHEN
The key validation check fails
THEN
The end-of-database flag is set to TRUE to terminate the search loop, as records are indexed and sorted, indicating no further matching records will be found
Context: A US cargo record has been retrieved that matches equipment and waybill criteria
GIVEN
A US cargo record has been retrieved that matches equipment and waybill criteria
Applied to: Cargo Deleted?, Continue to Next Record
WHEN
The cargo record has a deletion status indicator set to deleted
THEN
The record is skipped without setting the US manifest found flag, and processing continues to allow searching for the next record
Context: A US cargo record has been retrieved that matches equipment and waybill criteria and is not deleted
GIVEN
A US cargo record has been retrieved that matches equipment and waybill criteria and is not deleted
Applied to: TR Created?, Continue to Next Record
WHEN
The cargo record has the train-created indicator set to 'Y' (Yes)
THEN
The record is skipped without setting the US manifest found flag, and processing continues to allow searching for the next record
Context: A US cargo record has been retrieved that matches equipment car ID and waybill number, is not marked as deleted, and does not have a train record already created
GIVEN
A US cargo record has been retrieved that matches equipment car ID and waybill number, is not marked as deleted, and does not have a train record already created
Applied to: Set US Manifest Found Flag
WHEN
All validation checks pass successfully
THEN
The US manifest found flag is set to TRUE to indicate a valid associated US cargo record has been located and is ready for processing
R-GCX126-cbl-00999 (+4) File: GCX126R.cbl Call Z200 Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Z200':
  • Context - a cargo information message needs to be logged:
    For Call Z200-MOVE-LOG-INFORMATION to Initialize Log Structure:
    When the log structure initialization is invoked, then the log input area is cleared to spaces and the security byte is set to high-value and the sending transaction is set to 'gct1261e' and the user id from the common control area is copied to the log structure.
  • Context - the log structure is being initialized:
    For Clear GCX105-INPUT to Spaces:
    When the initialization process begins, then the gcx105-input field is set to spaces.
    For Set GCX105-SECURITY-BYTE to HIGH-VALUE:
    When security settings are being configured, then the gcx105-security-byte is set to high-value.
    For Set GCX105-SENDING-TRANSACTION to 'GCT1261E':
    When the transaction identifier is being set, then the gcx105-sending-transaction is set to 'gct1261e'.
  • Context - the log structure is being initialized and the common control area contains the current user id:
    For Set GCX105-ACF2-ID from CCCOM User ID:
    When user identification is being captured, then the gcx105-acf2-id is set to the value from cc-acf2-userid in the common control area.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo information message needs to be logged
GIVEN
A cargo information message needs to be logged
Applied to: Call Z200-MOVE-LOG-INFORMATION to Initialize Log Structure
WHEN
The log structure initialization is invoked
THEN
The log input area is cleared to spaces AND the security byte is set to high-value AND the sending transaction is set to 'GCT1261E' AND the user ID from the common control area is copied to the log structure
Context: The log structure is being initialized
GIVEN
The log structure is being initialized
Applied to: Clear GCX105-INPUT to Spaces
WHEN
The initialization process begins
THEN
The GCX105-INPUT field is set to spaces
Applied to: Set GCX105-SECURITY-BYTE to HIGH-VALUE
WHEN
Security settings are being configured
THEN
The GCX105-SECURITY-BYTE is set to HIGH-VALUE
Applied to: Set GCX105-SENDING-TRANSACTION to 'GCT1261E'
WHEN
The transaction identifier is being set
THEN
The GCX105-SENDING-TRANSACTION is set to 'GCT1261E'
Context: The log structure is being initialized AND the common control area contains the current user ID
GIVEN
The log structure is being initialized AND the common control area contains the current user ID
Applied to: Set GCX105-ACF2-ID from CCCOM User ID
WHEN
User identification is being captured
THEN
The GCX105-ACF2-ID is set to the value from CC-ACF2-USERID in the common control area
R-GCX126-cbl-01004 (+21) File: GCX126R.cbl Call Z300 Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Z300':
  • Context - a log entry creation request is initiated for gct1051e:
    For Log Message Empty?:
    When the gcx105-message field is empty (spaces) or contains only low-values, then the system skips the log entry creation process and exits the z300-spawn-gct1051e section without writing any log record.
  • Context - a valid log message exists in gcx105-message:
    For Normalize Date - Replace Spaces with Zeros:
    When the gcx105-date field contains space characters, then the system replaces all spaces in gcx105-date with zeroes to ensure proper date formatting.
  • Context - a valid log message exists in gcx105-message and the gcx105-date field has been normalized:
    For Normalize Time - Replace Spaces with '1':
    When the gcx105-time field contains space characters, then the system replaces all spaces in gcx105-time with the character '1' to ensure proper time formatting.
  • Context - the gcx105-date and gcx105-time fields have been normalized and a valid log message exists:
    For Move Log Input to GCT1051E Message:
    When the log entry preparation is in progress, then the system moves the complete gcx105-input structure to the gct1051e-msg field.
  • Context - the gct1051e message structure has been populated with log data:
    For Call CIMS with CHNG Function:
    When the system is ready to write the log entry, then the system calls cims with chng function using the alternate pcb and gct1051e message to change the message destination.
  • Context - the message destination has been changed to the alternate pcb and the gct1051e message is populated:
    For Call WRITMSGL to Write Message Log:
    When the system is ready to persist the log entry, then the system calls writmsgl with the alternate pcb, gct1051e message code, message content, message length, and module name to write the log entry.
  • Context - the log entry has been written to the message queue via writmsgl:
    For Call CIMS with PURG Function to Commit:
    When the log entry write operation is complete, then the system calls cims with purg function using the alternate pcb to commit the transaction and make the log entry permanent.
  • Context - a log message (gcx105-message) is being prepared for writing to the audit trail:
    For Log Message Empty?:
    When the log message field contains only spaces or low values, then the system skips all logging operations and exits the z300-spawn-gct1051e section without writing any log entry.
  • Context - a log message with a date field (gcx105-date) is ready to be written:
    For Replace Spaces with Zeroes in Date:
    When the date field contains any space characters, then the system replaces all spaces in the date field with zeroes to ensure numeric consistency.
  • Context - a log message with a time field (gcx105-time) is ready to be written:
    For Replace Spaces with '1' in Time:
    When the time field contains any space characters, then the system replaces all spaces in the time field with the character '1' to ensure data consistency.
  • Context - a validated log input structure (gcx105-input) with normalized date and time fields:
    For Move Log Input to GCT1051E Message:
    When the log message is ready to be written to the audit trail, then the system moves the entire log input structure to the gct1051e message format (gct1051e-msg).
  • Context - a formatted log message (gct1051e) ready to be written:
    For Call CIMS with CHNG Function:
    When the system needs to write the log entry to the audit trail, then the system calls cims with chng function using the alternate pcb (alt-pcb of cccom) and the gct1051e message structure to change the message destination.
  • Context - a log message with changed destination in the alternate pcb:
    For Call WRITMSGL to Write Message:
    When the system is ready to persist the log entry, then the system calls writmsgl utility with parameters: cccom control block, alternate pcb, message code (gct1051e-msg-code), message text (gct1051e-message), message length (gct1051e-msg-lgth), and module name (gct1051e-mod-name) to write the log entry to the audit trail.
  • Context - a log entry has been successfully written to the audit trail via the alternate pcb:
    For Call CIMS with PURG Function:
    When the log writing operation is complete, then the system calls cims with purg function using the alternate pcb (alt-pcb of cccom) to purge the message from the queue.
  • Context - a cargo information message is ready to be logged:
    For Message Empty?:
    When the message content (gcx105-message) is either spaces or low-values, then the system skips the logging process and exits without creating any log entry.
  • Context - a cargo information message with a date field (gcx105-date) is being prepared for logging:
    For Replace Spaces with Zeroes in Date:
    When the date field contains any space characters, then the system replaces all spaces in the date field with zeroes to ensure numeric consistency.
  • Context - a cargo information message with a time field (gcx105-time) is being prepared for logging:
    For Replace Spaces with '1' in Time:
    When the time field contains any space characters, then the system replaces all spaces in the time field with the character '1' to ensure valid time format.
  • Context - a validated cargo information message (gcx105-input) is ready for logging:
    For Move Input to GCT1051E Message:
    When the message needs to be written to the ims message queue, then the system moves the input message to the gct1051e message structure (gct1051e-msg).
  • Context - a cargo information message is ready to be written to ims:
    For Set Accept Status to Blank:
    When the system prepares to call ims message services, then the system sets the accept status (cc-accept-status) to blank (two spaces) to enable standard message processing.
  • Context - a cargo information message is prepared in gct1051e format:
    For Call CIMS with CHNG Function:
    When the message destination needs to be set in the ims message queue, then the system calls cims with chng function using the alternate pcb and gct1051e message structure to establish the message destination.
  • Context - a cargo information message is formatted in gct1051e structure with destination set:
    For Call WRITMSGL to Write Message Log:
    When the message needs to be permanently logged, then the system calls writmsgl with the alternate pcb, message code (gct1051e-msg-code), message content (gct1051e-message), message length (gct1051e-msg-lgth), and module name (gct1051e-mod-name) to write the log entry.
  • Context - a cargo information message has been successfully written to the message log:
    For Call CIMS with PURG Function:
    When the logging transaction needs to be completed, then the system calls cims with purg function using the alternate pcb to remove the message from the queue and finalize the transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A log entry creation request is initiated for GCT1051E
GIVEN
A log entry creation request is initiated for GCT1051E
Applied to: Log Message Empty?
WHEN
The GCX105-MESSAGE field is empty (spaces) OR contains only low-values
THEN
The system skips the log entry creation process and exits the Z300-SPAWN-GCT1051E section without writing any log record
Context: A valid log message exists in GCX105-MESSAGE
GIVEN
A valid log message exists in GCX105-MESSAGE
Applied to: Normalize Date - Replace Spaces with Zeros
WHEN
The GCX105-DATE field contains space characters
THEN
The system replaces all spaces in GCX105-DATE with zeroes to ensure proper date formatting
Context: A valid log message exists in GCX105-MESSAGE AND the GCX105-DATE field has been normalized
GIVEN
A valid log message exists in GCX105-MESSAGE AND the GCX105-DATE field has been normalized
Applied to: Normalize Time - Replace Spaces with '1'
WHEN
The GCX105-TIME field contains space characters
THEN
The system replaces all spaces in GCX105-TIME with the character '1' to ensure proper time formatting
Context: The GCX105-DATE and GCX105-TIME fields have been normalized AND a valid log message exists
GIVEN
The GCX105-DATE and GCX105-TIME fields have been normalized AND a valid log message exists
Applied to: Move Log Input to GCT1051E Message
WHEN
The log entry preparation is in progress
THEN
The system moves the complete GCX105-INPUT structure to the GCT1051E-MSG field
Context: The GCT1051E message structure has been populated with log data
GIVEN
The GCT1051E message structure has been populated with log data
Applied to: Call CIMS with CHNG Function
WHEN
The system is ready to write the log entry
THEN
The system calls CIMS with CHNG function using the alternate PCB and GCT1051E message to change the message destination
Context: The message destination has been changed to the alternate PCB AND the GCT1051E message is populated
GIVEN
The message destination has been changed to the alternate PCB AND the GCT1051E message is populated
Applied to: Call WRITMSGL to Write Message Log
WHEN
The system is ready to persist the log entry
THEN
The system calls WRITMSGL with the alternate PCB, GCT1051E message code, message content, message length, and module name to write the log entry
Context: The log entry has been written to the message queue via WRITMSGL
GIVEN
The log entry has been written to the message queue via WRITMSGL
Applied to: Call CIMS with PURG Function to Commit
WHEN
The log entry write operation is complete
THEN
The system calls CIMS with PURG function using the alternate PCB to commit the transaction and make the log entry permanent
Context: A log message (GCX105-MESSAGE) is being prepared for writing to the audit trail
GIVEN
A log message (GCX105-MESSAGE) is being prepared for writing to the audit trail
Applied to: Log Message Empty?
WHEN
The log message field contains only spaces OR low values
THEN
The system skips all logging operations and exits the Z300-SPAWN-GCT1051E section without writing any log entry
Context: A log message with a date field (GCX105-DATE) is ready to be written
GIVEN
A log message with a date field (GCX105-DATE) is ready to be written
Applied to: Replace Spaces with Zeroes in Date
WHEN
The date field contains any space characters
THEN
The system replaces all spaces in the date field with zeroes to ensure numeric consistency
Context: A log message with a time field (GCX105-TIME) is ready to be written
GIVEN
A log message with a time field (GCX105-TIME) is ready to be written
Applied to: Replace Spaces with '1' in Time
WHEN
The time field contains any space characters
THEN
The system replaces all spaces in the time field with the character '1' to ensure data consistency
Context: A validated log input structure (GCX105-INPUT) with normalized date and time fields
GIVEN
A validated log input structure (GCX105-INPUT) with normalized date and time fields
Applied to: Move Log Input to GCT1051E Message
WHEN
The log message is ready to be written to the audit trail
THEN
The system moves the entire log input structure to the GCT1051E message format (GCT1051E-MSG)
Context: A formatted log message (GCT1051E) ready to be written
GIVEN
A formatted log message (GCT1051E) ready to be written
Applied to: Call CIMS with CHNG Function
WHEN
The system needs to write the log entry to the audit trail
THEN
The system calls CIMS with CHNG function using the alternate PCB (ALT-PCB OF CCCOM) and the GCT1051E message structure to change the message destination
Context: A log message with changed destination in the alternate PCB
GIVEN
A log message with changed destination in the alternate PCB
Applied to: Call WRITMSGL to Write Message
WHEN
The system is ready to persist the log entry
THEN
The system calls WRITMSGL utility with parameters: CCCOM control block, alternate PCB, message code (GCT1051E-MSG-CODE), message text (GCT1051E-MESSAGE), message length (GCT1051E-MSG-LGTH), and module name (GCT1051E-MOD-NAME) to write the log entry to the audit trail
Context: A log entry has been successfully written to the audit trail via the alternate PCB
GIVEN
A log entry has been successfully written to the audit trail via the alternate PCB
Applied to: Call CIMS with PURG Function
WHEN
The log writing operation is complete
THEN
The system calls CIMS with PURG function using the alternate PCB (ALT-PCB OF CCCOM) to purge the message from the queue
Context: A cargo information message is ready to be logged
GIVEN
A cargo information message is ready to be logged
Applied to: Message Empty?
WHEN
The message content (GCX105-MESSAGE) is either spaces or low-values
THEN
The system skips the logging process and exits without creating any log entry
Context: A cargo information message with a date field (GCX105-DATE) is being prepared for logging
GIVEN
A cargo information message with a date field (GCX105-DATE) is being prepared for logging
Applied to: Replace Spaces with Zeroes in Date
WHEN
The date field contains any space characters
THEN
The system replaces all spaces in the date field with zeroes to ensure numeric consistency
Context: A cargo information message with a time field (GCX105-TIME) is being prepared for logging
GIVEN
A cargo information message with a time field (GCX105-TIME) is being prepared for logging
Applied to: Replace Spaces with '1' in Time
WHEN
The time field contains any space characters
THEN
The system replaces all spaces in the time field with the character '1' to ensure valid time format
Context: A validated cargo information message (GCX105-INPUT) is ready for logging
GIVEN
A validated cargo information message (GCX105-INPUT) is ready for logging
Applied to: Move Input to GCT1051E Message
WHEN
The message needs to be written to the IMS message queue
THEN
The system moves the input message to the GCT1051E message structure (GCT1051E-MSG)
Context: A cargo information message is ready to be written to IMS
GIVEN
A cargo information message is ready to be written to IMS
Applied to: Set Accept Status to Blank
WHEN
The system prepares to call IMS message services
THEN
The system sets the accept status (CC-ACCEPT-STATUS) to blank (two spaces) to enable standard message processing
Context: A cargo information message is prepared in GCT1051E format
GIVEN
A cargo information message is prepared in GCT1051E format
Applied to: Call CIMS with CHNG Function
WHEN
The message destination needs to be set in the IMS message queue
THEN
The system calls CIMS with CHNG function using the alternate PCB and GCT1051E message structure to establish the message destination
Context: A cargo information message is formatted in GCT1051E structure with destination set
GIVEN
A cargo information message is formatted in GCT1051E structure with destination set
Applied to: Call WRITMSGL to Write Message Log
WHEN
The message needs to be permanently logged
THEN
The system calls WRITMSGL with the alternate PCB, message code (GCT1051E-MSG-CODE), message content (GCT1051E-MESSAGE), message length (GCT1051E-MSG-LGTH), and module name (GCT1051E-MOD-NAME) to write the log entry
Context: A cargo information message has been successfully written to the message log
GIVEN
A cargo information message has been successfully written to the message log
Applied to: Call CIMS with PURG Function
WHEN
The logging transaction needs to be completed
THEN
The system calls CIMS with PURG function using the alternate PCB to remove the message from the queue and finalize the transaction
R-GCX126-cbl-01026 (+7) File: GCX126R.cbl Evaluate Return Status and Handle Email Send Results Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Return Status and Handle Email Send Results':
  • Context - an email notification has been processed through emcsend2:
    For No Errors - Email Sent Successfully:
    When the return status indicates no errors (emi-no-errors), then the system purges the alternate message queue to complete the email transaction.
  • Context - an email notification is being sent through emcsend2:
    For From User Not Found Error:
    When the return status indicates the from user was not found (emi-from-not-found), then the system sets error message 'emi - invalid merlin from' and aborts the program.
    For Filename Invalid Error:
    When the return status indicates the destination filename is invalid (emi-filename-invalid), then the system sets error message 'emi - invalid merlin filename' and aborts the program.
  • Context - an email notification has failed due to invalid to or copy recipient (emi-to-or-copy-not-found) and the notification type is unreleased cargo (88-z110-mrln-type-is-unrlse):
    For Get Bad Merlin ID from TO-USERCODES 2:
    When the system needs to identify the invalid recipient, then the system captures the invalid merlin id from emi-to-usercodes position 2 into ws-bad-merlin-id.
  • Context - an email notification has failed due to invalid to or copy recipient (emi-to-or-copy-not-found) and the notification type is not unreleased cargo:
    For Get Bad Merlin ID from TO-USERCODES 1:
    When the system needs to identify the invalid recipient, then the system captures the invalid merlin id from emi-to-usercodes position 1 into ws-bad-merlin-id.
  • Context - an email notification has failed due to invalid to or copy recipient (emi-to-or-copy-not-found):
    For Set TO-USERCODES 1 to OM01247:
    When the system prepares to reroute the notification, then the system clears emi-to-usercode, sets emi-to-usercodes position 1 to 'om01247', and sets destination filename to 'in'.
  • Context - an email notification has failed due to invalid recipient and has been rerouted to default user om01247 with destination filename 'in':
    For 40:Resend Failed Email:
    When the system executes the resend operation, then the system calls z116-resend-merlin to attempt delivery to the default recipient.
  • Context - an email notification was successfully rerouted to default recipient (emi-no-errors after resend):
    For Prepare Reroute Notification Subject:
    When the system prepares the reroute notification, then the system clears emi-subject and creates a message containing the invalid merlin id (ws-bad-merlin-id) with text 'invalid merlin to - report reroute', then calls z116-resend-merlin again to send this notification.
👨‍💻 Technical ACs (Gherkin)
Context: An email notification has been processed through EMCSEND2
GIVEN
An email notification has been processed through EMCSEND2
Applied to: No Errors - Email Sent Successfully
WHEN
The return status indicates no errors (EMI-NO-ERRORS)
THEN
The system purges the alternate message queue to complete the email transaction
Context: An email notification is being sent through EMCSEND2
GIVEN
An email notification is being sent through EMCSEND2
Applied to: From User Not Found Error
WHEN
The return status indicates the FROM user was not found (EMI-FROM-NOT-FOUND)
THEN
The system sets error message 'EMI - INVALID MERLIN FROM' and aborts the program
Applied to: Filename Invalid Error
WHEN
The return status indicates the destination filename is invalid (EMI-FILENAME-INVALID)
THEN
The system sets error message 'EMI - INVALID MERLIN FILENAME' and aborts the program
Context: An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND) and the notification type is unreleased cargo (88-Z110-MRLN-TYPE-IS-UNRLSE)
GIVEN
An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND) and the notification type is unreleased cargo (88-Z110-MRLN-TYPE-IS-UNRLSE)
Applied to: Get Bad Merlin ID from TO-USERCODES 2
WHEN
The system needs to identify the invalid recipient
THEN
The system captures the invalid Merlin ID from EMI-TO-USERCODES position 2 into WS-BAD-MERLIN-ID
Context: An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND) and the notification type is not unreleased cargo
GIVEN
An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND) and the notification type is not unreleased cargo
Applied to: Get Bad Merlin ID from TO-USERCODES 1
WHEN
The system needs to identify the invalid recipient
THEN
The system captures the invalid Merlin ID from EMI-TO-USERCODES position 1 into WS-BAD-MERLIN-ID
Context: An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND)
GIVEN
An email notification has failed due to invalid TO or COPY recipient (EMI-TO-OR-COPY-NOT-FOUND)
Applied to: Set TO-USERCODES 1 to OM01247
WHEN
The system prepares to reroute the notification
THEN
The system clears EMI-TO-USERCODE, sets EMI-TO-USERCODES position 1 to 'OM01247', and sets destination filename to 'IN'
Context: An email notification has failed due to invalid recipient and has been rerouted to default user OM01247 with destination filename 'IN'
GIVEN
An email notification has failed due to invalid recipient and has been rerouted to default user OM01247 with destination filename 'IN'
Applied to: 40:Resend Failed Email
WHEN
The system executes the resend operation
THEN
The system calls Z116-RESEND-MERLIN to attempt delivery to the default recipient
Context: An email notification was successfully rerouted to default recipient (EMI-NO-ERRORS after resend)
GIVEN
An email notification was successfully rerouted to default recipient (EMI-NO-ERRORS after resend)
Applied to: Prepare Reroute Notification Subject
WHEN
The system prepares the reroute notification
THEN
The system clears EMI-SUBJECT and creates a message containing the invalid Merlin ID (WS-BAD-MERLIN-ID) with text 'INVALID MERLIN TO - REPORT REROUTE', then calls Z116-RESEND-MERLIN again to send this notification
R-GCX126-cbl-01034 (+7) File: GCX126R.cbl Call EMCSEND2 with Resend Parameters Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call EMCSEND2 with Resend Parameters':
  • Context - the system needs to send an email notification and cccom contains current session information:
    For Call CCISCOM to Initialize ISCOM:
    When the resend email process is initiated, then the system calls cciscom with cccom and iscom parameters to initialize the communication control block for email operations.
  • Context - the communication control block is initialized and all email parameters are prepared including from user code, destination filename, to user code, copy user code, subject, keywords, and report content:
    For Call EMCSEND2 with Parameters:
    When the system executes the email send operation, then the system calls emcsend2 with iscom, from user code, destination filename, to user code, copy user code, subject, keywords, report content (mrln-350-report), return status flag, segment numbers, and item type to send the email notification.
  • Context - the emcsend2 call has completed and iscom contains updated communication information:
    For Call ISCCCOM to Restore CCCOM:
    When the email send operation finishes, then the system calls iscccom with iscom and cccom parameters to restore the communication control block state.
  • Context - the email notification was sent through emcsend2 and the return status flag indicates no errors (emi-no-errors):
    For Purge IMS Message Queue:
    When the system evaluates the email send result, then the system calls cims with cccom, purg function, and alt-pcb to purge the message from the ims queue.
  • Context - the emcsend2 call completed and the return status flag indicates the sender user code was not found (emi-from-not-found):
    For Set Error: Invalid Merlin FROM:
    When the system evaluates the email send result, then the system moves 'emi - invalid merlin from' to the error message field in cccom and performs the abend routine (z900-abend).
  • Context - the emcsend2 call completed and the return status flag indicates the recipient or copy user code was not found (emi-to-or-copy-not-found):
    For Set Error: Invalid Merlin TO or COPY:
    When the system evaluates the email send result, then the system moves 'emi - invalid merlin to or copy' to the error message field in cccom and performs the abend routine (z900-abend).
  • Context - the emcsend2 call completed and the return status flag indicates the destination filename is invalid (emi-filename-invalid):
    For Set Error: Invalid Merlin Filename:
    When the system evaluates the email send result, then the system moves 'emi - invalid merlin filename' to the error message field in cccom and performs the abend routine (z900-abend).
  • Context - the email send operation has completed with any result status:
    For Increment Machine Sequence Number:
    When the system finishes processing the email notification, then the system adds 1 to ws-fmt-machine-seq to increment the machine sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to send an email notification and CCCOM contains current session information
GIVEN
The system needs to send an email notification and CCCOM contains current session information
Applied to: Call CCISCOM to Initialize ISCOM
WHEN
The resend email process is initiated
THEN
The system calls CCISCOM with CCCOM and ISCOM parameters to initialize the communication control block for email operations
Context: The communication control block is initialized and all email parameters are prepared including from user code, destination filename, to user code, copy user code, subject, keywords, and report content
GIVEN
The communication control block is initialized and all email parameters are prepared including from user code, destination filename, to user code, copy user code, subject, keywords, and report content
Applied to: Call EMCSEND2 with Parameters
WHEN
The system executes the email send operation
THEN
The system calls EMCSEND2 with ISCOM, from user code, destination filename, to user code, copy user code, subject, keywords, report content (MRLN-350-REPORT), return status flag, segment numbers, and item type to send the email notification
Context: The EMCSEND2 call has completed and ISCOM contains updated communication information
GIVEN
The EMCSEND2 call has completed and ISCOM contains updated communication information
Applied to: Call ISCCCOM to Restore CCCOM
WHEN
The email send operation finishes
THEN
The system calls ISCCCOM with ISCOM and CCCOM parameters to restore the communication control block state
Context: The email notification was sent through EMCSEND2 and the return status flag indicates no errors (EMI-NO-ERRORS)
GIVEN
The email notification was sent through EMCSEND2 and the return status flag indicates no errors (EMI-NO-ERRORS)
Applied to: Purge IMS Message Queue
WHEN
The system evaluates the email send result
THEN
The system calls CIMS with CCCOM, PURG function, and ALT-PCB to purge the message from the IMS queue
Context: The EMCSEND2 call completed and the return status flag indicates the sender user code was not found (EMI-FROM-NOT-FOUND)
GIVEN
The EMCSEND2 call completed and the return status flag indicates the sender user code was not found (EMI-FROM-NOT-FOUND)
Applied to: Set Error: Invalid Merlin FROM
WHEN
The system evaluates the email send result
THEN
The system moves 'EMI - INVALID MERLIN FROM' to the error message field in CCCOM and performs the abend routine (Z900-ABEND)
Context: The EMCSEND2 call completed and the return status flag indicates the recipient or copy user code was not found (EMI-TO-OR-COPY-NOT-FOUND)
GIVEN
The EMCSEND2 call completed and the return status flag indicates the recipient or copy user code was not found (EMI-TO-OR-COPY-NOT-FOUND)
Applied to: Set Error: Invalid Merlin TO or COPY
WHEN
The system evaluates the email send result
THEN
The system moves 'EMI - INVALID MERLIN TO OR COPY' to the error message field in CCCOM and performs the abend routine (Z900-ABEND)
Context: The EMCSEND2 call completed and the return status flag indicates the destination filename is invalid (EMI-FILENAME-INVALID)
GIVEN
The EMCSEND2 call completed and the return status flag indicates the destination filename is invalid (EMI-FILENAME-INVALID)
Applied to: Set Error: Invalid Merlin Filename
WHEN
The system evaluates the email send result
THEN
The system moves 'EMI - INVALID MERLIN FILENAME' to the error message field in CCCOM and performs the abend routine (Z900-ABEND)
Context: The email send operation has completed with any result status
GIVEN
The email send operation has completed with any result status
Applied to: Increment Machine Sequence Number
WHEN
The system finishes processing the email notification
THEN
The system adds 1 to WS-FMT-MACHINE-SEQ to increment the machine sequence number
R-GCX126-cbl-01042 (+9) File: GCX126R.cbl Evaluate Return Status and Handle Resend Results Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Return Status and Handle Resend Results':
  • Context - an email notification has been sent via emcsend2:
    For No Errors - Purge Message Queue:
    When the return status flag indicates emi-no-errors, then the system purges the message from the alternate pcb message queue and increments the machine sequence number.
  • Context - an email notification has been attempted via emcsend2:
    For Abort with Error Message: EMI - INVALID MERLIN FROM:
    When the return status flag indicates emi-from-not-found, then the system sets the error message to 'emi - invalid merlin from' and aborts processing.
    For Abort with Error Message: EMI - INVALID MERLIN FILENAME:
    When the return status flag indicates emi-filename-invalid, then the system sets the error message to 'emi - invalid merlin filename' and aborts processing.
  • Context - an unrelease type email notification has been attempted via emcsend2 and the message type is unrlse:
    For Save Bad Merlin ID from TO-USERCODES 02:
    When the return status flag indicates emi-to-or-copy-not-found, then the system saves the invalid merlin id from to-usercodes position 02 to ws-bad-merlin-id for error reporting.
  • Context - a non-unrelease type email notification has been attempted via emcsend2 and the message type is not unrlse:
    For Save Bad Merlin ID from TO-USERCODES 01:
    When the return status flag indicates emi-to-or-copy-not-found, then the system saves the invalid merlin id from to-usercodes position 01 to ws-bad-merlin-id for error reporting.
  • Context - an email notification has failed with emi-to-or-copy-not-found and the invalid merlin id has been captured:
    For Set TO-USERCODES 01 to OM01247:
    When the system prepares to reroute the notification, then the system clears emi-to-usercode to spaces, sets to-usercodes position 01 to 'om01247', and sets the destination filename to 'in'.
  • Context - the notification recipient has been corrected to the default user om01247 and destination filename set to in:
    For Resend Email via EMCSEND2:
    When the system initiates the resend process, then the system calls emcsend2 with the corrected recipient information to resend the notification.
  • Context - the notification has been successfully resent to the default user om01247 with emi-no-errors status:
    For Build Reroute Message: Bad Merlin ID + INVALID MERLIN TO - REPORT REROUTE:
    When the resend operation completes successfully, then the system clears the emi-subject, builds a new subject message containing the bad merlin id concatenated with ' invalid merlin to - report reroute', and sends this notification via emcsend2.
  • Context - a notification resend has been attempted with the corrected default user om01247:
    For Abort with Error Message: EMI - INVALID MERLIN TO OR COPY:
    When the resend operation fails with a status other than emi-no-errors, then the system sets the error message to 'emi - invalid merlin to or copy' and aborts processing.
  • Context - an email notification has been successfully processed through emcsend2:
    For Increment Machine Sequence Number:
    When the notification processing completes without errors, then the system adds 1 to ws-fmt-machine-seq to increment the machine sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: An email notification has been sent via EMCSEND2
GIVEN
An email notification has been sent via EMCSEND2
Applied to: No Errors - Purge Message Queue
WHEN
The return status flag indicates EMI-NO-ERRORS
THEN
The system purges the message from the alternate PCB message queue and increments the machine sequence number
Context: An email notification has been attempted via EMCSEND2
GIVEN
An email notification has been attempted via EMCSEND2
Applied to: Abort with Error Message: EMI - INVALID MERLIN FROM
WHEN
The return status flag indicates EMI-FROM-NOT-FOUND
THEN
The system sets the error message to 'EMI - INVALID MERLIN FROM' and aborts processing
Applied to: Abort with Error Message: EMI - INVALID MERLIN FILENAME
WHEN
The return status flag indicates EMI-FILENAME-INVALID
THEN
The system sets the error message to 'EMI - INVALID MERLIN FILENAME' and aborts processing
Context: An unrelease type email notification has been attempted via EMCSEND2 and the message type is UNRLSE
GIVEN
An unrelease type email notification has been attempted via EMCSEND2 and the message type is UNRLSE
Applied to: Save Bad Merlin ID from TO-USERCODES 02
WHEN
The return status flag indicates EMI-TO-OR-COPY-NOT-FOUND
THEN
The system saves the invalid Merlin ID from TO-USERCODES position 02 to WS-BAD-MERLIN-ID for error reporting
Context: A non-unrelease type email notification has been attempted via EMCSEND2 and the message type is not UNRLSE
GIVEN
A non-unrelease type email notification has been attempted via EMCSEND2 and the message type is not UNRLSE
Applied to: Save Bad Merlin ID from TO-USERCODES 01
WHEN
The return status flag indicates EMI-TO-OR-COPY-NOT-FOUND
THEN
The system saves the invalid Merlin ID from TO-USERCODES position 01 to WS-BAD-MERLIN-ID for error reporting
Context: An email notification has failed with EMI-TO-OR-COPY-NOT-FOUND and the invalid Merlin ID has been captured
GIVEN
An email notification has failed with EMI-TO-OR-COPY-NOT-FOUND and the invalid Merlin ID has been captured
Applied to: Set TO-USERCODES 01 to OM01247
WHEN
The system prepares to reroute the notification
THEN
The system clears EMI-TO-USERCODE to spaces, sets TO-USERCODES position 01 to 'OM01247', and sets the destination filename to 'IN'
Context: The notification recipient has been corrected to the default user OM01247 and destination filename set to IN
GIVEN
The notification recipient has been corrected to the default user OM01247 and destination filename set to IN
Applied to: Resend Email via EMCSEND2
WHEN
The system initiates the resend process
THEN
The system calls EMCSEND2 with the corrected recipient information to resend the notification
Context: The notification has been successfully resent to the default user OM01247 with EMI-NO-ERRORS status
GIVEN
The notification has been successfully resent to the default user OM01247 with EMI-NO-ERRORS status
Applied to: Build Reroute Message: Bad Merlin ID + INVALID MERLIN TO - REPORT REROUTE
WHEN
The resend operation completes successfully
THEN
The system clears the EMI-SUBJECT, builds a new subject message containing the bad Merlin ID concatenated with ' INVALID MERLIN TO - REPORT REROUTE', and sends this notification via EMCSEND2
Context: A notification resend has been attempted with the corrected default user OM01247
GIVEN
A notification resend has been attempted with the corrected default user OM01247
Applied to: Abort with Error Message: EMI - INVALID MERLIN TO OR COPY
WHEN
The resend operation fails with a status other than EMI-NO-ERRORS
THEN
The system sets the error message to 'EMI - INVALID MERLIN TO OR COPY' and aborts processing
Context: An email notification has been successfully processed through EMCSEND2
GIVEN
An email notification has been successfully processed through EMCSEND2
Applied to: Increment Machine Sequence Number
WHEN
The notification processing completes without errors
THEN
The system adds 1 to WS-FMT-MACHINE-SEQ to increment the machine sequence number