Bits In Glass
BIG Pega COE Team

Detailed Acceptance Criteria (ACs)

Category: CA Cargo

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.

🎯 CA Cargo Scope Detected: Extracted 4752 rules, Optimally Merged into 435 Feature Scenarios.
R-GCCCANRL-cbl-00001 (+143) File: GCCCANRL.cblFile: GCCCBOL.cblFile: GCCCCADD.cblFile: GCCCCREL.cblFile: GCCS309C.cblFile: GCX122A.cbl Overview Rules Merged 144 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Overview Rules':
  • Context - a ccn key is provided for processing:
    For 2:Get First Follower Manifest:
    When the system initializes follower manifest processing, then the first follower manifest record matching the ccn key is retrieved and processing status is set based on record availability.
  • Context - the system is processing follower manifest records:
    For More Follower Manifests?:
    When a database operation is performed to retrieve records, then processing continues if status code is spaces, otherwise processing stops.
  • Context - a follower manifest record is retrieved:
    For 4:Validate Manifest for Processing:
    When the system compares the manifest ccn key with the input ccn key, then the manifest is processed only if the ccn keys are different, otherwise it is skipped.
  • Context - a manifest is being processed for cancel release:
    For 6:Set Manifest Status Based on CSA Indicator:
    When the system checks the csa indicator status, then if csa indicator is on, status is set to csa-dlv, otherwise status is set to manual.
    For 11:Set Manual Change Flag:
    When the system updates manifest data, then the 309 manual change flag is set to true.
  • Context - a manifest is being cancelled:
    For 7:Update Release Information:
    When the system updates release information, then current machine date is recorded as unrelease date, current user id is recorded, original release date is preserved, release information is cleared, and unrelease reason is set.
  • Context - a manifest has a destination station name:
    For 8:Lookup Station Information:
    When the system performs station lookup using table id 'mc', then if lookup is successful (return flag = '0'), station number from lookup is used, otherwise existing destination station number is retained.
  • Context - a manifest has an in-transit status:
    For 9:Update In-Transit Status:
    When the in-transit status is 'z' or 'e', then the in-transit status is changed to 'l'.
    For 10:Handle Special Transit Cases:
    When the in-transit status is 'r' or 't', then the destination station number for index is cleared to spaces.
    For 9:M10 Segment Processing:
    When the in-transit status is 't', then the system should set application type to '29', otherwise set to '27'.
  • Context - a manifest is being processed:
    For 12:Clear Delete Status:
    When the current status is not equal to 'deleted', then the delete status field is cleared to spaces.
    For 1:Manifest from 66MASTER station?:
    When the manifest from station equals '66master', then the system should exit processing immediately without performing any manifest operations.
    For 32:Post-Emanifest Amendment Flag?:
    When the post-emanifest amendment flag is set to true, then the system should process the m13 amendment segment.
  • Context - a manifest cancel release has been processed:
    For 13:Log Cancel Release Activity:
    When the system logs the activity, then an audit record is created with ccn key, user id, current date and time, and cargo release removed action code.
  • Context - current follower manifest processing is complete:
    For 15:Get Next Follower Manifest:
    When the system retrieves the next follower manifest, then if status code is spaces and ccn key matches the master manifest ccn, processing continues, otherwise processing stops.
  • Context - the cargo report program is starting:
    For 1:Initialize Program:
    When program initialization begins, then description arrays are cleared to spaces, index counters are set to 1, and cargo control number array is initialized to spaces.
  • Context - a valid shipment root key exists:
    For 2:Get Shipment Root Data:
    When the system needs to access shipment root data, then the shiproot segment is retrieved using the root key with 'gu' function code.
  • Context - shipment mine data has been retrieved:
    For 4:Extract EDI BOL Key:
    When the system needs to identify the edi bol key, then if shipment mine data is found, the first data line becomes the edi bol key, otherwise the key is set to spaces.
  • Context - the system needs to identify the customs broker:
    For 5:Build Broker Information:
    When building broker information, then first attempt to get broker from edi bol data, if not found then search fastway system data, if still not found then set broker name to 'unknown'.
  • Context - multiple broker records exist in edi bol data:
    For 5:Build Broker Information:
    When processing broker information from edi bol, then if organization id is 'xq', use that broker name and stop searching; if organization id is 'cb' and no xq found yet and custom id is not 'xr' or 'xu', store as temporary broker.
  • Context - broker name needs to be extracted from special handling instructions:
    For 5:Build Broker Information:
    When processing fastway data for broker information, then remove standard prefixes ('customs broker ', 'customs broker: ', 'broker ', 'broker: ', 'cb ', 'xq ', 'cb: ', 'xq: ') from the instruction text to get the actual broker name.
  • Context - a broker long name has been determined:
    For 5:Build Broker Information:
    When finalizing broker information, then look up the broker in gcst2rt table and if found use the short name, otherwise use the long name.
  • Context - edi bol data is available and reference number processing is needed:
    For 10:Build N9 Reference Numbers:
    When building n9 reference numbers from bol data, then search for 'bm' and 'si' qualified reference numbers, set empty references to 'n/a', and add them to the reference array up to maximum of 10 entries.
  • Context - shipment data contains a non-empty shipment id number:
    For 10:Build N9 Reference Numbers:
    When processing reference numbers from bol data, then add the shipment id as a 'cn' (container number) qualified reference to the reference array.
  • Context - bm or si reference numbers are missing from edi bol and space is available in reference array:
    For 10:Build N9 Reference Numbers:
    When building reference numbers, then use shipper bill number as 'bm' reference and search special handling codes for 'si' type references.
  • Context - reference numbers may contain leading spaces:
    For 15:Compress Reference Numbers:
    When compressing reference number data, then for each reference number that starts with spaces, shift all non-space characters to the left to remove leading spaces.
  • Context - equipment seal records exist with 'sn' type:
    For 16:Build Seal Numbers:
    When building seal number information, then extract up to 4 seal numbers from each record, excluding spaces and low-values, up to a maximum of 20 total seal numbers.
  • Context - shipment processing is in progress:
    For Multi-Bill Shipment?:
    When determining processing path, then if gccc-multi-bill-to-be-created flag is true, proceed with multi-bill ccn processing.
  • Context - multi-bill processing is required and edi bol data exists:
    For 17:Find Multi-Bill CCNs:
    When finding related cargo control numbers, then search 'rf' type records for 'xc' qualified cargo control numbers and add them to the ccn array, excluding the current cargo control number.
  • Context - shipment processing requires manifest checking:
    For Multi-Manifest Indicator = Y?:
    When evaluating manifest requirements, then if multi-manifest-ind equals 'y', set multi-bill shipment flag and process n10 data, otherwise set not-multi-bill shipment flag.
  • Context - multi-manifest shipment with matching cargo control number found:
    For 18:Process Multi-Bill N10 Data:
    When processing n10 lading data, then extract numeric quantity from right to left, pad with leading zeros, set lading quantity and origin country, and collect description lines.
  • Context - lading description processing is required:
    For 19:Process Lading Descriptions:
    When building cargo descriptions, then collect primary descriptions from l5 segments, additional descriptions from related records, special instructions with codes 'va', 'vs', or 'ev', and vehicle identification numbers.
  • Context - description data has been collected and is not empty:
    For 19:Process Lading Descriptions:
    When finalizing description processing, then call gcccomp to compress descriptions, move compressed result to lading description field, and if extra descriptions exist, call gccdesc to store them separately.
  • Context - shipment processing is complete:
    For 27:Process CSA Data:
    When checking for csa requirements, then if destination road number is 105 (canada) and haulage right carrier is empty, proceed with csa data processing.
  • Context - csa processing is required and edi bol importer segment is found:
    For 27:Process CSA Data:
    When validating importer information, then if entity id is 'im' with non-empty name and id code qualifier is 'm5' with non-empty id code, set csa indicator on and copy importer data; if qualifier is 'bn' or 'ai', only copy importer data without setting csa indicator.
  • Context - csa processing is required but edi bol importer segment is not found:
    For 27:Process CSA Data:
    When searching fastway data for csa information, then search for 'n1-01 im' segments followed by 'n1-02' importer name, 'n1-03' qualifier ('m5', 'bn', or 'ai'), and 'n1-04' business number; set csa indicator on only for 'm5' qualifier.
  • Context - a waybill key is provided for cargo manifest processing:
    For Waybill Key Valid?:
    When the system validates the waybill key format and retrieves shipment data, then if the waybill key is blank or non-numeric, set return status to invalid waybill key. if the waybill key is valid but no shipment is found, set return status to waybill not found. if the waybill key is valid and shipment exists, set return status to ok.
  • Context - importer name, business number, and business number qualifier are all provided:
    For Importer Data Backup:
    When the system searches through customs records sequence 3 to 24 for existing importer data, then for each sequence, retrieve customs record type 55. if entity id equals 'im', extract all importer details including name, address, contact information, and csa indicator. set importer found flag and clear importer fields from input.
  • Context - a waybill date is available from the shipment root:
    For Border Arrival Date Calculation:
    When the system calculates the border arrival eta using the date calculation service, then add the configured number of days to the waybill date to determine border arrival eta. if the date calculation fails, add an error message for invalid waybill date.
  • Context - origin and destination station information from shipment data:
    For Station Information Retrieval:
    When the system validates station names and state codes, then if origin station name is blank, add error message for invalid origin station name. if origin station state code is blank, add error message for invalid origin province/state code, otherwise determine origin country from state code lookup. if destination station name is blank, add error message for invalid destination station name.
  • Context - an action code and multi-manifest indicator from the request:
    For Manifest Port Determination:
    When the system determines manifest port requirements, then if action is iis-a6 or multi-manifest indicator equals 'y' and manifest from port is blank, set manifest from port to 'iis-a6'. if action is iis-a6 or multi-manifest indicator equals 'y' and manifest to port is blank, set manifest to port to 'iis-a6'.
  • Context - a ccn with type '9' and manifest port information:
    For Special Port Code Processing:
    When the system evaluates special port processing conditions, then if ccn type equals '9' and us exit code is not '00000' or manifest from station is not 'iis-a6' or manifest to station is not 'iis-a6' or manifest stations are different, force both manifest from and to stations to 'iis-a6'.
  • Context - manifest from and to port names requiring customs code validation:
    For Customs Code Validation:
    When the system looks up ports in the mc table and validates customs codes, then for manifest from port: if lookup successful but canadian customs code equals '00000', add error for invalid canadian customs code. if lookup fails, add error for invalid manifest port. for manifest to port: if blank, set error flag 1. if lookup successful but canadian customs code equals '00000', set error flag 2. if lookup fails, set error flag 3.
  • Context - manifest to station name and destination country information:
    For Sub-location Code Determination:
    When the system determines sub-location code requirements, then if manifest to station equals 'iis-a6' and destination is not us, lookup destination station in cm table to get port manifest information and set sub-location code from lookup results.
  • Context - consignee chop code and destination station number:
    For Bonded Siding Location Check:
    When the system looks up the consignee in the rf bonded siding table, then if consignee is found in rf table, set customer bonded status to true and get sub-location code from rf record. if consignee is not found in rf table, set customer bonded status to false.
  • Context - sub-location code, csa indicator, manifest station information, destination country, and arrival indicator:
    For Sub-location Requirement Validation:
    When the system evaluates sub-location code requirements, then if sub-location code is present or (sub-location code is blank and (csa indicator is on or manifest stations are the same but not 'iis-a6' or destination is us or arrival indicator is 'y')), continue processing. otherwise, set sub-location error flag.
  • Context - conveying car initial and number from shipment data, and tofc/cofc indicator:
    For Conveying Car Processing:
    When the system processes conveying car information, then if conveying car initial is present, use conveying car data from shipment. if conveying car initial is blank and tofc/cofc indicator equals 't' or 'c', set default conveying car to 'unkn' and '00000001'. if conveying car initial is blank and not tofc/cofc, clear conveying car fields.
  • Context - a conveying car initial that is not blank:
    For Equipment Validation:
    When the system validates the car id using the gcccarid service, then call gcccarid service to validate the conveying car. if validation returns all asterisks, add error message for invalid conveying car. if validation succeeds, update conveying car with validated value.
  • Context - previous carrier number and previous cargo control number from shipment data:
    For Previous Carrier Control Processing:
    When the system processes previous carrier control information, then if previous carrier number is not '0000' and not blank, combine previous carrier number (positions 1-4) with previous cargo control number (positions 5-21) to form complete previous ccn.
  • Context - edi bol commodity data or fastway shipment commodity data:
    For Weight and Quantity Roll-up:
    When the system rolls up weight and quantity information, then for each commodity sequence 1-98, retrieve edi commodity data and add lading quantity to total units. for first sequence, get weight data and set weight unit based on metric indicator. if no edi data found, retrieve fastway commodity data using gu then gn functions, adding units and weight from each commodity record.
  • Context - equipment load/empty status and current quantity qualifier:
    For Quantity Qualifier Setting:
    When the system determines the appropriate quantity qualifier, then if equipment status is 'e' (empty), set quantity qualifier to 'unt'. if equipment is loaded and quantity qualifier indicates carload ('c/l', 'cld', 'cl ', ' cl'), set quantity qualifier to 'pcs'. if quantity qualifier is blank, default to 'pcs'.
  • Context - edi bol special handling data:
    For Consolidated Load Indicator Retrieval:
    When the system checks for consolidated load indicators, then for each special handling sequence 1-98, retrieve edi special handling data. if special handling code equals 'cns', set consolidated indicator to 'y'. if no cns code found, set consolidated indicator to blank.
  • Context - shipper information from shipment root data:
    For Shipper Data Extraction:
    When the system extracts and validates shipper data, then extract shipper chop, name, and address from shipment data. if shipper name is blank, add error message for invalid shipper name. if shipper address line 1 is blank, set to 'na'. process address line 2 with special formatting rules and set default country to 'us' if address is incomplete.
  • Context - consignee information from shipment root data:
    For Consignee Data Extraction:
    When the system extracts and validates consignee data, then extract consignee name, chop, and address from shipment data. if consignee name is blank, add error message for invalid consignee name. if consignee address line 1 is blank, set to 'na'. process address line 2 with special formatting rules and set default country to 'ca' if address is incomplete.
  • Context - state/province codes for shipper and consignee addresses:
    For Address Validation:
    When the system validates address information, then for each address with state/province code, search state-country table to find matching entry and set corresponding country code. if state/province code is not found in table, add error message for invalid state/province code and leave country code blank.
  • Context - address fields that may be blank or incomplete:
    For Default Address Setting:
    When the system processes address information, then if address line 1 is blank, set to 'na'. if address line 2 is blank or has only first character with remaining 18 characters blank, set first 18 characters to 'na' and set appropriate default country code.
  • Context - commodity descriptions from shipment commodity data, shipment root free-form descriptions, and special handling instructions:
    For Commodity Description Building:
    When the system builds the complete commodity description, then extract descriptions from 10 commodity description fields and 2 free-form description fields. for special handling codes 'va', 'ev', or 'vs', combine handling code with handling instruction and add to description in available special handling description slots (up to 3 slots).
  • Context - complete description data assembled from various sources:
    For Description Data Compression:
    When the system compresses the description data, then call gcccomp service with 45000 byte source description and 22500 byte target description lengths. move compressed description to cargo record lading description field. distribute compressed description data across 46 cargo data segments in customs record 53.
  • Context - potential hazardous material data from edi bol, fastway shipment, or commodity master:
    For Hazardous Material Processing:
    When the system processes hazardous material information, then first check edi hazmat data for un numbers and proper shipping names. if not found in edi, check fastway emergency response data for un codes. if still not found, lookup commodity master for hazmat classification and un numbers. extract un number and commodity description for dangerous goods.
  • Context - bill of lading data and potential multiple ccn requirements:
    For Bill of Lading Processing:
    When the system processes bill of lading information using gcccbol service, then call gcccbol service with cargo record, customs records, and shipment data. if multiple ccn array is returned with data, process each ccn in the array (up to 99) and spawn gct0111e process for each additional manifest with waybill key, waybill date, ccn, and action code 'am'.
  • Context - csa indicator status, au table data availability, and existing importer information:
    For Importer Data Processing:
    When the system determines importer data source and processing, then if csa indicator is on or au table is blank or existing importer data is present, continue with current importer data. otherwise, if au table contains importer and business number, use au importer data, set business number qualifier to 'm5', and turn on csa indicator.
  • Context - in-transit status (transit or return) and csa indicator status:
    For CSA Indicator Management:
    When the system processes csa indicator for transit shipments, then if in-transit status is transit or return and csa indicator is on, turn off csa indicator, set au importer not found flag, and clear importer name, business number qualifier, and business number fields.
  • Context - action code of 'us' or 'rt' and a description source ccn provided:
    For Description Capture from Related CCN:
    When the system captures description from the related ccn, then retrieve description data from specified ccn using gccccio2 service. if successful, extract lading description and cargo data. for 'us' action, prepend ccn and ' moving in transit through canada ' to description. for 'rt' action, prepend ccn and ' moving in transit through us ' to description. compress modified description and update cargo records.
  • Context - origin and destination station state codes:
    For Country Code Determination:
    When the system determines country codes, then for origin station state code, search state-country table to find matching entry and set origin country. for destination station state code, search state-country table to find matching entry and set destination country. if no match found, leave country code blank.
  • Context - notify party name and consignee country code:
    For Notify Party Country Setting:
    When the system processes notify party information, then if notify party name is not blank, copy consignee country code to notify party country code field.
  • Context - origin country and destination country codes:
    For Application Type Determination:
    When the system determines application type, then search application type table using origin-destination country combination. if match found, set application type code and in-transit status from table entry. if ccn key starts with '6105e' and in-transit status is ocean, set broker name to 'not-req'.
  • Context - action code not 'rt' or 'us' and ccn key starting with '6105e' or '6105p':
    For Broker Information Retrieval:
    When the system retrieves broker information, then call gcccros2 service with shipper chop, consignee chop, origin station, destination station, origin splc wildcard, destination road number, and commodity code. if no data found, retry with shipper chop and origin station wildcards. if still no data found, retry with commodity code wildcard.
  • Context - broker data from crossing table lookup and existing broker information:
    For Broker Data Validation:
    When the system validates and applies broker data, then if crossing table data found and override flag equals 'y', apply broker data. if crossing table data found and override flag not 'y', apply broker data only if current broker name is blank, 'unknown', or 'not-req'. if broker specifies canadian manifest to station, update manifest to station information and validate customs codes.
  • Context - action code of 'rt' (return) or 'us' (transit):
    For Customs 2000 Detour Processing:
    When the system processes transit/return actions, then set broker name to 'not-req' and clear broker name 2. for 'rt' action: set in-transit status to return, application type to '33', clear destination station information, and update origin station from port lookup. for 'us' action: set in-transit status to transit and application type to '33'.
  • Context - in-transit status determination and ccn key information:
    For In-Transit Status Setting:
    When the system sets in-transit status and manages indexes, then if in-transit status is return, clear destination station index, destination station index station, and error/release status index. if ccn key does not start with '6105e', set in-transit status to local and clear destination station and error/release status indexes.
  • Context - edi bol shipper data or fastway shipment shipper data:
    For Shipper Record Building:
    When the system builds the shipper customs record, then set entity id to 'sh', sequence to '0001'. if edi shipper data found, use consignor name and shipper chop from edi, get address from edi address segments, get contact information from edi contact segments. if edi data not found, use shipper data from fastway shipment root. validate all segments and insert customs record.
  • Context - edi bol consignee data or fastway shipment consignee data:
    For Consignee Record Building:
    When the system builds the consignee customs record, then set entity id to 'cn', sequence to '0002'. if edi consignee data found, use shipper name and consignee chop from edi, get address from edi address segments, get contact information from edi contact segments. if edi data not found, use consignee data from fastway shipment root. validate all segments and insert customs record.
  • Context - edi transportation data or fastway shipment data for various entity types:
    For N1 Entity Segment Building:
    When the system builds n1 entity segments, then for each entity type (sf, uc, bn, c1, n1, pf, ss, 11, mc, oo, fw, nn), search edi transportation data for matching organization id. if found, extract entity information, address data, and contact information. build complete n1 segment with entity id, name, address, and contact details. validate segment data and insert customs record with appropriate sequence number.
  • Context - contact information from edi or fastway data sources:
    For Contact Information Processing:
    When the system processes contact information for entity records, then extract contact function code, contact name, communication number qualifier, and communication number. validate communication qualifier is blank, 'fx', or 'te'. if contact information is incomplete, generate appropriate error messages for missing required fields.
  • Context - completed customs record 55 data with ccn key, record type, and sequence number:
    For Customs Record 55 Insertion:
    When the system inserts customs record 55, then if sequence index is within maximum sequence limit, set ccn key, record type to '55', and sequence number. move complete record to customs record array and increment sequence index. validate all required fields before insertion.
  • Context - edi importer data, au table importer data, or backed up importer information:
    For Importer Segment Building:
    When the system builds the importer segment, then if edi importer data found, create importer record with edi details and manage csa indicator based on business number qualifier. if edi data not found but backed up importer data exists, use backed up data. if au table data found and no other importer data, create importer record from au table with business number qualifier 'm5' and turn on csa indicator.
  • Context - a cargo processing request is received with an action type:
    For Action Type?:
    When the system evaluates the action type, then the system routes to release processing if action is release, routes to cancel release processing if action is cancel-release, or continues without action for any other action type.
  • Context - a container control number key is provided for cargo processing:
    For Manifest Data Retrieval:
    When the system attempts to retrieve the corresponding manifest data, then the system loads the manifest record if found, or displays error message 'can not locate manifest for release/cancel release' if the manifest cannot be located.
  • Context - a cargo release request is initiated:
    For Manifest Release Processing:
    When the system processes the manual release, then the system sets message id to gcw123, sets manual release flag to true, copies the ccn key, clears the release quantity field, and moves the release reason to comments.
  • Context - a cancel release operation is being processed:
    For CSA Cargo Status Management:
    When the csa indicator is on, then the system sets the cargo status to csa-dlv (csa delivery).
    For Release Audit Trail Creation:
    When the system creates audit trail data, then the system records current machine date as unreleased date, captures acf2 user id as the user who performed cancel, saves original release date, clears release information, and sets the unrelease reason.
    For Master Manifest Processing:
    When the manifest is identified as a master manifest, then the system calls gcccanrl program with cccom and ccn key parameters for additional cancel release processing.
  • Context - a cancel release operation is being processed and csa indicator is off:
    For Manifest Status Determination:
    When the system evaluates the original ccn and manifest type, then the system sets status to manual if original ccn is blank or it's a follower manifest, otherwise sets status to sent.
  • Context - a cancel release operation requires station information:
    For Station Information Lookup:
    When the system performs station lookup using manifest destination station name, then the system uses station number from lookup table if successful (return flag = '0'), otherwise uses existing destination station number and initializes station data.
  • Context - a cancel release operation is processing cargo with in-transit status:
    For In-Transit Status Management:
    When the in-transit status is 'z' or 'e', then the system changes the in-transit status to local.
  • Context - a cancel release operation has been processed:
    For Cargo Release Logging:
    When the system creates audit log entry, then the system initializes logging input, sets action code to log-cargo-release-removed, and spawns gct1051e message with security information, ccn key, cargo type ca-cargo, transaction details, user id and timestamp.
  • Context - a cargo release has been processed:
    For Release Notification Generation:
    When the operation is not an export operation, then the system generates and sends gct1231e notification message with release details.
  • Context - cargo processing operations have been completed:
    For Manifest Data Update:
    When the system finalizes the transaction, then the system updates the manifest record with all changes made during processing using repl function.
  • Context - a ccn key is provided for manifest processing:
    For 2:Initialize manifest data retrieval:
    When the system initializes manifest data retrieval, then the system should fetch all manifest segments and set up data structures for processing.
  • Context - an action code is provided in the input parameters:
    For 3:Action Code Processing:
    When the system processes the action code, then the system should store the action code for use in subsequent manifest processing steps.
  • Context - a manifest has commodity and origin country information:
    For 4:Automotive Release Check:
    When the origin country is us, ca, or blank or the origin country is mx with automotive type code 'c' in position 2, and the csa indicator is off, then the system should set the automotive flag to true.
  • Context - a manifest is being processed with broker notification enabled:
    For 33:Broker Notification Processing:
    When the notify broker flag is set to true, then the system should prepare broker message with action code 'zzz' and spawn gct1051e transaction.
  • Context - a transaction type is specified for processing:
    For 5:Transmission Number Generation:
    When the transaction type is 'gct036', 'gct0021e', 'gct1251e', 'gct0111e', or other, then the system should assign transmission prefix 036, 002, 125, 011, or 901 respectively.
  • Context - a manifest requires customs notification:
    For 6:Destination Address Setup:
    When the notify customs flag is true and the manifest is not a pre-emanifest, then the system should set destination to 309-destination-5040, otherwise set to 309-destination.
  • Context - a transmission number is generated:
    For 7:Root Transaction Creation:
    When the system creates the root transaction, then the system should create transaction root with transmission number, transaction set '309', and handle duplicate transmission numbers by incrementing.
  • Context - a transaction is being processed:
    For 8:ST Segment Processing:
    When the st segment is created, then the system should create st segment with identifier 'st', destination address, and transaction code '309'.
  • Context - a manifest is being processed with arrival and program information:
    For 9:M10 Segment Processing:
    When the arrival indicator is 'y' or program name is 'gcx148', then the system should set manifest type code to 'a' for arrival, otherwise evaluate canadian customs train id and program name to set 'c' for customs or 'p' for pre-manifest, with special case of spaces for 5040 destination.
  • Context - a manifest has an action code and border arrival information:
    For 9:M10 Segment Processing:
    When the action code is '04', '05', or '06' and border arrival date is not blank and manifest is not pre-emanifest, then the system should set transaction purpose code to 'co' and set post-emanifest amendment flag to true, otherwise use the action code as transaction purpose code.
  • Context - a manifest requires eta date processing:
    For 10:P4 Segment Processing:
    When the destination is 309-destination, then the system should use current machine date, otherwise use border arrival eta or calculate from waybill date plus configured days if eta is blank.
  • Context - a transaction requires line number identification:
    For 11:LX Segment Processing:
    When the lx segment is processed, then the system should create lx segment with identifier 'lx' and assigned number '000001'.
  • Context - a post-emanifest amendment is required:
    For 12:M13 Segment Processing:
    When the m13 segment is processed, then the system should create m13 segment with scac 'cprs', manifest from station name, ccn key, and amendment code '60' if blank or use existing amendment code.
  • Context - a manifest has consolidated shipment information:
    For 13:M11 Segment Processing:
    When the consolidated indicator is 'y', then the system should set bill of lading type code to 'y', otherwise set to spaces.
  • Context - a manifest has weight unit qualifier information:
    For 13:M11 Segment Processing:
    When the weight unit qualifier is 'kg ' or ' kg', then the system should set weight unit code to 'k', otherwise set to 'l'.
  • Context - a manifest has csa indicator information:
    For 14:N9 Reference Processing:
    When the csa indicator is on, then the system should set reference number to '01', otherwise set to '00'.
  • Context - a manifest has in-transit status and origin country information:
    For 14:N9 Reference Processing:
    When the in-transit status is 't' or (status is 'l' and origin country is not 'ca' and table lookup is successful) or (status is 'e' and origin country is not 'ca'), then the system should create n9 segment with qualifier 'kd' and reference number 'in-transit'.
  • Context - entity information is being processed for a specific destination type:
    For 15:N1-N3-N4 Entity Processing:
    When the destination is 309-destination, then the system should validate n1 codes against 4040 table, otherwise validate against 5040 table and require city name, country code, and postal/state codes for us/ca addresses.
  • Context - a manifest requires in-bond processing:
    For 18:M12 Segment Processing:
    When the m12 segment is created, then the system should set in-bond type code to '61'.
  • Context - port information is being processed for different locations:
    For 19:R4 Port Processing:
    When multiple r4 segments are created for origin, border crossing, and destination, then the system should assign function codes 'o'/'j' for origin (based on destination type), '3' for border crossing, '4' for destination border, and 'e'/'r' for final destination (based on destination type).
  • Context - equipment information is being processed:
    For 20:VID Equipment Processing:
    When the conveying car field is blank, then the system should set equipment description code to 'rr' for railroad, otherwise set to 'cn' for container.
  • Context - a manifest is being processed with a specific destination type:
    For Destination Type?:
    When the destination type is 5040, then the system should skip m7 seal processing and proceed to n10 description processing, otherwise process m7 seals first.
  • Context - a manifest has seal number information:
    For 21:M7 Seal Processing:
    When seal numbers are available in the manifest data, then the system should create m7 segments with up to 4 seal numbers per segment, processing up to 20 total seal numbers.
  • Context - a manifest is being processed with equipment information:
    For 22:N10 Description Processing:
    When an idler car is found in the shipment, then the system should set quantity to zero for the n10 segment, otherwise use the lading quantity from the manifest.
  • Context - a manifest has commodity information:
    For Hazardous Material?:
    When the un number is blank or starts with 'na' or commodity description danger field is blank, then the system should skip hazardous material processing, otherwise process h1-h2 segments.
  • Context - hazardous material information is being processed:
    For 24:H1-H2 Hazardous Material Processing:
    When the destination is 309-destination, then the system should use the full un number, otherwise use positions 3-4 of the un number.
  • Context - a manifest is classified as an idler shipment:
    For Idler Shipment?:
    When the manifest is an idler shipment and customs notification is required, then the system should process additional idler cars in the consist.
  • Context - an idler shipment requires processing of follower cars:
    For 25:Idler Car Processing:
    When additional idler cars are found in the consist, then the system should process vid segments for each idler car and include n10 and h1-h2 segments based on destination type and hazardous material presence.
  • Context - all required segments have been processed:
    For 30:Transaction Completion:
    When the transaction completion phase is reached, then the system should finalize the edi transaction structure.
  • Context - a transaction has been completed:
    For 34:Transaction Completion Notification:
    When the transaction completion notification is triggered, then the system should spawn gct1211e transaction with the transmission number.
  • Context - the program is executing and the first-time processing flag is set:
    For 2:Process Merlin Configuration:
    When the system checks if this is the first oti processing, then the system processes merlin configuration, validates merlin ids, and initializes reference data, then sets the flag to indicate subsequent processing.
  • Context - four merlin user ids are retrieved from the admin table (dc-p-merlin-1 through 4):
    For 3:Control Merlin ID Validation:
    When each merlin id is validated against the emtz segment, then if dc-p-merlin-1 is invalid, use default 'om01247' and set not-found flag; for other invalid ids (2,3,4), fall back to dc-p-merlin-1 value.
  • Context - a reference number and transaction type indicator are provided:
    For 4:Initialize Reference Data:
    When the system initializes reference data and processing flags, then set message label to 'train report number :' for train transactions, 'cargo control number :' for cargo transactions, or 'reference number :' for other types.
  • Context - an incoming message with a specific type indicator:
    For Message Type?:
    When the system evaluates the message type, then route to acknowledgment processing for ack messages, or route to error processing for error and warning messages.
  • Context - an acknowledgment message is received:
    For 5:Process Acknowledgment Messages:
    When the system processes the acknowledgment, then set mst processing flag to false and route to train or cargo acknowledgment processing based on transaction type.
  • Context - a train acknowledgment message with a reference number:
    For 6:Process Train Acknowledgment:
    When the system looks up the train report, then if train not found, set error flag and add error message; if found, clear security errors for deleted records, set ack status with timestamp, and send aei notification if flag is 'y'.
  • Context - a cargo acknowledgment message with a control number:
    For 7:Process Cargo Acknowledgment:
    When the system looks up the cargo control record, then if cargo not found, add error message and set dcp interface error flag; if found, set status to 'ack' when current status is 'sent', determine processing terminal, and process arrival if indicator is 'y'.
  • Context - an error or warning message is received:
    For 8:Process Error Messages:
    When the system processes the error message, then check if message is test data first; if not test data, route to train or cargo error processing based on transaction type.
  • Context - a train error message with a reference number:
    For 9:Process Train Errors:
    When the system processes the train error, then if train not found, add appropriate error message (v67 warning or general train error); if found, determine processing terminal and handle v67 warnings specially.
  • Context - a cargo error message with a control number:
    For 10:Process Cargo Errors:
    When the system processes the cargo error, then if cargo not found and message is v67, process as train error; if cargo not found and not v67, add cargo error message; if found, save current status and determine processing terminal.
  • Context - an error code from the message:
    For 11:Retrieve Error Message Text:
    When the system looks up the error message text in the ms table, then if message found, use english text from table; if not found, use free-form message text and add 'message not found' error.
  • Context - an error message with error type and a found train or cargo record:
    For 12:Update Train/Cargo Status:
    When the system updates the record status, then if error type is 'x', set status to 'warning' or 'info' and exit; for train records not deleted, set error resend flag and status to 'reject' for type 'r' or 'error' otherwise; for cargo records, set status to 'reject' for type 'r' or 'error' otherwise.
  • Context - a message with a reference number:
    For Test Message?:
    When the system checks if the message is test data, then identify as train test if reference equals '6105etesttrain00000000000', or cargo test if reference starts with '6105ecprstestcargo' or '6105etestcargo'.
  • Context - a message identified as test data:
    For 13:Handle Test Messages:
    When the system processes the test message, then set appropriate test flags (test-train or test-cargo) and proceed to special check processing, bypassing normal error message handling.
  • Context - a train record with aei send flag set to 'y' and a status change:
    For 14:Send AEI Messages:
    When the system processes the train acknowledgment or status update, then look up email addresses for the port code, send notification with train id and status, and fall back to default recipients if lookup fails.
  • Context - messages need to be sent to users:
    For 15:Process Message Routing:
    When the system processes message routing, then get supervisor merlin id from terminal table, validate dc-p merlin ids, and prepare for sending messages to mst system and merlin users.
  • Context - a processing terminal identifier:
    For 16:Get Supervisor Merlin ID:
    When the system looks up supervisor information in the lt table, then if table entry found, use alternate terminal if specified and retrieve supervisor merlin id; if supervisor id invalid, add error message and clear user merlin id.
  • Context - dc-p merlin id needs validation for message sending:
    For 17:Validate Merlin User IDs:
    When the system validates the merlin user id, then if dc-p1 id not found, add error message indicating invalid dc&p merlin userid.
  • Context - an error message that needs to be sent to users:
    For Train Error?:
    When the system determines the routing destination, then route to train message sending if train error flag is set, otherwise route to cargo message sending.
  • Context - a cargo-related message and validated user merlin id:
    For 18:Send Cargo Messages to Merlin:
    When the system sends the message to merlin users, then send message to user merlin id; if sending fails, fall back to sending to default recipient 'om01247'.
  • Context - a train-related message and validated user merlin id:
    For 19:Send Train Messages to Merlin:
    When the system sends the message to merlin users, then send message to user merlin id with fallback to 'om01247' if failed, and additionally send a copy to 'caerror' file with 'om01247' as recipient.
  • Context - messages ready for distribution and mst processing flag is enabled:
    For 20:Send MST Messages:
    When the system sends messages to mst, then send header message first, then send each message entry using terminal call letters, and finally send wrap-up message.
  • Context - a cargo record with arrival indicator set to 'y':
    For 21:Process Arrival Notifications:
    When the system processes the cargo acknowledgment, then create arrival notification message with cargo control number, set action code to 'caa', and send to gct1481e transaction.
  • Context - a cargo record with status change and iron highway configuration:
    For 22:Update Iron Highway Records:
    When the system updates the cargo record and status differs from saved status, then look up iron highway configuration, populate record with cargo details including status, car id, waybill, and shipment id from n9 segments, then call iron highway update program.
  • Context - a processed transaction with current status and reference number:
    For 24:Log Transaction Activities:
    When the system logs the transaction activity, then create log message with current status, include transaction number for ack status, set appropriate cargo or train indicator, and send to gct1051e logging transaction.
  • Context - a test message (train or cargo) being processed:
    For 25:Process Special Checks:
    When the system performs special check processing, then look up t2 table entry, update 358-ack timestamp for train test messages or 309-ack timestamp for cargo test messages with current machine date, century, and time.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN key is provided for processing
GIVEN
A CCN key is provided for processing
Applied to: 2:Get First Follower Manifest
WHEN
The system initializes follower manifest processing
THEN
The first follower manifest record matching the CCN key is retrieved and processing status is set based on record availability
Context: The system is processing follower manifest records
GIVEN
The system is processing follower manifest records
Applied to: More Follower Manifests?
WHEN
A database operation is performed to retrieve records
THEN
Processing continues if status code is spaces, otherwise processing stops
Context: A follower manifest record is retrieved
GIVEN
A follower manifest record is retrieved
Applied to: 4:Validate Manifest for Processing
WHEN
The system compares the manifest CCN key with the input CCN key
THEN
The manifest is processed only if the CCN keys are different, otherwise it is skipped
Context: A manifest is being processed for cancel release
GIVEN
A manifest is being processed for cancel release
Applied to: 6:Set Manifest Status Based on CSA Indicator
WHEN
The system checks the CSA indicator status
THEN
If CSA indicator is ON, status is set to CSA-DLV, otherwise status is set to MANUAL
Applied to: 11:Set Manual Change Flag
WHEN
The system updates manifest data
THEN
The 309 manual change flag is set to true
Context: A manifest is being cancelled
GIVEN
A manifest is being cancelled
Applied to: 7:Update Release Information
WHEN
The system updates release information
THEN
Current machine date is recorded as unrelease date, current user ID is recorded, original release date is preserved, release information is cleared, and unrelease reason is set
Context: A manifest has a destination station name
GIVEN
A manifest has a destination station name
Applied to: 8:Lookup Station Information
WHEN
The system performs station lookup using table ID 'MC'
THEN
If lookup is successful (return flag = '0'), station number from lookup is used, otherwise existing destination station number is retained
Context: A manifest has an in-transit status
GIVEN
A manifest has an in-transit status
Applied to: 9:Update In-Transit Status
WHEN
The in-transit status is 'Z' or 'E'
THEN
The in-transit status is changed to 'L'
Applied to: 10:Handle Special Transit Cases
WHEN
The in-transit status is 'R' or 'T'
THEN
The destination station number for index is cleared to spaces
Applied to: 9:M10 Segment Processing
WHEN
The in-transit status is 'T'
THEN
The system should set application type to '29', otherwise set to '27'
Context: A manifest is being processed
GIVEN
A manifest is being processed
Applied to: 12:Clear Delete Status
WHEN
The current status is not equal to 'DELETED'
THEN
The delete status field is cleared to spaces
Applied to: 1:Manifest from 66MASTER station?
WHEN
The manifest from station equals '66MASTER'
THEN
The system should exit processing immediately without performing any manifest operations
Applied to: 32:Post-Emanifest Amendment Flag?
WHEN
The post-emanifest amendment flag is set to true
THEN
The system should process the M13 amendment segment
Context: A manifest cancel release has been processed
GIVEN
A manifest cancel release has been processed
Applied to: 13:Log Cancel Release Activity
WHEN
The system logs the activity
THEN
An audit record is created with CCN key, user ID, current date and time, and cargo release removed action code
Context: Current follower manifest processing is complete
GIVEN
Current follower manifest processing is complete
Applied to: 15:Get Next Follower Manifest
WHEN
The system retrieves the next follower manifest
THEN
If status code is spaces and CCN key matches the master manifest CCN, processing continues, otherwise processing stops
Context: The cargo report program is starting
GIVEN
The cargo report program is starting
Applied to: 1:Initialize Program
WHEN
Program initialization begins
THEN
Description arrays are cleared to spaces, index counters are set to 1, and cargo control number array is initialized to spaces
Context: A valid shipment root key exists
GIVEN
A valid shipment root key exists
Applied to: 2:Get Shipment Root Data
WHEN
The system needs to access shipment root data
THEN
The SHIPROOT segment is retrieved using the root key with 'GU' function code
Context: Shipment mine data has been retrieved
GIVEN
Shipment mine data has been retrieved
Applied to: 4:Extract EDI BOL Key
WHEN
The system needs to identify the EDI BOL key
THEN
If shipment mine data is found, the first data line becomes the EDI BOL key, otherwise the key is set to spaces
Context: The system needs to identify the customs broker
GIVEN
The system needs to identify the customs broker
Applied to: 5:Build Broker Information
WHEN
Building broker information
THEN
First attempt to get broker from EDI BOL data, if not found then search Fastway system data, if still not found then set broker name to 'UNKNOWN'
Context: Multiple broker records exist in EDI BOL data
GIVEN
Multiple broker records exist in EDI BOL data
Applied to: 5:Build Broker Information
WHEN
Processing broker information from EDI BOL
THEN
If organization ID is 'XQ', use that broker name and stop searching; if organization ID is 'CB' and no XQ found yet and custom ID is not 'XR' or 'XU', store as temporary broker
Context: Broker name needs to be extracted from special handling instructions
GIVEN
Broker name needs to be extracted from special handling instructions
Applied to: 5:Build Broker Information
WHEN
Processing Fastway data for broker information
THEN
Remove standard prefixes ('CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', 'XQ ', 'CB: ', 'XQ: ') from the instruction text to get the actual broker name
Context: A broker long name has been determined
GIVEN
A broker long name has been determined
Applied to: 5:Build Broker Information
WHEN
Finalizing broker information
THEN
Look up the broker in GCST2RT table and if found use the short name, otherwise use the long name
Context: EDI BOL data is available and reference number processing is needed
GIVEN
EDI BOL data is available and reference number processing is needed
Applied to: 10:Build N9 Reference Numbers
WHEN
Building N9 reference numbers from BOL data
THEN
Search for 'BM' and 'SI' qualified reference numbers, set empty references to 'N/A', and add them to the reference array up to maximum of 10 entries
Context: Shipment data contains a non-empty shipment ID number
GIVEN
Shipment data contains a non-empty shipment ID number
Applied to: 10:Build N9 Reference Numbers
WHEN
Processing reference numbers from BOL data
THEN
Add the shipment ID as a 'CN' (Container Number) qualified reference to the reference array
Context: BM or SI reference numbers are missing from EDI BOL and space is available in reference array
GIVEN
BM or SI reference numbers are missing from EDI BOL and space is available in reference array
Applied to: 10:Build N9 Reference Numbers
WHEN
Building reference numbers
THEN
Use shipper bill number as 'BM' reference and search special handling codes for 'SI' type references
Context: Reference numbers may contain leading spaces
GIVEN
Reference numbers may contain leading spaces
Applied to: 15:Compress Reference Numbers
WHEN
Compressing reference number data
THEN
For each reference number that starts with spaces, shift all non-space characters to the left to remove leading spaces
Context: Equipment seal records exist with 'SN' type
GIVEN
Equipment seal records exist with 'SN' type
Applied to: 16:Build Seal Numbers
WHEN
Building seal number information
THEN
Extract up to 4 seal numbers from each record, excluding spaces and low-values, up to a maximum of 20 total seal numbers
Context: Shipment processing is in progress
GIVEN
Shipment processing is in progress
Applied to: Multi-Bill Shipment?
WHEN
Determining processing path
THEN
If GCCC-MULTI-BILL-TO-BE-CREATED flag is true, proceed with multi-bill CCN processing
Context: Multi-bill processing is required and EDI BOL data exists
GIVEN
Multi-bill processing is required and EDI BOL data exists
Applied to: 17:Find Multi-Bill CCNs
WHEN
Finding related cargo control numbers
THEN
Search 'RF' type records for 'XC' qualified cargo control numbers and add them to the CCN array, excluding the current cargo control number
Context: Shipment processing requires manifest checking
GIVEN
Shipment processing requires manifest checking
Applied to: Multi-Manifest Indicator = Y?
WHEN
Evaluating manifest requirements
THEN
If MULTI-MANIFEST-IND equals 'Y', set multi-bill shipment flag and process N10 data, otherwise set not-multi-bill shipment flag
Context: Multi-manifest shipment with matching cargo control number found
GIVEN
Multi-manifest shipment with matching cargo control number found
Applied to: 18:Process Multi-Bill N10 Data
WHEN
Processing N10 lading data
THEN
Extract numeric quantity from right to left, pad with leading zeros, set lading quantity and origin country, and collect description lines
Context: Lading description processing is required
GIVEN
Lading description processing is required
Applied to: 19:Process Lading Descriptions
WHEN
Building cargo descriptions
THEN
Collect primary descriptions from L5 segments, additional descriptions from related records, special instructions with codes 'VA', 'VS', or 'EV', and vehicle identification numbers
Context: Description data has been collected and is not empty
GIVEN
Description data has been collected and is not empty
Applied to: 19:Process Lading Descriptions
WHEN
Finalizing description processing
THEN
Call GCCCOMP to compress descriptions, move compressed result to lading description field, and if extra descriptions exist, call GCCDESC to store them separately
Context: Shipment processing is complete
GIVEN
Shipment processing is complete
Applied to: 27:Process CSA Data
WHEN
Checking for CSA requirements
THEN
If destination road number is 105 (Canada) and haulage right carrier is empty, proceed with CSA data processing
Context: CSA processing is required and EDI BOL importer segment is found
GIVEN
CSA processing is required and EDI BOL importer segment is found
Applied to: 27:Process CSA Data
WHEN
Validating importer information
THEN
If entity ID is 'IM' with non-empty name and ID code qualifier is 'M5' with non-empty ID code, set CSA indicator ON and copy importer data; if qualifier is 'BN' or 'AI', only copy importer data without setting CSA indicator
Context: CSA processing is required but EDI BOL importer segment is not found
GIVEN
CSA processing is required but EDI BOL importer segment is not found
Applied to: 27:Process CSA Data
WHEN
Searching Fastway data for CSA information
THEN
Search for 'N1-01 IM' segments followed by 'N1-02' importer name, 'N1-03' qualifier ('M5', 'BN', or 'AI'), and 'N1-04' business number; set CSA indicator ON only for 'M5' qualifier
Context: A waybill key is provided for cargo manifest processing
GIVEN
A waybill key is provided for cargo manifest processing
Applied to: Waybill Key Valid?
WHEN
The system validates the waybill key format and retrieves shipment data
THEN
If the waybill key is blank or non-numeric, set return status to invalid waybill key. If the waybill key is valid but no shipment is found, set return status to waybill not found. If the waybill key is valid and shipment exists, set return status to OK
Context: Importer name, business number, and business number qualifier are all provided
GIVEN
Importer name, business number, and business number qualifier are all provided
Applied to: Importer Data Backup
WHEN
The system searches through customs records sequence 3 to 24 for existing importer data
THEN
For each sequence, retrieve customs record type 55. If entity ID equals 'IM', extract all importer details including name, address, contact information, and CSA indicator. Set importer found flag and clear importer fields from input
Context: A waybill date is available from the shipment root
GIVEN
A waybill date is available from the shipment root
Applied to: Border Arrival Date Calculation
WHEN
The system calculates the border arrival ETA using the date calculation service
THEN
Add the configured number of days to the waybill date to determine border arrival ETA. If the date calculation fails, add an error message for invalid waybill date
Context: Origin and destination station information from shipment data
GIVEN
Origin and destination station information from shipment data
Applied to: Station Information Retrieval
WHEN
The system validates station names and state codes
THEN
If origin station name is blank, add error message for invalid origin station name. If origin station state code is blank, add error message for invalid origin province/state code, otherwise determine origin country from state code lookup. If destination station name is blank, add error message for invalid destination station name
Context: An action code and multi-manifest indicator from the request
GIVEN
An action code and multi-manifest indicator from the request
Applied to: Manifest Port Determination
WHEN
The system determines manifest port requirements
THEN
If action is IIS-A6 or multi-manifest indicator equals 'Y' and manifest from port is blank, set manifest from port to 'IIS-A6'. If action is IIS-A6 or multi-manifest indicator equals 'Y' and manifest to port is blank, set manifest to port to 'IIS-A6'
Context: A CCN with type '9' and manifest port information
GIVEN
A CCN with type '9' and manifest port information
Applied to: Special Port Code Processing
WHEN
The system evaluates special port processing conditions
THEN
If CCN type equals '9' and US exit code is not '00000' or manifest from station is not 'IIS-A6' or manifest to station is not 'IIS-A6' or manifest stations are different, force both manifest from and to stations to 'IIS-A6'
Context: Manifest from and to port names requiring customs code validation
GIVEN
Manifest from and to port names requiring customs code validation
Applied to: Customs Code Validation
WHEN
The system looks up ports in the MC table and validates customs codes
THEN
For manifest from port: if lookup successful but Canadian customs code equals '00000', add error for invalid Canadian customs code. If lookup fails, add error for invalid manifest port. For manifest to port: if blank, set error flag 1. If lookup successful but Canadian customs code equals '00000', set error flag 2. If lookup fails, set error flag 3
Context: Manifest to station name and destination country information
GIVEN
Manifest to station name and destination country information
Applied to: Sub-location Code Determination
WHEN
The system determines sub-location code requirements
THEN
If manifest to station equals 'IIS-A6' and destination is not US, lookup destination station in CM table to get port manifest information and set sub-location code from lookup results
Context: Consignee chop code and destination station number
GIVEN
Consignee chop code and destination station number
Applied to: Bonded Siding Location Check
WHEN
The system looks up the consignee in the RF bonded siding table
THEN
If consignee is found in RF table, set customer bonded status to TRUE and get sub-location code from RF record. If consignee is not found in RF table, set customer bonded status to FALSE
Context: Sub-location code, CSA indicator, manifest station information, destination country, and arrival indicator
GIVEN
Sub-location code, CSA indicator, manifest station information, destination country, and arrival indicator
Applied to: Sub-location Requirement Validation
WHEN
The system evaluates sub-location code requirements
THEN
If sub-location code is present OR (sub-location code is blank AND (CSA indicator is on OR manifest stations are the same but not 'IIS-A6' OR destination is US OR arrival indicator is 'Y')), continue processing. Otherwise, set sub-location error flag
Context: Conveying car initial and number from shipment data, and TOFC/COFC indicator
GIVEN
Conveying car initial and number from shipment data, and TOFC/COFC indicator
Applied to: Conveying Car Processing
WHEN
The system processes conveying car information
THEN
If conveying car initial is present, use conveying car data from shipment. If conveying car initial is blank and TOFC/COFC indicator equals 'T' or 'C', set default conveying car to 'UNKN' and '00000001'. If conveying car initial is blank and not TOFC/COFC, clear conveying car fields
Context: A conveying car initial that is not blank
GIVEN
A conveying car initial that is not blank
Applied to: Equipment Validation
WHEN
The system validates the car ID using the GCCCARID service
THEN
Call GCCCARID service to validate the conveying car. If validation returns all asterisks, add error message for invalid conveying car. If validation succeeds, update conveying car with validated value
Context: Previous carrier number and previous cargo control number from shipment data
GIVEN
Previous carrier number and previous cargo control number from shipment data
Applied to: Previous Carrier Control Processing
WHEN
The system processes previous carrier control information
THEN
If previous carrier number is not '0000' and not blank, combine previous carrier number (positions 1-4) with previous cargo control number (positions 5-21) to form complete previous CCN
Context: EDI BOL commodity data or FastWay shipment commodity data
GIVEN
EDI BOL commodity data or FastWay shipment commodity data
Applied to: Weight and Quantity Roll-up
WHEN
The system rolls up weight and quantity information
THEN
For each commodity sequence 1-98, retrieve EDI commodity data and add lading quantity to total units. For first sequence, get weight data and set weight unit based on metric indicator. If no EDI data found, retrieve FastWay commodity data using GU then GN functions, adding units and weight from each commodity record
Context: Equipment load/empty status and current quantity qualifier
GIVEN
Equipment load/empty status and current quantity qualifier
Applied to: Quantity Qualifier Setting
WHEN
The system determines the appropriate quantity qualifier
THEN
If equipment status is 'E' (empty), set quantity qualifier to 'UNT'. If equipment is loaded and quantity qualifier indicates carload ('C/L', 'CLD', 'CL ', ' CL'), set quantity qualifier to 'PCS'. If quantity qualifier is blank, default to 'PCS'
Context: EDI BOL special handling data
GIVEN
EDI BOL special handling data
Applied to: Consolidated Load Indicator Retrieval
WHEN
The system checks for consolidated load indicators
THEN
For each special handling sequence 1-98, retrieve EDI special handling data. If special handling code equals 'CNS', set consolidated indicator to 'Y'. If no CNS code found, set consolidated indicator to blank
Context: Shipper information from shipment root data
GIVEN
Shipper information from shipment root data
Applied to: Shipper Data Extraction
WHEN
The system extracts and validates shipper data
THEN
Extract shipper chop, name, and address from shipment data. If shipper name is blank, add error message for invalid shipper name. If shipper address line 1 is blank, set to 'NA'. Process address line 2 with special formatting rules and set default country to 'US' if address is incomplete
Context: Consignee information from shipment root data
GIVEN
Consignee information from shipment root data
Applied to: Consignee Data Extraction
WHEN
The system extracts and validates consignee data
THEN
Extract consignee name, chop, and address from shipment data. If consignee name is blank, add error message for invalid consignee name. If consignee address line 1 is blank, set to 'NA'. Process address line 2 with special formatting rules and set default country to 'CA' if address is incomplete
Context: State/province codes for shipper and consignee addresses
GIVEN
State/province codes for shipper and consignee addresses
Applied to: Address Validation
WHEN
The system validates address information
THEN
For each address with state/province code, search state-country table to find matching entry and set corresponding country code. If state/province code is not found in table, add error message for invalid state/province code and leave country code blank
Context: Address fields that may be blank or incomplete
GIVEN
Address fields that may be blank or incomplete
Applied to: Default Address Setting
WHEN
The system processes address information
THEN
If address line 1 is blank, set to 'NA'. If address line 2 is blank or has only first character with remaining 18 characters blank, set first 18 characters to 'NA' and set appropriate default country code
Context: Commodity descriptions from shipment commodity data, shipment root free-form descriptions, and special handling instructions
GIVEN
Commodity descriptions from shipment commodity data, shipment root free-form descriptions, and special handling instructions
Applied to: Commodity Description Building
WHEN
The system builds the complete commodity description
THEN
Extract descriptions from 10 commodity description fields and 2 free-form description fields. For special handling codes 'VA', 'EV', or 'VS', combine handling code with handling instruction and add to description in available special handling description slots (up to 3 slots)
Context: Complete description data assembled from various sources
GIVEN
Complete description data assembled from various sources
Applied to: Description Data Compression
WHEN
The system compresses the description data
THEN
Call GCCCOMP service with 45000 byte source description and 22500 byte target description lengths. Move compressed description to cargo record lading description field. Distribute compressed description data across 46 cargo data segments in customs record 53
Context: Potential hazardous material data from EDI BOL, FastWay shipment, or commodity master
GIVEN
Potential hazardous material data from EDI BOL, FastWay shipment, or commodity master
Applied to: Hazardous Material Processing
WHEN
The system processes hazardous material information
THEN
First check EDI hazmat data for UN numbers and proper shipping names. If not found in EDI, check FastWay emergency response data for UN codes. If still not found, lookup commodity master for hazmat classification and UN numbers. Extract UN number and commodity description for dangerous goods
Context: Bill of lading data and potential multiple CCN requirements
GIVEN
Bill of lading data and potential multiple CCN requirements
Applied to: Bill of Lading Processing
WHEN
The system processes bill of lading information using GCCCBOL service
THEN
Call GCCCBOL service with cargo record, customs records, and shipment data. If multiple CCN array is returned with data, process each CCN in the array (up to 99) and spawn GCT0111E process for each additional manifest with waybill key, waybill date, CCN, and action code 'AM'
Context: CSA indicator status, AU table data availability, and existing importer information
GIVEN
CSA indicator status, AU table data availability, and existing importer information
Applied to: Importer Data Processing
WHEN
The system determines importer data source and processing
THEN
If CSA indicator is on or AU table is blank or existing importer data is present, continue with current importer data. Otherwise, if AU table contains importer and business number, use AU importer data, set business number qualifier to 'M5', and turn on CSA indicator
Context: In-transit status (transit or return) and CSA indicator status
GIVEN
In-transit status (transit or return) and CSA indicator status
Applied to: CSA Indicator Management
WHEN
The system processes CSA indicator for transit shipments
THEN
If in-transit status is transit or return and CSA indicator is on, turn off CSA indicator, set AU importer not found flag, and clear importer name, business number qualifier, and business number fields
Context: Action code of 'US' or 'RT' and a description source CCN provided
GIVEN
Action code of 'US' or 'RT' and a description source CCN provided
Applied to: Description Capture from Related CCN
WHEN
The system captures description from the related CCN
THEN
Retrieve description data from specified CCN using GCCCCIO2 service. If successful, extract lading description and cargo data. For 'US' action, prepend CCN and ' MOVING IN TRANSIT THROUGH CANADA ' to description. For 'RT' action, prepend CCN and ' MOVING IN TRANSIT THROUGH US ' to description. Compress modified description and update cargo records
Context: Origin and destination station state codes
GIVEN
Origin and destination station state codes
Applied to: Country Code Determination
WHEN
The system determines country codes
THEN
For origin station state code, search state-country table to find matching entry and set origin country. For destination station state code, search state-country table to find matching entry and set destination country. If no match found, leave country code blank
Context: Notify party name and consignee country code
GIVEN
Notify party name and consignee country code
Applied to: Notify Party Country Setting
WHEN
The system processes notify party information
THEN
If notify party name is not blank, copy consignee country code to notify party country code field
Context: Origin country and destination country codes
GIVEN
Origin country and destination country codes
Applied to: Application Type Determination
WHEN
The system determines application type
THEN
Search application type table using origin-destination country combination. If match found, set application type code and in-transit status from table entry. If CCN key starts with '6105E' and in-transit status is ocean, set broker name to 'NOT-REQ'
Context: Action code not 'RT' or 'US' and CCN key starting with '6105E' or '6105P'
GIVEN
Action code not 'RT' or 'US' and CCN key starting with '6105E' or '6105P'
Applied to: Broker Information Retrieval
WHEN
The system retrieves broker information
THEN
Call GCCCROS2 service with shipper chop, consignee chop, origin station, destination station, origin SPLC wildcard, destination road number, and commodity code. If no data found, retry with shipper chop and origin station wildcards. If still no data found, retry with commodity code wildcard
Context: Broker data from crossing table lookup and existing broker information
GIVEN
Broker data from crossing table lookup and existing broker information
Applied to: Broker Data Validation
WHEN
The system validates and applies broker data
THEN
If crossing table data found and override flag equals 'Y', apply broker data. If crossing table data found and override flag not 'Y', apply broker data only if current broker name is blank, 'UNKNOWN', or 'NOT-REQ'. If broker specifies Canadian manifest to station, update manifest to station information and validate customs codes
Context: Action code of 'RT' (return) or 'US' (transit)
GIVEN
Action code of 'RT' (return) or 'US' (transit)
Applied to: Customs 2000 Detour Processing
WHEN
The system processes transit/return actions
THEN
Set broker name to 'NOT-REQ' and clear broker name 2. For 'RT' action: set in-transit status to RETURN, application type to '33', clear destination station information, and update origin station from port lookup. For 'US' action: set in-transit status to TRANSIT and application type to '33'
Context: In-transit status determination and CCN key information
GIVEN
In-transit status determination and CCN key information
Applied to: In-Transit Status Setting
WHEN
The system sets in-transit status and manages indexes
THEN
If in-transit status is RETURN, clear destination station index, destination station index station, and error/release status index. If CCN key does not start with '6105E', set in-transit status to LOCAL and clear destination station and error/release status indexes
Context: EDI BOL shipper data or FastWay shipment shipper data
GIVEN
EDI BOL shipper data or FastWay shipment shipper data
Applied to: Shipper Record Building
WHEN
The system builds the shipper customs record
THEN
Set entity ID to 'SH', sequence to '0001'. If EDI shipper data found, use consignor name and shipper chop from EDI, get address from EDI address segments, get contact information from EDI contact segments. If EDI data not found, use shipper data from FastWay shipment root. Validate all segments and insert customs record
Context: EDI BOL consignee data or FastWay shipment consignee data
GIVEN
EDI BOL consignee data or FastWay shipment consignee data
Applied to: Consignee Record Building
WHEN
The system builds the consignee customs record
THEN
Set entity ID to 'CN', sequence to '0002'. If EDI consignee data found, use shipper name and consignee chop from EDI, get address from EDI address segments, get contact information from EDI contact segments. If EDI data not found, use consignee data from FastWay shipment root. Validate all segments and insert customs record
Context: EDI transportation data or FastWay shipment data for various entity types
GIVEN
EDI transportation data or FastWay shipment data for various entity types
Applied to: N1 Entity Segment Building
WHEN
The system builds N1 entity segments
THEN
For each entity type (SF, UC, BN, C1, N1, PF, SS, 11, MC, OO, FW, NN), search EDI transportation data for matching organization ID. If found, extract entity information, address data, and contact information. Build complete N1 segment with entity ID, name, address, and contact details. Validate segment data and insert customs record with appropriate sequence number
Context: Contact information from EDI or FastWay data sources
GIVEN
Contact information from EDI or FastWay data sources
Applied to: Contact Information Processing
WHEN
The system processes contact information for entity records
THEN
Extract contact function code, contact name, communication number qualifier, and communication number. Validate communication qualifier is blank, 'FX', or 'TE'. If contact information is incomplete, generate appropriate error messages for missing required fields
Context: Completed customs record 55 data with CCN key, record type, and sequence number
GIVEN
Completed customs record 55 data with CCN key, record type, and sequence number
Applied to: Customs Record 55 Insertion
WHEN
The system inserts customs record 55
THEN
If sequence index is within maximum sequence limit, set CCN key, record type to '55', and sequence number. Move complete record to customs record array and increment sequence index. Validate all required fields before insertion
Context: EDI importer data, AU table importer data, or backed up importer information
GIVEN
EDI importer data, AU table importer data, or backed up importer information
Applied to: Importer Segment Building
WHEN
The system builds the importer segment
THEN
If EDI importer data found, create importer record with EDI details and manage CSA indicator based on business number qualifier. If EDI data not found but backed up importer data exists, use backed up data. If AU table data found and no other importer data, create importer record from AU table with business number qualifier 'M5' and turn on CSA indicator
Context: A cargo processing request is received with an action type
GIVEN
A cargo processing request is received with an action type
Applied to: Action Type?
WHEN
The system evaluates the action type
THEN
The system routes to release processing if action is RELEASE, routes to cancel release processing if action is CANCEL-RELEASE, or continues without action for any other action type
Context: A Container Control Number key is provided for cargo processing
GIVEN
A Container Control Number key is provided for cargo processing
Applied to: Manifest Data Retrieval
WHEN
The system attempts to retrieve the corresponding manifest data
THEN
The system loads the manifest record if found, or displays error message 'CAN NOT LOCATE MANIFEST FOR RELEASE/CANCEL RELEASE' if the manifest cannot be located
Context: A cargo release request is initiated
GIVEN
A cargo release request is initiated
Applied to: Manifest Release Processing
WHEN
The system processes the manual release
THEN
The system sets message ID to GCW123, sets manual release flag to true, copies the CCN key, clears the release quantity field, and moves the release reason to comments
Context: A cancel release operation is being processed
GIVEN
A cancel release operation is being processed
Applied to: CSA Cargo Status Management
WHEN
The CSA indicator is ON
THEN
The system sets the cargo status to CSA-DLV (CSA Delivery)
Applied to: Release Audit Trail Creation
WHEN
The system creates audit trail data
THEN
The system records current machine date as unreleased date, captures ACF2 user ID as the user who performed cancel, saves original release date, clears release information, and sets the unrelease reason
Applied to: Master Manifest Processing
WHEN
The manifest is identified as a master manifest
THEN
The system calls GCCCANRL program with CCCOM and CCN key parameters for additional cancel release processing
Context: A cancel release operation is being processed and CSA indicator is OFF
GIVEN
A cancel release operation is being processed and CSA indicator is OFF
Applied to: Manifest Status Determination
WHEN
The system evaluates the original CCN and manifest type
THEN
The system sets status to MANUAL if original CCN is blank OR it's a follower manifest, otherwise sets status to SENT
Context: A cancel release operation requires station information
GIVEN
A cancel release operation requires station information
Applied to: Station Information Lookup
WHEN
The system performs station lookup using manifest destination station name
THEN
The system uses station number from lookup table if successful (return flag = '0'), otherwise uses existing destination station number and initializes station data
Context: A cancel release operation is processing cargo with in-transit status
GIVEN
A cancel release operation is processing cargo with in-transit status
Applied to: In-Transit Status Management
WHEN
The in-transit status is 'Z' OR 'E'
THEN
The system changes the in-transit status to LOCAL
Context: A cancel release operation has been processed
GIVEN
A cancel release operation has been processed
Applied to: Cargo Release Logging
WHEN
The system creates audit log entry
THEN
The system initializes logging input, sets action code to LOG-CARGO-RELEASE-REMOVED, and spawns GCT1051E message with security information, CCN key, cargo type CA-CARGO, transaction details, user ID and timestamp
Context: A cargo release has been processed
GIVEN
A cargo release has been processed
Applied to: Release Notification Generation
WHEN
The operation is NOT an export operation
THEN
The system generates and sends GCT1231E notification message with release details
Context: Cargo processing operations have been completed
GIVEN
Cargo processing operations have been completed
Applied to: Manifest Data Update
WHEN
The system finalizes the transaction
THEN
The system updates the manifest record with all changes made during processing using REPL function
Context: A CCN key is provided for manifest processing
GIVEN
A CCN key is provided for manifest processing
Applied to: 2:Initialize manifest data retrieval
WHEN
The system initializes manifest data retrieval
THEN
The system should fetch all manifest segments and set up data structures for processing
Context: An action code is provided in the input parameters
GIVEN
An action code is provided in the input parameters
Applied to: 3:Action Code Processing
WHEN
The system processes the action code
THEN
The system should store the action code for use in subsequent manifest processing steps
Context: A manifest has commodity and origin country information
GIVEN
A manifest has commodity and origin country information
Applied to: 4:Automotive Release Check
WHEN
The origin country is US, CA, or blank OR the origin country is MX with automotive type code 'C' in position 2, AND the CSA indicator is off
THEN
The system should set the automotive flag to true
Context: A manifest is being processed with broker notification enabled
GIVEN
A manifest is being processed with broker notification enabled
Applied to: 33:Broker Notification Processing
WHEN
The notify broker flag is set to true
THEN
The system should prepare broker message with action code 'ZZZ' and spawn GCT1051E transaction
Context: A transaction type is specified for processing
GIVEN
A transaction type is specified for processing
Applied to: 5:Transmission Number Generation
WHEN
The transaction type is 'GCT036', 'GCT0021E', 'GCT1251E', 'GCT0111E', or other
THEN
The system should assign transmission prefix 036, 002, 125, 011, or 901 respectively
Context: A manifest requires customs notification
GIVEN
A manifest requires customs notification
Applied to: 6:Destination Address Setup
WHEN
The notify customs flag is true AND the manifest is not a pre-emanifest
THEN
The system should set destination to 309-DESTINATION-5040, otherwise set to 309-DESTINATION
Context: A transmission number is generated
GIVEN
A transmission number is generated
Applied to: 7:Root Transaction Creation
WHEN
The system creates the root transaction
THEN
The system should create transaction root with transmission number, transaction set '309', and handle duplicate transmission numbers by incrementing
Context: A transaction is being processed
GIVEN
A transaction is being processed
Applied to: 8:ST Segment Processing
WHEN
The ST segment is created
THEN
The system should create ST segment with identifier 'ST', destination address, and transaction code '309'
Context: A manifest is being processed with arrival and program information
GIVEN
A manifest is being processed with arrival and program information
Applied to: 9:M10 Segment Processing
WHEN
The arrival indicator is 'Y' OR program name is 'GCX148'
THEN
The system should set manifest type code to 'A' for arrival, otherwise evaluate Canadian customs train ID and program name to set 'C' for customs or 'P' for pre-manifest, with special case of spaces for 5040 destination
Context: A manifest has an action code and border arrival information
GIVEN
A manifest has an action code and border arrival information
Applied to: 9:M10 Segment Processing
WHEN
The action code is '04', '05', or '06' AND border arrival date is not blank AND manifest is not pre-emanifest
THEN
The system should set transaction purpose code to 'CO' and set post-emanifest amendment flag to true, otherwise use the action code as transaction purpose code
Context: A manifest requires ETA date processing
GIVEN
A manifest requires ETA date processing
Applied to: 10:P4 Segment Processing
WHEN
The destination is 309-DESTINATION
THEN
The system should use current machine date, otherwise use border arrival ETA or calculate from waybill date plus configured days if ETA is blank
Context: A transaction requires line number identification
GIVEN
A transaction requires line number identification
Applied to: 11:LX Segment Processing
WHEN
The LX segment is processed
THEN
The system should create LX segment with identifier 'LX' and assigned number '000001'
Context: A post-emanifest amendment is required
GIVEN
A post-emanifest amendment is required
Applied to: 12:M13 Segment Processing
WHEN
The M13 segment is processed
THEN
The system should create M13 segment with SCAC 'CPRS', manifest from station name, CCN key, and amendment code '60' if blank or use existing amendment code
Context: A manifest has consolidated shipment information
GIVEN
A manifest has consolidated shipment information
Applied to: 13:M11 Segment Processing
WHEN
The consolidated indicator is 'Y'
THEN
The system should set bill of lading type code to 'Y', otherwise set to spaces
Context: A manifest has weight unit qualifier information
GIVEN
A manifest has weight unit qualifier information
Applied to: 13:M11 Segment Processing
WHEN
The weight unit qualifier is 'KG ' or ' KG'
THEN
The system should set weight unit code to 'K', otherwise set to 'L'
Context: A manifest has CSA indicator information
GIVEN
A manifest has CSA indicator information
Applied to: 14:N9 Reference Processing
WHEN
The CSA indicator is on
THEN
The system should set reference number to '01', otherwise set to '00'
Context: A manifest has in-transit status and origin country information
GIVEN
A manifest has in-transit status and origin country information
Applied to: 14:N9 Reference Processing
WHEN
The in-transit status is 'T' OR (status is 'L' AND origin country is not 'CA' AND table lookup is successful) OR (status is 'E' AND origin country is not 'CA')
THEN
The system should create N9 segment with qualifier 'KD' and reference number 'IN-TRANSIT'
Context: Entity information is being processed for a specific destination type
GIVEN
Entity information is being processed for a specific destination type
Applied to: 15:N1-N3-N4 Entity Processing
WHEN
The destination is 309-DESTINATION
THEN
The system should validate N1 codes against 4040 table, otherwise validate against 5040 table and require city name, country code, and postal/state codes for US/CA addresses
Context: A manifest requires in-bond processing
GIVEN
A manifest requires in-bond processing
Applied to: 18:M12 Segment Processing
WHEN
The M12 segment is created
THEN
The system should set in-bond type code to '61'
Context: Port information is being processed for different locations
GIVEN
Port information is being processed for different locations
Applied to: 19:R4 Port Processing
WHEN
Multiple R4 segments are created for origin, border crossing, and destination
THEN
The system should assign function codes 'O'/'J' for origin (based on destination type), '3' for border crossing, '4' for destination border, and 'E'/'R' for final destination (based on destination type)
Context: Equipment information is being processed
GIVEN
Equipment information is being processed
Applied to: 20:VID Equipment Processing
WHEN
The conveying car field is blank
THEN
The system should set equipment description code to 'RR' for railroad, otherwise set to 'CN' for container
Context: A manifest is being processed with a specific destination type
GIVEN
A manifest is being processed with a specific destination type
Applied to: Destination Type?
WHEN
The destination type is 5040
THEN
The system should skip M7 seal processing and proceed to N10 description processing, otherwise process M7 seals first
Context: A manifest has seal number information
GIVEN
A manifest has seal number information
Applied to: 21:M7 Seal Processing
WHEN
Seal numbers are available in the manifest data
THEN
The system should create M7 segments with up to 4 seal numbers per segment, processing up to 20 total seal numbers
Context: A manifest is being processed with equipment information
GIVEN
A manifest is being processed with equipment information
Applied to: 22:N10 Description Processing
WHEN
An idler car is found in the shipment
THEN
The system should set quantity to zero for the N10 segment, otherwise use the lading quantity from the manifest
Context: A manifest has commodity information
GIVEN
A manifest has commodity information
Applied to: Hazardous Material?
WHEN
The UN number is blank OR starts with 'NA' OR commodity description danger field is blank
THEN
The system should skip hazardous material processing, otherwise process H1-H2 segments
Context: Hazardous material information is being processed
GIVEN
Hazardous material information is being processed
Applied to: 24:H1-H2 Hazardous Material Processing
WHEN
The destination is 309-DESTINATION
THEN
The system should use the full UN number, otherwise use positions 3-4 of the UN number
Context: A manifest is classified as an idler shipment
GIVEN
A manifest is classified as an idler shipment
Applied to: Idler Shipment?
WHEN
The manifest is an idler shipment AND customs notification is required
THEN
The system should process additional idler cars in the consist
Context: An idler shipment requires processing of follower cars
GIVEN
An idler shipment requires processing of follower cars
Applied to: 25:Idler Car Processing
WHEN
Additional idler cars are found in the consist
THEN
The system should process VID segments for each idler car and include N10 and H1-H2 segments based on destination type and hazardous material presence
Context: All required segments have been processed
GIVEN
All required segments have been processed
Applied to: 30:Transaction Completion
WHEN
The transaction completion phase is reached
THEN
The system should finalize the EDI transaction structure
Context: A transaction has been completed
GIVEN
A transaction has been completed
Applied to: 34:Transaction Completion Notification
WHEN
The transaction completion notification is triggered
THEN
The system should spawn GCT1211E transaction with the transmission number
Context: The program is executing and the first-time processing flag is set
GIVEN
The program is executing and the first-time processing flag is set
Applied to: 2:Process Merlin Configuration
WHEN
The system checks if this is the first OTI processing
THEN
The system processes Merlin configuration, validates Merlin IDs, and initializes reference data, then sets the flag to indicate subsequent processing
Context: Four Merlin user IDs are retrieved from the admin table (DC-P-MERLIN-1 through 4)
GIVEN
Four Merlin user IDs are retrieved from the admin table (DC-P-MERLIN-1 through 4)
Applied to: 3:Control Merlin ID Validation
WHEN
Each Merlin ID is validated against the EMTZ segment
THEN
If DC-P-MERLIN-1 is invalid, use default 'OM01247' and set not-found flag; for other invalid IDs (2,3,4), fall back to DC-P-MERLIN-1 value
Context: A reference number and transaction type indicator are provided
GIVEN
A reference number and transaction type indicator are provided
Applied to: 4:Initialize Reference Data
WHEN
The system initializes reference data and processing flags
THEN
Set message label to 'TRAIN REPORT NUMBER :' for train transactions, 'CARGO CONTROL NUMBER :' for cargo transactions, or 'REFERENCE NUMBER :' for other types
Context: An incoming message with a specific type indicator
GIVEN
An incoming message with a specific type indicator
Applied to: Message Type?
WHEN
The system evaluates the message type
THEN
Route to acknowledgment processing for ACK messages, or route to error processing for ERROR and WARNING messages
Context: An acknowledgment message is received
GIVEN
An acknowledgment message is received
Applied to: 5:Process Acknowledgment Messages
WHEN
The system processes the acknowledgment
THEN
Set MST processing flag to false and route to train or cargo acknowledgment processing based on transaction type
Context: A train acknowledgment message with a reference number
GIVEN
A train acknowledgment message with a reference number
Applied to: 6:Process Train Acknowledgment
WHEN
The system looks up the train report
THEN
If train not found, set error flag and add error message; if found, clear security errors for deleted records, set ACK status with timestamp, and send AEI notification if flag is 'Y'
Context: A cargo acknowledgment message with a control number
GIVEN
A cargo acknowledgment message with a control number
Applied to: 7:Process Cargo Acknowledgment
WHEN
The system looks up the cargo control record
THEN
If cargo not found, add error message and set DCP interface error flag; if found, set status to 'ACK' when current status is 'SENT', determine processing terminal, and process arrival if indicator is 'Y'
Context: An error or warning message is received
GIVEN
An error or warning message is received
Applied to: 8:Process Error Messages
WHEN
The system processes the error message
THEN
Check if message is test data first; if not test data, route to train or cargo error processing based on transaction type
Context: A train error message with a reference number
GIVEN
A train error message with a reference number
Applied to: 9:Process Train Errors
WHEN
The system processes the train error
THEN
If train not found, add appropriate error message (V67 warning or general train error); if found, determine processing terminal and handle V67 warnings specially
Context: A cargo error message with a control number
GIVEN
A cargo error message with a control number
Applied to: 10:Process Cargo Errors
WHEN
The system processes the cargo error
THEN
If cargo not found and message is V67, process as train error; if cargo not found and not V67, add cargo error message; if found, save current status and determine processing terminal
Context: An error code from the message
GIVEN
An error code from the message
Applied to: 11:Retrieve Error Message Text
WHEN
The system looks up the error message text in the MS table
THEN
If message found, use English text from table; if not found, use free-form message text and add 'message not found' error
Context: An error message with error type and a found train or cargo record
GIVEN
An error message with error type and a found train or cargo record
Applied to: 12:Update Train/Cargo Status
WHEN
The system updates the record status
THEN
If error type is 'X', set status to 'WARNING' or 'INFO' and exit; for train records not deleted, set error resend flag and status to 'REJECT' for type 'R' or 'ERROR' otherwise; for cargo records, set status to 'REJECT' for type 'R' or 'ERROR' otherwise
Context: A message with a reference number
GIVEN
A message with a reference number
Applied to: Test Message?
WHEN
The system checks if the message is test data
THEN
Identify as train test if reference equals '6105ETESTTRAIN00000000000', or cargo test if reference starts with '6105ECPRSTESTCARGO' or '6105ETESTCARGO'
Context: A message identified as test data
GIVEN
A message identified as test data
Applied to: 13:Handle Test Messages
WHEN
The system processes the test message
THEN
Set appropriate test flags (TEST-TRAIN or TEST-CARGO) and proceed to special check processing, bypassing normal error message handling
Context: A train record with AEI send flag set to 'Y' and a status change
GIVEN
A train record with AEI send flag set to 'Y' and a status change
Applied to: 14:Send AEI Messages
WHEN
The system processes the train acknowledgment or status update
THEN
Look up email addresses for the port code, send notification with train ID and status, and fall back to default recipients if lookup fails
Context: Messages need to be sent to users
GIVEN
Messages need to be sent to users
Applied to: 15:Process Message Routing
WHEN
The system processes message routing
THEN
Get supervisor Merlin ID from terminal table, validate DC-P Merlin IDs, and prepare for sending messages to MST system and Merlin users
Context: A processing terminal identifier
GIVEN
A processing terminal identifier
Applied to: 16:Get Supervisor Merlin ID
WHEN
The system looks up supervisor information in the LT table
THEN
If table entry found, use alternate terminal if specified and retrieve supervisor Merlin ID; if supervisor ID invalid, add error message and clear user Merlin ID
Context: DC-P Merlin ID needs validation for message sending
GIVEN
DC-P Merlin ID needs validation for message sending
Applied to: 17:Validate Merlin User IDs
WHEN
The system validates the Merlin user ID
THEN
If DC-P1 ID not found, add error message indicating invalid DC&P Merlin userid
Context: An error message that needs to be sent to users
GIVEN
An error message that needs to be sent to users
Applied to: Train Error?
WHEN
The system determines the routing destination
THEN
Route to train message sending if train error flag is set, otherwise route to cargo message sending
Context: A cargo-related message and validated user Merlin ID
GIVEN
A cargo-related message and validated user Merlin ID
Applied to: 18:Send Cargo Messages to Merlin
WHEN
The system sends the message to Merlin users
THEN
Send message to user Merlin ID; if sending fails, fall back to sending to default recipient 'OM01247'
Context: A train-related message and validated user Merlin ID
GIVEN
A train-related message and validated user Merlin ID
Applied to: 19:Send Train Messages to Merlin
WHEN
The system sends the message to Merlin users
THEN
Send message to user Merlin ID with fallback to 'OM01247' if failed, and additionally send a copy to 'CAERROR' file with 'OM01247' as recipient
Context: Messages ready for distribution and MST processing flag is enabled
GIVEN
Messages ready for distribution and MST processing flag is enabled
Applied to: 20:Send MST Messages
WHEN
The system sends messages to MST
THEN
Send header message first, then send each message entry using terminal call letters, and finally send wrap-up message
Context: A cargo record with arrival indicator set to 'Y'
GIVEN
A cargo record with arrival indicator set to 'Y'
Applied to: 21:Process Arrival Notifications
WHEN
The system processes the cargo acknowledgment
THEN
Create arrival notification message with cargo control number, set action code to 'CAA', and send to GCT1481E transaction
Context: A cargo record with status change and Iron Highway configuration
GIVEN
A cargo record with status change and Iron Highway configuration
Applied to: 22:Update Iron Highway Records
WHEN
The system updates the cargo record and status differs from saved status
THEN
Look up Iron Highway configuration, populate record with cargo details including status, car ID, waybill, and shipment ID from N9 segments, then call Iron Highway update program
Context: A processed transaction with current status and reference number
GIVEN
A processed transaction with current status and reference number
Applied to: 24:Log Transaction Activities
WHEN
The system logs the transaction activity
THEN
Create log message with current status, include transaction number for ACK status, set appropriate cargo or train indicator, and send to GCT1051E logging transaction
Context: A test message (train or cargo) being processed
GIVEN
A test message (train or cargo) being processed
Applied to: 25:Process Special Checks
WHEN
The system performs special check processing
THEN
Look up T2 table entry, update 358-ACK timestamp for train test messages or 309-ACK timestamp for cargo test messages with current machine date, century, and time
R-GCCCANRL-cbl-00013 (+20) File: GCCCANRL.cblFile: GCCCBOL.cblFile: GCX122A.cbl Initialize Program Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Program':
  • Context - a program is currently executing with an active program name:
    For Save Current Program Name:
    When the system needs to switch to a new module for processing, then the current program name must be saved for later restoration.
  • Context - a module name is defined for the current processing operation:
    For Set Module Name as Active Program:
    When the system begins processing operations, then the module name must be set as the active program identifier.
  • Context - a ccn key is provided as input for manifest processing:
    For Set Up CCN Key for Search:
    When the system prepares to search for follower manifests, then the ccn key must be configured in the search parameters.
  • Context - the ccn key is configured for searching follower manifests:
    For Position to First Follower Manifest:
    When the system initiates the search for follower manifests, then the system must attempt to retrieve the first follower manifest record.
  • Context - the system has attempted to retrieve the first follower manifest:
    For First Follower Found?:
    When the database search operation completes, then if a follower manifest is found, the processing flag must be set to continue, otherwise it must be set to stop.
  • Context - a follower manifest record has been successfully retrieved:
    For Set Processing Flag to Continue:
    When the system evaluates the search results, then the processing flag must be set to indicate continuation of processing.
  • Context - no follower manifest records are found in the database search:
    For Set Processing Flag to Stop:
    When the system evaluates the search results, then the processing flag must be set to indicate termination of processing.
  • Context - the cargo report processing program is initiated:
    For Get System Date and Time:
    When the system begins execution, then the current system date and time are captured and stored for processing audit trail.
  • Context - a cargo report processing module is about to be executed:
    For Save Current Program Name:
    When the module processing begins, then the current program name from the common control area is saved to a temporary storage location.
  • Context - the cargo report processing module needs to establish its identity:
    For Set Module Name to Current Program:
    When module processing context is being set up, then the module name is assigned to the program identifier in the common control area.
  • Context - cargo report processing is starting:
    For Clear Description Fields:
    When working storage areas need to be prepared for description data, then the primary description field ws-desc-1 is cleared to spaces.
  • Context - description array processing is about to begin:
    For Reset Array Indexes:
    When array indexes need to be initialized, then the description array index ws-indexeb is set to position 1.
  • Context - multi-bill cargo processing is about to begin:
    For Clear CCN Array Table:
    When ccn array storage needs to be prepared, then the gcwcbol ccn array table is cleared to spaces.
  • Context - a program is executing with an active program name in the control communication block:
    For Save Current Program Name:
    When the system needs to execute a specific module, then the current program name must be saved before setting the new module name and restored after module completion.
  • Context - a module needs to be executed within the system:
    For Set Module Name in Control Block:
    When the processing context is being established, then the module name must be assigned to the program field in the control communication block.
  • Context - the system is initializing for message processing:
    For Initialize Test Message Indicators:
    When test message indicators need to be reset, then both train test indicator and cargo test indicator must be cleared to spaces.
  • Context - the system is preparing for message processing operations:
    For Initialize Communication Areas:
    When communication areas need to be initialized, then the system communication block (iscom) must be initialized to default values.
  • Context - the system is checking processing state:
    For First Time Processing?:
    When determining if merlin setup is needed, then if the first-time processing switch is true, merlin configuration must be processed, otherwise skip to completion.
  • Context - this is the first time the system is processing messages:
    For Process Merlin Configuration Setup:
    When merlin configuration setup is required, then the system must execute merlin processing routine to retrieve and validate user configurations.
  • Context - first-time merlin configuration setup has been completed:
    For Set Processing Flag to Not First Time:
    When the processing state needs to be updated, then the first-time processing switch must be set to false to indicate setup is complete.
  • Context - system initialization is being completed:
    For Complete Initialization:
    When smst processing needs to be enabled, then the smst-only first record flag must be set to 'y' to indicate first record processing.
👨‍💻 Technical ACs (Gherkin)
Context: A program is currently executing with an active program name
GIVEN
A program is currently executing with an active program name
Applied to: Save Current Program Name
WHEN
The system needs to switch to a new module for processing
THEN
The current program name must be saved for later restoration
Context: A module name is defined for the current processing operation
GIVEN
A module name is defined for the current processing operation
Applied to: Set Module Name as Active Program
WHEN
The system begins processing operations
THEN
The module name must be set as the active program identifier
Context: A CCN key is provided as input for manifest processing
GIVEN
A CCN key is provided as input for manifest processing
Applied to: Set Up CCN Key for Search
WHEN
The system prepares to search for follower manifests
THEN
The CCN key must be configured in the search parameters
Context: The CCN key is configured for searching follower manifests
GIVEN
The CCN key is configured for searching follower manifests
Applied to: Position to First Follower Manifest
WHEN
The system initiates the search for follower manifests
THEN
The system must attempt to retrieve the first follower manifest record
Context: The system has attempted to retrieve the first follower manifest
GIVEN
The system has attempted to retrieve the first follower manifest
Applied to: First Follower Found?
WHEN
The database search operation completes
THEN
If a follower manifest is found, the processing flag must be set to continue, otherwise it must be set to stop
Context: A follower manifest record has been successfully retrieved
GIVEN
A follower manifest record has been successfully retrieved
Applied to: Set Processing Flag to Continue
WHEN
The system evaluates the search results
THEN
The processing flag must be set to indicate continuation of processing
Context: No follower manifest records are found in the database search
GIVEN
No follower manifest records are found in the database search
Applied to: Set Processing Flag to Stop
WHEN
The system evaluates the search results
THEN
The processing flag must be set to indicate termination of processing
Context: The cargo report processing program is initiated
GIVEN
The cargo report processing program is initiated
Applied to: Get System Date and Time
WHEN
The system begins execution
THEN
The current system date and time are captured and stored for processing audit trail
Context: A cargo report processing module is about to be executed
GIVEN
A cargo report processing module is about to be executed
Applied to: Save Current Program Name
WHEN
The module processing begins
THEN
The current program name from the common control area is saved to a temporary storage location
Context: The cargo report processing module needs to establish its identity
GIVEN
The cargo report processing module needs to establish its identity
Applied to: Set Module Name to Current Program
WHEN
Module processing context is being set up
THEN
The module name is assigned to the program identifier in the common control area
Context: Cargo report processing is starting
GIVEN
Cargo report processing is starting
Applied to: Clear Description Fields
WHEN
Working storage areas need to be prepared for description data
THEN
The primary description field WS-DESC-1 is cleared to spaces
Context: Description array processing is about to begin
GIVEN
Description array processing is about to begin
Applied to: Reset Array Indexes
WHEN
Array indexes need to be initialized
THEN
The description array index WS-INDEXEB is set to position 1
Context: Multi-bill cargo processing is about to begin
GIVEN
Multi-bill cargo processing is about to begin
Applied to: Clear CCN Array Table
WHEN
CCN array storage needs to be prepared
THEN
The GCWCBOL CCN array table is cleared to spaces
Context: A program is executing with an active program name in the control communication block
GIVEN
A program is executing with an active program name in the control communication block
Applied to: Save Current Program Name
WHEN
The system needs to execute a specific module
THEN
The current program name must be saved before setting the new module name and restored after module completion
Context: A module needs to be executed within the system
GIVEN
A module needs to be executed within the system
Applied to: Set Module Name in Control Block
WHEN
The processing context is being established
THEN
The module name must be assigned to the program field in the control communication block
Context: The system is initializing for message processing
GIVEN
The system is initializing for message processing
Applied to: Initialize Test Message Indicators
WHEN
Test message indicators need to be reset
THEN
Both train test indicator and cargo test indicator must be cleared to spaces
Context: The system is preparing for message processing operations
GIVEN
The system is preparing for message processing operations
Applied to: Initialize Communication Areas
WHEN
Communication areas need to be initialized
THEN
The system communication block (ISCOM) must be initialized to default values
Context: The system is checking processing state
GIVEN
The system is checking processing state
Applied to: First Time Processing?
WHEN
Determining if Merlin setup is needed
THEN
If the first-time processing switch is true, Merlin configuration must be processed, otherwise skip to completion
Context: This is the first time the system is processing messages
GIVEN
This is the first time the system is processing messages
Applied to: Process Merlin Configuration Setup
WHEN
Merlin configuration setup is required
THEN
The system must execute Merlin processing routine to retrieve and validate user configurations
Context: First-time Merlin configuration setup has been completed
GIVEN
First-time Merlin configuration setup has been completed
Applied to: Set Processing Flag to Not First Time
WHEN
The processing state needs to be updated
THEN
The first-time processing switch must be set to false to indicate setup is complete
Context: System initialization is being completed
GIVEN
System initialization is being completed
Applied to: Complete Initialization
WHEN
SMST processing needs to be enabled
THEN
The SMST-only first record flag must be set to 'Y' to indicate first record processing
R-GCCCCREL-cbl-00013 (+4) File: GCCCCREL.cbl Manifest Release Processing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Release Processing':
  • Context - a cargo release process is being initiated:
    For Set Manual Release Flag:
    When the system processes a manual release request, then the message id should be set to gcw123 and the manual release flag should be set to true.
  • Context - a cargo release request contains a cargo control number key:
    For Copy Cargo Control Number:
    When the system processes the release request, then the cargo control number key should be copied to the gcw123 message structure.
  • Context - a manual cargo release is being processed:
    For Copy Cargo Control Number:
    When the system prepares the release message, then the release quantity field should be set to spaces (cleared).
  • Context - a cargo release request contains a release reason:
    For Copy Release Reason to Comments:
    When the system processes the release request, then the release reason should be copied to the gcw123 comments field.
  • Context - a cargo release has been processed:
    For Generate Release Notification Message:
    When the cargo is not classified as export cargo, then a release notification message (gct1231e) should be generated and sent.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release process is being initiated
GIVEN
A cargo release process is being initiated
Applied to: Set Manual Release Flag
WHEN
The system processes a manual release request
THEN
The message ID should be set to GCW123 and the manual release flag should be set to true
Context: A cargo release request contains a cargo control number key
GIVEN
A cargo release request contains a cargo control number key
Applied to: Copy Cargo Control Number
WHEN
The system processes the release request
THEN
The cargo control number key should be copied to the GCW123 message structure
Context: A manual cargo release is being processed
GIVEN
A manual cargo release is being processed
Applied to: Copy Cargo Control Number
WHEN
The system prepares the release message
THEN
The release quantity field should be set to spaces (cleared)
Context: A cargo release request contains a release reason
GIVEN
A cargo release request contains a release reason
Applied to: Copy Release Reason to Comments
WHEN
The system processes the release request
THEN
The release reason should be copied to the GCW123 comments field
Context: A cargo release has been processed
GIVEN
A cargo release has been processed
Applied to: Generate Release Notification Message
WHEN
The cargo is not classified as export cargo
THEN
A release notification message (GCT1231E) should be generated and sent
R-GCCCCREL-cbl-00018 (+9) File: GCCCCREL.cbl Manifest Cancel Release Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Cancel Release Processing':
  • Context - a manifest cancel release is being processed:
    For Is CSA Cargo?:
    When the cargo has csa indicator turned on, then the cargo status must be set to csa-dlv (csa delivery).
    For Create Audit Trail Information:
    When the status has been determined, then the system must record the current machine date as unreleased date, current user id as unreleasing user, and preserve the original release date.
    For Clear Release Information:
    When audit trail information has been created, then the system must clear all existing release information fields.
    For Set Unreleasing Reason:
    When release information has been cleared, then the system must set the unrelease reason in the cargo release reason field.
    For Lookup Station Information:
    When unreleasing reason has been set, then the system must attempt to lookup the station number using the manifest destination station name, and if successful use the looked-up station number, otherwise use the existing destination station number.
    For In-Transit Status Z or E?:
    When the cargo in-transit status is 'z' (zone) or 'e' (export), then the system must update the in-transit status to local.
    For Is Master Manifest?:
    When the manifest is identified as a master manifest, then the system must invoke the master manifest cancel release processing program (gcccanrl).
  • Context - a manifest cancel release is being processed and csa indicator is off:
    For Original Sent Status Empty OR Follower Manifest?:
    When the original ccn sent status is empty or the manifest is a follower manifest, then the cargo status must be set to manual.
    For Set Status to SENT:
    When the original ccn sent status is not empty and the manifest is not a follower manifest, then the cargo status must be set to sent.
  • Context - a manifest cancel release has been processed:
    For Create Cargo Release Removal Log:
    When all status updates and master manifest processing (if applicable) are complete, then the system must create a cargo release removal log entry with action code log-cargo-release-removed and spawn the logging message (gct1051e).
👨‍💻 Technical ACs (Gherkin)
Context: A manifest cancel release is being processed
GIVEN
A manifest cancel release is being processed
Applied to: Is CSA Cargo?
WHEN
The cargo has CSA indicator turned on
THEN
The cargo status must be set to CSA-DLV (CSA Delivery)
Applied to: Create Audit Trail Information
WHEN
The status has been determined
THEN
The system must record the current machine date as unreleased date, current user ID as unreleasing user, and preserve the original release date
Applied to: Clear Release Information
WHEN
Audit trail information has been created
THEN
The system must clear all existing release information fields
Applied to: Set Unreleasing Reason
WHEN
Release information has been cleared
THEN
The system must set the unrelease reason in the cargo release reason field
Applied to: Lookup Station Information
WHEN
Unreleasing reason has been set
THEN
The system must attempt to lookup the station number using the manifest destination station name, and if successful use the looked-up station number, otherwise use the existing destination station number
Applied to: In-Transit Status Z or E?
WHEN
The cargo in-transit status is 'Z' (zone) or 'E' (export)
THEN
The system must update the in-transit status to LOCAL
Applied to: Is Master Manifest?
WHEN
The manifest is identified as a master manifest
THEN
The system must invoke the master manifest cancel release processing program (GCCCANRL)
Context: A manifest cancel release is being processed and CSA indicator is off
GIVEN
A manifest cancel release is being processed and CSA indicator is off
Applied to: Original Sent Status Empty OR Follower Manifest?
WHEN
The original CCN sent status is empty OR the manifest is a follower manifest
THEN
The cargo status must be set to MANUAL
Applied to: Set Status to SENT
WHEN
The original CCN sent status is not empty AND the manifest is not a follower manifest
THEN
The cargo status must be set to SENT
Context: A manifest cancel release has been processed
GIVEN
A manifest cancel release has been processed
Applied to: Create Cargo Release Removal Log
WHEN
All status updates and master manifest processing (if applicable) are complete
THEN
The system must create a cargo release removal log entry with action code LOG-CARGO-RELEASE-REMOVED and spawn the logging message (GCT1051E)
R-GCCCANRL-cbl-00020 (+4) File: GCCCANRL.cbl Get First Follower Manifest Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get First Follower Manifest':
  • Context - a lead manifest ccn number is provided as input:
    For Set Search Key to Lead Manifest CCN Number:
    When the system initializes the follower manifest search process, then the search key is set to the lead manifest ccn number for database query.
  • Context - the search key is set to the lead manifest ccn number:
    For Execute Database Query for First Follower Manifest:
    When the system executes the database query for the first follower manifest, then the database is queried using gu operation with the ccn key and status is returned.
  • Context - a database query for follower manifest has been executed:
    For Follower Manifest Found?:
    When the system checks the query status code, then if status code is spaces then manifest is found, otherwise no manifest is available.
  • Context - a follower manifest record was successfully found in the database:
    For Set Flag: More Manifests Available for Processing:
    When the system processes the successful query result, then the processing flag is set to indicate more manifests are available for processing.
  • Context - no follower manifest record was found in the database:
    For Set Flag: No Manifests Available for Processing:
    When the system processes the unsuccessful query result, then the processing flag is set to indicate no manifests are available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A lead manifest CCN number is provided as input
GIVEN
A lead manifest CCN number is provided as input
Applied to: Set Search Key to Lead Manifest CCN Number
WHEN
The system initializes the follower manifest search process
THEN
The search key is set to the lead manifest CCN number for database query
Context: The search key is set to the lead manifest CCN number
GIVEN
The search key is set to the lead manifest CCN number
Applied to: Execute Database Query for First Follower Manifest
WHEN
The system executes the database query for the first follower manifest
THEN
The database is queried using GU operation with the CCN key and status is returned
Context: A database query for follower manifest has been executed
GIVEN
A database query for follower manifest has been executed
Applied to: Follower Manifest Found?
WHEN
The system checks the query status code
THEN
If status code is spaces then manifest is found, otherwise no manifest is available
Context: A follower manifest record was successfully found in the database
GIVEN
A follower manifest record was successfully found in the database
Applied to: Set Flag: More Manifests Available for Processing
WHEN
The system processes the successful query result
THEN
The processing flag is set to indicate more manifests are available for processing
Context: No follower manifest record was found in the database
GIVEN
No follower manifest record was found in the database
Applied to: Set Flag: No Manifests Available for Processing
WHEN
The system processes the unsuccessful query result
THEN
The processing flag is set to indicate no manifests are available for processing
R-GCCCANRL-cbl-00025 (+12) File: GCCCANRL.cbl Process Each Follower Manifest Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Each Follower Manifest':
  • Context - a follower manifest record is being processed:
    For Is Current Manifest Different from Lead Manifest?:
    When the current manifest ccn key equals the input lead manifest ccn key, then skip all cancel release processing for this manifest and move to the next follower manifest.
    For Is Current Manifest Different from Lead Manifest?:
    When the current manifest ccn key is not equal to the input lead manifest ccn key, then proceed with getting manifest for hold and update, setting cancel release data, logging activity, and updating the manifest record.
  • Context - a follower manifest needs to be processed for cancel release:
    For Get Manifest for Hold and Update:
    When the manifest ccn key is different from the lead manifest, then retrieve the manifest record using ghu (get hold for update) operation with the manifest ccn key.
  • Context - a manifest is being processed for cancel release:
    For Set Cancel Release Data:
    When the csa indicator is on, then set the manifest status to csa delivery.
    For Set Cancel Release Data:
    When the csa indicator is not on, then set the manifest status to manual.
    For Set Cancel Release Data:
    When station information lookup is performed using the manifest destination station name, then if lookup is successful, use the station number from the lookup result; otherwise, use the existing destination station number.
    For Set Cancel Release Data:
    When the in-transit status is z or e, then change the in-transit status to l.
    For Set Cancel Release Data:
    When the in-transit status is r or t, then clear the destination station number for index.
    For Set Cancel Release Data:
    When the current status is not deleted, then clear the delete status.
  • Context - a manifest release is being canceled:
    For Set Cancel Release Data:
    When cancel release data is being set, then record the current machine date as unrelease date, current user id as unreleasing user, preserve original release date, clear release information, and set the unrelease reason.
  • Context - a manifest release has been canceled:
    For Log Cancel Release Activity:
    When cancel release processing is complete, then create audit log entry with security information, ccn key, transaction details, user id, timestamp, and cargo release removal action code, then write the log message to the system.
  • Context - cancel release data has been set and logged:
    For Update Manifest Record:
    When all cancel release processing is complete for a manifest, then update the manifest record using repl operation to save all changes.
  • Context - current follower manifest processing is complete:
    For Get Next Follower Manifest:
    When getting the next follower manifest, then retrieve next follower record and if successful, verify the master manifest ccn matches the input ccn key to continue processing, otherwise stop processing.
👨‍💻 Technical ACs (Gherkin)
Context: A follower manifest record is being processed
GIVEN
A follower manifest record is being processed
Applied to: Is Current Manifest Different from Lead Manifest?
WHEN
The current manifest CCN key equals the input lead manifest CCN key
THEN
Skip all cancel release processing for this manifest and move to the next follower manifest
Applied to: Is Current Manifest Different from Lead Manifest?
WHEN
The current manifest CCN key is not equal to the input lead manifest CCN key
THEN
Proceed with getting manifest for hold and update, setting cancel release data, logging activity, and updating the manifest record
Context: A follower manifest needs to be processed for cancel release
GIVEN
A follower manifest needs to be processed for cancel release
Applied to: Get Manifest for Hold and Update
WHEN
The manifest CCN key is different from the lead manifest
THEN
Retrieve the manifest record using GHU (Get Hold for Update) operation with the manifest CCN key
Context: A manifest is being processed for cancel release
GIVEN
A manifest is being processed for cancel release
Applied to: Set Cancel Release Data
WHEN
The CSA indicator is on
THEN
Set the manifest status to CSA delivery
Applied to: Set Cancel Release Data
WHEN
The CSA indicator is not on
THEN
Set the manifest status to manual
Applied to: Set Cancel Release Data
WHEN
Station information lookup is performed using the manifest destination station name
THEN
If lookup is successful, use the station number from the lookup result; otherwise, use the existing destination station number
Applied to: Set Cancel Release Data
WHEN
The in-transit status is Z or E
THEN
Change the in-transit status to L
Applied to: Set Cancel Release Data
WHEN
The in-transit status is R or T
THEN
Clear the destination station number for index
Applied to: Set Cancel Release Data
WHEN
The current status is not DELETED
THEN
Clear the delete status
Context: A manifest release is being canceled
GIVEN
A manifest release is being canceled
Applied to: Set Cancel Release Data
WHEN
Cancel release data is being set
THEN
Record the current machine date as unrelease date, current user ID as unreleasing user, preserve original release date, clear release information, and set the unrelease reason
Context: A manifest release has been canceled
GIVEN
A manifest release has been canceled
Applied to: Log Cancel Release Activity
WHEN
Cancel release processing is complete
THEN
Create audit log entry with security information, CCN key, transaction details, user ID, timestamp, and cargo release removal action code, then write the log message to the system
Context: Cancel release data has been set and logged
GIVEN
Cancel release data has been set and logged
Applied to: Update Manifest Record
WHEN
All cancel release processing is complete for a manifest
THEN
Update the manifest record using REPL operation to save all changes
Context: Current follower manifest processing is complete
GIVEN
Current follower manifest processing is complete
Applied to: Get Next Follower Manifest
WHEN
Getting the next follower manifest
THEN
Retrieve next follower record and if successful, verify the master manifest CCN matches the input CCN key to continue processing, otherwise stop processing
R-GCCCBOL-cbl-00028 (+4) File: GCCCBOL.cbl Get Shipment Root Data Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Shipment Root Data':
  • Context - a shipment processing request is initiated and a root key exists for the current shipment:
    For Get Shipment Root Data:
    When the system attempts to retrieve shipment root data from the shiproot database using the shipment's root key, then the system should successfully access and load the shipment root information making it available for subsequent cargo processing operations.
  • Context - a request to retrieve shipment root data is made:
    For Initialize Database Access Parameters:
    When the system initializes database access parameters, then the communication area should be cleared to spaces and the segment type should be set to 'shiproot' to identify the target data structure.
  • Context - database access parameters are initialized and a current shipment context exists with a valid root key:
    For Set Root Key from Current Shipment:
    When the system sets the root key for the database query, then the root key parameter should be populated with the current shipment's root key value to ensure accurate data retrieval.
  • Context - database access parameters are configured with segment type and root key:
    For Set Database Function to Get Unique:
    When the system sets the database function type, then the function code should be set to 'gu' (get unique) and accept status should be set to 'ge' (get equal) to retrieve exactly one matching shipment root record.
  • Context - all database access parameters are properly configured including segment type, root key, and function codes:
    For Call Database Access Routine:
    When the system calls the database access routine fwcwbio, then the database call should be executed with the communication control area, database parameters, and shipment root data structure to attempt data retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment processing request is initiated and a root key exists for the current shipment
GIVEN
A shipment processing request is initiated and a root key exists for the current shipment
Applied to: Get Shipment Root Data
WHEN
The system attempts to retrieve shipment root data from the SHIPROOT database using the shipment's root key
THEN
The system should successfully access and load the shipment root information making it available for subsequent cargo processing operations
Context: A request to retrieve shipment root data is made
GIVEN
A request to retrieve shipment root data is made
Applied to: Initialize Database Access Parameters
WHEN
The system initializes database access parameters
THEN
The communication area should be cleared to spaces and the segment type should be set to 'SHIPROOT' to identify the target data structure
Context: Database access parameters are initialized and a current shipment context exists with a valid root key
GIVEN
Database access parameters are initialized and a current shipment context exists with a valid root key
Applied to: Set Root Key from Current Shipment
WHEN
The system sets the root key for the database query
THEN
The root key parameter should be populated with the current shipment's root key value to ensure accurate data retrieval
Context: Database access parameters are configured with segment type and root key
GIVEN
Database access parameters are configured with segment type and root key
Applied to: Set Database Function to Get Unique
WHEN
The system sets the database function type
THEN
The function code should be set to 'GU' (Get Unique) and accept status should be set to 'GE' (Get Equal) to retrieve exactly one matching shipment root record
Context: All database access parameters are properly configured including segment type, root key, and function codes
GIVEN
All database access parameters are properly configured including segment type, root key, and function codes
Applied to: Call Database Access Routine
WHEN
The system calls the database access routine FWCWBIO
THEN
The database call should be executed with the communication control area, database parameters, and shipment root data structure to attempt data retrieval
R-GCCCCREL-cbl-00028 File: GCCCCREL.cbl CSA Cargo Status Management
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Cargo Status Management':
  • Context - a cargo release cancellation is being processed:
    For Set Cargo Status to CSA-DLV:
    When the csa indicator is turned on for the cargo, then the cargo status must be set to csa-dlv (csa delivery).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release cancellation is being processed
GIVEN
A cargo release cancellation is being processed
Applied to: Set Cargo Status to CSA-DLV
WHEN
The CSA indicator is turned on for the cargo
THEN
The cargo status must be set to CSA-DLV (CSA Delivery)
R-GCCCCREL-cbl-00029 (+2) File: GCCCCREL.cbl Manifest Status Determination Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Status Determination':
  • Context - a manifest cancel release process is being executed:
    For CSA Indicator On?:
    When the csa indicator is on, then the manifest status should be set to csa-dlv.
  • Context - a manifest cancel release process is being executed and csa indicator is off:
    For Original Sent Status Empty OR Follower Manifest?:
    When the original ccn sent status is empty or the manifest is a follower manifest, then the manifest status should be set to manual.
    For Set Status to SENT:
    When the original ccn sent status is not empty and the manifest is not a follower manifest, then the manifest status should be set to sent.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest cancel release process is being executed
GIVEN
A manifest cancel release process is being executed
Applied to: CSA Indicator On?
WHEN
The CSA indicator is ON
THEN
The manifest status should be set to CSA-DLV
Context: A manifest cancel release process is being executed and CSA indicator is OFF
GIVEN
A manifest cancel release process is being executed and CSA indicator is OFF
Applied to: Original Sent Status Empty OR Follower Manifest?
WHEN
The original CCN sent status is empty OR the manifest is a follower manifest
THEN
The manifest status should be set to MANUAL
Applied to: Set Status to SENT
WHEN
The original CCN sent status is not empty AND the manifest is not a follower manifest
THEN
The manifest status should be set to SENT
R-GCCCCREL-cbl-00032 (+4) File: GCCCCREL.cbl Release Audit Trail Creation Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Audit Trail Creation':
  • Context - a cancel release operation is being processed:
    For Capture Current Date as Unreleasing Date & Capture Current User ID as Unreleasing User & Clear Previous Release Information:
    When the system processes the cancel release request, then the current machine date is captured and stored as the unreleasing date and the current acf2 user id is captured and stored as the unreleasing user and all release information fields are cleared to spaces.
  • Context - a cancel release operation is being processed and cargo has an existing release date:
    For Preserve Original Release Date:
    When the system processes the cancel release request, then the original release date is preserved in a separate field before clearing current release information.
  • Context - a cancel release operation is being processed with an unreleasing reason:
    For Record Unreleasing Reason:
    When the system processes the cancel release request, then the unreleasing reason is stored in the cargo release reason field.
👨‍💻 Technical ACs (Gherkin)
Context: A cancel release operation is being processed
GIVEN
A cancel release operation is being processed
Applied to: Capture Current Date as Unreleasing Date & Capture Current User ID as Unreleasing User & Clear Previous Release Information
WHEN
The system processes the cancel release request
THEN
The current machine date is captured and stored as the unreleasing date AND The current ACF2 user ID is captured and stored as the unreleasing user AND All release information fields are cleared to spaces
Context: A cancel release operation is being processed and cargo has an existing release date
GIVEN
A cancel release operation is being processed and cargo has an existing release date
Applied to: Preserve Original Release Date
WHEN
The system processes the cancel release request
THEN
The original release date is preserved in a separate field before clearing current release information
Context: A cancel release operation is being processed with an unreleasing reason
GIVEN
A cancel release operation is being processed with an unreleasing reason
Applied to: Record Unreleasing Reason
WHEN
The system processes the cancel release request
THEN
The unreleasing reason is stored in the cargo release reason field
R-GCCCBOL-cbl-00033 (+10) File: GCCCBOL.cbl Get Shipment Mine Data Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Shipment Mine Data':
  • Context - a request to retrieve shipment mine data:
    For Initialize SHIPMINE segment:
    When the system begins the data retrieval process, then the shipmine data structure is cleared to spaces.
  • Context - a shipment mine data retrieval request:
    For Set segment type to 'SHIPMIN':
    When the system configures the segment type, then the segment type is set to 'shipmin' to identify shipment mine records.
  • Context - a configured shipment mine segment type:
    For Set segment ID to 'E':
    When the system sets the segment identifier, then the segment id is set to 'e' to identify the specific data category.
  • Context - a shipment mine segment counter value:
    For Set segment number from counter:
    When the system configures the segment number, then the segment number is set from the ws-shipmine-seg-nbr counter.
  • Context - a configured shipment mine segment request:
    For Set function code to 'GU' - Get Unique:
    When the system sets the database function code, then the function code is set to 'gu' for get unique operation.
  • Context - a fully configured shipment mine data request:
    For Call FWCWBIO to retrieve data:
    When the system calls the fwcwbio database interface, then the database retrieval operation is executed with the configured parameters.
  • Context - a completed database retrieval operation:
    For Data Retrieved Successfully?:
    When the system checks the operation status, then if the status code is spaces, the retrieval is considered successful, otherwise it failed.
  • Context - a successful shipment mine data retrieval:
    For Set SHIPMINE-FOUND flag:
    When the system updates the status flag, then the ws-shipmine-found flag is set to true.
  • Context - successfully retrieved shipment mine data:
    For Extract EDI BOL key from data line 1:
    When the system processes the first data line, then the edi bol key is extracted from data-line(1) and stored in work-edi-bol-key.
  • Context - a failed shipment mine data retrieval:
    For Set SHIPMINE-NOT-FOUND flag:
    When the system updates the status flag, then the ws-shipmine-not-found flag is set to true.
  • Context - shipment mine data retrieval failed:
    For Extract EDI BOL key from data line 1:
    When the system processes the edi bol key extraction, then the work-edi-bol-key is set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve shipment mine data
GIVEN
A request to retrieve shipment mine data
Applied to: Initialize SHIPMINE segment
WHEN
The system begins the data retrieval process
THEN
The SHIPMINE data structure is cleared to spaces
Context: A shipment mine data retrieval request
GIVEN
A shipment mine data retrieval request
Applied to: Set segment type to 'SHIPMIN'
WHEN
The system configures the segment type
THEN
The segment type is set to 'SHIPMIN' to identify shipment mine records
Context: A configured shipment mine segment type
GIVEN
A configured shipment mine segment type
Applied to: Set segment ID to 'E'
WHEN
The system sets the segment identifier
THEN
The segment ID is set to 'E' to identify the specific data category
Context: A shipment mine segment counter value
GIVEN
A shipment mine segment counter value
Applied to: Set segment number from counter
WHEN
The system configures the segment number
THEN
The segment number is set from the WS-SHIPMINE-SEG-NBR counter
Context: A configured shipment mine segment request
GIVEN
A configured shipment mine segment request
Applied to: Set function code to 'GU' - Get Unique
WHEN
The system sets the database function code
THEN
The function code is set to 'GU' for Get Unique operation
Context: A fully configured shipment mine data request
GIVEN
A fully configured shipment mine data request
Applied to: Call FWCWBIO to retrieve data
WHEN
The system calls the FWCWBIO database interface
THEN
The database retrieval operation is executed with the configured parameters
Context: A completed database retrieval operation
GIVEN
A completed database retrieval operation
Applied to: Data Retrieved Successfully?
WHEN
The system checks the operation status
THEN
If the status code is spaces, the retrieval is considered successful, otherwise it failed
Context: A successful shipment mine data retrieval
GIVEN
A successful shipment mine data retrieval
Applied to: Set SHIPMINE-FOUND flag
WHEN
The system updates the status flag
THEN
The WS-SHIPMINE-FOUND flag is set to TRUE
Context: Successfully retrieved shipment mine data
GIVEN
Successfully retrieved shipment mine data
Applied to: Extract EDI BOL key from data line 1
WHEN
The system processes the first data line
THEN
The EDI BOL key is extracted from DATA-LINE(1) and stored in WORK-EDI-BOL-KEY
Context: A failed shipment mine data retrieval
GIVEN
A failed shipment mine data retrieval
Applied to: Set SHIPMINE-NOT-FOUND flag
WHEN
The system updates the status flag
THEN
The WS-SHIPMINE-NOT-FOUND flag is set to TRUE
Context: Shipment mine data retrieval failed
GIVEN
Shipment mine data retrieval failed
Applied to: Extract EDI BOL key from data line 1
WHEN
The system processes the EDI BOL key extraction
THEN
The WORK-EDI-BOL-KEY is set to spaces
R-GCCS309C-cbl-00034 (+1) File: GCCS309C.cbl Manifest Validation Merged 2 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Validation':
  • Context - a manifest is being processed for transmission:
    For Check if manifest is from 66MASTER station and exit if true:
    When the manifest origin station is '66master', then the system should immediately exit without performing any manifest processing or transmission activities.
    For Continue to next process:
    When the manifest origin station is not '66master', then the system should continue with initialization and subsequent manifest processing steps.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for transmission
GIVEN
A manifest is being processed for transmission
Applied to: Check if manifest is from 66MASTER station and exit if true
WHEN
The manifest origin station is '66MASTER'
THEN
The system should immediately exit without performing any manifest processing or transmission activities
Applied to: Continue to next process
WHEN
The manifest origin station is not '66MASTER'
THEN
The system should continue with initialization and subsequent manifest processing steps
R-GCX122A-cbl-00035 (+14) File: GCX122A.cbl Process Merlin Configuration Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Merlin Configuration':
  • Context - system needs to configure merlin user ids for message routing:
    For Retrieve Administration Table Entry:
    When administration table lookup is performed with table id 'ad' and sequence id 'adminid', then administration table segment is retrieved and stored for further processing.
  • Context - administration table lookup has been performed:
    For Admin Table Found?:
    When table lookup return flag equals 0, then administration table segment is loaded for merlin id extraction, otherwise error message is set and error handling is called.
  • Context - administration table segment has been successfully retrieved:
    For Extract 4 Merlin User IDs from Admin Table:
    When merlin id validation process begins, then four merlin user ids (dc-p-merlin-1, dc-p-merlin-2, dc-p-merlin-3, dc-p-merlin-4) are extracted from administration table for validation.
  • Context - dc-p merlin id #1 has been extracted from administration table:
    For Validate DC-P Merlin ID #1:
    When user id validation is performed against user directory, then user id validation status is determined for further processing.
  • Context - dc-p merlin id #1 validation has been performed:
    For Set DC-P Merlin ID as Valid:
    When user directory status code is blank indicating valid user, then dc-p merlin id is stored as valid and dc-p id found flag is set to true.
    For Set Default ID 'OM01247' for DC-P Mark as Invalid:
    When user directory status code is not blank indicating invalid user, then default id 'om01247' is assigned to dc-p merlin id and dc-p id not found flag is set to true.
  • Context - dc-p merlin id #2 has been extracted from administration table:
    For Validate IFS Merlin ID #2:
    When user id validation is performed against user directory, then user id validation status is determined for ifs system routing.
  • Context - dc-p merlin id #2 validation has been performed:
    For Set IFS Merlin ID as Valid:
    When user directory status code is blank indicating valid user, then ifs merlin id is stored as valid for ifs system message routing.
    For Use DC-P Default ID for IFS:
    When user directory status code is not blank indicating invalid user, then dc-p merlin id #1 is assigned to ifs merlin id as fallback.
  • Context - dc-p merlin id #3 has been extracted from administration table:
    For Validate HHS Merlin ID #3:
    When user id validation is performed against user directory, then user id validation status is determined for hhs system routing.
  • Context - dc-p merlin id #3 validation has been performed:
    For Set HHS Merlin ID as Valid:
    When user directory status code is blank indicating valid user, then hhs merlin id is stored as valid for hhs system message routing.
    For Use DC-P Default ID for HHS:
    When user directory status code is not blank indicating invalid user, then dc-p merlin id #1 is assigned to hhs merlin id as fallback.
  • Context - dc-p merlin id #4 has been extracted from administration table:
    For Validate IMS Merlin ID #4:
    When user id validation is performed against user directory, then user id validation status is determined for ims system routing.
  • Context - dc-p merlin id #4 validation has been performed:
    For Set IMS Merlin ID as Valid:
    When user directory status code is blank indicating valid user, then ims merlin id is stored as valid for ims system message routing.
    For Use DC-P Default ID for IMS:
    When user directory status code is not blank indicating invalid user, then dc-p merlin id #1 is assigned to ims merlin id as fallback.
👨‍💻 Technical ACs (Gherkin)
Context: System needs to configure Merlin user IDs for message routing
GIVEN
System needs to configure Merlin user IDs for message routing
Applied to: Retrieve Administration Table Entry
WHEN
Administration table lookup is performed with table ID 'AD' and sequence ID 'ADMINID'
THEN
Administration table segment is retrieved and stored for further processing
Context: Administration table lookup has been performed
GIVEN
Administration table lookup has been performed
Applied to: Admin Table Found?
WHEN
Table lookup return flag equals 0
THEN
Administration table segment is loaded for Merlin ID extraction, otherwise error message is set and error handling is called
Context: Administration table segment has been successfully retrieved
GIVEN
Administration table segment has been successfully retrieved
Applied to: Extract 4 Merlin User IDs from Admin Table
WHEN
Merlin ID validation process begins
THEN
Four Merlin user IDs (DC-P-MERLIN-1, DC-P-MERLIN-2, DC-P-MERLIN-3, DC-P-MERLIN-4) are extracted from administration table for validation
Context: DC-P Merlin ID #1 has been extracted from administration table
GIVEN
DC-P Merlin ID #1 has been extracted from administration table
Applied to: Validate DC-P Merlin ID #1
WHEN
User ID validation is performed against user directory
THEN
User ID validation status is determined for further processing
Context: DC-P Merlin ID #1 validation has been performed
GIVEN
DC-P Merlin ID #1 validation has been performed
Applied to: Set DC-P Merlin ID as Valid
WHEN
User directory status code is blank indicating valid user
THEN
DC-P Merlin ID is stored as valid and DC-P ID found flag is set to true
Applied to: Set Default ID 'OM01247' for DC-P Mark as Invalid
WHEN
User directory status code is not blank indicating invalid user
THEN
Default ID 'OM01247' is assigned to DC-P Merlin ID and DC-P ID not found flag is set to true
Context: DC-P Merlin ID #2 has been extracted from administration table
GIVEN
DC-P Merlin ID #2 has been extracted from administration table
Applied to: Validate IFS Merlin ID #2
WHEN
User ID validation is performed against user directory
THEN
User ID validation status is determined for IFS system routing
Context: DC-P Merlin ID #2 validation has been performed
GIVEN
DC-P Merlin ID #2 validation has been performed
Applied to: Set IFS Merlin ID as Valid
WHEN
User directory status code is blank indicating valid user
THEN
IFS Merlin ID is stored as valid for IFS system message routing
Applied to: Use DC-P Default ID for IFS
WHEN
User directory status code is not blank indicating invalid user
THEN
DC-P Merlin ID #1 is assigned to IFS Merlin ID as fallback
Context: DC-P Merlin ID #3 has been extracted from administration table
GIVEN
DC-P Merlin ID #3 has been extracted from administration table
Applied to: Validate HHS Merlin ID #3
WHEN
User ID validation is performed against user directory
THEN
User ID validation status is determined for HHS system routing
Context: DC-P Merlin ID #3 validation has been performed
GIVEN
DC-P Merlin ID #3 validation has been performed
Applied to: Set HHS Merlin ID as Valid
WHEN
User directory status code is blank indicating valid user
THEN
HHS Merlin ID is stored as valid for HHS system message routing
Applied to: Use DC-P Default ID for HHS
WHEN
User directory status code is not blank indicating invalid user
THEN
DC-P Merlin ID #1 is assigned to HHS Merlin ID as fallback
Context: DC-P Merlin ID #4 has been extracted from administration table
GIVEN
DC-P Merlin ID #4 has been extracted from administration table
Applied to: Validate IMS Merlin ID #4
WHEN
User ID validation is performed against user directory
THEN
User ID validation status is determined for IMS system routing
Context: DC-P Merlin ID #4 validation has been performed
GIVEN
DC-P Merlin ID #4 validation has been performed
Applied to: Set IMS Merlin ID as Valid
WHEN
User directory status code is blank indicating valid user
THEN
IMS Merlin ID is stored as valid for IMS system message routing
Applied to: Use DC-P Default ID for IMS
WHEN
User directory status code is not blank indicating invalid user
THEN
DC-P Merlin ID #1 is assigned to IMS Merlin ID as fallback
R-GCCS309C-cbl-00036 (+9) File: GCCS309C.cbl Initialization Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialization':
  • Context - a manifest processing request is initiated with input parameters containing a ccn key:
    For Set CCN Key from Input Parameter:
    When the initialization process begins, then the system sets the ccn key from the input parameter to enable manifest data retrieval.
  • Context - the system needs to retrieve manifest data from the database:
    For Set Database Access Parameters:
    When database access parameters are being configured, then the system sets accept status to 'ge', clears the database interface structure, sets fetch-all flag to true, sets function to gu (get unique), and sets index-not-used flag to true.
  • Context - the manifest processing initialization is starting:
    For Set Idler Car Not Found Flag:
    When system flags are being initialized, then the system sets the idler car not found flag to true.
  • Context - database access parameters are configured and ccn key is set:
    For Call Database Access Module GCCCCIO2:
    When the system needs to retrieve manifest data, then the system calls the gccccio2 module with all required parameters including cccom, gcwccio2, manifest segments, and working storage arrays.
  • Context - the database access module gccccio2 has been called:
    For Database Access Successful?:
    When the system checks the result of the database operation, then if the error number field is spaces, the operation is considered successful; otherwise it is considered an error.
  • Context - database access completed successfully with no error number:
    For Move Retrieved Manifest Data to Working Storage:
    When manifest data needs to be loaded into working storage, then the system moves the first occurrence of gcsccs53 data from the working storage array to the gcsccs53 segment.
    For Move Additional Segment Data to Working Storage:
    When additional segment data needs to be loaded into working storage, then the system moves the first occurrence of gcsccs55 data from the working storage array to the gcsccs55 segment.
  • Context - database access operation failed with an error number greater than spaces:
    For Display Database Error Message:
    When the system needs to handle the database error, then the system sets the error message to 'unable to locate manifest in database' and calls the error handler 'cerr'.
  • Context - manifest data has been successfully retrieved and loaded:
    For Set Action Code from Input:
    When the system needs to set the action code for processing, then the system moves the action code from the input parameter gcws309c-act-cde to the working storage action field ws-action.
  • Context - the action code has been set and manifest data is loaded:
    For Check Automotive Release Requirements:
    When the initialization process needs to complete, then the system performs the d210-check-automotive-release procedure to validate automotive release requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated with input parameters containing a CCN key
GIVEN
A manifest processing request is initiated with input parameters containing a CCN key
Applied to: Set CCN Key from Input Parameter
WHEN
The initialization process begins
THEN
The system sets the CCN key from the input parameter to enable manifest data retrieval
Context: The system needs to retrieve manifest data from the database
GIVEN
The system needs to retrieve manifest data from the database
Applied to: Set Database Access Parameters
WHEN
Database access parameters are being configured
THEN
The system sets accept status to 'GE', clears the database interface structure, sets fetch-all flag to true, sets function to GU (Get Unique), and sets index-not-used flag to true
Context: The manifest processing initialization is starting
GIVEN
The manifest processing initialization is starting
Applied to: Set Idler Car Not Found Flag
WHEN
System flags are being initialized
THEN
The system sets the idler car not found flag to true
Context: Database access parameters are configured and CCN key is set
GIVEN
Database access parameters are configured and CCN key is set
Applied to: Call Database Access Module GCCCCIO2
WHEN
The system needs to retrieve manifest data
THEN
The system calls the GCCCCIO2 module with all required parameters including CCCOM, GCWCCIO2, manifest segments, and working storage arrays
Context: The database access module GCCCCIO2 has been called
GIVEN
The database access module GCCCCIO2 has been called
Applied to: Database Access Successful?
WHEN
The system checks the result of the database operation
THEN
If the error number field is spaces, the operation is considered successful; otherwise it is considered an error
Context: Database access completed successfully with no error number
GIVEN
Database access completed successfully with no error number
Applied to: Move Retrieved Manifest Data to Working Storage
WHEN
Manifest data needs to be loaded into working storage
THEN
The system moves the first occurrence of GCSCCS53 data from the working storage array to the GCSCCS53 segment
Applied to: Move Additional Segment Data to Working Storage
WHEN
Additional segment data needs to be loaded into working storage
THEN
The system moves the first occurrence of GCSCCS55 data from the working storage array to the GCSCCS55 segment
Context: Database access operation failed with an error number greater than spaces
GIVEN
Database access operation failed with an error number greater than spaces
Applied to: Display Database Error Message
WHEN
The system needs to handle the database error
THEN
The system sets the error message to 'UNABLE TO LOCATE MANIFEST IN DATABASE' and calls the error handler 'CERR'
Context: Manifest data has been successfully retrieved and loaded
GIVEN
Manifest data has been successfully retrieved and loaded
Applied to: Set Action Code from Input
WHEN
The system needs to set the action code for processing
THEN
The system moves the action code from the input parameter GCWS309C-ACT-CDE to the working storage action field WS-ACTION
Context: The action code has been set and manifest data is loaded
GIVEN
The action code has been set and manifest data is loaded
Applied to: Check Automotive Release Requirements
WHEN
The initialization process needs to complete
THEN
The system performs the D210-CHECK-AUTOMOTIVE-RELEASE procedure to validate automotive release requirements
R-GCCCCREL-cbl-00037 (+7) File: GCCCCREL.cbl Station Information Lookup Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Information Lookup':
  • Context - a station lookup operation needs to be performed:
    For Initialize Station Lookup Parameters:
    When the system prepares to lookup station information, then all lookup parameters are cleared and function code is set to retrieve data.
  • Context - a station lookup operation is being performed:
    For Set Table ID to 'MC' for Station Master:
    When the system needs to specify which table to query, then the table id is set to 'mc' to identify the station master table.
  • Context - a manifest with a destination station name exists:
    For Use Manifest Destination Station Name as Key:
    When the system performs a station lookup, then the manifest destination station name is used as the search key.
  • Context - station lookup parameters are initialized and search key is set:
    For Call Station Table Lookup Service:
    When the system needs to retrieve station information, then the gcctbio service is called with the station lookup parameters.
  • Context - a station lookup has been performed:
    For Extract Station Number from Retrieved Record:
    When the lookup service returns a successful result with return flag equal to '0', then the station number is extracted from the retrieved station master record.
    For Initialize Empty Station Record:
    When the lookup service fails to find the station (return flag is not '0'), then the station master record structure is initialized to empty values.
  • Context - a station number has been successfully retrieved from the station master table:
    For Set Station Number for Indexing:
    When the system needs to set the destination station number for indexing, then the retrieved station number is assigned to the destination station number for index field.
  • Context - a station lookup has failed to find the station in the master table:
    For Use Original Destination Station Number:
    When the system needs to assign a destination station number for indexing, then the original destination station number from the manifest is used as the destination station number for index.
👨‍💻 Technical ACs (Gherkin)
Context: A station lookup operation needs to be performed
GIVEN
A station lookup operation needs to be performed
Applied to: Initialize Station Lookup Parameters
WHEN
The system prepares to lookup station information
THEN
All lookup parameters are cleared and function code is set to retrieve data
Context: A station lookup operation is being performed
GIVEN
A station lookup operation is being performed
Applied to: Set Table ID to 'MC' for Station Master
WHEN
The system needs to specify which table to query
THEN
The table ID is set to 'MC' to identify the station master table
Context: A manifest with a destination station name exists
GIVEN
A manifest with a destination station name exists
Applied to: Use Manifest Destination Station Name as Key
WHEN
The system performs a station lookup
THEN
The manifest destination station name is used as the search key
Context: Station lookup parameters are initialized and search key is set
GIVEN
Station lookup parameters are initialized and search key is set
Applied to: Call Station Table Lookup Service
WHEN
The system needs to retrieve station information
THEN
The GCCTBIO service is called with the station lookup parameters
Context: A station lookup has been performed
GIVEN
A station lookup has been performed
Applied to: Extract Station Number from Retrieved Record
WHEN
The lookup service returns a successful result with return flag equal to '0'
THEN
The station number is extracted from the retrieved station master record
Applied to: Initialize Empty Station Record
WHEN
The lookup service fails to find the station (return flag is not '0')
THEN
The station master record structure is initialized to empty values
Context: A station number has been successfully retrieved from the station master table
GIVEN
A station number has been successfully retrieved from the station master table
Applied to: Set Station Number for Indexing
WHEN
The system needs to set the destination station number for indexing
THEN
The retrieved station number is assigned to the destination station number for index field
Context: A station lookup has failed to find the station in the master table
GIVEN
A station lookup has failed to find the station in the master table
Applied to: Use Original Destination Station Number
WHEN
The system needs to assign a destination station number for indexing
THEN
The original destination station number from the manifest is used as the destination station number for index
R-GCCCANRL-cbl-00038 File: GCCCANRL.cbl Validate Manifest for Processing
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Manifest for Processing':
  • Context - a manifest record has been retrieved for cancel release processing:
    For Check if the retrieved manifest is not the lead manifest to avoid processing it:
    When the system compares the current manifest ccn key with the input lead manifest ccn key, then if the ccn keys are the same, skip processing as this is the lead manifest; if the ccn keys are different, proceed with cancel release processing for the follower manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record has been retrieved for cancel release processing
GIVEN
A manifest record has been retrieved for cancel release processing
Applied to: Check if the retrieved manifest is not the lead manifest to avoid processing it
WHEN
The system compares the current manifest CCN key with the input lead manifest CCN key
THEN
If the CCN keys are the same, skip processing as this is the lead manifest; if the CCN keys are different, proceed with cancel release processing for the follower manifest
R-GCCCANRL-cbl-00039 (+2) File: GCCCANRL.cbl Get Manifest for Hold and Update Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Manifest for Hold and Update':
  • Context - a manifest retrieval operation is about to be performed:
    For Clear Accept Status:
    When the system prepares to get a manifest record with hold for update, then the system accept status must be cleared to ensure clean retrieval operation.
  • Context - a specific manifest record needs to be retrieved for update:
    For Set Manifest CCN Key for Retrieval:
    When the system prepares the retrieval parameters, then the manifest ccn key must be set to the target record's ccn key to ensure correct record identification.
  • Context - the manifest ccn key has been set for a specific record:
    For Execute Get Hold for Update Command:
    When the system needs to retrieve and lock the manifest record for update, then a get hold update command must be executed to retrieve the record with exclusive lock.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest retrieval operation is about to be performed
GIVEN
A manifest retrieval operation is about to be performed
Applied to: Clear Accept Status
WHEN
The system prepares to get a manifest record with hold for update
THEN
The system accept status must be cleared to ensure clean retrieval operation
Context: A specific manifest record needs to be retrieved for update
GIVEN
A specific manifest record needs to be retrieved for update
Applied to: Set Manifest CCN Key for Retrieval
WHEN
The system prepares the retrieval parameters
THEN
The manifest CCN key must be set to the target record's CCN key to ensure correct record identification
Context: The manifest CCN key has been set for a specific record
GIVEN
The manifest CCN key has been set for a specific record
Applied to: Execute Get Hold for Update Command
WHEN
The system needs to retrieve and lock the manifest record for update
THEN
A get hold update command must be executed to retrieve the record with exclusive lock
R-GCCCCADD-cbl-00041 (+8) File: GCCCCADD.cbl Program Initialization Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Program Initialization':
  • Context - a customs manifest creation request is initiated:
    For Waybill Key Present?:
    When the system checks for waybill key presence, then if waybill key is spaces, set return status to invalid waybill key, otherwise proceed to numeric validation.
  • Context - a waybill key is present in the request:
    For Waybill Key Numeric?:
    When the system validates the waybill key format, then if waybill key is not numeric, set return status to invalid waybill key, otherwise proceed to shipment retrieval.
  • Context - a valid numeric waybill key is provided:
    For Retrieve Shipment Root Data:
    When the system attempts to retrieve shipment root data, then execute shipment root data retrieval process using the waybill key.
  • Context - shipment root data retrieval has been attempted:
    For Shipment Found?:
    When the system checks if shipment data was found, then if shipment found, set return status to ok, otherwise set return status to waybill not found.
  • Context - program initialization is in progress:
    For Initialize Working Variables:
    When working variables need to be set to initial state, then set message index to zero, initialize counters, clear message fields, and set error flags to off state.
  • Context - customs manifest processing is being initialized:
    For Check for Existing Importer Data:
    When the system evaluates importer data availability, then if importer, business number, and business number qualifier are all present, proceed to search for existing importer records.
  • Context - importer data exists in input and search criteria are met:
    For Search for Existing Importer in Customs Records:
    When the system searches customs records from sequence 3 to 24, then for each sequence, retrieve customs record type 55 and check if entity id equals 'im' for importer records.
  • Context - an existing importer record is found in customs records:
    For Backup Existing Importer Data:
    When the system processes the found importer data, then extract and store all importer details including name, address, contact information, and clear original importer fields from input.
  • Context - program initialization is completing:
    For Initialize Customs Record Arrays:
    When customs record storage areas need to be prepared, then clear customs record type 55 arrays and set initial sequence index to 3.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest creation request is initiated
GIVEN
A customs manifest creation request is initiated
Applied to: Waybill Key Present?
WHEN
The system checks for waybill key presence
THEN
If waybill key is spaces, set return status to invalid waybill key, otherwise proceed to numeric validation
Context: A waybill key is present in the request
GIVEN
A waybill key is present in the request
Applied to: Waybill Key Numeric?
WHEN
The system validates the waybill key format
THEN
If waybill key is not numeric, set return status to invalid waybill key, otherwise proceed to shipment retrieval
Context: A valid numeric waybill key is provided
GIVEN
A valid numeric waybill key is provided
Applied to: Retrieve Shipment Root Data
WHEN
The system attempts to retrieve shipment root data
THEN
Execute shipment root data retrieval process using the waybill key
Context: Shipment root data retrieval has been attempted
GIVEN
Shipment root data retrieval has been attempted
Applied to: Shipment Found?
WHEN
The system checks if shipment data was found
THEN
If shipment found, set return status to OK, otherwise set return status to waybill not found
Context: Program initialization is in progress
GIVEN
Program initialization is in progress
Applied to: Initialize Working Variables
WHEN
Working variables need to be set to initial state
THEN
Set message index to zero, initialize counters, clear message fields, and set error flags to off state
Context: Customs manifest processing is being initialized
GIVEN
Customs manifest processing is being initialized
Applied to: Check for Existing Importer Data
WHEN
The system evaluates importer data availability
THEN
If importer, business number, and business number qualifier are all present, proceed to search for existing importer records
Context: Importer data exists in input and search criteria are met
GIVEN
Importer data exists in input and search criteria are met
Applied to: Search for Existing Importer in Customs Records
WHEN
The system searches customs records from sequence 3 to 24
THEN
For each sequence, retrieve customs record type 55 and check if entity ID equals 'IM' for importer records
Context: An existing importer record is found in customs records
GIVEN
An existing importer record is found in customs records
Applied to: Backup Existing Importer Data
WHEN
The system processes the found importer data
THEN
Extract and store all importer details including name, address, contact information, and clear original importer fields from input
Context: Program initialization is completing
GIVEN
Program initialization is completing
Applied to: Initialize Customs Record Arrays
WHEN
Customs record storage areas need to be prepared
THEN
Clear customs record type 55 arrays and set initial sequence index to 3
R-GCCCANRL-cbl-00042 File: GCCCANRL.cbl Set Manifest Status Based on CSA Indicator
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Manifest Status Based on CSA Indicator':
  • Context - a cargo manifest record is being processed for cancel release:
    For Set Manifest Status Based on CSA Indicator - Update manifest status to CSA-DLV if CSA indicator is on, otherwise set to MANUAL:
    When the system evaluates the csa indicator status, then if csa indicator is on, set manifest status to csa-dlv, otherwise set manifest status to manual.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest record is being processed for cancel release
GIVEN
A cargo manifest record is being processed for cancel release
Applied to: Set Manifest Status Based on CSA Indicator - Update manifest status to CSA-DLV if CSA indicator is on, otherwise set to MANUAL
WHEN
The system evaluates the CSA indicator status
THEN
If CSA indicator is ON, set manifest status to CSA-DLV, otherwise set manifest status to MANUAL
R-GCCCANRL-cbl-00043 (+4) File: GCCCANRL.cbl Update Release Information Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Release Information':
  • Context - a cargo release is being canceled:
    For Capture Current Date for Unrelease & Clear All Release Information:
    When the system processes the cancel release request, then the current machine date is captured and stored as the unrelease date and all release information fields are cleared and set to spaces.
  • Context - a cargo release is being canceled by a user:
    For Capture Current User ID:
    When the system processes the cancel release request, then the current user's acf2 user id is captured and stored as the unreleasing user.
  • Context - a cargo release with an existing release date is being canceled:
    For Save Original Release Date:
    When the system processes the cancel release request, then the original release date is saved before any release information is cleared.
  • Context - a cargo release is being canceled with a specific unrelease reason:
    For Set Unrelease Reason with Details:
    When the system processes the cancel release request, then the unrelease reason is recorded in the release reason field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release is being canceled
GIVEN
A cargo release is being canceled
Applied to: Capture Current Date for Unrelease & Clear All Release Information
WHEN
The system processes the cancel release request
THEN
The current machine date is captured and stored as the unrelease date AND All release information fields are cleared and set to spaces
Context: A cargo release is being canceled by a user
GIVEN
A cargo release is being canceled by a user
Applied to: Capture Current User ID
WHEN
The system processes the cancel release request
THEN
The current user's ACF2 user ID is captured and stored as the unreleasing user
Context: A cargo release with an existing release date is being canceled
GIVEN
A cargo release with an existing release date is being canceled
Applied to: Save Original Release Date
WHEN
The system processes the cancel release request
THEN
The original release date is saved before any release information is cleared
Context: A cargo release is being canceled with a specific unrelease reason
GIVEN
A cargo release is being canceled with a specific unrelease reason
Applied to: Set Unrelease Reason with Details
WHEN
The system processes the cancel release request
THEN
The unrelease reason is recorded in the release reason field
R-GCCCBOL-cbl-00044 (+3) File: GCCCBOL.cbl Extract EDI BOL Key Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract EDI BOL Key':
  • Context - the system needs to extract edi bol key from shipment data:
    For Set Shipmine Segment Number to 1:
    When the extraction process begins, then the shipmine segment number is set to 1 to start from the first segment.
  • Context - the shipmine segment number is set:
    For Retrieve Shipmine Data:
    When the system attempts to retrieve shipmine data, then the system calls the database access routine to get the shipmine segment data.
  • Context - shipmine data has been successfully retrieved from the database:
    For Extract BOL Key from First Data Line:
    When the system processes the retrieved shipmine segment, then the edi bol key is extracted from the first data line and stored in the work area.
  • Context - the system attempts to retrieve shipmine data:
    For Set BOL Key to Blank:
    When no shipmine data is found in the database, then the edi bol key is set to blank spaces.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to extract EDI BOL key from shipment data
GIVEN
The system needs to extract EDI BOL key from shipment data
Applied to: Set Shipmine Segment Number to 1
WHEN
The extraction process begins
THEN
The shipmine segment number is set to 1 to start from the first segment
Context: The shipmine segment number is set
GIVEN
The shipmine segment number is set
Applied to: Retrieve Shipmine Data
WHEN
The system attempts to retrieve shipmine data
THEN
The system calls the database access routine to get the shipmine segment data
Context: Shipmine data has been successfully retrieved from the database
GIVEN
Shipmine data has been successfully retrieved from the database
Applied to: Extract BOL Key from First Data Line
WHEN
The system processes the retrieved shipmine segment
THEN
The EDI BOL key is extracted from the first data line and stored in the work area
Context: The system attempts to retrieve shipmine data
GIVEN
The system attempts to retrieve shipmine data
Applied to: Set BOL Key to Blank
WHEN
No shipmine data is found in the database
THEN
The EDI BOL key is set to blank spaces
R-GCCCCREL-cbl-00046 File: GCCCCREL.cbl Master Manifest Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Master Manifest Processing':
  • Context - a cargo manifest is being processed for cancel release:
    For Call GCCCANRL Subprogram for Specialized Cancel Release Processing:
    When the manifest is identified as a master manifest type, then the system calls the gcccanrl subprogram with the common control block and ccn key to perform specialized master manifest cancel release processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed for cancel release
GIVEN
A cargo manifest is being processed for cancel release
Applied to: Call GCCCANRL Subprogram for Specialized Cancel Release Processing
WHEN
The manifest is identified as a master manifest type
THEN
The system calls the GCCCANRL subprogram with the common control block and CCN key to perform specialized master manifest cancel release processing
R-GCCS309C-cbl-00046 (+4) File: GCCS309C.cbl Action Code Processing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Action Code Processing':
  • Context - a manifest transaction is being processed with an action code:
    For Action Code = '04', '05', or '06'?:
    When the action code is '04', '05', or '06', then the system should evaluate border arrival date and pre-emanifest status for amendment processing.
  • Context - a manifest transaction has action code '04', '05', or '06':
    For Border Arrival Date exists AND Not Pre-Emanifest?:
    When the border arrival date is not empty and the manifest is not a pre-emanifest, then the system should apply post-emanifest amendment processing rules.
  • Context - a manifest has action code '04', '05', or '06' and has border arrival date and is not pre-emanifest:
    For Set Purpose Code to 'CO':
    When post-emanifest amendment processing is triggered, then the transaction purpose code should be set to 'co'.
  • Context - a manifest qualifies for post-emanifest amendment processing:
    For Set Post-Emanifest Amendment Flag:
    When the purpose code is set to 'co', then the post-emanifest amendment flag should be set to true.
  • Context - a manifest transaction is being processed:
    For Use Original Action Code as Purpose Code:
    When the action code is not '04', '05', or '06' or border arrival date is empty or it is a pre-emanifest, then the original action code should be used as the transaction purpose code.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest transaction is being processed with an action code
GIVEN
A manifest transaction is being processed with an action code
Applied to: Action Code = '04', '05', or '06'?
WHEN
The action code is '04', '05', or '06'
THEN
The system should evaluate border arrival date and pre-emanifest status for amendment processing
Context: A manifest transaction has action code '04', '05', or '06'
GIVEN
A manifest transaction has action code '04', '05', or '06'
Applied to: Border Arrival Date exists AND Not Pre-Emanifest?
WHEN
The border arrival date is not empty AND the manifest is not a pre-emanifest
THEN
The system should apply post-emanifest amendment processing rules
Context: A manifest has action code '04', '05', or '06' AND has border arrival date AND is not pre-emanifest
GIVEN
A manifest has action code '04', '05', or '06' AND has border arrival date AND is not pre-emanifest
Applied to: Set Purpose Code to 'CO'
WHEN
Post-emanifest amendment processing is triggered
THEN
The transaction purpose code should be set to 'CO'
Context: A manifest qualifies for post-emanifest amendment processing
GIVEN
A manifest qualifies for post-emanifest amendment processing
Applied to: Set Post-Emanifest Amendment Flag
WHEN
The purpose code is set to 'CO'
THEN
The post-emanifest amendment flag should be set to true
Context: A manifest transaction is being processed
GIVEN
A manifest transaction is being processed
Applied to: Use Original Action Code as Purpose Code
WHEN
The action code is not '04', '05', or '06' OR border arrival date is empty OR it is a pre-emanifest
THEN
The original action code should be used as the transaction purpose code
R-GCCCCREL-cbl-00047 (+9) File: GCCCCREL.cbl Cargo Release Logging Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Release Logging':
  • Context - a cargo release removal operation needs to be logged:
    For Initialize Log Entry Structure:
    When the system begins the audit logging process, then the log entry structure is initialized to clear any previous data.
  • Context - an audit log entry is being created for cargo release removal:
    For Set Action Code to 'Cargo Release Removed':
    When the system sets the action code in the log entry, then the action code is set to log-cargo-release-removed to identify the type of operation.
    For Mark as Canadian Cargo:
    When the system sets the cargo type classification, then the cargo type is set to gcx105-ca-cargo to indicate canadian cargo.
  • Context - an audit log entry is being created:
    For Set Security Level to High Values:
    When the system sets the security level, then the security byte is set to high-values to indicate maximum security classification.
    For Copy Current Date to Log:
    When the system records the date of the operation, then the current machine century and date are copied to gcx105-work-century and gcx105-work-yymmdd, then formatted as gcx105-date.
    For Copy Current Time to Log:
    When the system records the time of the operation, then the current machine time from cc-machine-time is copied to gcx105-time in the log entry.
  • Context - a cargo release removal is being logged:
    For Copy Cargo Control Number to Log:
    When the system records the cargo identifier, then the cargo control number from gccc-ccn-key is copied to gcx105-train-or-us-ccn in the log entry.
  • Context - a cargo release removal operation is being logged:
    For Copy Transaction Code to Log:
    When the system records the originating transaction, then the transaction code from cc-trans-code is copied to gcx105-sending-transaction in the log entry.
  • Context - a cargo release removal is being performed by a user:
    For Copy User ID to Log:
    When the system creates the audit log entry, then the user id from cc-acf2-userid is copied to gcx105-acf2-id in the log entry.
  • Context - a complete audit log entry has been prepared for cargo release removal:
    For Send Log Message to Audit System:
    When the system sends the log message to the audit system, then the log entry is transmitted via gct1051e message to the external audit system for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release removal operation needs to be logged
GIVEN
A cargo release removal operation needs to be logged
Applied to: Initialize Log Entry Structure
WHEN
The system begins the audit logging process
THEN
The log entry structure is initialized to clear any previous data
Context: An audit log entry is being created for cargo release removal
GIVEN
An audit log entry is being created for cargo release removal
Applied to: Set Action Code to 'Cargo Release Removed'
WHEN
The system sets the action code in the log entry
THEN
The action code is set to LOG-CARGO-RELEASE-REMOVED to identify the type of operation
Applied to: Mark as Canadian Cargo
WHEN
The system sets the cargo type classification
THEN
The cargo type is set to GCX105-CA-CARGO to indicate Canadian cargo
Context: An audit log entry is being created
GIVEN
An audit log entry is being created
Applied to: Set Security Level to High Values
WHEN
The system sets the security level
THEN
The security byte is set to HIGH-VALUES to indicate maximum security classification
Applied to: Copy Current Date to Log
WHEN
The system records the date of the operation
THEN
The current machine century and date are copied to GCX105-WORK-CENTURY and GCX105-WORK-YYMMDD, then formatted as GCX105-DATE
Applied to: Copy Current Time to Log
WHEN
The system records the time of the operation
THEN
The current machine time from CC-MACHINE-TIME is copied to GCX105-TIME in the log entry
Context: A cargo release removal is being logged
GIVEN
A cargo release removal is being logged
Applied to: Copy Cargo Control Number to Log
WHEN
The system records the cargo identifier
THEN
The cargo control number from GCCC-CCN-KEY is copied to GCX105-TRAIN-OR-US-CCN in the log entry
Context: A cargo release removal operation is being logged
GIVEN
A cargo release removal operation is being logged
Applied to: Copy Transaction Code to Log
WHEN
The system records the originating transaction
THEN
The transaction code from CC-TRANS-CODE is copied to GCX105-SENDING-TRANSACTION in the log entry
Context: A cargo release removal is being performed by a user
GIVEN
A cargo release removal is being performed by a user
Applied to: Copy User ID to Log
WHEN
The system creates the audit log entry
THEN
The user ID from CC-ACF2-USERID is copied to GCX105-ACF2-ID in the log entry
Context: A complete audit log entry has been prepared for cargo release removal
GIVEN
A complete audit log entry has been prepared for cargo release removal
Applied to: Send Log Message to Audit System
WHEN
The system sends the log message to the audit system
THEN
The log entry is transmitted via GCT1051E message to the external audit system for processing
R-GCCCANRL-cbl-00048 (+8) File: GCCCANRL.cbl Lookup Station Information Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Station Information':
  • Context - a station lookup operation is being initiated:
    For Initialize Table Access Parameters:
    When the system prepares to access the master control table, then all table key values and control flags are cleared to spaces to ensure clean lookup parameters.
  • Context - a station lookup operation requires access to the master control table:
    For Set Table ID to 'MC' for Master Control:
    When the system sets up table access parameters, then the table identifier is set to 'mc' to specify master control table access.
  • Context - a manifest record contains a destination station name:
    For Use Manifest Destination Station Name as Key:
    When the system performs a station lookup, then the manifest destination station name is used as the search key for the master control table lookup.
  • Context - all lookup parameters are properly initialized with table id 'mc' and station name key:
    For Call Master Control Table Service:
    When the system needs to retrieve station information, then the gcctbio service is called with gu function code to perform the table lookup.
  • Context - a master control table lookup has been performed:
    For Station Found Successfully?:
    When the system checks the lookup result, then if the return flag equals '0', the station was found successfully, otherwise the station was not found.
  • Context - a station record was successfully retrieved from the master control table:
    For Extract Station Number from Retrieved Record:
    When the system processes the retrieved station information, then the station number is extracted from the master control segment and moved to the table segment.
  • Context - a station number was successfully retrieved from the master control table lookup:
    For Set Destination Station Number for Index:
    When the system updates the destination station information, then the retrieved station number is assigned to the destination station number for index field.
  • Context - a station lookup operation failed to find the station in the master control table:
    For Use Current Manifest Station Number:
    When the system handles the lookup failure, then the master control segment is initialized to empty values.
  • Context - a station lookup failed and the master control segment was initialized:
    For Set Destination Station Number for Index:
    When the system needs to set the destination station number for indexing, then the existing destination station number from the manifest is used for the index field.
👨‍💻 Technical ACs (Gherkin)
Context: A station lookup operation is being initiated
GIVEN
A station lookup operation is being initiated
Applied to: Initialize Table Access Parameters
WHEN
The system prepares to access the master control table
THEN
All table key values and control flags are cleared to spaces to ensure clean lookup parameters
Context: A station lookup operation requires access to the master control table
GIVEN
A station lookup operation requires access to the master control table
Applied to: Set Table ID to 'MC' for Master Control
WHEN
The system sets up table access parameters
THEN
The table identifier is set to 'MC' to specify Master Control table access
Context: A manifest record contains a destination station name
GIVEN
A manifest record contains a destination station name
Applied to: Use Manifest Destination Station Name as Key
WHEN
The system performs a station lookup
THEN
The manifest destination station name is used as the search key for the master control table lookup
Context: All lookup parameters are properly initialized with table ID 'MC' and station name key
GIVEN
All lookup parameters are properly initialized with table ID 'MC' and station name key
Applied to: Call Master Control Table Service
WHEN
The system needs to retrieve station information
THEN
The GCCTBIO service is called with GU function code to perform the table lookup
Context: A master control table lookup has been performed
GIVEN
A master control table lookup has been performed
Applied to: Station Found Successfully?
WHEN
The system checks the lookup result
THEN
If the return flag equals '0', the station was found successfully, otherwise the station was not found
Context: A station record was successfully retrieved from the master control table
GIVEN
A station record was successfully retrieved from the master control table
Applied to: Extract Station Number from Retrieved Record
WHEN
The system processes the retrieved station information
THEN
The station number is extracted from the master control segment and moved to the table segment
Context: A station number was successfully retrieved from the master control table lookup
GIVEN
A station number was successfully retrieved from the master control table lookup
Applied to: Set Destination Station Number for Index
WHEN
The system updates the destination station information
THEN
The retrieved station number is assigned to the destination station number for index field
Context: A station lookup operation failed to find the station in the master control table
GIVEN
A station lookup operation failed to find the station in the master control table
Applied to: Use Current Manifest Station Number
WHEN
The system handles the lookup failure
THEN
The master control segment is initialized to empty values
Context: A station lookup failed and the master control segment was initialized
GIVEN
A station lookup failed and the master control segment was initialized
Applied to: Set Destination Station Number for Index
WHEN
The system needs to set the destination station number for indexing
THEN
The existing destination station number from the manifest is used for the index field
R-GCCCBOL-cbl-00048 (+18) File: GCCCBOL.cbl Build Broker Information Merged 19 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Broker Information':
  • Context - the broker building process is starting:
    For Initialize Broker Name Variables:
    When the system initializes broker processing variables, then all broker name variables are set to spaces for clean processing.
  • Context - an edi bol key exists for the shipment:
    For Search EBSNRTD Segments:
    When the system searches ebsnrtd segments for organization data, then organization records with type 'tn' are retrieved sequentially for broker identification.
  • Context - organization data is being processed from bol segments:
    For Organization ID = 'XQ'?:
    When an organization record has custom id equal to 'xq', then the organization name is set as the final broker name and search is completed.
  • Context - organization data is being processed from bol segments and no xq type broker has been found:
    For Organization ID = 'CB'?:
    When an organization record has id equal to 'cb' and custom id is not 'xr' or 'xu', then the organization name is stored as temporary broker name for potential use.
  • Context - all bol organization segments have been processed and a temporary cb broker exists:
    For Get Broker from BOL:
    When no xq type broker was found during the search, then the temporary cb broker name becomes the final broker name.
  • Context - no broker was found in bol data or bol key is not available:
    For Search Special Handling Codes:
    When the system searches fastway special handling codes, then special handling records are examined for xq and cb type broker codes.
  • Context - fastway special handling codes are being processed:
    For Code = 'XQ'?:
    When a special handling code equals 'xq', then the handling instruction is extracted as broker name and search is completed.
  • Context - fastway special handling codes are being processed and no xq code has been found:
    For Code = 'CB'?:
    When a special handling code equals 'cb', then the handling instruction is stored as temporary broker name.
  • Context - no broker information was found in bol data or fastway special handling:
    For Set Broker Name to 'UNKNOWN':
    When all broker search attempts have been exhausted, then the broker name is set to 'unknown'.
  • Context - a broker name has been identified from data sources:
    For Starts with 'CUSTOMS BROKER '?:
    When the broker name starts with 'customs broker ' (15 characters), then the actual broker name is extracted from position 16 onwards.
  • Context - a broker name starts with 'customs broker: ' (16 characters):
    For Parse Broker Name:
    When the system parses the broker name, then the actual broker name is extracted from position 17 onwards.
  • Context - a broker name starts with 'broker ' (7 characters):
    For Starts with 'BROKER '?:
    When the system parses the broker name, then the actual broker name is extracted from position 8 onwards.
  • Context - a broker name starts with 'broker: ' (8 characters):
    For Parse Broker Name:
    When the system parses the broker name, then the actual broker name is extracted from position 9 onwards.
  • Context - a broker name starts with 'cb ' or 'xq ' (3 characters):
    For Starts with 'CB ' or 'XQ '?:
    When the system parses the broker name, then the actual broker name is extracted from position 4 onwards.
  • Context - a broker name starts with 'cb: ' or 'xq: ' (4 characters):
    For Parse Broker Name:
    When the system parses the broker name, then the actual broker name is extracted from position 5 onwards.
  • Context - a broker name does not start with any recognized prefixes:
    For Use Full String as Name:
    When the system parses the broker name, then the entire string is used as the broker name without modification.
  • Context - a broker long name has been identified and parsed:
    For Lookup Broker Short Name:
    When the system looks up the broker name in gcst2rt table, then the system searches for a corresponding short name translation.
  • Context - a broker short name translation exists in gcst2rt table:
    For Use Short Name from GCST2RT:
    When the lookup operation finds a matching record, then the short name from gcst2rt is used as the final broker name.
  • Context - no broker short name translation exists in gcst2rt table:
    For Use Original Long Name:
    When the lookup operation finds no matching record, then the original parsed long name is used as the final broker name.
👨‍💻 Technical ACs (Gherkin)
Context: The broker building process is starting
GIVEN
The broker building process is starting
Applied to: Initialize Broker Name Variables
WHEN
The system initializes broker processing variables
THEN
All broker name variables are set to spaces for clean processing
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Search EBSNRTD Segments
WHEN
The system searches EBSNRTD segments for organization data
THEN
Organization records with type 'TN' are retrieved sequentially for broker identification
Context: Organization data is being processed from BOL segments
GIVEN
Organization data is being processed from BOL segments
Applied to: Organization ID = 'XQ'?
WHEN
An organization record has custom ID equal to 'XQ'
THEN
The organization name is set as the final broker name and search is completed
Context: Organization data is being processed from BOL segments and no XQ type broker has been found
GIVEN
Organization data is being processed from BOL segments and no XQ type broker has been found
Applied to: Organization ID = 'CB'?
WHEN
An organization record has ID equal to 'CB' and custom ID is not 'XR' or 'XU'
THEN
The organization name is stored as temporary broker name for potential use
Context: All BOL organization segments have been processed and a temporary CB broker exists
GIVEN
All BOL organization segments have been processed and a temporary CB broker exists
Applied to: Get Broker from BOL
WHEN
No XQ type broker was found during the search
THEN
The temporary CB broker name becomes the final broker name
Context: No broker was found in BOL data or BOL key is not available
GIVEN
No broker was found in BOL data or BOL key is not available
Applied to: Search Special Handling Codes
WHEN
The system searches Fastway special handling codes
THEN
Special handling records are examined for XQ and CB type broker codes
Context: Fastway special handling codes are being processed
GIVEN
Fastway special handling codes are being processed
Applied to: Code = 'XQ'?
WHEN
A special handling code equals 'XQ'
THEN
The handling instruction is extracted as broker name and search is completed
Context: Fastway special handling codes are being processed and no XQ code has been found
GIVEN
Fastway special handling codes are being processed and no XQ code has been found
Applied to: Code = 'CB'?
WHEN
A special handling code equals 'CB'
THEN
The handling instruction is stored as temporary broker name
Context: No broker information was found in BOL data or Fastway special handling
GIVEN
No broker information was found in BOL data or Fastway special handling
Applied to: Set Broker Name to 'UNKNOWN'
WHEN
All broker search attempts have been exhausted
THEN
The broker name is set to 'UNKNOWN'
Context: A broker name has been identified from data sources
GIVEN
A broker name has been identified from data sources
Applied to: Starts with 'CUSTOMS BROKER '?
WHEN
The broker name starts with 'CUSTOMS BROKER ' (15 characters)
THEN
The actual broker name is extracted from position 16 onwards
Context: A broker name starts with 'CUSTOMS BROKER: ' (16 characters)
GIVEN
A broker name starts with 'CUSTOMS BROKER: ' (16 characters)
Applied to: Parse Broker Name
WHEN
The system parses the broker name
THEN
The actual broker name is extracted from position 17 onwards
Context: A broker name starts with 'BROKER ' (7 characters)
GIVEN
A broker name starts with 'BROKER ' (7 characters)
Applied to: Starts with 'BROKER '?
WHEN
The system parses the broker name
THEN
The actual broker name is extracted from position 8 onwards
Context: A broker name starts with 'BROKER: ' (8 characters)
GIVEN
A broker name starts with 'BROKER: ' (8 characters)
Applied to: Parse Broker Name
WHEN
The system parses the broker name
THEN
The actual broker name is extracted from position 9 onwards
Context: A broker name starts with 'CB ' or 'XQ ' (3 characters)
GIVEN
A broker name starts with 'CB ' or 'XQ ' (3 characters)
Applied to: Starts with 'CB ' or 'XQ '?
WHEN
The system parses the broker name
THEN
The actual broker name is extracted from position 4 onwards
Context: A broker name starts with 'CB: ' or 'XQ: ' (4 characters)
GIVEN
A broker name starts with 'CB: ' or 'XQ: ' (4 characters)
Applied to: Parse Broker Name
WHEN
The system parses the broker name
THEN
The actual broker name is extracted from position 5 onwards
Context: A broker name does not start with any recognized prefixes
GIVEN
A broker name does not start with any recognized prefixes
Applied to: Use Full String as Name
WHEN
The system parses the broker name
THEN
The entire string is used as the broker name without modification
Context: A broker long name has been identified and parsed
GIVEN
A broker long name has been identified and parsed
Applied to: Lookup Broker Short Name
WHEN
The system looks up the broker name in GCST2RT table
THEN
The system searches for a corresponding short name translation
Context: A broker short name translation exists in GCST2RT table
GIVEN
A broker short name translation exists in GCST2RT table
Applied to: Use Short Name from GCST2RT
WHEN
The lookup operation finds a matching record
THEN
The short name from GCST2RT is used as the final broker name
Context: No broker short name translation exists in GCST2RT table
GIVEN
No broker short name translation exists in GCST2RT table
Applied to: Use Original Long Name
WHEN
The lookup operation finds no matching record
THEN
The original parsed long name is used as the final broker name
R-GCCCCADD-cbl-00050 (+13) File: GCCCCADD.cbl Importer Data Backup Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Backup':
  • Context - a corrector edi transaction is being processed and importer data exists in input parameters and business number and business number qualifier are present:
    For Corrector EDI with Existing Importer Data?:
    When the system checks for existing importer data, then the system should initiate backup process if all importer fields are populated.
  • Context - importer backup process has been initiated and ccn key is available:
    For Search Existing Importer Records in Customs Database:
    When the system searches customs records from sequence 3 to 24 for importer entity type 'im', then the system should iterate through each sequence until importer is found or maximum sequence is reached.
  • Context - system has searched customs database records for importer information:
    For Importer Record Found?:
    When a record is retrieved with entity id code equal to 'im', then the system should set importer found flag and proceed with data extraction.
  • Context - an importer record has been found in the customs database:
    For Extract Current Importer Information:
    When the system processes the importer record, then the system should extract entity id, name, chop code, business identifiers, and set importer found status.
  • Context - importer information has been extracted from database record:
    For Backup Importer Name and CHOP Code:
    When the system processes importer identification data, then the system should store importer name and chop code in temporary backup variables.
  • Context - importer identification data has been backed up:
    For Backup Business Number and Qualifier:
    When the system processes business registration information, then the system should store business number qualifier and business number in temporary backup variables.
  • Context - business registration data has been backed up:
    For Backup Address Information:
    When the system processes address information, then the system should store address line 1 and address line 2 in temporary backup variables.
  • Context - address information has been backed up:
    For Backup City, State, Postal Code:
    When the system processes geographic location data, then the system should store city name, state/province code, and postal code in temporary backup variables.
  • Context - geographic location data has been backed up:
    For Backup Country Code:
    When the system processes country information, then the system should store country code in temporary backup variable.
  • Context - country information has been backed up:
    For Backup Contact Information:
    When the system processes contact details, then the system should store contact function code, person name, communication number qualifier, and communication number in temporary backup variables.
  • Context - contact information has been backed up:
    For Store CSA Indicator Status:
    When the system processes csa program status, then the system should store csa indicator value in temporary backup variable.
  • Context - all importer data has been backed up to temporary variables:
    For Set Backup Completion Flag:
    When the backup process completes successfully, then the system should set importer found flag to indicate backup completion.
  • Context - importer data backup has been completed:
    For Clear Original Importer Fields:
    When the system prepares for corrector processing, then the system should clear importer, business number, and business number qualifier fields from input.
  • Context - system is not processing corrector edi or no existing importer data is found in database search:
    For Skip Backup - No Existing Data:
    When the backup process evaluation occurs, then the system should skip backup operations and continue with normal processing.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed AND importer data exists in input parameters AND business number and business number qualifier are present
GIVEN
A corrector EDI transaction is being processed AND importer data exists in input parameters AND business number and business number qualifier are present
Applied to: Corrector EDI with Existing Importer Data?
WHEN
The system checks for existing importer data
THEN
The system should initiate backup process if all importer fields are populated
Context: Importer backup process has been initiated AND CCN key is available
GIVEN
Importer backup process has been initiated AND CCN key is available
Applied to: Search Existing Importer Records in Customs Database
WHEN
The system searches customs records from sequence 3 to 24 for importer entity type 'IM'
THEN
The system should iterate through each sequence until importer is found or maximum sequence is reached
Context: System has searched customs database records for importer information
GIVEN
System has searched customs database records for importer information
Applied to: Importer Record Found?
WHEN
A record is retrieved with entity ID code equal to 'IM'
THEN
The system should set importer found flag and proceed with data extraction
Context: An importer record has been found in the customs database
GIVEN
An importer record has been found in the customs database
Applied to: Extract Current Importer Information
WHEN
The system processes the importer record
THEN
The system should extract entity ID, name, CHOP code, business identifiers, and set importer found status
Context: Importer information has been extracted from database record
GIVEN
Importer information has been extracted from database record
Applied to: Backup Importer Name and CHOP Code
WHEN
The system processes importer identification data
THEN
The system should store importer name and CHOP code in temporary backup variables
Context: Importer identification data has been backed up
GIVEN
Importer identification data has been backed up
Applied to: Backup Business Number and Qualifier
WHEN
The system processes business registration information
THEN
The system should store business number qualifier and business number in temporary backup variables
Context: Business registration data has been backed up
GIVEN
Business registration data has been backed up
Applied to: Backup Address Information
WHEN
The system processes address information
THEN
The system should store address line 1 and address line 2 in temporary backup variables
Context: Address information has been backed up
GIVEN
Address information has been backed up
Applied to: Backup City, State, Postal Code
WHEN
The system processes geographic location data
THEN
The system should store city name, state/province code, and postal code in temporary backup variables
Context: Geographic location data has been backed up
GIVEN
Geographic location data has been backed up
Applied to: Backup Country Code
WHEN
The system processes country information
THEN
The system should store country code in temporary backup variable
Context: Country information has been backed up
GIVEN
Country information has been backed up
Applied to: Backup Contact Information
WHEN
The system processes contact details
THEN
The system should store contact function code, person name, communication number qualifier, and communication number in temporary backup variables
Context: Contact information has been backed up
GIVEN
Contact information has been backed up
Applied to: Store CSA Indicator Status
WHEN
The system processes CSA program status
THEN
The system should store CSA indicator value in temporary backup variable
Context: All importer data has been backed up to temporary variables
GIVEN
All importer data has been backed up to temporary variables
Applied to: Set Backup Completion Flag
WHEN
The backup process completes successfully
THEN
The system should set importer found flag to indicate backup completion
Context: Importer data backup has been completed
GIVEN
Importer data backup has been completed
Applied to: Clear Original Importer Fields
WHEN
The system prepares for corrector processing
THEN
The system should clear importer, business number, and business number qualifier fields from input
Context: System is not processing corrector EDI OR no existing importer data is found in database search
GIVEN
System is not processing corrector EDI OR no existing importer data is found in database search
Applied to: Skip Backup - No Existing Data
WHEN
The backup process evaluation occurs
THEN
The system should skip backup operations and continue with normal processing
R-GCX122A-cbl-00050 (+4) File: GCX122A.cbl Control Merlin ID Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Control Merlin ID Validation':
  • Context - the system has retrieved dc-p merlin id 1 from the admin configuration table:
    For Validate DC-P Merlin ID 1:
    When the system validates this merlin id against the user directory, then if the id is valid, it is set as the dcp merlin id and marked as found, otherwise the default 'om01247' is used as dcp merlin id and the original id is marked as not found.
  • Context - the system has the dc-p merlin id 2 from the admin configuration and the validated dcp merlin id:
    For Validate DC-P Merlin ID 2:
    When the system validates dc-p merlin id 2 against the user directory, then if the id is valid, it is set as the ifs merlin id, otherwise the dcp merlin id is used as the ifs merlin id.
  • Context - the system has the dc-p merlin id 3 from the admin configuration and the validated dcp merlin id:
    For Validate DC-P Merlin ID 3:
    When the system validates dc-p merlin id 3 against the user directory, then if the id is valid, it is set as the hhs merlin id, otherwise the dcp merlin id is used as the hhs merlin id.
  • Context - the system has the dc-p merlin id 4 from the admin configuration and the validated dcp merlin id:
    For Validate DC-P Merlin ID 4:
    When the system validates dc-p merlin id 4 against the user directory, then if the id is valid, it is set as the ims merlin id, otherwise the dcp merlin id is used as the ims merlin id.
  • Context - the primary dc-p merlin id 1 has been validated and found to be invalid:
    For Set Default 'OM01247' as DCP Merlin ID:
    When the system needs to establish the dcp merlin id, then the system sets 'om01247' as the dcp merlin id and marks the primary id as not found.
👨‍💻 Technical ACs (Gherkin)
Context: The system has retrieved DC-P Merlin ID 1 from the admin configuration table
GIVEN
The system has retrieved DC-P Merlin ID 1 from the admin configuration table
Applied to: Validate DC-P Merlin ID 1
WHEN
The system validates this Merlin ID against the user directory
THEN
If the ID is valid, it is set as the DCP Merlin ID and marked as found, otherwise the default 'OM01247' is used as DCP Merlin ID and the original ID is marked as not found
Context: The system has the DC-P Merlin ID 2 from the admin configuration and the validated DCP Merlin ID
GIVEN
The system has the DC-P Merlin ID 2 from the admin configuration and the validated DCP Merlin ID
Applied to: Validate DC-P Merlin ID 2
WHEN
The system validates DC-P Merlin ID 2 against the user directory
THEN
If the ID is valid, it is set as the IFS Merlin ID, otherwise the DCP Merlin ID is used as the IFS Merlin ID
Context: The system has the DC-P Merlin ID 3 from the admin configuration and the validated DCP Merlin ID
GIVEN
The system has the DC-P Merlin ID 3 from the admin configuration and the validated DCP Merlin ID
Applied to: Validate DC-P Merlin ID 3
WHEN
The system validates DC-P Merlin ID 3 against the user directory
THEN
If the ID is valid, it is set as the HHS Merlin ID, otherwise the DCP Merlin ID is used as the HHS Merlin ID
Context: The system has the DC-P Merlin ID 4 from the admin configuration and the validated DCP Merlin ID
GIVEN
The system has the DC-P Merlin ID 4 from the admin configuration and the validated DCP Merlin ID
Applied to: Validate DC-P Merlin ID 4
WHEN
The system validates DC-P Merlin ID 4 against the user directory
THEN
If the ID is valid, it is set as the IMS Merlin ID, otherwise the DCP Merlin ID is used as the IMS Merlin ID
Context: The primary DC-P Merlin ID 1 has been validated and found to be invalid
GIVEN
The primary DC-P Merlin ID 1 has been validated and found to be invalid
Applied to: Set Default 'OM01247' as DCP Merlin ID
WHEN
The system needs to establish the DCP Merlin ID
THEN
The system sets 'OM01247' as the DCP Merlin ID and marks the primary ID as not found
R-GCCS309C-cbl-00051 (+7) File: GCCS309C.cbl Automotive Release Check Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Automotive Release Check':
  • Context - a shipment manifest with consignee chop and commodity code fields:
    For Consignee CHOP and Commodity Code present?:
    When the system checks for automotive release eligibility, then the system should only proceed with au table lookup if both consignee chop and commodity code are not spaces.
  • Context - valid consignee chop and commodity code are present:
    For Access AU Table with CHOP and Commodity Code:
    When the system performs au table lookup, then the system should query the au table with table id 'au', chop as key-chop, and commodity code as key-commodity.
  • Context - au table lookup has been performed with consignee chop and commodity code:
    For AU Table entry found?:
    When the system checks the lookup result, then the system should set non-automotive flag if no matching au table entry is found, otherwise proceed with automotive type evaluation.
  • Context - a valid au table entry exists for the shipment:
    For Origin Country is US, CA, or blank?:
    When the system evaluates origin country for automotive eligibility, then the system should consider the shipment eligible for automotive processing if origin country is 'us', 'ca', or blank spaces.
  • Context - a valid au table entry exists and origin country is not us, ca, or blank:
    For Origin Country is MX and AU Type 2nd char is 'C'?:
    When the system evaluates mexican origin shipments, then the system should consider the shipment eligible for automotive processing if origin country is 'mx' and the second character of au type is 'c'.
  • Context - the shipment meets origin country requirements for automotive processing:
    For CSA Indicator is OFF?:
    When the system checks csa indicator status, then the system should only set automotive flag to true if csa indicator is off, otherwise set non-automotive flag.
  • Context - all automotive eligibility criteria are satisfied (valid au entry, eligible origin country, csa indicator off):
    For Set AUTOMOTIVE flag to TRUE:
    When the system finalizes automotive classification, then the system should set the automotive flag to true to enable automotive-specific processing.
  • Context - any automotive eligibility criteria fails (missing chop/commodity, no au entry, ineligible origin country, or csa indicator on):
    For Set NON-AUTOMOTIVE flag to TRUE:
    When the system finalizes automotive classification, then the system should set the non-automotive flag to true as the default processing mode.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment manifest with consignee CHOP and commodity code fields
GIVEN
A shipment manifest with consignee CHOP and commodity code fields
Applied to: Consignee CHOP and Commodity Code present?
WHEN
The system checks for automotive release eligibility
THEN
The system should only proceed with AU table lookup if both consignee CHOP and commodity code are not spaces
Context: Valid consignee CHOP and commodity code are present
GIVEN
Valid consignee CHOP and commodity code are present
Applied to: Access AU Table with CHOP and Commodity Code
WHEN
The system performs AU table lookup
THEN
The system should query the AU table with table ID 'AU', CHOP as key-chop, and commodity code as key-commodity
Context: AU table lookup has been performed with consignee CHOP and commodity code
GIVEN
AU table lookup has been performed with consignee CHOP and commodity code
Applied to: AU Table entry found?
WHEN
The system checks the lookup result
THEN
The system should set NON-AUTOMOTIVE flag if no matching AU table entry is found, otherwise proceed with automotive type evaluation
Context: A valid AU table entry exists for the shipment
GIVEN
A valid AU table entry exists for the shipment
Applied to: Origin Country is US, CA, or blank?
WHEN
The system evaluates origin country for automotive eligibility
THEN
The system should consider the shipment eligible for automotive processing if origin country is 'US', 'CA', or blank spaces
Context: A valid AU table entry exists and origin country is not US, CA, or blank
GIVEN
A valid AU table entry exists and origin country is not US, CA, or blank
Applied to: Origin Country is MX and AU Type 2nd char is 'C'?
WHEN
The system evaluates Mexican origin shipments
THEN
The system should consider the shipment eligible for automotive processing if origin country is 'MX' and the second character of AU type is 'C'
Context: The shipment meets origin country requirements for automotive processing
GIVEN
The shipment meets origin country requirements for automotive processing
Applied to: CSA Indicator is OFF?
WHEN
The system checks CSA indicator status
THEN
The system should only set AUTOMOTIVE flag to TRUE if CSA indicator is OFF, otherwise set NON-AUTOMOTIVE flag
Context: All automotive eligibility criteria are satisfied (valid AU entry, eligible origin country, CSA indicator OFF)
GIVEN
All automotive eligibility criteria are satisfied (valid AU entry, eligible origin country, CSA indicator OFF)
Applied to: Set AUTOMOTIVE flag to TRUE
WHEN
The system finalizes automotive classification
THEN
The system should set the AUTOMOTIVE flag to TRUE to enable automotive-specific processing
Context: Any automotive eligibility criteria fails (missing CHOP/commodity, no AU entry, ineligible origin country, or CSA indicator ON)
GIVEN
Any automotive eligibility criteria fails (missing CHOP/commodity, no AU entry, ineligible origin country, or CSA indicator ON)
Applied to: Set NON-AUTOMOTIVE flag to TRUE
WHEN
The system finalizes automotive classification
THEN
The system should set the NON-AUTOMOTIVE flag to TRUE as the default processing mode
R-GCX122A-cbl-00055 (+6) File: GCX122A.cbl Initialize Reference Data Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Reference Data':
  • Context - an oti message is received with a reference number in field oti-03-ref-num:
    For Extract Reference Number from Message:
    When the system processes the message for reference initialization, then the reference number is copied to emi-ref, mst-ref, msg-ref-key, and ws-ref-number variables.
  • Context - the system is initializing reference data processing:
    For Set Processing Flags to Active:
    When processing flags need to be set to their active states, then sw-process-mst is set to true, sw-process-merlin is set to true, sw-not-train-error is set to true, and sw-not-cargo-error is set to true.
  • Context - the system is setting up message processing variables:
    For Initialize Message Indicators:
    When message indicators and counters need to be initialized, then ws-ind-text is set to line-mess-min, ws-ind-mst is set to line-mess-min-mst, ws-ind-user is set to zero, mst-indx is set to zero, and ws-ind-err is set to zero.
  • Context - the system is preparing message storage areas for new processing:
    For Clear Message Content Areas:
    When content areas need to be cleared, then emi-to-usercode, emi-copy-usercode, emi-keywords, emi-text, emi-return-status-flag, mst-table, mst-call-lettrs, and ws-lterm-process are set to spaces.
  • Context - a message is being processed and oti-02-train condition is true:
    For Set Train Report Label:
    When the system determines the message type for labeling, then msg-lib is set to 'train report number :'.
  • Context - a message is being processed and oti-02-cargo condition is true:
    For Set Cargo Control Label:
    When the system determines the message type for labeling, then msg-lib is set to 'cargo control number :'.
  • Context - a message is being processed and neither oti-02-train nor oti-02-cargo conditions are true:
    For Set Generic Reference Label:
    When the system determines the message type for labeling, then msg-lib is set to 'reference number :'.
👨‍💻 Technical ACs (Gherkin)
Context: An OTI message is received with a reference number in field OTI-03-REF-NUM
GIVEN
An OTI message is received with a reference number in field OTI-03-REF-NUM
Applied to: Extract Reference Number from Message
WHEN
The system processes the message for reference initialization
THEN
The reference number is copied to EMI-REF, MST-REF, MSG-REF-KEY, and WS-REF-NUMBER variables
Context: The system is initializing reference data processing
GIVEN
The system is initializing reference data processing
Applied to: Set Processing Flags to Active
WHEN
Processing flags need to be set to their active states
THEN
SW-PROCESS-MST is set to TRUE, SW-PROCESS-MERLIN is set to TRUE, SW-NOT-TRAIN-ERROR is set to TRUE, and SW-NOT-CARGO-ERROR is set to TRUE
Context: The system is setting up message processing variables
GIVEN
The system is setting up message processing variables
Applied to: Initialize Message Indicators
WHEN
Message indicators and counters need to be initialized
THEN
WS-IND-TEXT is set to LINE-MESS-MIN, WS-IND-MST is set to LINE-MESS-MIN-MST, WS-IND-USER is set to ZERO, MST-INDX is set to ZERO, and WS-IND-ERR is set to ZERO
Context: The system is preparing message storage areas for new processing
GIVEN
The system is preparing message storage areas for new processing
Applied to: Clear Message Content Areas
WHEN
Content areas need to be cleared
THEN
EMI-TO-USERCODE, EMI-COPY-USERCODE, EMI-KEYWORDS, EMI-TEXT, EMI-RETURN-STATUS-FLAG, MST-TABLE, MST-CALL-LETTRS, and WS-LTERM-PROCESS are set to SPACES
Context: A message is being processed and OTI-02-TRAIN condition is true
GIVEN
A message is being processed and OTI-02-TRAIN condition is true
Applied to: Set Train Report Label
WHEN
The system determines the message type for labeling
THEN
MSG-LIB is set to 'TRAIN REPORT NUMBER :'
Context: A message is being processed and OTI-02-CARGO condition is true
GIVEN
A message is being processed and OTI-02-CARGO condition is true
Applied to: Set Cargo Control Label
WHEN
The system determines the message type for labeling
THEN
MSG-LIB is set to 'CARGO CONTROL NUMBER :'
Context: A message is being processed and neither OTI-02-TRAIN nor OTI-02-CARGO conditions are true
GIVEN
A message is being processed and neither OTI-02-TRAIN nor OTI-02-CARGO conditions are true
Applied to: Set Generic Reference Label
WHEN
The system determines the message type for labeling
THEN
MSG-LIB is set to 'REFERENCE NUMBER :'
R-GCCCANRL-cbl-00057 File: GCCCANRL.cbl Update In
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update In':
  • Context - a cargo manifest record is being processed for cancel release:
    For Update In-Transit Status - Change in-transit status from Z or E to L (Local) if applicable:
    When the current in-transit status is z or e, then the in-transit status is changed to l (local).
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest record is being processed for cancel release
GIVEN
A cargo manifest record is being processed for cancel release
Applied to: Update In-Transit Status - Change in-transit status from Z or E to L (Local) if applicable
WHEN
The current in-transit status is Z or E
THEN
The in-transit status is changed to L (Local)
R-GCCCCREL-cbl-00057 (+5) File: GCCCCREL.cbl Release Notification Generation Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Release Notification Generation':
  • Context - a cargo release process is initiated:
    For Set Message ID to GCW123:
    When the system prepares release notification message, then the message id is set to gcw123 and manual release flag is set to true.
  • Context - a release notification message is being prepared:
    For Copy Cargo Control Number to Message:
    When the system processes cargo control information, then the cargo control number from the release request is copied to the message ccn key field.
  • Context - a manual release notification is being prepared:
    For Clear Release Quantity Field:
    When the system sets up message fields, then the release quantity field is cleared to spaces.
  • Context - a release request contains a release reason:
    For Copy Release Reason to Comments:
    When the system prepares the notification message, then the release reason is copied to the message comments field.
  • Context - a cargo release notification is being processed:
    For Is Cargo Export Type?:
    When the system checks if the cargo is classified as export type, then if cargo is export type, notification generation is skipped; otherwise notification is generated.
  • Context - a non-export cargo release notification is ready to be sent:
    For Send Message via CIMS:
    When the system processes the notification request, then the gct1231e message is prepared, sent via cims, logged, and the message queue is purged.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release process is initiated
GIVEN
A cargo release process is initiated
Applied to: Set Message ID to GCW123
WHEN
The system prepares release notification message
THEN
The message ID is set to GCW123 and manual release flag is set to true
Context: A release notification message is being prepared
GIVEN
A release notification message is being prepared
Applied to: Copy Cargo Control Number to Message
WHEN
The system processes cargo control information
THEN
The cargo control number from the release request is copied to the message CCN key field
Context: A manual release notification is being prepared
GIVEN
A manual release notification is being prepared
Applied to: Clear Release Quantity Field
WHEN
The system sets up message fields
THEN
The release quantity field is cleared to spaces
Context: A release request contains a release reason
GIVEN
A release request contains a release reason
Applied to: Copy Release Reason to Comments
WHEN
The system prepares the notification message
THEN
The release reason is copied to the message comments field
Context: A cargo release notification is being processed
GIVEN
A cargo release notification is being processed
Applied to: Is Cargo Export Type?
WHEN
The system checks if the cargo is classified as export type
THEN
If cargo is export type, notification generation is skipped; otherwise notification is generated
Context: A non-export cargo release notification is ready to be sent
GIVEN
A non-export cargo release notification is ready to be sent
Applied to: Send Message via CIMS
WHEN
The system processes the notification request
THEN
The GCT1231E message is prepared, sent via CIMS, logged, and the message queue is purged
R-GCCCANRL-cbl-00058 File: GCCCANRL.cbl Handle Special Transit Cases
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Special Transit Cases':
  • Context - a manifest record is being processed for cancel release:
    For Handle Special Transit Cases - Clear destination station number for returning (R) or transit (T) status manifests:
    When the manifest in-transit status is 'r' (returning) or 't' (transit), then the destination station number for index should be cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record is being processed for cancel release
GIVEN
A manifest record is being processed for cancel release
Applied to: Handle Special Transit Cases - Clear destination station number for returning (R) or transit (T) status manifests
WHEN
The manifest in-transit status is 'R' (Returning) or 'T' (Transit)
THEN
The destination station number for index should be cleared to spaces
R-GCCCANRL-cbl-00059 File: GCCCANRL.cbl Set Manual Change Flag
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Manual Change Flag':
  • Context - a cargo manifest is being processed for cancellation or release changes:
    For Set Manual Change Flag to TRUE:
    When the system is setting cancel release data for the manifest, then the manual change flag (309-manual-change) must be set to true to indicate manual intervention.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed for cancellation or release changes
GIVEN
A cargo manifest is being processed for cancellation or release changes
Applied to: Set Manual Change Flag to TRUE
WHEN
The system is setting cancel release data for the manifest
THEN
The manual change flag (309-MANUAL-CHANGE) must be set to TRUE to indicate manual intervention
R-GCCS309C-cbl-00059 (+6) File: GCCS309C.cbl Transmission Number Generation Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transmission Number Generation':
  • Context - a transaction is being processed:
    For Set Prefix to 036 for GCT036:
    When the transaction type is 'gct036', then the transmission prefix should be set to 036.
    For Set Prefix to 002 for GCT0021E:
    When the transaction type is 'gct0021e', then the transmission prefix should be set to 002.
    For Set Prefix to 125 for GCT1251E:
    When the transaction type is 'gct1251e', then the transmission prefix should be set to 125.
    For Set Prefix to 011 for GCT0111E:
    When the transaction type is 'gct0111e', then the transmission prefix should be set to 011.
    For Set Prefix to 901 for Other Transactions:
    When the transaction type is not 'gct036', 'gct0021e', 'gct1251e', or 'gct0111e', then the transmission prefix should be set to 901.
  • Context - a transmission prefix has been determined:
    For Get Machine Time from System:
    When the system needs to generate a unique transmission number, then the current machine time should be retrieved from the system.
  • Context - a transmission prefix has been determined and machine time has been retrieved:
    For Combine Prefix with Machine Time:
    When the system generates the transmission number, then the transmission number should be created by combining the prefix with the machine time.
👨‍💻 Technical ACs (Gherkin)
Context: A transaction is being processed
GIVEN
A transaction is being processed
Applied to: Set Prefix to 036 for GCT036
WHEN
The transaction type is 'GCT036'
THEN
The transmission prefix should be set to 036
Applied to: Set Prefix to 002 for GCT0021E
WHEN
The transaction type is 'GCT0021E'
THEN
The transmission prefix should be set to 002
Applied to: Set Prefix to 125 for GCT1251E
WHEN
The transaction type is 'GCT1251E'
THEN
The transmission prefix should be set to 125
Applied to: Set Prefix to 011 for GCT0111E
WHEN
The transaction type is 'GCT0111E'
THEN
The transmission prefix should be set to 011
Applied to: Set Prefix to 901 for Other Transactions
WHEN
The transaction type is not 'GCT036', 'GCT0021E', 'GCT1251E', or 'GCT0111E'
THEN
The transmission prefix should be set to 901
Context: A transmission prefix has been determined
GIVEN
A transmission prefix has been determined
Applied to: Get Machine Time from System
WHEN
The system needs to generate a unique transmission number
THEN
The current machine time should be retrieved from the system
Context: A transmission prefix has been determined and machine time has been retrieved
GIVEN
A transmission prefix has been determined and machine time has been retrieved
Applied to: Combine Prefix with Machine Time
WHEN
The system generates the transmission number
THEN
The transmission number should be created by combining the prefix with the machine time
R-GCCCANRL-cbl-00060 File: GCCCANRL.cbl Clear Delete Status
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Clear Delete Status':
  • Context - a manifest record is being processed for cancel release:
    For Clear Delete Status Field:
    When the manifest current status is not equal to 'deleted', then the delete status field should be cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record is being processed for cancel release
GIVEN
A manifest record is being processed for cancel release
Applied to: Clear Delete Status Field
WHEN
The manifest current status is not equal to 'DELETED'
THEN
The delete status field should be cleared to spaces
R-GCCCANRL-cbl-00061 (+9) File: GCCCANRL.cbl Log Cancel Release Activity Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Cancel Release Activity':
  • Context - a cancel release activity needs to be logged:
    For Set Security Information:
    When the logging process begins, then the security byte should be set to high values.
  • Context - a manifest with a ccn key exists:
    For Record Manifest CCN Number:
    When creating an audit log entry, then the manifest ccn key should be recorded as the train or us ccn in the log.
  • Context - a cancel release activity is being logged:
    For Set Transaction Type to Cargo:
    When setting up the audit log entry, then the transaction type should be set to cargo.
  • Context - a user is performing a cancel release transaction:
    For Record User ID and Transaction Code:
    When creating the audit log entry, then the user's acf2 id and the transaction code should be recorded in the log.
  • Context - a cancel release activity is being processed:
    For Capture Current Date and Time:
    When creating the audit log entry, then the current machine date, century, and time should be captured and recorded in the log.
  • Context - a cargo release is being cancelled:
    For Set Action Code to 'Cargo Release Removed':
    When creating the audit log entry, then the action code should be set to indicate cargo release removal.
  • Context - all audit information has been collected:
    For Prepare Log Message:
    When preparing to send the log entry, then the audit information should be formatted into the message structure and the accept status should be cleared.
  • Context - a formatted audit log message is ready:
    For Send Log Entry to Audit System:
    When sending the log entry to the audit system, then the system should call the audit service to process the log entry.
  • Context - an audit log entry has been prepared:
    For Write Message to Log:
    When writing to the system log, then the message should be written to the log with proper message code, content, length, and module name.
  • Context - the audit log entry has been written:
    For Complete Logging Process:
    When completing the logging process, then the system should purge any temporary logging resources.
👨‍💻 Technical ACs (Gherkin)
Context: A cancel release activity needs to be logged
GIVEN
A cancel release activity needs to be logged
Applied to: Set Security Information
WHEN
The logging process begins
THEN
The security byte should be set to high values
Context: A manifest with a CCN key exists
GIVEN
A manifest with a CCN key exists
Applied to: Record Manifest CCN Number
WHEN
Creating an audit log entry
THEN
The manifest CCN key should be recorded as the train or US CCN in the log
Context: A cancel release activity is being logged
GIVEN
A cancel release activity is being logged
Applied to: Set Transaction Type to Cargo
WHEN
Setting up the audit log entry
THEN
The transaction type should be set to cargo
Context: A user is performing a cancel release transaction
GIVEN
A user is performing a cancel release transaction
Applied to: Record User ID and Transaction Code
WHEN
Creating the audit log entry
THEN
The user's ACF2 ID and the transaction code should be recorded in the log
Context: A cancel release activity is being processed
GIVEN
A cancel release activity is being processed
Applied to: Capture Current Date and Time
WHEN
Creating the audit log entry
THEN
The current machine date, century, and time should be captured and recorded in the log
Context: A cargo release is being cancelled
GIVEN
A cargo release is being cancelled
Applied to: Set Action Code to 'Cargo Release Removed'
WHEN
Creating the audit log entry
THEN
The action code should be set to indicate cargo release removal
Context: All audit information has been collected
GIVEN
All audit information has been collected
Applied to: Prepare Log Message
WHEN
Preparing to send the log entry
THEN
The audit information should be formatted into the message structure and the accept status should be cleared
Context: A formatted audit log message is ready
GIVEN
A formatted audit log message is ready
Applied to: Send Log Entry to Audit System
WHEN
Sending the log entry to the audit system
THEN
The system should call the audit service to process the log entry
Context: An audit log entry has been prepared
GIVEN
An audit log entry has been prepared
Applied to: Write Message to Log
WHEN
Writing to the system log
THEN
The message should be written to the log with proper message code, content, length, and module name
Context: The audit log entry has been written
GIVEN
The audit log entry has been written
Applied to: Complete Logging Process
WHEN
Completing the logging process
THEN
The system should purge any temporary logging resources
R-GCX122A-cbl-00062 (+11) File: GCX122A.cbl Process Acknowledgment Messages Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Acknowledgment Messages':
  • Context - an acknowledgment message is received:
    For Message Type?:
    When the system evaluates the message type indicator, then the message is routed to train processing if oti-02-train is true, cargo processing if oti-02-cargo is true, or other reference processing for all other cases.
  • Context - a train acknowledgment message with reference number oti-03-ref-num:
    For Train Report Found?:
    When the system searches for the train report using the reference number, then processing continues with train update if found, or error message generation if not found.
  • Context - a valid train report is found for acknowledgment:
    For Update Train Status to ACK:
    When the acknowledgment is processed, then the train status is set to ack, security errors are cleared if the record is deleted or delete-pending, and acknowledgment flag is set to true.
  • Context - a train acknowledgment is being processed:
    For Record Acknowledgment Number:
    When the acknowledgment details are recorded, then the acknowledgment number from bgn-02-ref-num is stored and current date/time is captured for the acknowledgment timestamp.
  • Context - a train acknowledgment message is received:
    For Send Train Not Found Message:
    When the train report is not found in the database, then an error message 'train report not found on customs database' is added to the message queue and train error flag is set.
  • Context - a cargo acknowledgment message with reference number oti-03-ref-num:
    For Cargo Control Number Found?:
    When the system searches for the cargo control number, then processing continues with cargo update if found, or error message generation if not found.
  • Context - a valid cargo control number is found for acknowledgment:
    For Update Cargo Status to ACK:
    When the cargo acknowledgment is processed, then the cargo current status is set to 'ack' if the current status is sent, and the processing terminal is determined from last modify terminal or creation terminal.
  • Context - a cargo acknowledgment message is received:
    For Send CCN Not Found Message:
    When the cargo control number is not found in the database, then an error message 'ccn not found on customs d.b. for 824 ack' is added to the message queue and dcp interface error flag is set.
  • Context - a cargo acknowledgment is being processed successfully:
    For Arrival Processing Required?:
    When the system checks the cargo arrival indicator, then arrival processing is triggered if gccc-arrival-ind equals 'y', otherwise normal processing continues.
  • Context - a cargo record has arrival indicator set to 'y':
    For Process Cargo Arrival:
    When cargo acknowledgment processing determines arrival processing is required, then the arrival processing routine z700-process-arrival is executed to handle cargo arrival notifications.
  • Context - an acknowledgment message for a reference number that is neither train nor cargo:
    For Format Application Message:
    When the reference number oti-03-ref-num is not spaces, then an application message is formatted using the reference number qualifier and advance number, and message counters are incremented.
  • Context - a train acknowledgment has been processed successfully:
    For Update Train Status to ACK:
    When the train record has aei-send flag set to 'y', then an aei notification message is sent containing train id and current status information.
👨‍💻 Technical ACs (Gherkin)
Context: An acknowledgment message is received
GIVEN
An acknowledgment message is received
Applied to: Message Type?
WHEN
The system evaluates the message type indicator
THEN
The message is routed to train processing if OTI-02-TRAIN is true, cargo processing if OTI-02-CARGO is true, or other reference processing for all other cases
Context: A train acknowledgment message with reference number OTI-03-REF-NUM
GIVEN
A train acknowledgment message with reference number OTI-03-REF-NUM
Applied to: Train Report Found?
WHEN
The system searches for the train report using the reference number
THEN
Processing continues with train update if found, or error message generation if not found
Context: A valid train report is found for acknowledgment
GIVEN
A valid train report is found for acknowledgment
Applied to: Update Train Status to ACK
WHEN
The acknowledgment is processed
THEN
The train status is set to ACK, security errors are cleared if the record is deleted or delete-pending, and acknowledgment flag is set to true
Context: A train acknowledgment is being processed
GIVEN
A train acknowledgment is being processed
Applied to: Record Acknowledgment Number
WHEN
The acknowledgment details are recorded
THEN
The acknowledgment number from BGN-02-REF-NUM is stored and current date/time is captured for the acknowledgment timestamp
Context: A train acknowledgment message is received
GIVEN
A train acknowledgment message is received
Applied to: Send Train Not Found Message
WHEN
The train report is not found in the database
THEN
An error message 'TRAIN REPORT NOT FOUND ON CUSTOMS DATABASE' is added to the message queue and train error flag is set
Context: A cargo acknowledgment message with reference number OTI-03-REF-NUM
GIVEN
A cargo acknowledgment message with reference number OTI-03-REF-NUM
Applied to: Cargo Control Number Found?
WHEN
The system searches for the cargo control number
THEN
Processing continues with cargo update if found, or error message generation if not found
Context: A valid cargo control number is found for acknowledgment
GIVEN
A valid cargo control number is found for acknowledgment
Applied to: Update Cargo Status to ACK
WHEN
The cargo acknowledgment is processed
THEN
The cargo current status is set to 'ACK' if the current status is SENT, and the processing terminal is determined from last modify terminal or creation terminal
Context: A cargo acknowledgment message is received
GIVEN
A cargo acknowledgment message is received
Applied to: Send CCN Not Found Message
WHEN
The cargo control number is not found in the database
THEN
An error message 'CCN NOT FOUND ON CUSTOMS D.B. FOR 824 ACK' is added to the message queue and DCP interface error flag is set
Context: A cargo acknowledgment is being processed successfully
GIVEN
A cargo acknowledgment is being processed successfully
Applied to: Arrival Processing Required?
WHEN
The system checks the cargo arrival indicator
THEN
Arrival processing is triggered if GCCC-ARRIVAL-IND equals 'Y', otherwise normal processing continues
Context: A cargo record has arrival indicator set to 'Y'
GIVEN
A cargo record has arrival indicator set to 'Y'
Applied to: Process Cargo Arrival
WHEN
Cargo acknowledgment processing determines arrival processing is required
THEN
The arrival processing routine Z700-PROCESS-ARRIVAL is executed to handle cargo arrival notifications
Context: An acknowledgment message for a reference number that is neither train nor cargo
GIVEN
An acknowledgment message for a reference number that is neither train nor cargo
Applied to: Format Application Message
WHEN
The reference number OTI-03-REF-NUM is not spaces
THEN
An application message is formatted using the reference number qualifier and advance number, and message counters are incremented
Context: A train acknowledgment has been processed successfully
GIVEN
A train acknowledgment has been processed successfully
Applied to: Update Train Status to ACK
WHEN
The train record has AEI-SEND flag set to 'Y'
THEN
An AEI notification message is sent containing train ID and current status information
R-GCCCCREL-cbl-00063 (+4) File: GCCCCREL.cbl Manifest Data Retrieval Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Data Retrieval':
  • Context - a manifest data retrieval operation is initiated:
    For Setup Retrieval Parameters:
    When the system prepares to access manifest data, then the retrieval parameters are set to target canadian manifest cargo records with get unique function and no index usage.
  • Context - a cargo control number key is provided in the release request:
    For Set Cargo Control Number Key:
    When the system prepares to retrieve manifest data, then the cargo control number key is assigned to the manifest record key field.
  • Context - manifest retrieval parameters are configured and cargo control number key is set:
    For Call Data Access Service:
    When the system needs to access manifest data, then the canadian cargo data access service is called with the configured parameters and manifest record structure.
  • Context - a data access service call has been executed for manifest retrieval:
    For Manifest Record Found?:
    When the system evaluates the retrieval results, then the system determines whether the manifest data is within valid range and accessible.
  • Context - a manifest record retrieval attempt has failed:
    For Generate Error Message:
    When the manifest data is not found or not within valid range, then an error message 'can not locate manifest for release/cancel release' is generated and error handling is invoked.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest data retrieval operation is initiated
GIVEN
A manifest data retrieval operation is initiated
Applied to: Setup Retrieval Parameters
WHEN
The system prepares to access manifest data
THEN
The retrieval parameters are set to target Canadian manifest cargo records with GET UNIQUE function and no index usage
Context: A cargo control number key is provided in the release request
GIVEN
A cargo control number key is provided in the release request
Applied to: Set Cargo Control Number Key
WHEN
The system prepares to retrieve manifest data
THEN
The cargo control number key is assigned to the manifest record key field
Context: Manifest retrieval parameters are configured and cargo control number key is set
GIVEN
Manifest retrieval parameters are configured and cargo control number key is set
Applied to: Call Data Access Service
WHEN
The system needs to access manifest data
THEN
The Canadian cargo data access service is called with the configured parameters and manifest record structure
Context: A data access service call has been executed for manifest retrieval
GIVEN
A data access service call has been executed for manifest retrieval
Applied to: Manifest Record Found?
WHEN
The system evaluates the retrieval results
THEN
The system determines whether the manifest data is within valid range and accessible
Context: A manifest record retrieval attempt has failed
GIVEN
A manifest record retrieval attempt has failed
Applied to: Generate Error Message
WHEN
The manifest data is not found or not within valid range
THEN
An error message 'CAN NOT LOCATE MANIFEST FOR RELEASE/CANCEL RELEASE' is generated and error handling is invoked
R-GCCCCADD-cbl-00064 (+7) File: GCCCCADD.cbl Cargo Control Setup Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Cargo Control Setup':
  • Context - a waybill key is provided in the input parameters:
    For Set CCN Key from Waybill:
    When the cargo control setup process begins, then the waybill key should be assigned to the cargo control waybill key for index field.
  • Context - a waybill number index exists in the cargo control data:
    For Extract Waybill Number:
    When the waybill number needs to be extracted, then the waybill number index value should be assigned to the main waybill number field.
  • Context - a new cargo control record is being created:
    For Set Status to Pending:
    When the status needs to be initialized, then the cargo control status should be set to pending.
  • Context - shipment root data contains a car id:
    For Extract Equipment Car ID:
    When equipment information needs to be assigned to cargo control, then the car id from shipment root should be assigned to the cargo control equipment car field.
  • Context - a cargo control record is being initialized:
    For Set Error/Release Status:
    When the error or release status needs to be set, then the error or release status index should be set to 'e'.
  • Context - shipment root data contains a waybill date:
    For Extract Waybill Date:
    When waybill date information needs to be assigned to cargo control, then the waybill date from shipment root should be assigned to both cargo control waybill date and waybill date index fields.
  • Context - the waybill date has been extracted and assigned:
    For Set Waybill Date Index:
    When the waybill date index needs to be set, then the waybill date should be assigned to the waybill date index field.
  • Context - equipment car information has been assigned to cargo control:
    For Set Equipment ID for Index:
    When the equipment id index needs to be set, then the equipment car value should be assigned to the equipment id for index field.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill key is provided in the input parameters
GIVEN
A waybill key is provided in the input parameters
Applied to: Set CCN Key from Waybill
WHEN
The cargo control setup process begins
THEN
The waybill key should be assigned to the cargo control waybill key for index field
Context: A waybill number index exists in the cargo control data
GIVEN
A waybill number index exists in the cargo control data
Applied to: Extract Waybill Number
WHEN
The waybill number needs to be extracted
THEN
The waybill number index value should be assigned to the main waybill number field
Context: A new cargo control record is being created
GIVEN
A new cargo control record is being created
Applied to: Set Status to Pending
WHEN
The status needs to be initialized
THEN
The cargo control status should be set to pending
Context: Shipment root data contains a car ID
GIVEN
Shipment root data contains a car ID
Applied to: Extract Equipment Car ID
WHEN
Equipment information needs to be assigned to cargo control
THEN
The car ID from shipment root should be assigned to the cargo control equipment car field
Context: A cargo control record is being initialized
GIVEN
A cargo control record is being initialized
Applied to: Set Error/Release Status
WHEN
The error or release status needs to be set
THEN
The error or release status index should be set to 'E'
Context: Shipment root data contains a waybill date
GIVEN
Shipment root data contains a waybill date
Applied to: Extract Waybill Date
WHEN
Waybill date information needs to be assigned to cargo control
THEN
The waybill date from shipment root should be assigned to both cargo control waybill date and waybill date index fields
Context: The waybill date has been extracted and assigned
GIVEN
The waybill date has been extracted and assigned
Applied to: Set Waybill Date Index
WHEN
The waybill date index needs to be set
THEN
The waybill date should be assigned to the waybill date index field
Context: Equipment car information has been assigned to cargo control
GIVEN
Equipment car information has been assigned to cargo control
Applied to: Set Equipment ID for Index
WHEN
The equipment ID index needs to be set
THEN
The equipment car value should be assigned to the equipment ID for index field
R-GCCS309C-cbl-00066 (+2) File: GCCS309C.cbl Destination Address Setup Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Address Setup':
  • Context - a manifest processing request is received:
    For Set Broker EDI Address as Destination:
    When the broker notification flag (gcws309c-notify-broker) is set to true, then the system should set the broker edi address (gcws309c-x12-broker) as the work destination and log edi address.
  • Context - a manifest processing request requires customs notification:
    For Pre-Emanifest Status?:
    When the customs notification flag (gcws309c-notify-customs) is true and the manifest is not a pre-emanifest (gccc-not-pre-emanifest), then the system should set the destination to 309-destination-5040, otherwise set it to 309-destination.
  • Context - a destination address has been determined for the manifest:
    For Move Destination to ST Segment:
    When processing the st segment for edi transmission, then the system should move the work destination to the st-01-destination field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is received
GIVEN
A manifest processing request is received
Applied to: Set Broker EDI Address as Destination
WHEN
The broker notification flag (GCWS309C-NOTIFY-BROKER) is set to true
THEN
The system should set the broker EDI address (GCWS309C-X12-BROKER) as the work destination and log EDI address
Context: A manifest processing request requires customs notification
GIVEN
A manifest processing request requires customs notification
Applied to: Pre-Emanifest Status?
WHEN
The customs notification flag (GCWS309C-NOTIFY-CUSTOMS) is true and the manifest is not a pre-emanifest (GCCC-NOT-PRE-EMANIFEST)
THEN
The system should set the destination to 309-DESTINATION-5040, otherwise set it to 309-DESTINATION
Context: A destination address has been determined for the manifest
GIVEN
A destination address has been determined for the manifest
Applied to: Move Destination to ST Segment
WHEN
Processing the ST segment for EDI transmission
THEN
The system should move the work destination to the ST-01-DESTINATION field
R-GCCCCREL-cbl-00068 (+3) File: GCCCCREL.cbl Manifest Data Update Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Data Update':
  • Context - a manifest record needs to be updated:
    For Initialize Update Parameters:
    When the system begins the update process, then all update control parameters are cleared and reset to initial state.
  • Context - the system is preparing to update manifest data:
    For Set Target Segment to Canadian Manifest Cargo:
    When the target segment needs to be identified, then the system sets the target to canadian manifest cargo segment (gcsccrt).
  • Context - the target segment has been identified as canadian manifest cargo:
    For Set Function to Replace Record:
    When the update function type needs to be specified, then the system sets the function to replace (repl) the existing record.
  • Context - update parameters are initialized and function is set to replace:
    For Execute Manifest Record Update:
    When the system executes the manifest update, then the canadian manifest cargo record is updated with the modified release information using the gccccio program.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record needs to be updated
GIVEN
A manifest record needs to be updated
Applied to: Initialize Update Parameters
WHEN
The system begins the update process
THEN
All update control parameters are cleared and reset to initial state
Context: The system is preparing to update manifest data
GIVEN
The system is preparing to update manifest data
Applied to: Set Target Segment to Canadian Manifest Cargo
WHEN
The target segment needs to be identified
THEN
The system sets the target to Canadian manifest cargo segment (GCSCCRT)
Context: The target segment has been identified as Canadian manifest cargo
GIVEN
The target segment has been identified as Canadian manifest cargo
Applied to: Set Function to Replace Record
WHEN
The update function type needs to be specified
THEN
The system sets the function to replace (REPL) the existing record
Context: Update parameters are initialized and function is set to replace
GIVEN
Update parameters are initialized and function is set to replace
Applied to: Execute Manifest Record Update
WHEN
The system executes the manifest update
THEN
The Canadian manifest cargo record is updated with the modified release information using the GCCCCIO program
R-GCCS309C-cbl-00069 (+6) File: GCCS309C.cbl Root Transaction Creation Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Root Transaction Creation':
  • Context - a manifest transaction needs to be processed:
    For Evaluate Transaction Type:
    When the system evaluates the transaction type from gcws309c-transaction, then the system assigns transmission prefix 036 for gct036, 002 for gct0021e, 125 for gct1251e, 011 for gct0111e, or 901 for any other transaction type.
  • Context - a transmission number needs to be generated:
    For Use Machine Time as Base Transmission Number:
    When the system creates a new transmission, then the system uses the current machine time from cccom as the transmission number.
  • Context - a new transmission needs to be created:
    For Initialize Root Transmission Segment:
    When the system prepares the root transmission segment, then the system initializes a9rt-transmission-segment to clear any previous data.
  • Context - a root transmission segment is being configured:
    For Set Transaction Set to '309':
    When the system sets up the transaction details, then the system assigns '309' as the transaction set type in a9rt-transaction-set.
  • Context - a root transmission segment is being prepared:
    For Clear Read and Delete Flag:
    When the system configures transmission properties, then the system sets a9rt-read-and-delete-flag to spaces to prevent automatic deletion.
  • Context - a transmission creation attempt fails due to duplicate transmission number:
    For Creation Successful?:
    When the system receives a non-space status code from cccom indicating failure, then the system increments transmission-numb by 1 and retries the creation process until successful.
  • Context - a root transmission segment is fully configured with transmission number and transaction set:
    For Attempt to Create Root Transaction:
    When the system needs to create the root transaction, then the system calls a200-create-trans-root to persist the transmission segment.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest transaction needs to be processed
GIVEN
A manifest transaction needs to be processed
Applied to: Evaluate Transaction Type
WHEN
The system evaluates the transaction type from GCWS309C-TRANSACTION
THEN
The system assigns transmission prefix 036 for GCT036, 002 for GCT0021E, 125 for GCT1251E, 011 for GCT0111E, or 901 for any other transaction type
Context: A transmission number needs to be generated
GIVEN
A transmission number needs to be generated
Applied to: Use Machine Time as Base Transmission Number
WHEN
The system creates a new transmission
THEN
The system uses the current machine time from CCCOM as the transmission number
Context: A new transmission needs to be created
GIVEN
A new transmission needs to be created
Applied to: Initialize Root Transmission Segment
WHEN
The system prepares the root transmission segment
THEN
The system initializes A9RT-TRANSMISSION-SEGMENT to clear any previous data
Context: A root transmission segment is being configured
GIVEN
A root transmission segment is being configured
Applied to: Set Transaction Set to '309'
WHEN
The system sets up the transaction details
THEN
The system assigns '309' as the transaction set type in A9RT-TRANSACTION-SET
Context: A root transmission segment is being prepared
GIVEN
A root transmission segment is being prepared
Applied to: Clear Read and Delete Flag
WHEN
The system configures transmission properties
THEN
The system sets A9RT-READ-AND-DELETE-FLAG to spaces to prevent automatic deletion
Context: A transmission creation attempt fails due to duplicate transmission number
GIVEN
A transmission creation attempt fails due to duplicate transmission number
Applied to: Creation Successful?
WHEN
The system receives a non-space status code from CCCOM indicating failure
THEN
The system increments TRANSMISSION-NUMB by 1 and retries the creation process until successful
Context: A root transmission segment is fully configured with transmission number and transaction set
GIVEN
A root transmission segment is fully configured with transmission number and transaction set
Applied to: Attempt to Create Root Transaction
WHEN
The system needs to create the root transaction
THEN
The system calls A200-CREATE-TRANS-ROOT to persist the transmission segment
R-GCCCANRL-cbl-00071 (+1) File: GCCCANRL.cbl Update Manifest Record Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Manifest Record':
  • Context - a manifest record update operation is about to be performed:
    For Clear Accept Status:
    When the system prepares to replace the manifest record, then the accept status field must be cleared to spaces to reset operation status.
  • Context - the manifest record has been retrieved and updated with cancellation data:
    For Execute Database Replace Operation:
    When the system needs to persist the updated manifest information, then the system must call the database interface program with replace operation to update the manifest record.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record update operation is about to be performed
GIVEN
A manifest record update operation is about to be performed
Applied to: Clear Accept Status
WHEN
The system prepares to replace the manifest record
THEN
The accept status field must be cleared to spaces to reset operation status
Context: The manifest record has been retrieved and updated with cancellation data
GIVEN
The manifest record has been retrieved and updated with cancellation data
Applied to: Execute Database Replace Operation
WHEN
The system needs to persist the updated manifest information
THEN
The system must call the database interface program with replace operation to update the manifest record
R-GCCCCADD-cbl-00072 (+3) File: GCCCCADD.cbl Border Arrival Date Calculation Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Border Arrival Date Calculation':
  • Context - a shipment root record exists with waybill date information:
    For Extract Waybill Date from SHIPROOT:
    When the system needs to calculate border arrival eta, then the waybill date is extracted from the shipment root record and stored in work variables for date calculation.
  • Context - a waybill date exists and needs eta calculation:
    For Configure Date Calculation Parameters:
    When the system prepares to calculate border arrival date, then the date calculation is configured to add days operation with the waybill date formatted with century information and the configured number of days for eta.
  • Context - date calculation parameters are properly configured with waybill date and days to add:
    For Call Date Calculation Utility ISCDTCAL:
    When the system needs to calculate the border arrival eta, then the iscdtcal utility is called to perform the date arithmetic operation.
  • Context - the date calculation utility has been executed:
    For Date Calculation Successful?:
    When the system checks the calculation result status, then if calculation is successful, the new calculated date is set as border arrival eta, otherwise an invalid waybill date error message is retrieved and added to the message collection.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment root record exists with waybill date information
GIVEN
A shipment root record exists with waybill date information
Applied to: Extract Waybill Date from SHIPROOT
WHEN
The system needs to calculate border arrival ETA
THEN
The waybill date is extracted from the shipment root record and stored in work variables for date calculation
Context: A waybill date exists and needs ETA calculation
GIVEN
A waybill date exists and needs ETA calculation
Applied to: Configure Date Calculation Parameters
WHEN
The system prepares to calculate border arrival date
THEN
The date calculation is configured to add days operation with the waybill date formatted with century information and the configured number of days for ETA
Context: Date calculation parameters are properly configured with waybill date and days to add
GIVEN
Date calculation parameters are properly configured with waybill date and days to add
Applied to: Call Date Calculation Utility ISCDTCAL
WHEN
The system needs to calculate the border arrival ETA
THEN
The ISCDTCAL utility is called to perform the date arithmetic operation
Context: The date calculation utility has been executed
GIVEN
The date calculation utility has been executed
Applied to: Date Calculation Successful?
WHEN
The system checks the calculation result status
THEN
If calculation is successful, the new calculated date is set as border arrival ETA, otherwise an invalid waybill date error message is retrieved and added to the message collection
R-GCCCCREL-cbl-00072 (+4) File: GCCCCREL.cbl Create Audit Trail Information Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Create Audit Trail Information':
  • Context - a cargo release is being canceled:
    For Capture Current Machine Date as Unrelease Date & Record Current User ID as Unreleasing User & Clear Previous Release Information & Set Unrelease Reason Code:
    When the cancel release process is initiated, then the current machine date should be recorded as the unrelease date and the current user's acf2 user id should be recorded as the unreleasing user and all release information fields should be cleared to spaces and the unrelease reason should be recorded in the release reason field.
  • Context - a cargo release is being canceled and has an existing release date:
    For Preserve Original Release Date:
    When the cancel release process is initiated, then the original release date should be preserved in the original release date field.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release is being canceled
GIVEN
A cargo release is being canceled
Applied to: Capture Current Machine Date as Unrelease Date & Record Current User ID as Unreleasing User & Clear Previous Release Information & Set Unrelease Reason Code
WHEN
The cancel release process is initiated
THEN
The current machine date should be recorded as the unrelease date AND The current user's ACF2 user ID should be recorded as the unreleasing user AND All release information fields should be cleared to spaces AND The unrelease reason should be recorded in the release reason field
Context: A cargo release is being canceled and has an existing release date
GIVEN
A cargo release is being canceled and has an existing release date
Applied to: Preserve Original Release Date
WHEN
The cancel release process is initiated
THEN
The original release date should be preserved in the original release date field
R-GCCCANRL-cbl-00073 (+4) File: GCCCANRL.cbl Get Next Follower Manifest Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Next Follower Manifest':
  • Context - the system is processing follower manifests in sequence:
    For Retrieve Next Manifest Record:
    When the system attempts to retrieve the next manifest record, then the system executes a database get-next operation to fetch the subsequent manifest record.
  • Context - a database get-next operation has been executed for manifest records:
    For Record Retrieved Successfully?:
    When the system checks the operation result status, then if the status code is spaces (successful), the system proceeds with record validation, otherwise it sets no-more-records flag.
  • Context - a manifest record has been successfully retrieved and the input ccn key is available:
    For Does Manifest Belong to Same Master Group?:
    When the system compares the master manifest ccn from the retrieved record with the input ccn key, then if the master manifest ccn equals the input ccn key, the manifest belongs to the same group, otherwise it belongs to a different group.
  • Context - a manifest record has been successfully retrieved and belongs to the same master manifest group:
    For Set Flag: More Manifests Available:
    When the system needs to set the processing continuation flag, then the system sets the flag to indicate more manifests are available for processing.
  • Context - either the manifest record retrieval failed or the retrieved manifest belongs to a different master group:
    For Set Flag: No More Manifests:
    When the system needs to set the processing termination flag, then the system sets the flag to indicate no more manifests are available for processing.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing follower manifests in sequence
GIVEN
The system is processing follower manifests in sequence
Applied to: Retrieve Next Manifest Record
WHEN
The system attempts to retrieve the next manifest record
THEN
The system executes a database get-next operation to fetch the subsequent manifest record
Context: A database get-next operation has been executed for manifest records
GIVEN
A database get-next operation has been executed for manifest records
Applied to: Record Retrieved Successfully?
WHEN
The system checks the operation result status
THEN
If the status code is spaces (successful), the system proceeds with record validation, otherwise it sets no-more-records flag
Context: A manifest record has been successfully retrieved and the input CCN key is available
GIVEN
A manifest record has been successfully retrieved and the input CCN key is available
Applied to: Does Manifest Belong to Same Master Group?
WHEN
The system compares the master manifest CCN from the retrieved record with the input CCN key
THEN
If the master manifest CCN equals the input CCN key, the manifest belongs to the same group, otherwise it belongs to a different group
Context: A manifest record has been successfully retrieved and belongs to the same master manifest group
GIVEN
A manifest record has been successfully retrieved and belongs to the same master manifest group
Applied to: Set Flag: More Manifests Available
WHEN
The system needs to set the processing continuation flag
THEN
The system sets the flag to indicate more manifests are available for processing
Context: Either the manifest record retrieval failed or the retrieved manifest belongs to a different master group
GIVEN
Either the manifest record retrieval failed or the retrieved manifest belongs to a different master group
Applied to: Set Flag: No More Manifests
WHEN
The system needs to set the processing termination flag
THEN
The system sets the flag to indicate no more manifests are available for processing
R-GCX122A-cbl-00074 (+13) File: GCX122A.cbl Process Train Acknowledgment Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Train Acknowledgment':
  • Context - a train acknowledgment message with a reference number:
    For Retrieve Train Report by Reference Number:
    When the system processes the acknowledgment, then the system retrieves the corresponding train report from the database using the reference number.
  • Context - a train report lookup has been performed:
    For Train Report Found?:
    When the database query completes, then the system determines if the train report exists based on the database status code being spaces or not.
  • Context - a train report lookup has failed:
    For Set Error Message: Train Report Not Found:
    When the train report is not found in the database, then the system adds the message 'train report not found on customs database' to the error text and mst entry.
  • Context - a train report is not found in the database:
    For Mark as Train Error for Notification:
    When the error message is set, then the system sets the train error flag to true for subsequent notification processing.
  • Context - a train report is found in the database:
    For Clear Previous Error Status:
    When processing the acknowledgment, then the system clears the security error field by moving spaces to it.
  • Context - a train report exists in the database:
    For Train Deleted or Delete Pending?:
    When processing the acknowledgment, then the system checks if the train report has deleted status or delete-pending status.
  • Context - a train report is marked as deleted or delete-pending:
    For Clear Position and Port Data:
    When processing the acknowledgment, then the system initializes (clears) the security position and port fields.
  • Context - a valid train report is being processed for acknowledgment:
    For Set Train Status to ACK:
    When the acknowledgment processing continues, then the system sets the train acknowledgment flag to true and updates current status to 'ack'.
  • Context - a train acknowledgment is being processed:
    For Record Acknowledgment Reference Number:
    When setting acknowledgment details, then the system moves the reference number from the bgn segment to the train acknowledgment number field.
    For Capture Current Date and Time:
    When recording acknowledgment details, then the system captures machine century, date, and time from the common communication area and formats them into acknowledgment date-time field.
  • Context - train acknowledgment details have been set:
    For Update Train Report in Database:
    When completing the acknowledgment process, then the system performs a database replace operation to update the train report with acknowledgment information.
  • Context - a train report has been successfully acknowledged:
    For AEI Send Required?:
    When checking for additional notifications, then the system checks if the aei send flag equals 'y' to determine if aei message should be sent.
  • Context - aei send is required for the train:
    For Prepare AEI Status Message:
    When preparing the notification message, then the system creates a message subject containing 'train: ' followed by the canadian customs train id, ' status: ' and the current status.
  • Context - an aei status message has been prepared:
    For Send AEI Message to Border Points:
    When sending the notification, then the system calls the aei message sending function to transmit the status update.
👨‍💻 Technical ACs (Gherkin)
Context: A train acknowledgment message with a reference number
GIVEN
A train acknowledgment message with a reference number
Applied to: Retrieve Train Report by Reference Number
WHEN
The system processes the acknowledgment
THEN
The system retrieves the corresponding train report from the database using the reference number
Context: A train report lookup has been performed
GIVEN
A train report lookup has been performed
Applied to: Train Report Found?
WHEN
The database query completes
THEN
The system determines if the train report exists based on the database status code being spaces or not
Context: A train report lookup has failed
GIVEN
A train report lookup has failed
Applied to: Set Error Message: Train Report Not Found
WHEN
The train report is not found in the database
THEN
The system adds the message 'TRAIN REPORT NOT FOUND ON CUSTOMS DATABASE' to the error text and MST entry
Context: A train report is not found in the database
GIVEN
A train report is not found in the database
Applied to: Mark as Train Error for Notification
WHEN
The error message is set
THEN
The system sets the train error flag to true for subsequent notification processing
Context: A train report is found in the database
GIVEN
A train report is found in the database
Applied to: Clear Previous Error Status
WHEN
Processing the acknowledgment
THEN
The system clears the security error field by moving spaces to it
Context: A train report exists in the database
GIVEN
A train report exists in the database
Applied to: Train Deleted or Delete Pending?
WHEN
Processing the acknowledgment
THEN
The system checks if the train report has deleted status or delete-pending status
Context: A train report is marked as deleted or delete-pending
GIVEN
A train report is marked as deleted or delete-pending
Applied to: Clear Position and Port Data
WHEN
Processing the acknowledgment
THEN
The system initializes (clears) the security position and port fields
Context: A valid train report is being processed for acknowledgment
GIVEN
A valid train report is being processed for acknowledgment
Applied to: Set Train Status to ACK
WHEN
The acknowledgment processing continues
THEN
The system sets the train acknowledgment flag to true and updates current status to 'ACK'
Context: A train acknowledgment is being processed
GIVEN
A train acknowledgment is being processed
Applied to: Record Acknowledgment Reference Number
WHEN
Setting acknowledgment details
THEN
The system moves the reference number from the BGN segment to the train acknowledgment number field
Applied to: Capture Current Date and Time
WHEN
Recording acknowledgment details
THEN
The system captures machine century, date, and time from the common communication area and formats them into acknowledgment date-time field
Context: Train acknowledgment details have been set
GIVEN
Train acknowledgment details have been set
Applied to: Update Train Report in Database
WHEN
Completing the acknowledgment process
THEN
The system performs a database replace operation to update the train report with acknowledgment information
Context: A train report has been successfully acknowledged
GIVEN
A train report has been successfully acknowledged
Applied to: AEI Send Required?
WHEN
Checking for additional notifications
THEN
The system checks if the AEI send flag equals 'Y' to determine if AEI message should be sent
Context: AEI send is required for the train
GIVEN
AEI send is required for the train
Applied to: Prepare AEI Status Message
WHEN
Preparing the notification message
THEN
The system creates a message subject containing 'TRAIN: ' followed by the Canadian customs train ID, ' STATUS: ' and the current status
Context: An AEI status message has been prepared
GIVEN
An AEI status message has been prepared
Applied to: Send AEI Message to Border Points
WHEN
Sending the notification
THEN
The system calls the AEI message sending function to transmit the status update
R-GCCCCADD-cbl-00076 (+8) File: GCCCCADD.cbl Station Information Retrieval Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Information Retrieval':
  • Context - a shipment record with origin station information:
    For Origin Station Name Present?:
    When the origin station name field is empty or contains only spaces, then generate an error message indicating invalid origin station name.
  • Context - a shipment record with a valid origin station name:
    For Set Origin Station Name to GCCC-ORIGIN-STATION-NAME:
    When the origin station name field contains data, then set the origin station name in the customs manifest record.
  • Context - a shipment record with origin location information:
    For Origin Province/State Code Present?:
    When the origin province or state code field is empty or contains only spaces, then generate an error message for invalid origin province state code and clear the origin country determination table.
  • Context - a shipment record with a valid origin province or state code:
    For Set Origin Station State Code to GCCC-ORIGIN-STATION-STATE-CODE:
    When the origin province or state code field contains data, then set the origin station state code in the customs manifest record and perform origin country determination.
  • Context - a shipment record with origin station number in character format:
    For Convert Origin Station Number from Character to Numeric:
    When processing origin station information, then convert the character station number to numeric format and assign to the customs manifest origin station number field.
  • Context - a shipment record with destination station information:
    For Destination Station Name Present?:
    When the destination station name field is empty or contains only spaces, then generate an error message indicating invalid destination station name.
  • Context - a shipment record with a valid destination station name:
    For Set Destination Station Name to GCCC-DESTIN-STATION-NAME:
    When the destination station name field contains data, then set the destination station name in the customs manifest record.
  • Context - a shipment record with destination province or state code information:
    For Set Destination Station State Code to GCCC-DESTIN-STATION-STATE-CODE:
    When processing destination station information, then set the destination station state code in the customs manifest record.
  • Context - a shipment record with destination station number in character format:
    For Convert Destination Station Number from Character to Numeric:
    When processing destination station information, then convert the character station number to numeric format and assign to the customs manifest destination station number field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with origin station information
GIVEN
A shipment record with origin station information
Applied to: Origin Station Name Present?
WHEN
The origin station name field is empty or contains only spaces
THEN
Generate an error message indicating invalid origin station name
Context: A shipment record with a valid origin station name
GIVEN
A shipment record with a valid origin station name
Applied to: Set Origin Station Name to GCCC-ORIGIN-STATION-NAME
WHEN
The origin station name field contains data
THEN
Set the origin station name in the customs manifest record
Context: A shipment record with origin location information
GIVEN
A shipment record with origin location information
Applied to: Origin Province/State Code Present?
WHEN
The origin province or state code field is empty or contains only spaces
THEN
Generate an error message for invalid origin province state code and clear the origin country determination table
Context: A shipment record with a valid origin province or state code
GIVEN
A shipment record with a valid origin province or state code
Applied to: Set Origin Station State Code to GCCC-ORIGIN-STATION-STATE-CODE
WHEN
The origin province or state code field contains data
THEN
Set the origin station state code in the customs manifest record and perform origin country determination
Context: A shipment record with origin station number in character format
GIVEN
A shipment record with origin station number in character format
Applied to: Convert Origin Station Number from Character to Numeric
WHEN
Processing origin station information
THEN
Convert the character station number to numeric format and assign to the customs manifest origin station number field
Context: A shipment record with destination station information
GIVEN
A shipment record with destination station information
Applied to: Destination Station Name Present?
WHEN
The destination station name field is empty or contains only spaces
THEN
Generate an error message indicating invalid destination station name
Context: A shipment record with a valid destination station name
GIVEN
A shipment record with a valid destination station name
Applied to: Set Destination Station Name to GCCC-DESTIN-STATION-NAME
WHEN
The destination station name field contains data
THEN
Set the destination station name in the customs manifest record
Context: A shipment record with destination province or state code information
GIVEN
A shipment record with destination province or state code information
Applied to: Set Destination Station State Code to GCCC-DESTIN-STATION-STATE-CODE
WHEN
Processing destination station information
THEN
Set the destination station state code in the customs manifest record
Context: A shipment record with destination station number in character format
GIVEN
A shipment record with destination station number in character format
Applied to: Convert Destination Station Number from Character to Numeric
WHEN
Processing destination station information
THEN
Convert the character station number to numeric format and assign to the customs manifest destination station number field
R-GCCS309C-cbl-00076 (+5) File: GCCS309C.cbl ST Segment Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ST Segment Processing':
  • Context - a new st segment needs to be created for edi transmission:
    For Initialize ST segment structure:
    When the st segment processing begins, then the st segment structure is initialized, sequence number is incremented by 1, and st identifier is set to 'st '.
  • Context - a manifest transaction is being processed:
    For Notify Customs?:
    When the system checks if gcws309c-notify-customs flag is set, then if customs notification is required, proceed to emanifest type check, otherwise skip to transaction type setting.
  • Context - customs notification is required for the manifest:
    For Pre-Emanifest or Post-Emanifest?:
    When the system evaluates gccc-not-pre-emanifest flag, then if gccc-not-pre-emanifest is true, set destination to 5040 (309-destination-5040), otherwise set destination to standard (309-destination).
  • Context - an st segment is being created for manifest transmission:
    For Set transaction type to '309':
    When the transaction type needs to be assigned, then the transaction type is set to '309' in the st-02-transaction field.
  • Context - the destination and transaction type have been determined:
    For Move destination to ST-01 field:
    When the st segment fields need to be populated, then the work-destination value is moved to st-01-destination field and '309' is moved to st-02-transaction field.
  • Context - the st segment data has been populated with destination and transaction type:
    For Create ST segment in transmission:
    When the segment needs to be added to the transmission, then the st segment is moved to transmission data, sequence number is assigned, and the segment is created in the transmission via c200-create-trans-dept.
👨‍💻 Technical ACs (Gherkin)
Context: A new ST segment needs to be created for EDI transmission
GIVEN
A new ST segment needs to be created for EDI transmission
Applied to: Initialize ST segment structure
WHEN
The ST segment processing begins
THEN
The ST segment structure is initialized, sequence number is incremented by 1, and ST identifier is set to 'ST '
Context: A manifest transaction is being processed
GIVEN
A manifest transaction is being processed
Applied to: Notify Customs?
WHEN
The system checks if GCWS309C-NOTIFY-CUSTOMS flag is set
THEN
If customs notification is required, proceed to emanifest type check, otherwise skip to transaction type setting
Context: Customs notification is required for the manifest
GIVEN
Customs notification is required for the manifest
Applied to: Pre-Emanifest or Post-Emanifest?
WHEN
The system evaluates GCCC-NOT-PRE-EMANIFEST flag
THEN
If GCCC-NOT-PRE-EMANIFEST is true, set destination to 5040 (309-DESTINATION-5040), otherwise set destination to standard (309-DESTINATION)
Context: An ST segment is being created for manifest transmission
GIVEN
An ST segment is being created for manifest transmission
Applied to: Set transaction type to '309'
WHEN
The transaction type needs to be assigned
THEN
The transaction type is set to '309' in the ST-02-TRANSACTION field
Context: The destination and transaction type have been determined
GIVEN
The destination and transaction type have been determined
Applied to: Move destination to ST-01 field
WHEN
The ST segment fields need to be populated
THEN
The WORK-DESTINATION value is moved to ST-01-DESTINATION field and '309' is moved to ST-02-TRANSACTION field
Context: The ST segment data has been populated with destination and transaction type
GIVEN
The ST segment data has been populated with destination and transaction type
Applied to: Create ST segment in transmission
WHEN
The segment needs to be added to the transmission
THEN
The ST segment is moved to transmission data, sequence number is assigned, and the segment is created in the transmission via C200-CREATE-TRANS-DEPT
R-GCCCCREL-cbl-00077 (+6) File: GCCCCREL.cbl Call Station Table Lookup Service Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Station Table Lookup Service':
  • Context - a station table lookup is requested:
    For Initialize Lookup Parameters:
    When the system prepares to call the station lookup service, then all lookup parameters are cleared and function code is set to gu (get unique).
  • Context - station lookup parameters are being configured:
    For Set Table ID to 'MC':
    When the system needs to identify which table to search, then the table id is set to 'mc' to indicate station master table.
  • Context - a manifest record with destination station name exists:
    For Set Station Name from Manifest:
    When the system prepares station lookup parameters, then the manifest destination station name is copied to the lookup key field.
  • Context - station lookup parameters are properly initialized with table id and station name:
    For Call GCCTBIO Service:
    When the system needs to retrieve station details, then the gcctbio service is called with all required parameters.
  • Context - station table lookup service has been called:
    For Station Found?:
    When the system receives a return flag from the lookup service, then if return flag equals '0' then station is found, otherwise station is not found.
  • Context - station lookup was successful with return flag '0':
    For Extract Station Number from Result:
    When the system processes the lookup result, then the station number from the lookup result is extracted and assigned to the destination station number for index.
  • Context - station lookup failed with return flag not equal to '0':
    For Initialize Empty Station Record:
    When the system needs to handle the lookup failure, then the station record is initialized to empty values and the existing destination station number is used for indexing.
👨‍💻 Technical ACs (Gherkin)
Context: A station table lookup is requested
GIVEN
A station table lookup is requested
Applied to: Initialize Lookup Parameters
WHEN
The system prepares to call the station lookup service
THEN
All lookup parameters are cleared and function code is set to GU (Get Unique)
Context: Station lookup parameters are being configured
GIVEN
Station lookup parameters are being configured
Applied to: Set Table ID to 'MC'
WHEN
The system needs to identify which table to search
THEN
The table ID is set to 'MC' to indicate station master table
Context: A manifest record with destination station name exists
GIVEN
A manifest record with destination station name exists
Applied to: Set Station Name from Manifest
WHEN
The system prepares station lookup parameters
THEN
The manifest destination station name is copied to the lookup key field
Context: Station lookup parameters are properly initialized with table ID and station name
GIVEN
Station lookup parameters are properly initialized with table ID and station name
Applied to: Call GCCTBIO Service
WHEN
The system needs to retrieve station details
THEN
The GCCTBIO service is called with all required parameters
Context: Station table lookup service has been called
GIVEN
Station table lookup service has been called
Applied to: Station Found?
WHEN
The system receives a return flag from the lookup service
THEN
If return flag equals '0' then station is found, otherwise station is not found
Context: Station lookup was successful with return flag '0'
GIVEN
Station lookup was successful with return flag '0'
Applied to: Extract Station Number from Result
WHEN
The system processes the lookup result
THEN
The station number from the lookup result is extracted and assigned to the destination station number for index
Context: Station lookup failed with return flag not equal to '0'
GIVEN
Station lookup failed with return flag not equal to '0'
Applied to: Initialize Empty Station Record
WHEN
The system needs to handle the lookup failure
THEN
The station record is initialized to empty values and the existing destination station number is used for indexing
R-GCCCANRL-cbl-00078 (+3) File: GCCCANRL.cbl Validate Continuation Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Continuation':
  • Context - a next follower manifest record has been successfully retrieved:
    For Does Next Manifest Master CCN Match Lead Manifest CCN?:
    When the system compares the next manifest's master ccn with the input ccn key, then if the master ccn matches the input ccn key, set continue processing flag, otherwise set stop processing flag.
  • Context - the next manifest's master ccn matches the input ccn key:
    For Set Continue Processing Flag:
    When the system needs to indicate processing should continue, then set the more records flag to true to continue processing.
  • Context - the next manifest's master ccn does not match the input ccn key:
    For Set Stop Processing Flag:
    When the system needs to indicate processing should stop, then set the no more records flag to true to stop processing.
  • Context - a request to get the next follower manifest has been made:
    For Next Manifest Retrieved Successfully:
    When the database status code is spaces indicating successful retrieval, then proceed to validate if the manifest belongs to the same group, otherwise stop processing.
👨‍💻 Technical ACs (Gherkin)
Context: A next follower manifest record has been successfully retrieved
GIVEN
A next follower manifest record has been successfully retrieved
Applied to: Does Next Manifest Master CCN Match Lead Manifest CCN?
WHEN
The system compares the next manifest's master CCN with the input CCN key
THEN
If the master CCN matches the input CCN key, set continue processing flag, otherwise set stop processing flag
Context: The next manifest's master CCN matches the input CCN key
GIVEN
The next manifest's master CCN matches the input CCN key
Applied to: Set Continue Processing Flag
WHEN
The system needs to indicate processing should continue
THEN
Set the more records flag to true to continue processing
Context: The next manifest's master CCN does not match the input CCN key
GIVEN
The next manifest's master CCN does not match the input CCN key
Applied to: Set Stop Processing Flag
WHEN
The system needs to indicate processing should stop
THEN
Set the no more records flag to true to stop processing
Context: A request to get the next follower manifest has been made
GIVEN
A request to get the next follower manifest has been made
Applied to: Next Manifest Retrieved Successfully
WHEN
The database status code is spaces indicating successful retrieval
THEN
Proceed to validate if the manifest belongs to the same group, otherwise stop processing
R-GCCCBOL-cbl-00081 (+6) File: GCCCBOL.cbl Parse Broker Name Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parse Broker Name':
  • Context - a special handling instruction string is provided for broker name extraction:
    For Check if starts with 'CUSTOMS BROKER ':
    When the string starts with 'customs broker ' (15 characters including space), then extract the broker name from position 16 to 43 (28 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with 'customs broker ':
    For Check if starts with 'CUSTOMS BROKER: ':
    When the string starts with 'customs broker: ' (16 characters including colon and space), then extract the broker name from position 17 to 43 (27 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with 'customs broker ' or 'customs broker: ':
    For Check if starts with 'BROKER ':
    When the string starts with 'broker ' (7 characters including space), then extract the broker name from position 8 to 43 (36 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with 'customs broker ', 'customs broker: ', or 'broker ':
    For Check if starts with 'BROKER: ':
    When the string starts with 'broker: ' (8 characters including colon and space), then extract the broker name from position 9 to 43 (35 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with any customs broker or broker prefixes:
    For Check if starts with 'CB ' or 'XQ ':
    When the string starts with 'cb ' or 'xq ' (3 characters including space), then extract the broker name from position 4 to 44 (41 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with any customs broker, broker, cb, or xq prefixes:
    For Check if starts with 'CB: ' or 'XQ: ':
    When the string starts with 'cb: ' or 'xq: ' (4 characters including colon and space), then extract the broker name from position 5 to 44 (40 characters) and set it as the broker long name.
  • Context - a special handling instruction string is provided for broker name extraction and it does not start with any recognized broker prefixes:
    For Use entire string as broker name:
    When the string does not start with 'customs broker ', 'customs broker: ', 'broker ', 'broker: ', 'cb ', 'xq ', 'cb: ', or 'xq: ', then use the entire special handling instruction string as the broker long name.
👨‍💻 Technical ACs (Gherkin)
Context: A special handling instruction string is provided for broker name extraction
GIVEN
A special handling instruction string is provided for broker name extraction
Applied to: Check if starts with 'CUSTOMS BROKER '
WHEN
The string starts with 'CUSTOMS BROKER ' (15 characters including space)
THEN
Extract the broker name from position 16 to 43 (28 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER '
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER '
Applied to: Check if starts with 'CUSTOMS BROKER: '
WHEN
The string starts with 'CUSTOMS BROKER: ' (16 characters including colon and space)
THEN
Extract the broker name from position 17 to 43 (27 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER ' or 'CUSTOMS BROKER: '
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER ' or 'CUSTOMS BROKER: '
Applied to: Check if starts with 'BROKER '
WHEN
The string starts with 'BROKER ' (7 characters including space)
THEN
Extract the broker name from position 8 to 43 (36 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', or 'BROKER '
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', or 'BROKER '
Applied to: Check if starts with 'BROKER: '
WHEN
The string starts with 'BROKER: ' (8 characters including colon and space)
THEN
Extract the broker name from position 9 to 43 (35 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with any CUSTOMS BROKER or BROKER prefixes
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with any CUSTOMS BROKER or BROKER prefixes
Applied to: Check if starts with 'CB ' or 'XQ '
WHEN
The string starts with 'CB ' or 'XQ ' (3 characters including space)
THEN
Extract the broker name from position 4 to 44 (41 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with any CUSTOMS BROKER, BROKER, CB, or XQ prefixes
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with any CUSTOMS BROKER, BROKER, CB, or XQ prefixes
Applied to: Check if starts with 'CB: ' or 'XQ: '
WHEN
The string starts with 'CB: ' or 'XQ: ' (4 characters including colon and space)
THEN
Extract the broker name from position 5 to 44 (40 characters) and set it as the broker long name
Context: A special handling instruction string is provided for broker name extraction and it does not start with any recognized broker prefixes
GIVEN
A special handling instruction string is provided for broker name extraction and it does not start with any recognized broker prefixes
Applied to: Use entire string as broker name
WHEN
The string does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', 'XQ ', 'CB: ', or 'XQ: '
THEN
Use the entire special handling instruction string as the broker long name
R-GCCCANRL-cbl-00082 File: GCCCANRL.cbl Complete Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complete Processing':
  • Context - all follower manifests have been processed through the cancel release workflow and the original program name was saved at the beginning of processing:
    For Complete Processing - Restore original program name and return control to calling program:
    When the cancel release processing loop has completed with no more follower records to process, then the system restores the original program name to the program context and returns control to the calling program.
👨‍💻 Technical ACs (Gherkin)
Context: All follower manifests have been processed through the cancel release workflow AND the original program name was saved at the beginning of processing
GIVEN
All follower manifests have been processed through the cancel release workflow AND the original program name was saved at the beginning of processing
Applied to: Complete Processing - Restore original program name and return control to calling program
WHEN
The cancel release processing loop has completed with no more follower records to process
THEN
The system restores the original program name to the program context AND returns control to the calling program
R-GCCS309C-cbl-00082 (+22) File: GCCS309C.cbl M10 Segment Processing Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M10 Segment Processing':
  • Context - a manifest is being processed for edi transmission:
    For Set SCAC code to 'CPRS':
    When the m10 segment is being created, then the scac code field is set to 'cprs'.
    For Set transport type code to 'R' for Rail:
    When the m10 segment transport type is being set, then the transport type code is set to 'r' indicating rail transportation.
    For Set quantity to 1:
    When the m10 segment quantity is being set, then the quantity is set to 1.
  • Context - a manifest has an origin country specified:
    For Set country code from manifest origin country:
    When the m10 segment country code is being set, then the country code is set to the value from the manifest origin country field.
  • Context - a manifest is being processed for rail transportation:
    For Set vessel name to 'TRAIN':
    When the m10 segment vessel name is being set, then the vessel name is set to 'train'.
  • Context - a manifest has a ccn creation date field:
    For CCN creation date valid?:
    When the flight voyage number needs to be determined, then if the ccn creation date is not numeric or equals zero, use machine date; otherwise use the ccn creation date.
  • Context - the ccn creation date is not numeric or equals zero:
    For Use machine date for flight/voyage number:
    When the flight voyage number is being calculated, then the machine century and machine date are concatenated and used as the flight voyage number.
  • Context - the ccn creation date is numeric and non-zero:
    For Convert CCN creation date to flight/voyage number:
    When the flight voyage number is being calculated, then if the year is less than 90, prefix with '20'; otherwise prefix with '19', then convert to julian format.
  • Context - a manifest is being processed:
    For Arrival indicator or specific program?:
    When the manifest type code needs to be determined, then if arrival indicator is 'y' or the calling program is 'gcx148', set manifest type to 'a' for arrival.
    For Post-emanifest amendment conditions?:
    When the transaction purpose code needs to be determined, then if action code is '04', '05', or '06' and border arrival date exists and not pre-emanifest, set purpose to 'co'; otherwise use the action code.
  • Context - the arrival indicator is 'y' or the calling program is 'gcx148':
    For Set manifest type to 'A' for Arrival:
    When the manifest type code is being set, then the manifest type code is set to 'a' indicating an arrival manifest.
  • Context - the manifest is not for arrival and not processed by gcx148:
    For Canadian customs north train ID exists?:
    When the manifest type code needs to be determined, then if canadian customs north train id is spaces, check for specific programs; otherwise set to customs type.
  • Context - the canadian customs north train id is spaces:
    For Specific program GCX146 or GCX147?:
    When the manifest type code needs to be determined, then if the calling program is 'gcx146' or 'gcx147', set to customs type; otherwise set to pre-manifest type.
  • Context - either the canadian customs north train id exists or the calling program is 'gcx146' or 'gcx147':
    For Set manifest type to 'C' for Customs:
    When the manifest type code is being set, then the manifest type code is set to 'c' indicating a customs manifest.
  • Context - the manifest is not for arrival, not processed by specific customs programs, and has no canadian customs north train id:
    For Set manifest type to 'P' for Pre-manifest:
    When the manifest type code is being set, then the manifest type code is set to 'p' indicating a pre-manifest.
  • Context - a manifest has a ccn key:
    For Set reference number to CCN key:
    When the m10 segment reference number is being set, then the reference number is set to the ccn key value.
  • Context - the action code is '04', '05', or '06' and border arrival date is not spaces and the manifest is not pre-emanifest:
    For Set purpose code to 'CO' for amendment:
    When the transaction purpose code is being set, then the purpose code is set to 'co' and the post-emanifest amendment flag is set to true.
  • Context - the conditions for post-emanifest amendment are not met:
    For Set purpose code to action code:
    When the transaction purpose code is being set, then the purpose code is set to the original action code value.
  • Context - a manifest has an in-transit status:
    For In-transit status is 'T'?:
    When the application type needs to be determined, then if in-transit status is 't', set application type to '29'; otherwise set to '27'.
  • Context - the in-transit status is 't':
    For Set application type to '29':
    When the application type is being set, then the application type is set to '29'.
  • Context - the in-transit status is not 't':
    For Set application type to '27':
    When the application type is being set, then the application type is set to '27'.
  • Context - the m10 segment has been populated with data:
    For Replace underscores with spaces in segment:
    When the segment is being prepared for transmission, then all underscore characters in the segment are replaced with spaces.
  • Context - the m10 segment has been formatted and populated:
    For Add segment to EDI transmission:
    When the segment is ready for transmission, then the segment is added to the edi transmission with an incremented sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for EDI transmission
GIVEN
A manifest is being processed for EDI transmission
Applied to: Set SCAC code to 'CPRS'
WHEN
The M10 segment is being created
THEN
The SCAC code field is set to 'CPRS'
Applied to: Set transport type code to 'R' for Rail
WHEN
The M10 segment transport type is being set
THEN
The transport type code is set to 'R' indicating rail transportation
Applied to: Set quantity to 1
WHEN
The M10 segment quantity is being set
THEN
The quantity is set to 1
Context: A manifest has an origin country specified
GIVEN
A manifest has an origin country specified
Applied to: Set country code from manifest origin country
WHEN
The M10 segment country code is being set
THEN
The country code is set to the value from the manifest origin country field
Context: A manifest is being processed for rail transportation
GIVEN
A manifest is being processed for rail transportation
Applied to: Set vessel name to 'TRAIN'
WHEN
The M10 segment vessel name is being set
THEN
The vessel name is set to 'TRAIN'
Context: A manifest has a CCN creation date field
GIVEN
A manifest has a CCN creation date field
Applied to: CCN creation date valid?
WHEN
The flight voyage number needs to be determined
THEN
If the CCN creation date is not numeric or equals zero, use machine date; otherwise use the CCN creation date
Context: The CCN creation date is not numeric or equals zero
GIVEN
The CCN creation date is not numeric or equals zero
Applied to: Use machine date for flight/voyage number
WHEN
The flight voyage number is being calculated
THEN
The machine century and machine date are concatenated and used as the flight voyage number
Context: The CCN creation date is numeric and non-zero
GIVEN
The CCN creation date is numeric and non-zero
Applied to: Convert CCN creation date to flight/voyage number
WHEN
The flight voyage number is being calculated
THEN
If the year is less than 90, prefix with '20'; otherwise prefix with '19', then convert to Julian format
Context: A manifest is being processed
GIVEN
A manifest is being processed
Applied to: Arrival indicator or specific program?
WHEN
The manifest type code needs to be determined
THEN
If arrival indicator is 'Y' or the calling program is 'GCX148', set manifest type to 'A' for Arrival
Applied to: Post-emanifest amendment conditions?
WHEN
The transaction purpose code needs to be determined
THEN
If action code is '04', '05', or '06' AND border arrival date exists AND not pre-emanifest, set purpose to 'CO'; otherwise use the action code
Context: The arrival indicator is 'Y' or the calling program is 'GCX148'
GIVEN
The arrival indicator is 'Y' or the calling program is 'GCX148'
Applied to: Set manifest type to 'A' for Arrival
WHEN
The manifest type code is being set
THEN
The manifest type code is set to 'A' indicating an arrival manifest
Context: The manifest is not for arrival and not processed by GCX148
GIVEN
The manifest is not for arrival and not processed by GCX148
Applied to: Canadian customs north train ID exists?
WHEN
The manifest type code needs to be determined
THEN
If Canadian customs north train ID is spaces, check for specific programs; otherwise set to customs type
Context: The Canadian customs north train ID is spaces
GIVEN
The Canadian customs north train ID is spaces
Applied to: Specific program GCX146 or GCX147?
WHEN
The manifest type code needs to be determined
THEN
If the calling program is 'GCX146' or 'GCX147', set to customs type; otherwise set to pre-manifest type
Context: Either the Canadian customs north train ID exists or the calling program is 'GCX146' or 'GCX147'
GIVEN
Either the Canadian customs north train ID exists or the calling program is 'GCX146' or 'GCX147'
Applied to: Set manifest type to 'C' for Customs
WHEN
The manifest type code is being set
THEN
The manifest type code is set to 'C' indicating a customs manifest
Context: The manifest is not for arrival, not processed by specific customs programs, and has no Canadian customs north train ID
GIVEN
The manifest is not for arrival, not processed by specific customs programs, and has no Canadian customs north train ID
Applied to: Set manifest type to 'P' for Pre-manifest
WHEN
The manifest type code is being set
THEN
The manifest type code is set to 'P' indicating a pre-manifest
Context: A manifest has a CCN key
GIVEN
A manifest has a CCN key
Applied to: Set reference number to CCN key
WHEN
The M10 segment reference number is being set
THEN
The reference number is set to the CCN key value
Context: The action code is '04', '05', or '06' AND border arrival date is not spaces AND the manifest is not pre-emanifest
GIVEN
The action code is '04', '05', or '06' AND border arrival date is not spaces AND the manifest is not pre-emanifest
Applied to: Set purpose code to 'CO' for amendment
WHEN
The transaction purpose code is being set
THEN
The purpose code is set to 'CO' and the post-emanifest amendment flag is set to true
Context: The conditions for post-emanifest amendment are not met
GIVEN
The conditions for post-emanifest amendment are not met
Applied to: Set purpose code to action code
WHEN
The transaction purpose code is being set
THEN
The purpose code is set to the original action code value
Context: A manifest has an in-transit status
GIVEN
A manifest has an in-transit status
Applied to: In-transit status is 'T'?
WHEN
The application type needs to be determined
THEN
If in-transit status is 'T', set application type to '29'; otherwise set to '27'
Context: The in-transit status is 'T'
GIVEN
The in-transit status is 'T'
Applied to: Set application type to '29'
WHEN
The application type is being set
THEN
The application type is set to '29'
Context: The in-transit status is not 'T'
GIVEN
The in-transit status is not 'T'
Applied to: Set application type to '27'
WHEN
The application type is being set
THEN
The application type is set to '27'
Context: The M10 segment has been populated with data
GIVEN
The M10 segment has been populated with data
Applied to: Replace underscores with spaces in segment
WHEN
The segment is being prepared for transmission
THEN
All underscore characters in the segment are replaced with spaces
Context: The M10 segment has been formatted and populated
GIVEN
The M10 segment has been formatted and populated
Applied to: Add segment to EDI transmission
WHEN
The segment is ready for transmission
THEN
The segment is added to the EDI transmission with an incremented sequence number
R-GCCCANRL-cbl-00083 (+5) File: GCCCANRL.cbl Set Unrelease Reason with Details Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Set Unrelease Reason with Details':
  • Context - a cargo release cancellation is being processed:
    For Get Current Machine Date:
    When the system needs to record the unrelease date, then the current machine date is captured and stored as the unrelease date.
    For Get Current User ID:
    When the system needs to record who performed the unrelease action, then the current acf2 user id is captured and stored as the unreleasing user.
    For Get Original Release Date from Manifest:
    When the system needs to preserve historical release information, then the original release date from the manifest is captured and stored.
    For Clear Existing Release Information:
    When the system needs to clear previous release information, then the release information field is cleared to spaces.
  • Context - a cargo release cancellation is being processed and all required details are available:
    For Construct Unrelease Reason with All Details:
    When the system needs to document the reason for unreleasing, then the unrelease reason is constructed with the predefined unrelease reason text.
  • Context - the unrelease reason has been constructed with all required details:
    For Update Manifest Release Reason Field:
    When the system needs to update the manifest with cancellation information, then the manifest release reason field is updated with the constructed unrelease reason.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release cancellation is being processed
GIVEN
A cargo release cancellation is being processed
Applied to: Get Current Machine Date
WHEN
The system needs to record the unrelease date
THEN
The current machine date is captured and stored as the unrelease date
Applied to: Get Current User ID
WHEN
The system needs to record who performed the unrelease action
THEN
The current ACF2 user ID is captured and stored as the unreleasing user
Applied to: Get Original Release Date from Manifest
WHEN
The system needs to preserve historical release information
THEN
The original release date from the manifest is captured and stored
Applied to: Clear Existing Release Information
WHEN
The system needs to clear previous release information
THEN
The release information field is cleared to spaces
Context: A cargo release cancellation is being processed and all required details are available
GIVEN
A cargo release cancellation is being processed and all required details are available
Applied to: Construct Unrelease Reason with All Details
WHEN
The system needs to document the reason for unreleasing
THEN
The unrelease reason is constructed with the predefined unrelease reason text
Context: The unrelease reason has been constructed with all required details
GIVEN
The unrelease reason has been constructed with all required details
Applied to: Update Manifest Release Reason Field
WHEN
The system needs to update the manifest with cancellation information
THEN
The manifest release reason field is updated with the constructed unrelease reason
R-GCCCCREL-cbl-00084 (+9) File: GCCCCREL.cbl Send Log Message to Audit System Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Log Message to Audit System':
  • Context - a cargo release removal audit log message is being prepared:
    For Set Security Level to High:
    When the system initializes the security settings for the log message, then the security byte must be set to high values to indicate maximum security level.
  • Context - a cargo release removal is being logged:
    For Populate Cargo Control Number:
    When the system prepares the audit log message, then the cargo control number from the manifest record must be copied to the audit log train or us ccn field.
  • Context - an audit log message is being created for cargo release removal:
    For Set Cargo Type as Canadian:
    When the system sets the cargo type classification, then the cargo type must be set to ca-cargo to indicate canadian cargo.
  • Context - a cargo release removal audit log is being prepared:
    For Add Transaction Code:
    When the system captures transaction details, then the transaction code from the common communication area must be copied to the sending transaction field in the audit log.
  • Context - a user performs a cargo release removal action:
    For Add User ID:
    When the system creates the audit log entry, then the acf2 user id from the common communication area must be recorded in the audit log acf2 id field.
  • Context - a cargo release removal action is being logged:
    For Add Current Date and Time:
    When the system prepares timestamp information, then the machine century, date, and time from the common communication area must be copied to the audit log work date and time fields.
  • Context - all audit log data elements have been populated:
    For Format Log Message:
    When the system prepares to send the audit message, then the complete audit input structure must be moved to the formatted log message structure.
  • Context - a formatted audit log message is ready for transmission:
    For Send Message to Audit Queue:
    When the system initiates message sending, then the cims program must be called with chng function to send the message to the alternate pcb queue.
  • Context - an audit message has been queued for processing:
    For Write Message to Log:
    When the system writes the message to the log, then the writmsgl program must be called with the message code, message content, message length, and module name.
  • Context - an audit message has been successfully written to the log system:
    For Purge Message Queue:
    When the system completes message processing, then the cims program must be called with purg function to purge the message from the alternate pcb queue.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release removal audit log message is being prepared
GIVEN
A cargo release removal audit log message is being prepared
Applied to: Set Security Level to High
WHEN
The system initializes the security settings for the log message
THEN
The security byte must be set to high values to indicate maximum security level
Context: A cargo release removal is being logged
GIVEN
A cargo release removal is being logged
Applied to: Populate Cargo Control Number
WHEN
The system prepares the audit log message
THEN
The cargo control number from the manifest record must be copied to the audit log train or US CCN field
Context: An audit log message is being created for cargo release removal
GIVEN
An audit log message is being created for cargo release removal
Applied to: Set Cargo Type as Canadian
WHEN
The system sets the cargo type classification
THEN
The cargo type must be set to CA-CARGO to indicate Canadian cargo
Context: A cargo release removal audit log is being prepared
GIVEN
A cargo release removal audit log is being prepared
Applied to: Add Transaction Code
WHEN
The system captures transaction details
THEN
The transaction code from the common communication area must be copied to the sending transaction field in the audit log
Context: A user performs a cargo release removal action
GIVEN
A user performs a cargo release removal action
Applied to: Add User ID
WHEN
The system creates the audit log entry
THEN
The ACF2 user ID from the common communication area must be recorded in the audit log ACF2 ID field
Context: A cargo release removal action is being logged
GIVEN
A cargo release removal action is being logged
Applied to: Add Current Date and Time
WHEN
The system prepares timestamp information
THEN
The machine century, date, and time from the common communication area must be copied to the audit log work date and time fields
Context: All audit log data elements have been populated
GIVEN
All audit log data elements have been populated
Applied to: Format Log Message
WHEN
The system prepares to send the audit message
THEN
The complete audit input structure must be moved to the formatted log message structure
Context: A formatted audit log message is ready for transmission
GIVEN
A formatted audit log message is ready for transmission
Applied to: Send Message to Audit Queue
WHEN
The system initiates message sending
THEN
The CIMS program must be called with CHNG function to send the message to the alternate PCB queue
Context: An audit message has been queued for processing
GIVEN
An audit message has been queued for processing
Applied to: Write Message to Log
WHEN
The system writes the message to the log
THEN
The WRITMSGL program must be called with the message code, message content, message length, and module name
Context: An audit message has been successfully written to the log system
GIVEN
An audit message has been successfully written to the log system
Applied to: Purge Message Queue
WHEN
The system completes message processing
THEN
The CIMS program must be called with PURG function to purge the message from the alternate PCB queue
R-GCCCCADD-cbl-00085 (+11) File: GCCCCADD.cbl Manifest Port Determination Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Port Determination':
  • Context - a shipment is being processed for customs manifest creation:
    For Set default manifest-from port to 'IIS-A6':
    When the action code is iis-a6 or the multi-manifest indicator equals 'y' and the manifest from port in shipment root is blank, then set the manifest from port to 'iis-a6'.
    For Set default manifest-to port to 'IIS-A6':
    When the action code is iis-a6 or the multi-manifest indicator equals 'y' and the manifest to port in shipment root is blank, then set the manifest to port to 'iis-a6'.
  • Context - a manifest from port has been determined from shipment root data:
    For Lookup manifest-from port in MC table:
    When the system needs to validate and get details for the manifest from port, then perform a lookup in the mc table using the manifest from port as the sequence id.
  • Context - mc table lookup for manifest from port was successful:
    For Canadian customs code = '00000'?:
    When the canadian customs code from mc table equals '00000', then clear the mc table data and add an error message for invalid canadian customs code for manifest port.
  • Context - a manifest from port needs to be validated in the mc table:
    For Add invalid manifest port error message:
    When the mc table lookup is not successful, then clear the mc table data and add an error message for invalid manifest port.
  • Context - mc table lookup for manifest from port was successful and canadian customs code is valid:
    For Set manifest-from station code:
    When processing manifest from port information, then set the manifest from station code to the canadian customs code from mc table and set the us port of exit code from mc table.
  • Context - a shipment requires manifest to port information:
    For Set error flag for missing manifest-to port:
    When the manifest to port from shipment root is blank, then set error flag 1 to on.
  • Context - mc table lookup for manifest to port was successful:
    For Canadian customs code = '00000'?:
    When the canadian customs code from mc table equals '00000', then clear the mc table data and set error flag 2 to on and save the port name for error messaging.
  • Context - a manifest to port needs to be validated in the mc table:
    For Add invalid customs code error message:
    When the mc table lookup is not successful, then clear the mc table data and set error flag 3 to on and save the port name for error messaging.
  • Context - a shipment with ccn type equals '9':
    For Override both ports to 'IIS-A6':
    When the us port of exit code is not '00000' or the manifest from station name is not 'iis-a6' or the manifest to station name is not 'iis-a6' or the manifest to station name does not equal the manifest from station name, then set both manifest from station name and manifest to station name to 'iis-a6'.
  • Context - mc table lookup for manifest to port was successful and canadian customs code is valid and ccn type 9 override conditions are not met:
    For Set manifest-to station code:
    When processing manifest to port information, then set the manifest to station code to the canadian customs code from mc table and set the destination station number from mc table station number and set the destination station number index from mc table station number.
  • Context - mc table data is available for manifest to port:
    For Set sub-location code from MC table:
    When the sub-location code from mc table is blank or low-values or the manifest to station name equals 'iis-a6' or the manifest to station name equals the manifest from station name, then set the sub-location code to blank else set the sub-location code to the value from mc table.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Set default manifest-from port to 'IIS-A6'
WHEN
The action code is IIS-A6 OR the multi-manifest indicator equals 'Y' AND the manifest from port in shipment root is blank
THEN
Set the manifest from port to 'IIS-A6'
Applied to: Set default manifest-to port to 'IIS-A6'
WHEN
The action code is IIS-A6 OR the multi-manifest indicator equals 'Y' AND the manifest to port in shipment root is blank
THEN
Set the manifest to port to 'IIS-A6'
Context: A manifest from port has been determined from shipment root data
GIVEN
A manifest from port has been determined from shipment root data
Applied to: Lookup manifest-from port in MC table
WHEN
The system needs to validate and get details for the manifest from port
THEN
Perform a lookup in the MC table using the manifest from port as the sequence ID
Context: MC table lookup for manifest from port was successful
GIVEN
MC table lookup for manifest from port was successful
Applied to: Canadian customs code = '00000'?
WHEN
The Canadian customs code from MC table equals '00000'
THEN
Clear the MC table data AND add an error message for invalid Canadian customs code for manifest port
Context: A manifest from port needs to be validated in the MC table
GIVEN
A manifest from port needs to be validated in the MC table
Applied to: Add invalid manifest port error message
WHEN
The MC table lookup is not successful
THEN
Clear the MC table data AND add an error message for invalid manifest port
Context: MC table lookup for manifest from port was successful AND Canadian customs code is valid
GIVEN
MC table lookup for manifest from port was successful AND Canadian customs code is valid
Applied to: Set manifest-from station code
WHEN
Processing manifest from port information
THEN
Set the manifest from station code to the Canadian customs code from MC table AND set the US port of exit code from MC table
Context: A shipment requires manifest to port information
GIVEN
A shipment requires manifest to port information
Applied to: Set error flag for missing manifest-to port
WHEN
The manifest to port from shipment root is blank
THEN
Set error flag 1 to ON
Context: MC table lookup for manifest to port was successful
GIVEN
MC table lookup for manifest to port was successful
Applied to: Canadian customs code = '00000'?
WHEN
The Canadian customs code from MC table equals '00000'
THEN
Clear the MC table data AND set error flag 2 to ON AND save the port name for error messaging
Context: A manifest to port needs to be validated in the MC table
GIVEN
A manifest to port needs to be validated in the MC table
Applied to: Add invalid customs code error message
WHEN
The MC table lookup is not successful
THEN
Clear the MC table data AND set error flag 3 to ON AND save the port name for error messaging
Context: A shipment with CCN type equals '9'
GIVEN
A shipment with CCN type equals '9'
Applied to: Override both ports to 'IIS-A6'
WHEN
The US port of exit code is not '00000' OR the manifest from station name is not 'IIS-A6' OR the manifest to station name is not 'IIS-A6' OR the manifest to station name does not equal the manifest from station name
THEN
Set both manifest from station name and manifest to station name to 'IIS-A6'
Context: MC table lookup for manifest to port was successful AND Canadian customs code is valid AND CCN type 9 override conditions are not met
GIVEN
MC table lookup for manifest to port was successful AND Canadian customs code is valid AND CCN type 9 override conditions are not met
Applied to: Set manifest-to station code
WHEN
Processing manifest to port information
THEN
Set the manifest to station code to the Canadian customs code from MC table AND set the destination station number from MC table station number AND set the destination station number index from MC table station number
Context: MC table data is available for manifest to port
GIVEN
MC table data is available for manifest to port
Applied to: Set sub-location code from MC table
WHEN
The sub-location code from MC table is blank OR low-values OR the manifest to station name equals 'IIS-A6' OR the manifest to station name equals the manifest from station name
THEN
Set the sub-location code to blank ELSE set the sub-location code to the value from MC table
R-GCCCBOL-cbl-00088 (+2) File: GCCCBOL.cbl Lookup Broker Short Name Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup Broker Short Name':
  • Context - the system has processed broker information from edi bol or fastway sources:
    For Broker Long Name Available?:
    When the broker long name field is evaluated for availability, then the system proceeds to standardization lookup only if broker long name is not spaces.
  • Context - a valid broker long name exists and is not spaces:
    For Query GCST2RT Table:
    When the system queries the gcst2rt table using the broker long name as the search key, then the system retrieves the corresponding broker record from gcst2rt table.
  • Context - the system has performed a lookup in gcst2rt table using broker long name:
    For Broker Found in GCST2RT?:
    When the lookup result indicates whether a matching broker record was found in gcst2rt, then if broker is found in gcst2rt, use the standardized short name from gct2-broker-name-short field, otherwise use the original broker long name.
👨‍💻 Technical ACs (Gherkin)
Context: The system has processed broker information from EDI BOL or Fastway sources
GIVEN
The system has processed broker information from EDI BOL or Fastway sources
Applied to: Broker Long Name Available?
WHEN
The broker long name field is evaluated for availability
THEN
The system proceeds to standardization lookup only if broker long name is not spaces
Context: A valid broker long name exists and is not spaces
GIVEN
A valid broker long name exists and is not spaces
Applied to: Query GCST2RT Table
WHEN
The system queries the GCST2RT table using the broker long name as the search key
THEN
The system retrieves the corresponding broker record from GCST2RT table
Context: The system has performed a lookup in GCST2RT table using broker long name
GIVEN
The system has performed a lookup in GCST2RT table using broker long name
Applied to: Broker Found in GCST2RT?
WHEN
The lookup result indicates whether a matching broker record was found in GCST2RT
THEN
If broker is found in GCST2RT, use the standardized short name from GCT2-BROKER-NAME-SHORT field, otherwise use the original broker long name
R-GCX122A-cbl-00088 (+7) File: GCX122A.cbl Process Cargo Acknowledgment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Acknowledgment':
  • Context - a cargo acknowledgment message with reference number is received:
    For Retrieve Cargo Control Record by Reference Number:
    When the system attempts to retrieve the cargo control record using the reference number, then the system performs database lookup using the reference number as key for both cargo control and cargo segment records.
  • Context - a cargo acknowledgment is being processed:
    For Add Error Message: CCN Not Found:
    When the cargo control number is not found in the customs database, then the system adds error message 'ccn not found on customs d.b. for 824 ack' and sets dcp interface error flag to true.
  • Context - a cargo control record is found and has status sent:
    For Update Cargo Status to ACK:
    When processing a cargo acknowledgment message, then the system updates the cargo current status to 'ack'.
  • Context - a cargo control record is found in the database:
    For Set Current Status to ACK:
    When processing a cargo acknowledgment message, then the system sets the working current status to 'ack'.
  • Context - a cargo control record is found with terminal information:
    For Use Last Modify Terminal for Processing:
    When the last modify terminal field is not empty, then the system uses the last modify terminal for processing operations.
    For Use Creation Terminal for Processing:
    When the last modify terminal field is empty or not available, then the system uses the creation terminal for processing operations.
  • Context - a cargo control record is being processed for acknowledgment:
    For Process Arrival Notifications:
    When the arrival indicator field equals 'y', then the system performs arrival processing operations.
  • Context - cargo acknowledgment processing is complete with status and terminal updates:
    For Update Cargo Control Record:
    When all acknowledgment processing steps are finished, then the system updates the cargo control record in the database with all modified fields.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo acknowledgment message with reference number is received
GIVEN
A cargo acknowledgment message with reference number is received
Applied to: Retrieve Cargo Control Record by Reference Number
WHEN
The system attempts to retrieve the cargo control record using the reference number
THEN
The system performs database lookup using the reference number as key for both cargo control and cargo segment records
Context: A cargo acknowledgment is being processed
GIVEN
A cargo acknowledgment is being processed
Applied to: Add Error Message: CCN Not Found
WHEN
The cargo control number is not found in the customs database
THEN
The system adds error message 'CCN NOT FOUND ON CUSTOMS D.B. FOR 824 ACK' and sets DCP interface error flag to true
Context: A cargo control record is found and has status SENT
GIVEN
A cargo control record is found and has status SENT
Applied to: Update Cargo Status to ACK
WHEN
Processing a cargo acknowledgment message
THEN
The system updates the cargo current status to 'ACK'
Context: A cargo control record is found in the database
GIVEN
A cargo control record is found in the database
Applied to: Set Current Status to ACK
WHEN
Processing a cargo acknowledgment message
THEN
The system sets the working current status to 'ACK'
Context: A cargo control record is found with terminal information
GIVEN
A cargo control record is found with terminal information
Applied to: Use Last Modify Terminal for Processing
WHEN
The last modify terminal field is not empty
THEN
The system uses the last modify terminal for processing operations
Applied to: Use Creation Terminal for Processing
WHEN
The last modify terminal field is empty or not available
THEN
The system uses the creation terminal for processing operations
Context: A cargo control record is being processed for acknowledgment
GIVEN
A cargo control record is being processed for acknowledgment
Applied to: Process Arrival Notifications
WHEN
The arrival indicator field equals 'Y'
THEN
The system performs arrival processing operations
Context: Cargo acknowledgment processing is complete with status and terminal updates
GIVEN
Cargo acknowledgment processing is complete with status and terminal updates
Applied to: Update Cargo Control Record
WHEN
All acknowledgment processing steps are finished
THEN
The system updates the cargo control record in the database with all modified fields
R-GCCCANRL-cbl-00089 (+10) File: GCCCANRL.cbl Call Master Control Table Service Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Master Control Table Service':
  • Context - a master control table lookup is required:
    For Set Function Code to GU:
    When the table service is being prepared for execution, then the function code should be set to gu for data retrieval operation.
  • Context - a table lookup operation is being initialized:
    For Clear Key Values and Flags:
    When the lookup parameters need to be prepared, then all key values, flags, and filler fields should be cleared to spaces.
  • Context - a table lookup operation is being configured:
    For Set Table ID to 'MC':
    When the target table needs to be identified, then the table id should be set to 'mc' to identify the master control table.
  • Context - a manifest record contains a destination station name:
    For Set Station Name from Manifest:
    When a master control table lookup is being performed, then the manifest destination station name should be used as the lookup key.
  • Context - a table service call is about to be executed:
    For Clear Return Flag:
    When the service parameters are being finalized, then the return flag should be cleared to spaces for proper response detection.
  • Context - all table lookup parameters have been prepared:
    For Call GCCTBIO Service:
    When station information needs to be retrieved from master control table, then the gcctbio service should be called with the prepared parameters.
  • Context - a master control table lookup has been executed:
    For Return Flag = '0'?:
    When the service returns with a response, then if the return flag equals '0', the lookup was successful, otherwise it failed.
  • Context - a master control table lookup was successful:
    For Extract Station Number from Response:
    When the response contains valid station information, then the station number should be extracted from the response segment.
  • Context - a station number has been successfully extracted from table lookup:
    For Set Station Number for Index:
    When the destination station information needs to be updated, then the extracted station number should be assigned to the destination station number for index field.
  • Context - a master control table lookup has failed:
    For Initialize Empty Segment:
    When the table response is not available, then the master control table segment should be initialized to empty values.
    For Use Original Station Number:
    When station number information is still needed for processing, then the original destination station number should be used for the index field.
👨‍💻 Technical ACs (Gherkin)
Context: A master control table lookup is required
GIVEN
A master control table lookup is required
Applied to: Set Function Code to GU
WHEN
The table service is being prepared for execution
THEN
The function code should be set to GU for data retrieval operation
Context: A table lookup operation is being initialized
GIVEN
A table lookup operation is being initialized
Applied to: Clear Key Values and Flags
WHEN
The lookup parameters need to be prepared
THEN
All key values, flags, and filler fields should be cleared to spaces
Context: A table lookup operation is being configured
GIVEN
A table lookup operation is being configured
Applied to: Set Table ID to 'MC'
WHEN
The target table needs to be identified
THEN
The table ID should be set to 'MC' to identify the Master Control table
Context: A manifest record contains a destination station name
GIVEN
A manifest record contains a destination station name
Applied to: Set Station Name from Manifest
WHEN
A Master Control table lookup is being performed
THEN
The manifest destination station name should be used as the lookup key
Context: A table service call is about to be executed
GIVEN
A table service call is about to be executed
Applied to: Clear Return Flag
WHEN
The service parameters are being finalized
THEN
The return flag should be cleared to spaces for proper response detection
Context: All table lookup parameters have been prepared
GIVEN
All table lookup parameters have been prepared
Applied to: Call GCCTBIO Service
WHEN
Station information needs to be retrieved from Master Control table
THEN
The GCCTBIO service should be called with the prepared parameters
Context: A Master Control table lookup has been executed
GIVEN
A Master Control table lookup has been executed
Applied to: Return Flag = '0'?
WHEN
The service returns with a response
THEN
If the return flag equals '0', the lookup was successful, otherwise it failed
Context: A Master Control table lookup was successful
GIVEN
A Master Control table lookup was successful
Applied to: Extract Station Number from Response
WHEN
The response contains valid station information
THEN
The station number should be extracted from the response segment
Context: A station number has been successfully extracted from table lookup
GIVEN
A station number has been successfully extracted from table lookup
Applied to: Set Station Number for Index
WHEN
The destination station information needs to be updated
THEN
The extracted station number should be assigned to the destination station number for index field
Context: A Master Control table lookup has failed
GIVEN
A Master Control table lookup has failed
Applied to: Initialize Empty Segment
WHEN
The table response is not available
THEN
The Master Control table segment should be initialized to empty values
Applied to: Use Original Station Number
WHEN
Station number information is still needed for processing
THEN
The original destination station number should be used for the index field
R-GCCCBOL-cbl-00091 (+8) File: GCCCBOL.cbl Build N9 Reference Numbers Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build N9 Reference Numbers':
  • Context - the system is ready to process n9 reference numbers:
    For Initialize Reference Number Variables:
    When reference number processing begins, then initialize sequence counter to 0, array index to 1, set bol reference found flag to true, set bm not found flag to true, set si not found flag to true, and set blank n9 not found flag to true.
  • Context - reference number array exists with 10 possible slots:
    For Initialize Reference Number Variables:
    When system needs to find an empty slot for new reference numbers, then search through array positions 1 to 10 until finding a blank reference number qualifier or reaching position 10, and set blank n9 found flag when empty slot is located.
  • Context - bol reference data is found and reference qualifier equals 'bm' and bm reference has not been found yet:
    For Extract BM Reference Number from BOL:
    When processing bol reference records, then set reference qualifier to 'bm', copy reference number to array (or 'n/a' if blank), set bm found flag to true, and increment array index by 1.
  • Context - bol reference data is found and reference qualifier equals 'si' and si reference has not been found yet:
    For Extract SI Reference Number from BOL:
    When processing bol reference records, then set reference qualifier to 'si', copy reference number to array (or 'n/a' if blank), set si found flag to true, and increment array index by 1.
  • Context - bol basic data is found and shipment method payment field is not blank:
    For Extract Payment Method from BOL:
    When processing bol basic data after reference extraction, then copy shipment method payment value to cargo report payment method field.
  • Context - bol basic data is found and shipment id number is not blank:
    For Extract Shipment ID Number from BOL:
    When processing bol basic data after payment method extraction, then increment array index by 1, set reference qualifier to 'cn', and copy shipment id number to reference array.
  • Context - bm reference was not found in bol data:
    For Get BM Reference from Fastway Bill Number:
    When falling back to fastway system data, then set reference qualifier to 'bm', copy shipper bill number to reference array, set bm found flag to true, and increment array index by 1.
  • Context - si reference was not found in bol data and special handling code equals 'si' and si has not been found yet and array index is within limit:
    For Extract SI Reference from Fastway:
    When processing fastway special handling data from positions 1 to 7, then set si found flag to true, copy special handling code to reference qualifier, copy special handling instruction to reference number, increment array index by 1, and set blank n9 not found flag if array exceeds limit.
  • Context - a reference number field is blank or contains spaces:
    For Extract BM Reference Number from BOL:
    When processing any reference number from bol data, then set the reference number value to 'n/a'.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process N9 reference numbers
GIVEN
The system is ready to process N9 reference numbers
Applied to: Initialize Reference Number Variables
WHEN
Reference number processing begins
THEN
Initialize sequence counter to 0, array index to 1, set BOL reference found flag to true, set BM not found flag to true, set SI not found flag to true, and set blank N9 not found flag to true
Context: Reference number array exists with 10 possible slots
GIVEN
Reference number array exists with 10 possible slots
Applied to: Initialize Reference Number Variables
WHEN
System needs to find an empty slot for new reference numbers
THEN
Search through array positions 1 to 10 until finding a blank reference number qualifier or reaching position 10, and set blank N9 found flag when empty slot is located
Context: BOL reference data is found and reference qualifier equals 'BM' and BM reference has not been found yet
GIVEN
BOL reference data is found and reference qualifier equals 'BM' and BM reference has not been found yet
Applied to: Extract BM Reference Number from BOL
WHEN
Processing BOL reference records
THEN
Set reference qualifier to 'BM', copy reference number to array (or 'N/A' if blank), set BM found flag to true, and increment array index by 1
Context: BOL reference data is found and reference qualifier equals 'SI' and SI reference has not been found yet
GIVEN
BOL reference data is found and reference qualifier equals 'SI' and SI reference has not been found yet
Applied to: Extract SI Reference Number from BOL
WHEN
Processing BOL reference records
THEN
Set reference qualifier to 'SI', copy reference number to array (or 'N/A' if blank), set SI found flag to true, and increment array index by 1
Context: BOL basic data is found and shipment method payment field is not blank
GIVEN
BOL basic data is found and shipment method payment field is not blank
Applied to: Extract Payment Method from BOL
WHEN
Processing BOL basic data after reference extraction
THEN
Copy shipment method payment value to cargo report payment method field
Context: BOL basic data is found and shipment ID number is not blank
GIVEN
BOL basic data is found and shipment ID number is not blank
Applied to: Extract Shipment ID Number from BOL
WHEN
Processing BOL basic data after payment method extraction
THEN
Increment array index by 1, set reference qualifier to 'CN', and copy shipment ID number to reference array
Context: BM reference was not found in BOL data
GIVEN
BM reference was not found in BOL data
Applied to: Get BM Reference from Fastway Bill Number
WHEN
Falling back to Fastway system data
THEN
Set reference qualifier to 'BM', copy shipper bill number to reference array, set BM found flag to true, and increment array index by 1
Context: SI reference was not found in BOL data and special handling code equals 'SI' and SI has not been found yet and array index is within limit
GIVEN
SI reference was not found in BOL data and special handling code equals 'SI' and SI has not been found yet and array index is within limit
Applied to: Extract SI Reference from Fastway
WHEN
Processing Fastway special handling data from positions 1 to 7
THEN
Set SI found flag to true, copy special handling code to reference qualifier, copy special handling instruction to reference number, increment array index by 1, and set blank N9 not found flag if array exceeds limit
Context: A reference number field is blank or contains spaces
GIVEN
A reference number field is blank or contains spaces
Applied to: Extract BM Reference Number from BOL
WHEN
Processing any reference number from BOL data
THEN
Set the reference number value to 'N/A'
R-GCCCCREL-cbl-00094 (+4) File: GCCCCREL.cbl Send Message via CIMS Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Message via CIMS':
  • Context - a cargo release is being processed with message content prepared:
    For Send Message to Queue:
    When the release operation is not an export type, then the system sends a gct1231e notification message through cims messaging system.
  • Context - a notification message needs to be sent:
    For Initialize CIMS Session:
    When the message sending process begins, then the system calls cims with chng parameter to initialize the messaging session.
  • Context - a release notification needs to be sent:
    For Prepare Message Content:
    When the message preparation process starts, then the system copies gcx123-input to gct1231e-msg and clears the accept status.
  • Context - the cims session is initialized and message content is prepared:
    For Send Message to Queue:
    When the actual message transmission occurs, then the system calls writmsgl with message code, content, length and module name parameters.
  • Context - a message has been sent through cims:
    For Terminate CIMS Session:
    When the message transmission is complete, then the system calls cims with purg parameter to terminate the session.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release is being processed with message content prepared
GIVEN
A cargo release is being processed with message content prepared
Applied to: Send Message to Queue
WHEN
The release operation is not an export type
THEN
The system sends a GCT1231E notification message through CIMS messaging system
Context: A notification message needs to be sent
GIVEN
A notification message needs to be sent
Applied to: Initialize CIMS Session
WHEN
The message sending process begins
THEN
The system calls CIMS with CHNG parameter to initialize the messaging session
Context: A release notification needs to be sent
GIVEN
A release notification needs to be sent
Applied to: Prepare Message Content
WHEN
The message preparation process starts
THEN
The system copies GCX123-INPUT to GCT1231E-MSG and clears the accept status
Context: The CIMS session is initialized and message content is prepared
GIVEN
The CIMS session is initialized and message content is prepared
Applied to: Send Message to Queue
WHEN
The actual message transmission occurs
THEN
The system calls WRITMSGL with message code, content, length and module name parameters
Context: A message has been sent through CIMS
GIVEN
A message has been sent through CIMS
Applied to: Terminate CIMS Session
WHEN
The message transmission is complete
THEN
The system calls CIMS with PURG parameter to terminate the session
R-GCX122A-cbl-00096 (+13) File: GCX122A.cbl Process Error Messages Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Error Messages':
  • Context - a train error message is received:
    For Is Test Message?:
    When the reference number equals '6105etesttrain00000000000', then the message is flagged as test data and special test processing is performed.
  • Context - a cargo error message is received:
    For Is Test Message?:
    When the reference number starts with '6105ecprstestcargo' or '6105etestcargo', then the message is flagged as test data and special test processing is performed.
  • Context - an error message is received that is not test data:
    For Message Type?:
    When the message type indicator is evaluated, then the message is routed to either train error processing or cargo error processing based on the type indicator.
  • Context - a train error message with a reference number is being processed:
    For Train Report Found?:
    When the system searches for the train report using the reference number, then if the train report is not found, an error flag is set and a 'train report not found' message is recorded.
  • Context - a train report is found and an error message is being processed:
    For Is V67 Warning?:
    When the free-form message text starts with 'v67', then the message is classified as a v67 warning and special warning processing is applied.
  • Context - a cargo error message with a reference number is being processed:
    For Cargo Control Found?:
    When the system searches for the cargo control number using the reference number, then if the cargo control number is not found, an error flag is set and a 'ccn not found' message is recorded.
  • Context - a cargo control number is not found in the database:
    For Is V67 Warning - Process as Train?:
    When the free-form message text starts with 'v67', then the message is rerouted to train error processing instead of cargo error processing.
  • Context - an error message needs to be processed and displayed:
    For Error Message Found in Tables?:
    When the system searches for standardized message text using the error code, then if found, the standardized english text is used; if not found, the original free-form message is used and a 'message not found' warning is added.
  • Context - an error message has been processed and message text retrieved:
    For Error Type?:
    When the error type from the message table is evaluated, then status is set to info for type 'x' with warning messages, warning for type 'x' with error messages, error for other types, or reject for type 'r'.
  • Context - an error status needs to be applied to a record:
    For Record Type?:
    When the system evaluates which type of record was successfully found and processed, then the appropriate update procedure is called for either train reports or cargo control records.
  • Context - a train report exists and is not deleted or delete-pending:
    For Update Train Report Status:
    When an error or reject status needs to be applied, then the error resend flag is set, the train key and position date are recorded in error fields, and the status is updated to either error or reject based on error type.
  • Context - a cargo control record exists and needs status update:
    For Update Cargo Control Status:
    When an error or reject status needs to be applied, then the error status index is set to 'e', the error status is set to either 'e' for errors or 'r' for rejects, and the current status is updated accordingly.
  • Context - a train report is found in the database:
    For Retrieve Last Modified Terminal:
    When terminal information is needed for message routing, then if last modified terminal is not empty, use it; otherwise use the creation terminal for processing.
  • Context - a cargo control record is found in the database:
    For Retrieve Last Modified Terminal:
    When terminal information is needed for message routing, then if ccn last modify terminal is not empty, use it; otherwise use the ccn creation terminal for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train error message is received
GIVEN
A train error message is received
Applied to: Is Test Message?
WHEN
The reference number equals '6105ETESTTRAIN00000000000'
THEN
The message is flagged as test data and special test processing is performed
Context: A cargo error message is received
GIVEN
A cargo error message is received
Applied to: Is Test Message?
WHEN
The reference number starts with '6105ECPRSTESTCARGO' or '6105ETESTCARGO'
THEN
The message is flagged as test data and special test processing is performed
Context: An error message is received that is not test data
GIVEN
An error message is received that is not test data
Applied to: Message Type?
WHEN
The message type indicator is evaluated
THEN
The message is routed to either train error processing or cargo error processing based on the type indicator
Context: A train error message with a reference number is being processed
GIVEN
A train error message with a reference number is being processed
Applied to: Train Report Found?
WHEN
The system searches for the train report using the reference number
THEN
If the train report is not found, an error flag is set and a 'train report not found' message is recorded
Context: A train report is found and an error message is being processed
GIVEN
A train report is found and an error message is being processed
Applied to: Is V67 Warning?
WHEN
The free-form message text starts with 'V67'
THEN
The message is classified as a V67 warning and special warning processing is applied
Context: A cargo error message with a reference number is being processed
GIVEN
A cargo error message with a reference number is being processed
Applied to: Cargo Control Found?
WHEN
The system searches for the cargo control number using the reference number
THEN
If the cargo control number is not found, an error flag is set and a 'CCN not found' message is recorded
Context: A cargo control number is not found in the database
GIVEN
A cargo control number is not found in the database
Applied to: Is V67 Warning - Process as Train?
WHEN
The free-form message text starts with 'V67'
THEN
The message is rerouted to train error processing instead of cargo error processing
Context: An error message needs to be processed and displayed
GIVEN
An error message needs to be processed and displayed
Applied to: Error Message Found in Tables?
WHEN
The system searches for standardized message text using the error code
THEN
If found, the standardized English text is used; if not found, the original free-form message is used and a 'message not found' warning is added
Context: An error message has been processed and message text retrieved
GIVEN
An error message has been processed and message text retrieved
Applied to: Error Type?
WHEN
The error type from the message table is evaluated
THEN
Status is set to INFO for type 'X' with warning messages, WARNING for type 'X' with error messages, ERROR for other types, or REJECT for type 'R'
Context: An error status needs to be applied to a record
GIVEN
An error status needs to be applied to a record
Applied to: Record Type?
WHEN
The system evaluates which type of record was successfully found and processed
THEN
The appropriate update procedure is called for either train reports or cargo control records
Context: A train report exists and is not deleted or delete-pending
GIVEN
A train report exists and is not deleted or delete-pending
Applied to: Update Train Report Status
WHEN
An error or reject status needs to be applied
THEN
The error resend flag is set, the train key and position date are recorded in error fields, and the status is updated to either ERROR or REJECT based on error type
Context: A cargo control record exists and needs status update
GIVEN
A cargo control record exists and needs status update
Applied to: Update Cargo Control Status
WHEN
An error or reject status needs to be applied
THEN
The error status index is set to 'E', the error status is set to either 'E' for errors or 'R' for rejects, and the current status is updated accordingly
Context: A train report is found in the database
GIVEN
A train report is found in the database
Applied to: Retrieve Last Modified Terminal
WHEN
Terminal information is needed for message routing
THEN
If last modified terminal is not empty, use it; otherwise use the creation terminal for processing
Context: A cargo control record is found in the database
GIVEN
A cargo control record is found in the database
Applied to: Retrieve Last Modified Terminal
WHEN
Terminal information is needed for message routing
THEN
If CCN last modify terminal is not empty, use it; otherwise use the CCN creation terminal for processing
R-GCCCCADD-cbl-00097 (+4) File: GCCCCADD.cbl Special Port Code Processing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Port Code Processing':
  • Context - a shipment is being processed with either iis-a6 action code or multi-manifest indicator set to 'y':
    For Set Manifest From Port to IIS-A6:
    When the manifest from port field in the shipment root is empty (spaces), then the manifest from port should be automatically set to 'iis-a6'.
    For Set Manifest To Port to IIS-A6:
    When the manifest to port field in the shipment root is empty (spaces), then the manifest to port should be automatically set to 'iis-a6'.
  • Context - a shipment has ccn type equal to '9':
    For Override Both Ports to IIS-A6:
    When the us station exit code is not '00000' or the manifest from station name is not 'iis-a6' or the manifest to station name is not 'iis-a6' or the manifest to station name does not equal the manifest from station name, then both the manifest from station name and manifest to station name should be set to 'iis-a6'.
  • Context - a shipment has manifest to station name equal to 'iis-a6' and the destination is not in the united states:
    For Lookup CM Table for Station:
    When the system needs to determine sub-location code information, then the destination station number should be looked up in the cm table to retrieve port manifest upon information.
  • Context - the cm table lookup was successful and returned port manifest upon information:
    For Set Sub-location Code from MC Table:
    When the port manifest upon value is used to lookup the mc table, then if the mc table lookup is successful, the sub-location code should be retrieved from the mc table record, otherwise the sub-location code should be cleared.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed with either IIS-A6 action code or multi-manifest indicator set to 'Y'
GIVEN
A shipment is being processed with either IIS-A6 action code or multi-manifest indicator set to 'Y'
Applied to: Set Manifest From Port to IIS-A6
WHEN
The manifest from port field in the shipment root is empty (spaces)
THEN
The manifest from port should be automatically set to 'IIS-A6'
Applied to: Set Manifest To Port to IIS-A6
WHEN
The manifest to port field in the shipment root is empty (spaces)
THEN
The manifest to port should be automatically set to 'IIS-A6'
Context: A shipment has CCN type equal to '9'
GIVEN
A shipment has CCN type equal to '9'
Applied to: Override Both Ports to IIS-A6
WHEN
The US station exit code is not '00000' OR the manifest from station name is not 'IIS-A6' OR the manifest to station name is not 'IIS-A6' OR the manifest to station name does not equal the manifest from station name
THEN
Both the manifest from station name and manifest to station name should be set to 'IIS-A6'
Context: A shipment has manifest to station name equal to 'IIS-A6' and the destination is not in the United States
GIVEN
A shipment has manifest to station name equal to 'IIS-A6' and the destination is not in the United States
Applied to: Lookup CM Table for Station
WHEN
The system needs to determine sub-location code information
THEN
The destination station number should be looked up in the CM table to retrieve port manifest upon information
Context: The CM table lookup was successful and returned port manifest upon information
GIVEN
The CM table lookup was successful and returned port manifest upon information
Applied to: Set Sub-location Code from MC Table
WHEN
The port manifest upon value is used to lookup the MC table
THEN
If the MC table lookup is successful, the sub-location code should be retrieved from the MC table record, otherwise the sub-location code should be cleared
R-GCCCANRL-cbl-00100 (+8) File: GCCCANRL.cbl Prepare Log Message Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Log Message':
  • Context - a cancel release operation is being logged:
    For Set Security Information:
    When the system prepares the audit log message, then the security byte is set to high-values for maximum security classification.
  • Context - a manifest cancel release operation is being processed:
    For Set Manifest CCN Number:
    When the audit log entry is being prepared, then the manifest ccn key is recorded in the log entry train/ccn field.
  • Context - a cargo manifest cancel release is being logged:
    For Set Cargo Type Indicator:
    When the audit log entry is being created, then the cargo type indicator is set to ca-cargo to identify this as a cargo operation.
  • Context - a cancel release transaction is being processed:
    For Set Transaction Code:
    When the audit log is being prepared, then the transaction code from the common communication area is recorded in the log entry.
  • Context - a user is performing a cancel release operation:
    For Set User ID:
    When the audit log entry is being created, then the user's acf2 id from the common communication area is recorded in the log.
  • Context - a cancel release operation is being performed:
    For Set Current Date & Set Current Time:
    When the audit log entry is being prepared, then the current machine century and date are recorded in the log entry and the current machine time is recorded in the log entry.
  • Context - a cargo release is being cancelled:
    For Set Action Code as 'Cargo Release Removed':
    When the audit log entry is being created, then the action code is set to log-cargo-release-removed to identify the type of operation.
  • Context - all audit log components have been prepared:
    For Format Complete Log Message:
    When the log message needs to be transmitted, then the complete log input structure is moved to the message format for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cancel release operation is being logged
GIVEN
A cancel release operation is being logged
Applied to: Set Security Information
WHEN
The system prepares the audit log message
THEN
The security byte is set to high-values for maximum security classification
Context: A manifest cancel release operation is being processed
GIVEN
A manifest cancel release operation is being processed
Applied to: Set Manifest CCN Number
WHEN
The audit log entry is being prepared
THEN
The manifest CCN key is recorded in the log entry train/CCN field
Context: A cargo manifest cancel release is being logged
GIVEN
A cargo manifest cancel release is being logged
Applied to: Set Cargo Type Indicator
WHEN
The audit log entry is being created
THEN
The cargo type indicator is set to CA-CARGO to identify this as a cargo operation
Context: A cancel release transaction is being processed
GIVEN
A cancel release transaction is being processed
Applied to: Set Transaction Code
WHEN
The audit log is being prepared
THEN
The transaction code from the common communication area is recorded in the log entry
Context: A user is performing a cancel release operation
GIVEN
A user is performing a cancel release operation
Applied to: Set User ID
WHEN
The audit log entry is being created
THEN
The user's ACF2 ID from the common communication area is recorded in the log
Context: A cancel release operation is being performed
GIVEN
A cancel release operation is being performed
Applied to: Set Current Date & Set Current Time
WHEN
The audit log entry is being prepared
THEN
The current machine century and date are recorded in the log entry AND The current machine time is recorded in the log entry
Context: A cargo release is being cancelled
GIVEN
A cargo release is being cancelled
Applied to: Set Action Code as 'Cargo Release Removed'
WHEN
The audit log entry is being created
THEN
The action code is set to LOG-CARGO-RELEASE-REMOVED to identify the type of operation
Context: All audit log components have been prepared
GIVEN
All audit log components have been prepared
Applied to: Format Complete Log Message
WHEN
The log message needs to be transmitted
THEN
The complete log input structure is moved to the message format for processing
R-GCCCCADD-cbl-00102 (+5) File: GCCCCADD.cbl Customs Code Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customs Code Validation':
  • Context - a manifest from port has been successfully looked up in the mc table:
    For Check Canadian Customs Code:
    When the canadian customs code equals '00000', then the system marks the canadian customs code as invalid, generates an error message for invalid canadian customs port, and clears the mc table data.
  • Context - a manifest from port has been successfully looked up in the mc table and the canadian customs code is not '00000':
    For Set Canadian Customs Code:
    When the customs code validation passes, then the system sets the canadian customs code to the manifest from station code and sets the us port of exit code.
  • Context - a manifest from port lookup is attempted in the mc table:
    For Generate MC Table Not Found Error:
    When the mc table lookup is not successful, then the system clears the mc table data, generates an error message for invalid manifest port mc, and uses the port name as the error message number.
  • Context - a manifest to port has been successfully looked up in the mc table:
    For Check Manifest To Canadian Customs Code:
    When the canadian customs code equals '00000', then the system clears the mc table data, sets error flag 2, and saves the port name for error reporting.
  • Context - a manifest to port has been successfully looked up in the mc table and the canadian customs code is valid:
    For Set Manifest To Station Code:
    When the customs code validation passes, then the system sets the manifest to station code, batch print call letters, and destination station number for indexing.
  • Context - a manifest to port lookup is attempted in the mc table:
    For Generate MC Table Not Found Error:
    When the mc table lookup is not successful, then the system clears the mc table data, sets error flag 3, and saves the port name for error reporting.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest from port has been successfully looked up in the MC table
GIVEN
A manifest from port has been successfully looked up in the MC table
Applied to: Check Canadian Customs Code
WHEN
The Canadian customs code equals '00000'
THEN
The system marks the Canadian customs code as invalid, generates an error message for invalid Canadian customs port, and clears the MC table data
Context: A manifest from port has been successfully looked up in the MC table and the Canadian customs code is not '00000'
GIVEN
A manifest from port has been successfully looked up in the MC table and the Canadian customs code is not '00000'
Applied to: Set Canadian Customs Code
WHEN
The customs code validation passes
THEN
The system sets the Canadian customs code to the manifest from station code and sets the US port of exit code
Context: A manifest from port lookup is attempted in the MC table
GIVEN
A manifest from port lookup is attempted in the MC table
Applied to: Generate MC Table Not Found Error
WHEN
The MC table lookup is not successful
THEN
The system clears the MC table data, generates an error message for invalid manifest port MC, and uses the port name as the error message number
Context: A manifest to port has been successfully looked up in the MC table
GIVEN
A manifest to port has been successfully looked up in the MC table
Applied to: Check Manifest To Canadian Customs Code
WHEN
The Canadian customs code equals '00000'
THEN
The system clears the MC table data, sets error flag 2, and saves the port name for error reporting
Context: A manifest to port has been successfully looked up in the MC table and the Canadian customs code is valid
GIVEN
A manifest to port has been successfully looked up in the MC table and the Canadian customs code is valid
Applied to: Set Manifest To Station Code
WHEN
The customs code validation passes
THEN
The system sets the manifest to station code, batch print call letters, and destination station number for indexing
Context: A manifest to port lookup is attempted in the MC table
GIVEN
A manifest to port lookup is attempted in the MC table
Applied to: Generate MC Table Not Found Error
WHEN
The MC table lookup is not successful
THEN
The system clears the MC table data, sets error flag 3, and saves the port name for error reporting
R-GCCS309C-cbl-00105 (+12) File: GCCS309C.cbl P4 Segment Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'P4 Segment Processing':
  • Context - a p4 segment processing request is initiated:
    For Initialize P4 segment structure:
    When the system begins p4 segment creation, then the p4 segment structure is initialized to empty values and the segment identifier is set to 'p4'.
  • Context - a p4 segment is being processed with manifest data available:
    For Set location ID from manifest from-station name:
    When the system sets the location identifier, then the p4 location id field is populated with the manifest from-station name.
  • Context - a p4 segment is being processed with destination type information:
    For Check destination type:
    When the system evaluates the destination type for eta date assignment, then if destination is 309-destination, use current machine date; otherwise, use border arrival eta logic.
  • Context - a p4 segment is being processed and destination type is 309-destination:
    For Set ETA date to current machine date:
    When the system assigns the eta date, then the p4 eta date is set to the concatenation of current machine century and machine date.
  • Context - a p4 segment is being processed for non-309-destination type:
    For Border arrival ETA exists?:
    When the system checks for existing border arrival eta, then if border arrival eta is spaces or low-values, calculate new eta; otherwise, use existing eta.
  • Context - a p4 segment is being processed and border arrival eta is empty:
    For Calculate ETA by adding days to waybill date:
    When the system calculates a new eta date, then the system adds ws-days-for-eta to the waybill date using date calculation service and updates the border arrival eta if successful.
  • Context - a p4 segment is being processed and border arrival eta contains valid data:
    For Use existing border arrival ETA:
    When the system assigns the eta date, then the p4 eta date is set to the existing border arrival eta value.
  • Context - a p4 segment is being processed:
    For Set quantity to 1:
    When the system sets the quantity field, then the p4 quantity field is set to 1.
    For Clear ID code and time fields:
    When the system sets optional fields, then the p4 id code and time fields are set to spaces.
  • Context - a p4 segment is ready for transmission:
    For Add sequence number:
    When the system assigns sequence numbering, then the sequence number is incremented by 1 and assigned to the p4 segment.
  • Context - a p4 segment contains underscore characters:
    For Replace underscores with spaces:
    When the system formats the segment for transmission, then all underscore characters in the p4 segment are replaced with spaces.
  • Context - a p4 segment has been formatted and sequenced:
    For Store P4 segment data:
    When the system prepares for transmission, then the p4 segment data is moved to the transmission data field.
  • Context - a p4 segment is ready with transmission data:
    For Create transmission department record:
    When the system creates the transmission record, then the system calls the transmission department creation process with proper status code.
👨‍💻 Technical ACs (Gherkin)
Context: A P4 segment processing request is initiated
GIVEN
A P4 segment processing request is initiated
Applied to: Initialize P4 segment structure
WHEN
The system begins P4 segment creation
THEN
The P4 segment structure is initialized to empty values and the segment identifier is set to 'P4'
Context: A P4 segment is being processed with manifest data available
GIVEN
A P4 segment is being processed with manifest data available
Applied to: Set location ID from manifest from-station name
WHEN
The system sets the location identifier
THEN
The P4 location ID field is populated with the manifest from-station name
Context: A P4 segment is being processed with destination type information
GIVEN
A P4 segment is being processed with destination type information
Applied to: Check destination type
WHEN
The system evaluates the destination type for ETA date assignment
THEN
If destination is 309-DESTINATION, use current machine date; otherwise, use border arrival ETA logic
Context: A P4 segment is being processed and destination type is 309-DESTINATION
GIVEN
A P4 segment is being processed and destination type is 309-DESTINATION
Applied to: Set ETA date to current machine date
WHEN
The system assigns the ETA date
THEN
The P4 ETA date is set to the concatenation of current machine century and machine date
Context: A P4 segment is being processed for non-309-DESTINATION type
GIVEN
A P4 segment is being processed for non-309-DESTINATION type
Applied to: Border arrival ETA exists?
WHEN
The system checks for existing border arrival ETA
THEN
If border arrival ETA is spaces or low-values, calculate new ETA; otherwise, use existing ETA
Context: A P4 segment is being processed and border arrival ETA is empty
GIVEN
A P4 segment is being processed and border arrival ETA is empty
Applied to: Calculate ETA by adding days to waybill date
WHEN
The system calculates a new ETA date
THEN
The system adds WS-DAYS-FOR-ETA to the waybill date using date calculation service and updates the border arrival ETA if successful
Context: A P4 segment is being processed and border arrival ETA contains valid data
GIVEN
A P4 segment is being processed and border arrival ETA contains valid data
Applied to: Use existing border arrival ETA
WHEN
The system assigns the ETA date
THEN
The P4 ETA date is set to the existing border arrival ETA value
Context: A P4 segment is being processed
GIVEN
A P4 segment is being processed
Applied to: Set quantity to 1
WHEN
The system sets the quantity field
THEN
The P4 quantity field is set to 1
Applied to: Clear ID code and time fields
WHEN
The system sets optional fields
THEN
The P4 ID code and time fields are set to spaces
Context: A P4 segment is ready for transmission
GIVEN
A P4 segment is ready for transmission
Applied to: Add sequence number
WHEN
The system assigns sequence numbering
THEN
The sequence number is incremented by 1 and assigned to the P4 segment
Context: A P4 segment contains underscore characters
GIVEN
A P4 segment contains underscore characters
Applied to: Replace underscores with spaces
WHEN
The system formats the segment for transmission
THEN
All underscore characters in the P4 segment are replaced with spaces
Context: A P4 segment has been formatted and sequenced
GIVEN
A P4 segment has been formatted and sequenced
Applied to: Store P4 segment data
WHEN
The system prepares for transmission
THEN
The P4 segment data is moved to the transmission data field
Context: A P4 segment is ready with transmission data
GIVEN
A P4 segment is ready with transmission data
Applied to: Create transmission department record
WHEN
The system creates the transmission record
THEN
The system calls the transmission department creation process with proper status code
R-GCCCCADD-cbl-00108 (+35) File: GCCCCADD.cbl Sub Merged 36 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Sub':
  • Context - a cargo manifest with a manifest-to station name:
    For Is Manifest-To Station = 'IIS-A6'?:
    When the system checks if the manifest-to station equals 'iis-a6', then the system proceeds to destination country validation if true, otherwise checks existing sub-location code from mc table.
  • Context - a manifest-to station of 'iis-a6' and a destination with state/province code:
    For Is Destination NOT US?:
    When the system searches the state-country table to determine if destination state corresponds to 'us' country, then the system proceeds to cm table lookup if destination is not us, otherwise sets sub-location code to spaces.
  • Context - a destination that is not us and manifest-to station of 'iis-a6':
    For Lookup CM Table with Destination Station Number:
    When the system calls gcctbio with table id 'cm' and destination station number as sequence id, then the system retrieves cm table segment data for further processing.
  • Context - a cm table lookup has been performed with destination station number:
    For CM Table Lookup Successful?:
    When the system checks the gcctbio return flag for successful status, then the system proceeds to get port manifest information if successful, otherwise sets sub-location code to spaces.
  • Context - a successful cm table lookup with valid segment data:
    For Get Port Manifest Upon from CM Table:
    When the system moves the cm table segment to gcstbrtcm structure, then the system extracts the port manifest upon value for subsequent mc table lookup.
  • Context - a port manifest upon value extracted from cm table:
    For Lookup MC Table with Port Manifest Upon:
    When the system calls gcctbio with table id 'mc' and port manifest upon as sequence id, then the system retrieves mc table segment data for sub-location code extraction.
  • Context - an mc table lookup has been performed with port manifest upon value:
    For MC Table Lookup Successful?:
    When the system checks the gcctbio return flag for successful status, then the system sets sub-location code from mc table if successful, otherwise sets sub-location code to spaces.
  • Context - a successful mc table lookup with valid segment data:
    For Set Sub-location Code from MC Table:
    When the system moves the mc table segment to gcstbrtmc structure, then the system assigns the mc sub-location code to the cargo manifest sub-location code field.
  • Context - a failed cm table lookup, failed mc table lookup, or destination is us:
    For Set Sub-location Code to SPACES:
    When the system cannot retrieve valid sub-location information, then the system sets the sub-location code to spaces.
  • Context - an existing sub-location code from mc table processing:
    For Sub-location Code from MC = SPACES or LOW-VALUES?:
    When the system checks if the mc sub-location code equals spaces or low-values, then the system clears the sub-location code if empty, otherwise checks manifest station conditions.
  • Context - a non-empty sub-location code from mc table:
    For Manifest-To = 'IIS-A6' OR Manifest-From = Manifest-To?:
    When the system checks if manifest-to station equals 'iis-a6' or manifest-to station equals manifest-from station, then the system clears the sub-location code if conditions are met, otherwise keeps the existing sub-location code.
  • Context - sub-location code from mc table is empty or manifest stations meet special conditions:
    For Clear Sub-location Code:
    When the system determines that sub-location code should be cleared, then the system sets the sub-location code to spaces.
  • Context - a non-empty sub-location code from mc table and manifest stations do not meet clearing conditions:
    For Keep Sub-location Code from MC Table:
    When the system determines that sub-location code should be retained, then the system keeps the existing sub-location code from the mc table.
  • Context - a shipment with destination station information:
    For Is Sub-location Code Present?:
    When the sub-location code field is evaluated for presence, then if sub-location code is not spaces, sub-location requirements are considered met.
  • Context - a shipment without a sub-location code:
    For CSA Indicator On?:
    When the csa indicator is evaluated, then if csa indicator is on, sub-location requirements are considered met.
  • Context - a shipment without sub-location code and csa indicator off:
    For Manifest From = Manifest To AND Not IIS-A6?:
    When manifest from station name equals manifest to station name and manifest to station name is not 'iis-a6', then sub-location requirements are considered met.
  • Context - a shipment that doesn't meet previous sub-location exemptions:
    For Destination is US?:
    When the destination country is determined to be us based on state/province code lookup, then sub-location requirements are considered met.
  • Context - a shipment that doesn't meet other sub-location exemptions:
    For Arrival Indicator = 'Y'?:
    When the arrival indicator is evaluated, then if arrival indicator equals 'y', sub-location requirements are considered met.
  • Context - a shipment that doesn't meet any sub-location exemption criteria:
    For Set Sub-location Error Flag:
    When all sub-location validation checks are completed, then the sub-location error flag is set to indicate missing required sub-location code.
  • Context - a shipment that has completed sub-location validation:
    For Clear Sub-location Code:
    When the shipment has in-transit status of transit or return, then the sub-location code is cleared to spaces.
  • Context - a non-transit/non-return shipment with sub-location error flag set:
    For Generate Invalid Destination Station Sub-location Error:
    When final sub-location validation is performed, then an error message for invalid destination station sub-location code is generated and added to the message list.
  • Context - manifest to station name equals 'iis-a6' and destination is not us:
    For Lookup CM Table with Destination Station:
    When system looks up destination station number in cm table, then if cm table lookup is successful, retrieve port manifest upon information for further mc table lookup.
  • Context - cm table lookup was successful and returned port manifest upon information:
    For Set Sub-location Code from MC Table:
    When system looks up the port manifest upon value in mc table, then if mc table lookup is successful, set sub-location code from mc table sub-location code field, otherwise set sub-location code to spaces.
  • Context - consignee chop code and destination station number are available:
    For Check Customer Bonded Siding:
    When system looks up consignee in rf table using chop code and station number, then if rf table lookup is successful, set sub-location code from rf table and set customer bonded indicator to true, otherwise set customer bonded indicator to false.
  • Context - sub-location code processing is complete:
    For Apply Sub-location Requirement Rules:
    When system evaluates if sub-location code is present or csa indicator is on or manifest from equals manifest to (and not iis-a6) or destination is us or arrival indicator is y, then if any condition is true, sub-location code is valid and processing continues, otherwise set sub-location error flag.
  • Context - shipment has in-transit status (transit or return):
    For Clear Sub-location Code and Customer Bonded Indicator:
    When system processes sub-location requirements, then clear sub-location code and customer bonded indicator to spaces.
  • Context - sub-location error flag is set and shipment is not in-transit or return status:
    For Generate Sub-location Error Message:
    When system validates sub-location requirements, then generate error message for invalid destination station sub-location code.
  • Context - a cargo manifest is being processed with destination station information:
    For Sub-location Code Present?:
    When the sub-location code field contains a value that is not spaces, then the sub-location requirements are considered met and no further validation is needed.
  • Context - a cargo manifest is being processed and sub-location code is not present:
    For CSA Indicator On?:
    When the csa indicator is set to on, then the sub-location requirements are considered met regardless of other conditions.
  • Context - a cargo manifest is being processed with csa indicator off and no sub-location code:
    For Manifest From = Manifest To AND Not IIS-A6?:
    When the manifest from station name equals the manifest to station name and the manifest to station name is not equal to 'iis-a6', then the sub-location requirements are considered met.
  • Context - a cargo manifest is being processed with manifest stations not equal or manifest to station is iis-a6:
    For Destination is US?:
    When the destination state/province code corresponds to a us state in the state-country lookup table, then the sub-location requirements are considered met.
  • Context - a cargo manifest is being processed with destination not in us:
    For Arrival Indicator = Y?:
    When the arrival indicator field is set to 'y', then the sub-location requirements are considered met.
  • Context - a cargo manifest is being validated for sub-location requirements:
    For Sub-location Requirements Met:
    When any of the following conditions are met: sub-location code is present, csa indicator is on, manifest stations are equal and not iis-a6, destination is us, or arrival indicator is y, then the sub-location validation passes and no error flag is set.
  • Context - a cargo manifest is being processed for sub-location validation:
    For Set Sub-location Error Flag:
    When sub-location code is not present and csa indicator is off and manifest stations are not equal or manifest to is iis-a6 and destination is not us and arrival indicator is not y, then the sub-location error flag is set to indicate validation failure.
  • Context - a cargo manifest has failed sub-location validation and is being processed for transit or return:
    For Generate Error Message: Invalid Destination Station Sub-location Code:
    When the sub-location error flag is set, then an error message 'invalid destination station sub-location code' is generated and retrieved from the message table.
  • Context - a sub-location validation error message has been generated:
    For Add Error to Message Array:
    When the error message needs to be communicated to the user, then the error message is added to the message array and the return status is set to error.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest with a manifest-to station name
GIVEN
A cargo manifest with a manifest-to station name
Applied to: Is Manifest-To Station = 'IIS-A6'?
WHEN
The system checks if the manifest-to station equals 'IIS-A6'
THEN
The system proceeds to destination country validation if true, otherwise checks existing sub-location code from MC table
Context: A manifest-to station of 'IIS-A6' and a destination with state/province code
GIVEN
A manifest-to station of 'IIS-A6' and a destination with state/province code
Applied to: Is Destination NOT US?
WHEN
The system searches the state-country table to determine if destination state corresponds to 'US' country
THEN
The system proceeds to CM table lookup if destination is not US, otherwise sets sub-location code to spaces
Context: A destination that is not US and manifest-to station of 'IIS-A6'
GIVEN
A destination that is not US and manifest-to station of 'IIS-A6'
Applied to: Lookup CM Table with Destination Station Number
WHEN
The system calls GCCTBIO with table ID 'CM' and destination station number as sequence ID
THEN
The system retrieves CM table segment data for further processing
Context: A CM table lookup has been performed with destination station number
GIVEN
A CM table lookup has been performed with destination station number
Applied to: CM Table Lookup Successful?
WHEN
The system checks the GCCTBIO return flag for successful status
THEN
The system proceeds to get port manifest information if successful, otherwise sets sub-location code to spaces
Context: A successful CM table lookup with valid segment data
GIVEN
A successful CM table lookup with valid segment data
Applied to: Get Port Manifest Upon from CM Table
WHEN
The system moves the CM table segment to GCSTBRTCM structure
THEN
The system extracts the port manifest upon value for subsequent MC table lookup
Context: A port manifest upon value extracted from CM table
GIVEN
A port manifest upon value extracted from CM table
Applied to: Lookup MC Table with Port Manifest Upon
WHEN
The system calls GCCTBIO with table ID 'MC' and port manifest upon as sequence ID
THEN
The system retrieves MC table segment data for sub-location code extraction
Context: An MC table lookup has been performed with port manifest upon value
GIVEN
An MC table lookup has been performed with port manifest upon value
Applied to: MC Table Lookup Successful?
WHEN
The system checks the GCCTBIO return flag for successful status
THEN
The system sets sub-location code from MC table if successful, otherwise sets sub-location code to spaces
Context: A successful MC table lookup with valid segment data
GIVEN
A successful MC table lookup with valid segment data
Applied to: Set Sub-location Code from MC Table
WHEN
The system moves the MC table segment to GCSTBRTMC structure
THEN
The system assigns the MC sub-location code to the cargo manifest sub-location code field
Context: A failed CM table lookup, failed MC table lookup, or destination is US
GIVEN
A failed CM table lookup, failed MC table lookup, or destination is US
Applied to: Set Sub-location Code to SPACES
WHEN
The system cannot retrieve valid sub-location information
THEN
The system sets the sub-location code to spaces
Context: An existing sub-location code from MC table processing
GIVEN
An existing sub-location code from MC table processing
Applied to: Sub-location Code from MC = SPACES or LOW-VALUES?
WHEN
The system checks if the MC sub-location code equals spaces or low-values
THEN
The system clears the sub-location code if empty, otherwise checks manifest station conditions
Context: A non-empty sub-location code from MC table
GIVEN
A non-empty sub-location code from MC table
Applied to: Manifest-To = 'IIS-A6' OR Manifest-From = Manifest-To?
WHEN
The system checks if manifest-to station equals 'IIS-A6' OR manifest-to station equals manifest-from station
THEN
The system clears the sub-location code if conditions are met, otherwise keeps the existing sub-location code
Context: Sub-location code from MC table is empty OR manifest stations meet special conditions
GIVEN
Sub-location code from MC table is empty OR manifest stations meet special conditions
Applied to: Clear Sub-location Code
WHEN
The system determines that sub-location code should be cleared
THEN
The system sets the sub-location code to spaces
Context: A non-empty sub-location code from MC table and manifest stations do not meet clearing conditions
GIVEN
A non-empty sub-location code from MC table and manifest stations do not meet clearing conditions
Applied to: Keep Sub-location Code from MC Table
WHEN
The system determines that sub-location code should be retained
THEN
The system keeps the existing sub-location code from the MC table
Context: A shipment with destination station information
GIVEN
A shipment with destination station information
Applied to: Is Sub-location Code Present?
WHEN
The sub-location code field is evaluated for presence
THEN
If sub-location code is not spaces, sub-location requirements are considered met
Context: A shipment without a sub-location code
GIVEN
A shipment without a sub-location code
Applied to: CSA Indicator On?
WHEN
The CSA indicator is evaluated
THEN
If CSA indicator is ON, sub-location requirements are considered met
Context: A shipment without sub-location code and CSA indicator OFF
GIVEN
A shipment without sub-location code and CSA indicator OFF
Applied to: Manifest From = Manifest To AND Not IIS-A6?
WHEN
Manifest from station name equals manifest to station name AND manifest to station name is not 'IIS-A6'
THEN
Sub-location requirements are considered met
Context: A shipment that doesn't meet previous sub-location exemptions
GIVEN
A shipment that doesn't meet previous sub-location exemptions
Applied to: Destination is US?
WHEN
The destination country is determined to be US based on state/province code lookup
THEN
Sub-location requirements are considered met
Context: A shipment that doesn't meet other sub-location exemptions
GIVEN
A shipment that doesn't meet other sub-location exemptions
Applied to: Arrival Indicator = 'Y'?
WHEN
The arrival indicator is evaluated
THEN
If arrival indicator equals 'Y', sub-location requirements are considered met
Context: A shipment that doesn't meet any sub-location exemption criteria
GIVEN
A shipment that doesn't meet any sub-location exemption criteria
Applied to: Set Sub-location Error Flag
WHEN
All sub-location validation checks are completed
THEN
The sub-location error flag is set to indicate missing required sub-location code
Context: A shipment that has completed sub-location validation
GIVEN
A shipment that has completed sub-location validation
Applied to: Clear Sub-location Code
WHEN
The shipment has in-transit status of TRANSIT or RETURN
THEN
The sub-location code is cleared to spaces
Context: A non-transit/non-return shipment with sub-location error flag set
GIVEN
A non-transit/non-return shipment with sub-location error flag set
Applied to: Generate Invalid Destination Station Sub-location Error
WHEN
Final sub-location validation is performed
THEN
An error message for invalid destination station sub-location code is generated and added to the message list
Context: Manifest to station name equals 'IIS-A6' and destination is not US
GIVEN
Manifest to station name equals 'IIS-A6' and destination is not US
Applied to: Lookup CM Table with Destination Station
WHEN
System looks up destination station number in CM table
THEN
If CM table lookup is successful, retrieve port manifest upon information for further MC table lookup
Context: CM table lookup was successful and returned port manifest upon information
GIVEN
CM table lookup was successful and returned port manifest upon information
Applied to: Set Sub-location Code from MC Table
WHEN
System looks up the port manifest upon value in MC table
THEN
If MC table lookup is successful, set sub-location code from MC table sub-location code field, otherwise set sub-location code to spaces
Context: Consignee CHOP code and destination station number are available
GIVEN
Consignee CHOP code and destination station number are available
Applied to: Check Customer Bonded Siding
WHEN
System looks up consignee in RF table using CHOP code and station number
THEN
If RF table lookup is successful, set sub-location code from RF table and set customer bonded indicator to true, otherwise set customer bonded indicator to false
Context: Sub-location code processing is complete
GIVEN
Sub-location code processing is complete
Applied to: Apply Sub-location Requirement Rules
WHEN
System evaluates if sub-location code is present OR CSA indicator is on OR manifest from equals manifest to (and not IIS-A6) OR destination is US OR arrival indicator is Y
THEN
If any condition is true, sub-location code is valid and processing continues, otherwise set sub-location error flag
Context: Shipment has in-transit status (transit or return)
GIVEN
Shipment has in-transit status (transit or return)
Applied to: Clear Sub-location Code and Customer Bonded Indicator
WHEN
System processes sub-location requirements
THEN
Clear sub-location code and customer bonded indicator to spaces
Context: Sub-location error flag is set and shipment is not in-transit or return status
GIVEN
Sub-location error flag is set and shipment is not in-transit or return status
Applied to: Generate Sub-location Error Message
WHEN
System validates sub-location requirements
THEN
Generate error message for invalid destination station sub-location code
Context: A cargo manifest is being processed with destination station information
GIVEN
A cargo manifest is being processed with destination station information
Applied to: Sub-location Code Present?
WHEN
The sub-location code field contains a value that is not spaces
THEN
The sub-location requirements are considered met and no further validation is needed
Context: A cargo manifest is being processed and sub-location code is not present
GIVEN
A cargo manifest is being processed and sub-location code is not present
Applied to: CSA Indicator On?
WHEN
The CSA indicator is set to ON
THEN
The sub-location requirements are considered met regardless of other conditions
Context: A cargo manifest is being processed with CSA indicator OFF and no sub-location code
GIVEN
A cargo manifest is being processed with CSA indicator OFF and no sub-location code
Applied to: Manifest From = Manifest To AND Not IIS-A6?
WHEN
The manifest from station name equals the manifest to station name AND the manifest to station name is not equal to 'IIS-A6'
THEN
The sub-location requirements are considered met
Context: A cargo manifest is being processed with manifest stations not equal or manifest to station is IIS-A6
GIVEN
A cargo manifest is being processed with manifest stations not equal or manifest to station is IIS-A6
Applied to: Destination is US?
WHEN
The destination state/province code corresponds to a US state in the state-country lookup table
THEN
The sub-location requirements are considered met
Context: A cargo manifest is being processed with destination not in US
GIVEN
A cargo manifest is being processed with destination not in US
Applied to: Arrival Indicator = Y?
WHEN
The arrival indicator field is set to 'Y'
THEN
The sub-location requirements are considered met
Context: A cargo manifest is being validated for sub-location requirements
GIVEN
A cargo manifest is being validated for sub-location requirements
Applied to: Sub-location Requirements Met
WHEN
Any of the following conditions are met: sub-location code is present, CSA indicator is ON, manifest stations are equal and not IIS-A6, destination is US, or arrival indicator is Y
THEN
The sub-location validation passes and no error flag is set
Context: A cargo manifest is being processed for sub-location validation
GIVEN
A cargo manifest is being processed for sub-location validation
Applied to: Set Sub-location Error Flag
WHEN
Sub-location code is not present AND CSA indicator is OFF AND manifest stations are not equal or manifest to is IIS-A6 AND destination is not US AND arrival indicator is not Y
THEN
The sub-location error flag is set to indicate validation failure
Context: A cargo manifest has failed sub-location validation and is being processed for transit or return
GIVEN
A cargo manifest has failed sub-location validation and is being processed for transit or return
Applied to: Generate Error Message: Invalid Destination Station Sub-location Code
WHEN
The sub-location error flag is set
THEN
An error message 'Invalid Destination Station Sub-location Code' is generated and retrieved from the message table
Context: A sub-location validation error message has been generated
GIVEN
A sub-location validation error message has been generated
Applied to: Add Error to Message Array
WHEN
The error message needs to be communicated to the user
THEN
The error message is added to the message array and the return status is set to ERROR
R-GCCCANRL-cbl-00109 (+10) File: GCCCANRL.cbl Send Log Entry to Audit System Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Log Entry to Audit System':
  • Context - a cargo release cancellation audit log entry is being created:
    For Set Security Level to High:
    When the system prepares the security settings for the log entry, then the security byte must be set to high values to establish maximum security level.
  • Context - a manifest record is being processed for release cancellation:
    For Populate Log Entry with Manifest CCN:
    When the system creates an audit log entry, then the manifest ccn key must be recorded in the train or us ccn field of the log entry.
  • Context - an audit log entry is being created for cargo release cancellation:
    For Set Cargo Type Indicator:
    When the system sets the cargo type classification, then the cargo type indicator must be set to ca-cargo to identify this as a cargo-related transaction.
  • Context - a cargo release cancellation is being processed:
    For Record Transaction Code & Set Current Date and Time:
    When the system creates an audit log entry, then the transaction code from the common communication area must be recorded as the sending transaction in the log entry and the current machine date (including century) and time must be recorded in the log entry.
  • Context - a user initiates a cargo release cancellation:
    For Capture User ID:
    When the system creates an audit log entry, then the acf2 user id from the common communication area must be recorded in the log entry.
  • Context - a cargo release is being cancelled:
    For Set Action Code as Release Removed:
    When the system creates an audit log entry, then the action code must be set to log-cargo-release-removed to identify this specific type of transaction.
  • Context - all audit log data has been populated:
    For Format Message for Logging:
    When the system prepares to send the audit entry, then the log input data must be moved to the message structure for proper formatting.
  • Context - an audit log entry has been formatted for transmission:
    For Send Message to Audit System:
    When the system sends the audit entry, then the cims program must be called with chng function to transmit the audit message through the alternate pcb.
  • Context - an audit message has been sent to the logging system:
    For Write Message to Log:
    When the system writes the message to the log, then the writmsgl program must be called with the message code, message content, message length, and module name.
  • Context - an audit message has been successfully written to the log:
    For Purge Message Queue:
    When the system completes the logging process, then the cims program must be called with purg function to purge the message queue through the alternate pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo release cancellation audit log entry is being created
GIVEN
A cargo release cancellation audit log entry is being created
Applied to: Set Security Level to High
WHEN
The system prepares the security settings for the log entry
THEN
The security byte must be set to high values to establish maximum security level
Context: A manifest record is being processed for release cancellation
GIVEN
A manifest record is being processed for release cancellation
Applied to: Populate Log Entry with Manifest CCN
WHEN
The system creates an audit log entry
THEN
The manifest CCN key must be recorded in the train or US CCN field of the log entry
Context: An audit log entry is being created for cargo release cancellation
GIVEN
An audit log entry is being created for cargo release cancellation
Applied to: Set Cargo Type Indicator
WHEN
The system sets the cargo type classification
THEN
The cargo type indicator must be set to CA-CARGO to identify this as a cargo-related transaction
Context: A cargo release cancellation is being processed
GIVEN
A cargo release cancellation is being processed
Applied to: Record Transaction Code & Set Current Date and Time
WHEN
The system creates an audit log entry
THEN
The transaction code from the common communication area must be recorded as the sending transaction in the log entry AND The current machine date (including century) and time must be recorded in the log entry
Context: A user initiates a cargo release cancellation
GIVEN
A user initiates a cargo release cancellation
Applied to: Capture User ID
WHEN
The system creates an audit log entry
THEN
The ACF2 user ID from the common communication area must be recorded in the log entry
Context: A cargo release is being cancelled
GIVEN
A cargo release is being cancelled
Applied to: Set Action Code as Release Removed
WHEN
The system creates an audit log entry
THEN
The action code must be set to LOG-CARGO-RELEASE-REMOVED to identify this specific type of transaction
Context: All audit log data has been populated
GIVEN
All audit log data has been populated
Applied to: Format Message for Logging
WHEN
The system prepares to send the audit entry
THEN
The log input data must be moved to the message structure for proper formatting
Context: An audit log entry has been formatted for transmission
GIVEN
An audit log entry has been formatted for transmission
Applied to: Send Message to Audit System
WHEN
The system sends the audit entry
THEN
The CIMS program must be called with CHNG function to transmit the audit message through the alternate PCB
Context: An audit message has been sent to the logging system
GIVEN
An audit message has been sent to the logging system
Applied to: Write Message to Log
WHEN
The system writes the message to the log
THEN
The WRITMSGL program must be called with the message code, message content, message length, and module name
Context: An audit message has been successfully written to the log
GIVEN
An audit message has been successfully written to the log
Applied to: Purge Message Queue
WHEN
The system completes the logging process
THEN
The CIMS program must be called with PURG function to purge the message queue through the alternate PCB
R-GCX122A-cbl-00110 (+11) File: GCX122A.cbl Process Train Errors Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Train Errors':
  • Context - a train error message is being processed:
    For Is Test Train Message?:
    When the reference number equals '6105etesttrain00000000000', then the message is flagged as test train data and special test processing is performed.
    For Set Train Error Flag:
    When the message is not a test train message, then the train error flag is set to true.
  • Context - a test train message has been identified:
    For Handle Test Train Processing:
    When the reference number matches the test train pattern, then special check processing is performed and test train indicator is set to true.
  • Context - a train error needs to be processed:
    For Retrieve Train Report from Database:
    When the system needs to update the train report, then the train report is retrieved from gcsb4rt database using the reference number as key.
  • Context - a train report is not found in the database:
    For Is V67 Warning Message?:
    When the free form message starts with 'v67', then the message is identified as a v67 warning requiring special handling.
    For Set Error Flag for DCP Interface:
    When an error message has been added for the missing train, then the dcp interface error flag is set to true.
  • Context - a train report is not found and the message is a v67 warning:
    For Add Warning Message: Train/Cargo Not Found for V67 Warning:
    When the system processes the missing train record, then the message 'train/cargo not found on customs database for v67 warning' is added to the error text and mst entry.
  • Context - a train report is not found and the message is not a v67 warning:
    For Add Error Message: Train Report Not Found on Database:
    When the system processes the missing train record, then the message 'train report not found on customs database' is added to the error text and mst entry.
  • Context - a train report is found in the database:
    For Is V67 Warning?:
    When the free form message starts with 'v67', then the message is identified as a v67 warning and train message type is set.
    For Capture Last Modified Terminal:
    When the last modified terminal field is not empty, then the last modified terminal is captured for processing terminal identification.
    For Capture Creation Terminal if No Last Modified:
    When the last modified terminal field is empty, then the creation terminal is captured for processing terminal identification.
  • Context - a train report is found and the message is a v67 warning:
    For Set Train Message Type:
    When the v67 warning is being processed, then the train message type indicator is set to true.
👨‍💻 Technical ACs (Gherkin)
Context: A train error message is being processed
GIVEN
A train error message is being processed
Applied to: Is Test Train Message?
WHEN
The reference number equals '6105ETESTTRAIN00000000000'
THEN
The message is flagged as test train data and special test processing is performed
Applied to: Set Train Error Flag
WHEN
The message is not a test train message
THEN
The train error flag is set to true
Context: A test train message has been identified
GIVEN
A test train message has been identified
Applied to: Handle Test Train Processing
WHEN
The reference number matches the test train pattern
THEN
Special check processing is performed and test train indicator is set to true
Context: A train error needs to be processed
GIVEN
A train error needs to be processed
Applied to: Retrieve Train Report from Database
WHEN
The system needs to update the train report
THEN
The train report is retrieved from GCSB4RT database using the reference number as key
Context: A train report is not found in the database
GIVEN
A train report is not found in the database
Applied to: Is V67 Warning Message?
WHEN
The free form message starts with 'V67'
THEN
The message is identified as a V67 warning requiring special handling
Applied to: Set Error Flag for DCP Interface
WHEN
An error message has been added for the missing train
THEN
The DCP interface error flag is set to true
Context: A train report is not found and the message is a V67 warning
GIVEN
A train report is not found and the message is a V67 warning
Applied to: Add Warning Message: Train/Cargo Not Found for V67 Warning
WHEN
The system processes the missing train record
THEN
The message 'TRAIN/CARGO NOT FOUND ON CUSTOMS DATABASE FOR V67 WARNING' is added to the error text and MST entry
Context: A train report is not found and the message is not a V67 warning
GIVEN
A train report is not found and the message is not a V67 warning
Applied to: Add Error Message: Train Report Not Found on Database
WHEN
The system processes the missing train record
THEN
The message 'TRAIN REPORT NOT FOUND ON CUSTOMS DATABASE' is added to the error text and MST entry
Context: A train report is found in the database
GIVEN
A train report is found in the database
Applied to: Is V67 Warning?
WHEN
The free form message starts with 'V67'
THEN
The message is identified as a V67 warning and train message type is set
Applied to: Capture Last Modified Terminal
WHEN
The last modified terminal field is not empty
THEN
The last modified terminal is captured for processing terminal identification
Applied to: Capture Creation Terminal if No Last Modified
WHEN
The last modified terminal field is empty
THEN
The creation terminal is captured for processing terminal identification
Context: A train report is found and the message is a V67 warning
GIVEN
A train report is found and the message is a V67 warning
Applied to: Set Train Message Type
WHEN
The V67 warning is being processed
THEN
The train message type indicator is set to true
R-GCCCBOL-cbl-00112 (+3) File: GCCCBOL.cbl Extract Payment Method Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Payment Method':
  • Context - a shipment requires payment method extraction from bol data:
    For Extract B2-SHIPMENT-METH-PAY from BOL:
    When the system retrieves the ebsbcbc bol segment and the payment method field contains valid data, then the payment method is extracted and stored in the cargo report structure.
  • Context - a request to extract payment method from bol data:
    For EBSBCBC segment found?:
    When the system attempts to retrieve the ebsbcbc bol segment, then the system proceeds with payment method extraction only if the bol segment is successfully found.
  • Context - an ebsbcbc bol segment has been successfully retrieved:
    For Payment method field not empty?:
    When the system checks the b2-shipment-meth-pay field for content, then the payment method is processed only if the field is not empty or contains spaces.
  • Context - a valid payment method has been extracted from the bol segment:
    For Store payment method in GCCC-BX03-SHIP-METH-PAY:
    When the b2-shipment-meth-pay field contains valid payment method data, then the payment method value is moved to gccc-bx03-ship-meth-pay field in the cargo report.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires payment method extraction from BOL data
GIVEN
A shipment requires payment method extraction from BOL data
Applied to: Extract B2-SHIPMENT-METH-PAY from BOL
WHEN
The system retrieves the EBSBCBC BOL segment and the payment method field contains valid data
THEN
The payment method is extracted and stored in the cargo report structure
Context: A request to extract payment method from BOL data
GIVEN
A request to extract payment method from BOL data
Applied to: EBSBCBC segment found?
WHEN
The system attempts to retrieve the EBSBCBC BOL segment
THEN
The system proceeds with payment method extraction only if the BOL segment is successfully found
Context: An EBSBCBC BOL segment has been successfully retrieved
GIVEN
An EBSBCBC BOL segment has been successfully retrieved
Applied to: Payment method field not empty?
WHEN
The system checks the B2-SHIPMENT-METH-PAY field for content
THEN
The payment method is processed only if the field is not empty or contains spaces
Context: A valid payment method has been extracted from the BOL segment
GIVEN
A valid payment method has been extracted from the BOL segment
Applied to: Store payment method in GCCC-BX03-SHIP-METH-PAY
WHEN
The B2-SHIPMENT-METH-PAY field contains valid payment method data
THEN
The payment method value is moved to GCCC-BX03-SHIP-METH-PAY field in the cargo report
R-GCCCBOL-cbl-00116 (+5) File: GCCCBOL.cbl Extract Shipment ID Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Shipment ID':
  • Context - a bol record exists with shipment data segment ebsbcbc:
    For Get EBSBCBC Segment from BOL:
    When the system processes the bol data for shipment identification, then the system should retrieve the ebsbcbc segment containing shipment id information.
  • Context - the system has attempted to retrieve ebsbcbc segment from bol data:
    For EBSBCBC Segment Found?:
    When the system checks if the ebsbcbc segment was successfully found, then the system should continue processing if segment is found, otherwise terminate the shipment id extraction process.
  • Context - the ebsbcbc segment has been successfully retrieved from bol data:
    For Shipment ID Number Available?:
    When the system checks the b2-shipment-id-no field for valid content, then the system should proceed with reference number creation if shipment id is not spaces, otherwise skip the shipment id processing.
  • Context - the shipment id number is valid and available in the ebsbcbc segment:
    For Increment Reference Number Counter:
    When the system prepares to add the shipment id as a reference number, then the system should increment the reference number counter by 1 to point to the next available array position.
  • Context - the reference number counter has been incremented for a new shipment id entry:
    For Set Reference Qualifier to 'CN':
    When the system sets the reference number qualifier, then the system should assign 'cn' as the qualifier to indicate this is a container number reference.
  • Context - the reference qualifier has been set to 'cn' and the counter is positioned correctly:
    For Move Shipment ID to Reference Number Field:
    When the system stores the shipment identification data, then the system should move the b2-shipment-id-no value to the reference number field at the current array position.
👨‍💻 Technical ACs (Gherkin)
Context: A BOL record exists with shipment data segment EBSBCBC
GIVEN
A BOL record exists with shipment data segment EBSBCBC
Applied to: Get EBSBCBC Segment from BOL
WHEN
The system processes the BOL data for shipment identification
THEN
The system should retrieve the EBSBCBC segment containing shipment ID information
Context: The system has attempted to retrieve EBSBCBC segment from BOL data
GIVEN
The system has attempted to retrieve EBSBCBC segment from BOL data
Applied to: EBSBCBC Segment Found?
WHEN
The system checks if the EBSBCBC segment was successfully found
THEN
The system should continue processing if segment is found, otherwise terminate the shipment ID extraction process
Context: The EBSBCBC segment has been successfully retrieved from BOL data
GIVEN
The EBSBCBC segment has been successfully retrieved from BOL data
Applied to: Shipment ID Number Available?
WHEN
The system checks the B2-SHIPMENT-ID-NO field for valid content
THEN
The system should proceed with reference number creation if shipment ID is not spaces, otherwise skip the shipment ID processing
Context: The shipment ID number is valid and available in the EBSBCBC segment
GIVEN
The shipment ID number is valid and available in the EBSBCBC segment
Applied to: Increment Reference Number Counter
WHEN
The system prepares to add the shipment ID as a reference number
THEN
The system should increment the reference number counter by 1 to point to the next available array position
Context: The reference number counter has been incremented for a new shipment ID entry
GIVEN
The reference number counter has been incremented for a new shipment ID entry
Applied to: Set Reference Qualifier to 'CN'
WHEN
The system sets the reference number qualifier
THEN
The system should assign 'CN' as the qualifier to indicate this is a Container Number reference
Context: The reference qualifier has been set to 'CN' and the counter is positioned correctly
GIVEN
The reference qualifier has been set to 'CN' and the counter is positioned correctly
Applied to: Move Shipment ID to Reference Number Field
WHEN
The system stores the shipment identification data
THEN
The system should move the B2-SHIPMENT-ID-NO value to the reference number field at the current array position
R-GCCS309C-cbl-00118 (+7) File: GCCS309C.cbl LX Segment Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'LX Segment Processing':
  • Context - a shipment manifest requires edi transmission processing:
    For Create assigned number segment for shipment grouping:
    When the system processes the lx segment for shipment grouping, then an lx segment is created with segment identifier 'lx' and assigned number '000001'.
  • Context - lx segment processing is initiated:
    For Initialize LX segment structure:
    When the system begins lx segment creation, then the lx segment structure is initialized to clear any previous data.
  • Context - an initialized lx segment structure exists:
    For Set segment identifier to 'LX':
    When the system sets the segment identifier, then the segment identifier is set to 'lx' to comply with edi standards.
  • Context - an lx segment with identifier set:
    For Set assigned number to '000001':
    When the system assigns the line number for shipment grouping, then the assigned number is set to '000001' as the first and only shipment group.
  • Context - lx segment data is prepared for transmission:
    For Increment sequence number:
    When the system processes the segment for transmission, then the transmission sequence number is incremented by 1 and assigned to the segment.
  • Context - lx segment contains underscore placeholder characters:
    For Replace underscores with spaces in segment:
    When the system prepares the segment for edi transmission, then all underscore characters in the lx segment are replaced with spaces.
  • Context - a properly formatted lx segment with sequence number assigned:
    For Move LX segment to transmission data:
    When the system prepares the segment for transmission, then the lx segment data is moved to the transmission data structure.
  • Context - lx segment data is prepared in the transmission structure:
    For Create transmission department record:
    When the system creates the transmission record, then a transmission department record is created for the lx segment.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment manifest requires EDI transmission processing
GIVEN
A shipment manifest requires EDI transmission processing
Applied to: Create assigned number segment for shipment grouping
WHEN
The system processes the LX segment for shipment grouping
THEN
An LX segment is created with segment identifier 'LX' and assigned number '000001'
Context: LX segment processing is initiated
GIVEN
LX segment processing is initiated
Applied to: Initialize LX segment structure
WHEN
The system begins LX segment creation
THEN
The LX segment structure is initialized to clear any previous data
Context: An initialized LX segment structure exists
GIVEN
An initialized LX segment structure exists
Applied to: Set segment identifier to 'LX'
WHEN
The system sets the segment identifier
THEN
The segment identifier is set to 'LX' to comply with EDI standards
Context: An LX segment with identifier set
GIVEN
An LX segment with identifier set
Applied to: Set assigned number to '000001'
WHEN
The system assigns the line number for shipment grouping
THEN
The assigned number is set to '000001' as the first and only shipment group
Context: LX segment data is prepared for transmission
GIVEN
LX segment data is prepared for transmission
Applied to: Increment sequence number
WHEN
The system processes the segment for transmission
THEN
The transmission sequence number is incremented by 1 and assigned to the segment
Context: LX segment contains underscore placeholder characters
GIVEN
LX segment contains underscore placeholder characters
Applied to: Replace underscores with spaces in segment
WHEN
The system prepares the segment for EDI transmission
THEN
All underscore characters in the LX segment are replaced with spaces
Context: A properly formatted LX segment with sequence number assigned
GIVEN
A properly formatted LX segment with sequence number assigned
Applied to: Move LX segment to transmission data
WHEN
The system prepares the segment for transmission
THEN
The LX segment data is moved to the transmission data structure
Context: LX segment data is prepared in the transmission structure
GIVEN
LX segment data is prepared in the transmission structure
Applied to: Create transmission department record
WHEN
The system creates the transmission record
THEN
A transmission department record is created for the LX segment
R-GCCCCADD-cbl-00121 (+3) File: GCCCCADD.cbl Bonded Siding Location Check Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bonded Siding Location Check':
  • Context - a shipment with consignee chop code and destination station number:
    For Setup RF Table Lookup Parameters:
    When the system needs to check for customer bonded siding locations, then the system sets up rf table lookup with consignee chop as sequence key and destination station number as station parameter.
  • Context - rf table lookup parameters are configured with consignee chop and destination station:
    For Call RF Table Lookup:
    When the system executes the rf table lookup, then the system calls the table lookup function to retrieve rail facility data.
  • Context - an rf table lookup has been executed for consignee and destination:
    For RF Table Record Found?:
    When the system evaluates the lookup results, then if a matching rf table record is found, set customer bonded indicator to true, otherwise set customer bonded indicator to false.
  • Context - a matching rf table record exists for the consignee and destination:
    For Retrieve Sub-location Code from RF Table:
    When the customer is determined to be bonded, then the system retrieves and assigns the sub-location code from the rf table record to the customs manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with consignee CHOP code and destination station number
GIVEN
A shipment with consignee CHOP code and destination station number
Applied to: Setup RF Table Lookup Parameters
WHEN
The system needs to check for customer bonded siding locations
THEN
The system sets up RF table lookup with consignee CHOP as sequence key and destination station number as station parameter
Context: RF table lookup parameters are configured with consignee CHOP and destination station
GIVEN
RF table lookup parameters are configured with consignee CHOP and destination station
Applied to: Call RF Table Lookup
WHEN
The system executes the RF table lookup
THEN
The system calls the table lookup function to retrieve rail facility data
Context: An RF table lookup has been executed for consignee and destination
GIVEN
An RF table lookup has been executed for consignee and destination
Applied to: RF Table Record Found?
WHEN
The system evaluates the lookup results
THEN
If a matching RF table record is found, set customer bonded indicator to TRUE, otherwise set customer bonded indicator to FALSE
Context: A matching RF table record exists for the consignee and destination
GIVEN
A matching RF table record exists for the consignee and destination
Applied to: Retrieve Sub-location Code from RF Table
WHEN
The customer is determined to be bonded
THEN
The system retrieves and assigns the sub-location code from the RF table record to the customs manifest
R-GCCCBOL-cbl-00122 (+10) File: GCCCBOL.cbl Compress Reference Numbers Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Compress Reference Numbers':
  • Context - a reference number processing operation is initiated:
    For Initialize Counter I = 1:
    When the system begins processing reference number fields, then the counter is set to 1 to start processing from the first reference number field.
  • Context - reference number fields are being processed sequentially:
    For Counter I <= 10?:
    When the system checks if more fields need processing, then processing continues only if the current field number is 10 or less, otherwise processing stops.
  • Context - a reference number field is being evaluated for compression:
    For Reference Number is Spaces OR First Character Not Space?:
    When the field is either completely empty (spaces) or the first character is not a space, then the field is skipped from compression processing and the system moves to the next field.
  • Context - a reference number field requires compression processing:
    For Move Reference Number to Work Table:
    When the field contains leading spaces that need to be removed, then the entire reference number content is copied to a work table for manipulation.
  • Context - reference number data has been copied to work area:
    For Clear Original Reference Number Field:
    When the original field needs to be prepared for compressed data, then the original reference number field is cleared (set to spaces).
  • Context - the system is scanning characters in a reference number field:
    For Position J <= 30?:
    When each character position is being evaluated, then scanning continues only if the current position is 30 or less, otherwise scanning stops.
  • Context - a character at a specific position is being evaluated:
    For Character is Space or Low-Value?:
    When the character is either a space or a low-value, then the character is marked for exclusion and the system moves to the next position.
  • Context - the system is scanning for the first meaningful character:
    For Mark First Non-Space Position K:
    When a character that is not a space or low-value is found, then the position of this character is marked as the starting point for compression.
  • Context - meaningful characters are being copied from work area to compressed field:
    For Position K <= 30?:
    When each source position is being processed, then copying continues only if the source position is 30 or less, otherwise copying stops.
  • Context - a meaningful character has been identified in the work area:
    For Copy Non-Space Character to Compressed Position:
    When the character needs to be placed in the compressed reference number, then the character is copied to the current position in the compressed field.
  • Context - processing of current reference number field is complete:
    For Increment Reference Counter I:
    When the system needs to continue with remaining fields, then the reference number counter is incremented by 1 to process the next field.
👨‍💻 Technical ACs (Gherkin)
Context: A reference number processing operation is initiated
GIVEN
A reference number processing operation is initiated
Applied to: Initialize Counter I = 1
WHEN
The system begins processing reference number fields
THEN
The counter is set to 1 to start processing from the first reference number field
Context: Reference number fields are being processed sequentially
GIVEN
Reference number fields are being processed sequentially
Applied to: Counter I <= 10?
WHEN
The system checks if more fields need processing
THEN
Processing continues only if the current field number is 10 or less, otherwise processing stops
Context: A reference number field is being evaluated for compression
GIVEN
A reference number field is being evaluated for compression
Applied to: Reference Number is Spaces OR First Character Not Space?
WHEN
The field is either completely empty (spaces) OR the first character is not a space
THEN
The field is skipped from compression processing and the system moves to the next field
Context: A reference number field requires compression processing
GIVEN
A reference number field requires compression processing
Applied to: Move Reference Number to Work Table
WHEN
The field contains leading spaces that need to be removed
THEN
The entire reference number content is copied to a work table for manipulation
Context: Reference number data has been copied to work area
GIVEN
Reference number data has been copied to work area
Applied to: Clear Original Reference Number Field
WHEN
The original field needs to be prepared for compressed data
THEN
The original reference number field is cleared (set to spaces)
Context: The system is scanning characters in a reference number field
GIVEN
The system is scanning characters in a reference number field
Applied to: Position J <= 30?
WHEN
Each character position is being evaluated
THEN
Scanning continues only if the current position is 30 or less, otherwise scanning stops
Context: A character at a specific position is being evaluated
GIVEN
A character at a specific position is being evaluated
Applied to: Character is Space or Low-Value?
WHEN
The character is either a space or a low-value
THEN
The character is marked for exclusion and the system moves to the next position
Context: The system is scanning for the first meaningful character
GIVEN
The system is scanning for the first meaningful character
Applied to: Mark First Non-Space Position K
WHEN
A character that is not a space or low-value is found
THEN
The position of this character is marked as the starting point for compression
Context: Meaningful characters are being copied from work area to compressed field
GIVEN
Meaningful characters are being copied from work area to compressed field
Applied to: Position K <= 30?
WHEN
Each source position is being processed
THEN
Copying continues only if the source position is 30 or less, otherwise copying stops
Context: A meaningful character has been identified in the work area
GIVEN
A meaningful character has been identified in the work area
Applied to: Copy Non-Space Character to Compressed Position
WHEN
The character needs to be placed in the compressed reference number
THEN
The character is copied to the current position in the compressed field
Context: Processing of current reference number field is complete
GIVEN
Processing of current reference number field is complete
Applied to: Increment Reference Counter I
WHEN
The system needs to continue with remaining fields
THEN
The reference number counter is incremented by 1 to process the next field
R-GCX122A-cbl-00122 (+13) File: GCX122A.cbl Process Cargo Errors Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Cargo Errors':
  • Context - a cargo error message is being processed:
    For Is Test Cargo Message?:
    When the reference number starts with '6105ecprstestcargo' or '6105etestcargo', then the message is flagged as test cargo and routed to special test processing.
  • Context - a cargo message has been identified as test data:
    For Handle Test Cargo Processing:
    When the test cargo flag is set, then the system performs special check processing and exits cargo error handling.
  • Context - a non-test cargo error message is being processed:
    For Set Cargo Error Flag:
    When the message is confirmed as production cargo data, then the cargo error flag is set to true.
  • Context - a cargo error message with a reference number:
    For Retrieve Cargo Control Record:
    When the system searches for the corresponding cargo control record, then the cargo record is retrieved if it exists in the database.
  • Context - a cargo control record is not found in the database:
    For Is V67 Warning?:
    When the free-form message starts with 'v67', then the message is identified as a v67 warning requiring train error processing.
  • Context - a cargo record is not found and the message is identified as v67 warning:
    For Process as Train Error Instead:
    When the v67 redirection rule is triggered, then the system processes the message using train error handling procedures.
  • Context - a cargo control record search fails and the message is not a v67 warning:
    For Add Error Message: CCN Not Found:
    When the cargo record is confirmed as not found, then an error message 'ccn not found on customs database' is added to the message queue.
  • Context - a cargo control record cannot be found in the database:
    For Set Error Flag for DCP Interface:
    When the cargo not found condition is confirmed, then the dcp interface error flag is set to true.
  • Context - a cargo control record is successfully found:
    For Save Current Cargo Status:
    When the system prepares to process the cargo error, then the current cargo status is saved for comparison and audit purposes.
  • Context - a cargo control record is successfully retrieved from the database:
    For Set Cargo Report Found Flag:
    When the cargo record exists and is accessible, then the cargo report found flag is set to true.
  • Context - a cargo control record has been found and status saved:
    For Capture Last Modify Terminal:
    When the system needs to determine the appropriate terminal for notifications, then the last modify terminal information is captured from the cargo record.
  • Context - terminal information needs to be determined for error routing:
    For Last Modify Terminal Available?:
    When the last modify terminal field is evaluated, then the system determines if a valid last modify terminal exists (not spaces).
  • Context - a valid last modify terminal exists in the cargo record:
    For Use Last Modify Terminal:
    When terminal selection logic is executed, then the last modify terminal is selected for processing error notifications.
  • Context - no valid last modify terminal exists in the cargo record:
    For Use Creation Terminal:
    When terminal selection fallback logic is triggered, then the creation terminal is selected for processing error notifications.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo error message is being processed
GIVEN
A cargo error message is being processed
Applied to: Is Test Cargo Message?
WHEN
The reference number starts with '6105ECPRSTESTCARGO' or '6105ETESTCARGO'
THEN
The message is flagged as test cargo and routed to special test processing
Context: A cargo message has been identified as test data
GIVEN
A cargo message has been identified as test data
Applied to: Handle Test Cargo Processing
WHEN
The test cargo flag is set
THEN
The system performs special check processing and exits cargo error handling
Context: A non-test cargo error message is being processed
GIVEN
A non-test cargo error message is being processed
Applied to: Set Cargo Error Flag
WHEN
The message is confirmed as production cargo data
THEN
The cargo error flag is set to true
Context: A cargo error message with a reference number
GIVEN
A cargo error message with a reference number
Applied to: Retrieve Cargo Control Record
WHEN
The system searches for the corresponding cargo control record
THEN
The cargo record is retrieved if it exists in the database
Context: A cargo control record is not found in the database
GIVEN
A cargo control record is not found in the database
Applied to: Is V67 Warning?
WHEN
The free-form message starts with 'V67'
THEN
The message is identified as a V67 warning requiring train error processing
Context: A cargo record is not found and the message is identified as V67 warning
GIVEN
A cargo record is not found and the message is identified as V67 warning
Applied to: Process as Train Error Instead
WHEN
The V67 redirection rule is triggered
THEN
The system processes the message using train error handling procedures
Context: A cargo control record search fails and the message is not a V67 warning
GIVEN
A cargo control record search fails and the message is not a V67 warning
Applied to: Add Error Message: CCN Not Found
WHEN
The cargo record is confirmed as not found
THEN
An error message 'CCN NOT FOUND ON CUSTOMS DATABASE' is added to the message queue
Context: A cargo control record cannot be found in the database
GIVEN
A cargo control record cannot be found in the database
Applied to: Set Error Flag for DCP Interface
WHEN
The cargo not found condition is confirmed
THEN
The DCP interface error flag is set to true
Context: A cargo control record is successfully found
GIVEN
A cargo control record is successfully found
Applied to: Save Current Cargo Status
WHEN
The system prepares to process the cargo error
THEN
The current cargo status is saved for comparison and audit purposes
Context: A cargo control record is successfully retrieved from the database
GIVEN
A cargo control record is successfully retrieved from the database
Applied to: Set Cargo Report Found Flag
WHEN
The cargo record exists and is accessible
THEN
The cargo report found flag is set to true
Context: A cargo control record has been found and status saved
GIVEN
A cargo control record has been found and status saved
Applied to: Capture Last Modify Terminal
WHEN
The system needs to determine the appropriate terminal for notifications
THEN
The last modify terminal information is captured from the cargo record
Context: Terminal information needs to be determined for error routing
GIVEN
Terminal information needs to be determined for error routing
Applied to: Last Modify Terminal Available?
WHEN
The last modify terminal field is evaluated
THEN
The system determines if a valid last modify terminal exists (not spaces)
Context: A valid last modify terminal exists in the cargo record
GIVEN
A valid last modify terminal exists in the cargo record
Applied to: Use Last Modify Terminal
WHEN
Terminal selection logic is executed
THEN
The last modify terminal is selected for processing error notifications
Context: No valid last modify terminal exists in the cargo record
GIVEN
No valid last modify terminal exists in the cargo record
Applied to: Use Creation Terminal
WHEN
Terminal selection fallback logic is triggered
THEN
The creation terminal is selected for processing error notifications
R-GCCS309C-cbl-00126 (+11) File: GCCS309C.cbl M13 Segment Processing Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M13 Segment Processing':
  • Context - a manifest amendment processing request is initiated:
    For Initialize M13 segment structure:
    When the m13 segment processing begins, then the m13 segment structure should be initialized to clear any previous data.
  • Context - an m13 segment is being created for manifest amendment:
    For Set segment identifier to 'M13':
    When the segment identifier needs to be set, then the segment identifier should be set to 'm13'.
  • Context - an m13 manifest amendment segment is being created:
    For Set SCAC code to 'CPRS':
    When the carrier identification needs to be specified, then the scac code should be set to 'cprs' for canadian pacific railway.
  • Context - a manifest has an originating station name:
    For Set location ID from manifest from-station name:
    When creating an m13 amendment segment, then the location id should be populated with the manifest from-station name.
  • Context - a manifest has a valid ccn key:
    For Set BOL/WB number from CCN key:
    When creating an m13 amendment segment, then the bol/wb number should be set to the ccn key value.
  • Context - an m13 amendment segment is being created:
    For Amendment code exists?:
    When the amendment code needs to be determined, then if amendment code exists and is not spaces or low-values, use the existing code; otherwise use default code '60'.
  • Context - a manifest contains an amendment code that is not spaces or low-values:
    For Use existing amendment code from manifest:
    When creating an m13 amendment segment, then the existing amendment code from the manifest should be used.
  • Context - a manifest amendment code is spaces or low-values:
    For Set default amendment code to '60':
    When creating an m13 amendment segment, then the amendment code should be set to default value '60'.
  • Context - an m13 segment is ready for transmission:
    For Increment sequence number:
    When the segment needs to be sequenced, then the sequence number should be incremented by 1.
  • Context - an m13 segment contains underscore characters:
    For Replace underscores with spaces in segment:
    When preparing the segment for transmission, then all underscore characters should be replaced with spaces.
  • Context - an m13 segment has been formatted and sequenced:
    For Store M13 segment in transmission data:
    When the segment is ready for transmission, then the m13 segment should be stored in the transmission data structure.
  • Context - an m13 segment is stored in transmission data:
    For Create transmission department record:
    When the segment needs to be processed through the transmission system, then a transmission department record should be created.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest amendment processing request is initiated
GIVEN
A manifest amendment processing request is initiated
Applied to: Initialize M13 segment structure
WHEN
The M13 segment processing begins
THEN
The M13 segment structure should be initialized to clear any previous data
Context: An M13 segment is being created for manifest amendment
GIVEN
An M13 segment is being created for manifest amendment
Applied to: Set segment identifier to 'M13'
WHEN
The segment identifier needs to be set
THEN
The segment identifier should be set to 'M13'
Context: An M13 manifest amendment segment is being created
GIVEN
An M13 manifest amendment segment is being created
Applied to: Set SCAC code to 'CPRS'
WHEN
The carrier identification needs to be specified
THEN
The SCAC code should be set to 'CPRS' for Canadian Pacific Railway
Context: A manifest has an originating station name
GIVEN
A manifest has an originating station name
Applied to: Set location ID from manifest from-station name
WHEN
Creating an M13 amendment segment
THEN
The location ID should be populated with the manifest from-station name
Context: A manifest has a valid CCN key
GIVEN
A manifest has a valid CCN key
Applied to: Set BOL/WB number from CCN key
WHEN
Creating an M13 amendment segment
THEN
The BOL/WB number should be set to the CCN key value
Context: An M13 amendment segment is being created
GIVEN
An M13 amendment segment is being created
Applied to: Amendment code exists?
WHEN
The amendment code needs to be determined
THEN
If amendment code exists and is not spaces or low-values, use the existing code; otherwise use default code '60'
Context: A manifest contains an amendment code that is not spaces or low-values
GIVEN
A manifest contains an amendment code that is not spaces or low-values
Applied to: Use existing amendment code from manifest
WHEN
Creating an M13 amendment segment
THEN
The existing amendment code from the manifest should be used
Context: A manifest amendment code is spaces or low-values
GIVEN
A manifest amendment code is spaces or low-values
Applied to: Set default amendment code to '60'
WHEN
Creating an M13 amendment segment
THEN
The amendment code should be set to default value '60'
Context: An M13 segment is ready for transmission
GIVEN
An M13 segment is ready for transmission
Applied to: Increment sequence number
WHEN
The segment needs to be sequenced
THEN
The sequence number should be incremented by 1
Context: An M13 segment contains underscore characters
GIVEN
An M13 segment contains underscore characters
Applied to: Replace underscores with spaces in segment
WHEN
Preparing the segment for transmission
THEN
All underscore characters should be replaced with spaces
Context: An M13 segment has been formatted and sequenced
GIVEN
An M13 segment has been formatted and sequenced
Applied to: Store M13 segment in transmission data
WHEN
The segment is ready for transmission
THEN
The M13 segment should be stored in the transmission data structure
Context: An M13 segment is stored in transmission data
GIVEN
An M13 segment is stored in transmission data
Applied to: Create transmission department record
WHEN
The segment needs to be processed through the transmission system
THEN
A transmission department record should be created
R-GCCCBOL-cbl-00133 (+13) File: GCCCBOL.cbl Build Seal Numbers Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build Seal Numbers':
  • Context - the system needs to process seal numbers from edi bol data:
    For Initialize seal counter to 1:
    When the seal number building process starts, then the seal counter is set to 1 and ebsbccx segment counter is initialized.
  • Context - the system is processing seal numbers from edi bol segments:
    For Set seal type to 'SN':
    When preparing to retrieve ebsbccx segments, then the type identifier is set to 'sn' for seal number segment retrieval.
    For Seal counter ≤ 20:
    When the seal counter reaches or exceeds 20, then the seal number processing stops to prevent exceeding the maximum capacity.
    For End Build Seal Numbers:
    When no more ebsbccx segments are found or the seal counter exceeds 20, then the seal number building process terminates.
  • Context - the system has a valid edi bol key and segment counter:
    For Get EBSBCCX segment from BOL:
    When retrieving ebsbccx segments with type 'sn', then the system attempts to get the ebsbccx segment and sets found/not found status.
  • Context - an ebsbccx segment has been retrieved successfully:
    For Seal Number 1 not empty:
    When checking the first seal number field (m7-seal-number-1), then the seal number is processed only if it is not equal to spaces or low-values.
  • Context - the first seal number in the ebsbccx segment is valid (not spaces or low-values):
    For Store Seal Number 1 in array:
    When storing the seal number data, then m7-seal-number-1 is moved to gcsccs56-seal-number at the current seal counter position.
  • Context - an ebsbccx segment has been retrieved and first seal number processed:
    For Seal Number 2 not empty:
    When checking the second seal number field (m7-seal-number-2), then the seal number is processed only if it is not equal to spaces or low-values.
  • Context - the second seal number in the ebsbccx segment is valid (not spaces or low-values):
    For Store Seal Number 2 in array:
    When storing the seal number data, then m7-seal-number-2 is moved to gcsccs56-seal-number at the current seal counter position.
  • Context - an ebsbccx segment has been retrieved and previous seal numbers processed:
    For Seal Number 3 not empty:
    When checking the third seal number field (m7-seal-number-3), then the seal number is processed only if it is not equal to spaces or low-values.
    For Seal Number 4 not empty:
    When checking the fourth seal number field (m7-seal-number-4), then the seal number is processed only if it is not equal to spaces or low-values.
  • Context - the third seal number in the ebsbccx segment is valid (not spaces or low-values):
    For Store Seal Number 3 in array:
    When storing the seal number data, then m7-seal-number-3 is moved to gcsccs56-seal-number at the current seal counter position.
  • Context - the fourth seal number in the ebsbccx segment is valid (not spaces or low-values):
    For Store Seal Number 4 in array:
    When storing the seal number data, then m7-seal-number-4 is moved to gcsccs56-seal-number at the current seal counter position.
  • Context - all seal numbers from the current ebsbccx segment have been processed:
    For Increment EBSBCCX segment counter:
    When moving to the next segment, then the ebsbccx segment counter (ws-sub-cx) is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process seal numbers from EDI BOL data
GIVEN
The system needs to process seal numbers from EDI BOL data
Applied to: Initialize seal counter to 1
WHEN
The seal number building process starts
THEN
The seal counter is set to 1 and EBSBCCX segment counter is initialized
Context: The system is processing seal numbers from EDI BOL segments
GIVEN
The system is processing seal numbers from EDI BOL segments
Applied to: Set seal type to 'SN'
WHEN
Preparing to retrieve EBSBCCX segments
THEN
The type identifier is set to 'SN' for seal number segment retrieval
Applied to: Seal counter ≤ 20
WHEN
The seal counter reaches or exceeds 20
THEN
The seal number processing stops to prevent exceeding the maximum capacity
Applied to: End Build Seal Numbers
WHEN
No more EBSBCCX segments are found OR the seal counter exceeds 20
THEN
The seal number building process terminates
Context: The system has a valid EDI BOL key and segment counter
GIVEN
The system has a valid EDI BOL key and segment counter
Applied to: Get EBSBCCX segment from BOL
WHEN
Retrieving EBSBCCX segments with type 'SN'
THEN
The system attempts to get the EBSBCCX segment and sets found/not found status
Context: An EBSBCCX segment has been retrieved successfully
GIVEN
An EBSBCCX segment has been retrieved successfully
Applied to: Seal Number 1 not empty
WHEN
Checking the first seal number field (M7-SEAL-NUMBER-1)
THEN
The seal number is processed only if it is not equal to spaces or low-values
Context: The first seal number in the EBSBCCX segment is valid (not spaces or low-values)
GIVEN
The first seal number in the EBSBCCX segment is valid (not spaces or low-values)
Applied to: Store Seal Number 1 in array
WHEN
Storing the seal number data
THEN
M7-SEAL-NUMBER-1 is moved to GCSCCS56-SEAL-NUMBER at the current seal counter position
Context: An EBSBCCX segment has been retrieved and first seal number processed
GIVEN
An EBSBCCX segment has been retrieved and first seal number processed
Applied to: Seal Number 2 not empty
WHEN
Checking the second seal number field (M7-SEAL-NUMBER-2)
THEN
The seal number is processed only if it is not equal to spaces or low-values
Context: The second seal number in the EBSBCCX segment is valid (not spaces or low-values)
GIVEN
The second seal number in the EBSBCCX segment is valid (not spaces or low-values)
Applied to: Store Seal Number 2 in array
WHEN
Storing the seal number data
THEN
M7-SEAL-NUMBER-2 is moved to GCSCCS56-SEAL-NUMBER at the current seal counter position
Context: An EBSBCCX segment has been retrieved and previous seal numbers processed
GIVEN
An EBSBCCX segment has been retrieved and previous seal numbers processed
Applied to: Seal Number 3 not empty
WHEN
Checking the third seal number field (M7-SEAL-NUMBER-3)
THEN
The seal number is processed only if it is not equal to spaces or low-values
Applied to: Seal Number 4 not empty
WHEN
Checking the fourth seal number field (M7-SEAL-NUMBER-4)
THEN
The seal number is processed only if it is not equal to spaces or low-values
Context: The third seal number in the EBSBCCX segment is valid (not spaces or low-values)
GIVEN
The third seal number in the EBSBCCX segment is valid (not spaces or low-values)
Applied to: Store Seal Number 3 in array
WHEN
Storing the seal number data
THEN
M7-SEAL-NUMBER-3 is moved to GCSCCS56-SEAL-NUMBER at the current seal counter position
Context: The fourth seal number in the EBSBCCX segment is valid (not spaces or low-values)
GIVEN
The fourth seal number in the EBSBCCX segment is valid (not spaces or low-values)
Applied to: Store Seal Number 4 in array
WHEN
Storing the seal number data
THEN
M7-SEAL-NUMBER-4 is moved to GCSCCS56-SEAL-NUMBER at the current seal counter position
Context: All seal numbers from the current EBSBCCX segment have been processed
GIVEN
All seal numbers from the current EBSBCCX segment have been processed
Applied to: Increment EBSBCCX segment counter
WHEN
Moving to the next segment
THEN
The EBSBCCX segment counter (WS-SUB-CX) is incremented by 1
R-GCCCCADD-cbl-00133 (+5) File: GCCCCADD.cbl Conveying Car Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Conveying Car Processing':
  • Context - a shipment record contains conveying car information:
    For Extract Conveying Car Initial and Number from Shipment Data:
    When the conveying car initial is not empty in the shipment data, then extract the conveying car initial and number from the shipment record and assign them to the customs manifest.
  • Context - a shipment has no conveying car initial specified:
    For Set Default Conveying Car: Initial='UNKN', Number='00000001':
    When the shipment type is tofc (trailer on flat car) or cofc (container on flat car), then set the conveying car initial to 'unkn' and the conveying car number to '00000001'.
    For Clear Conveying Car Information:
    When the shipment type is neither tofc nor cofc, then clear the conveying car initial and number fields.
  • Context - a conveying car initial is present in the manifest:
    For Validate Conveying Car ID Using GCCCARID Utility:
    When the car id validation is performed using the gcccarid utility, then the utility validates the car id format and returns either a validated id or an error indicator.
  • Context - a conveying car id has been validated successfully:
    For Update Conveying Car with Validated ID:
    When the validation utility returns a valid car id, then update the conveying car field with the validated car id.
  • Context - a conveying car id validation has been attempted:
    For Generate Invalid Conveying Car Error Message:
    When the validation utility indicates the car id is invalid, then generate an error message for invalid conveying car and add it to the message collection.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record contains conveying car information
GIVEN
A shipment record contains conveying car information
Applied to: Extract Conveying Car Initial and Number from Shipment Data
WHEN
The conveying car initial is not empty in the shipment data
THEN
Extract the conveying car initial and number from the shipment record and assign them to the customs manifest
Context: A shipment has no conveying car initial specified
GIVEN
A shipment has no conveying car initial specified
Applied to: Set Default Conveying Car: Initial='UNKN', Number='00000001'
WHEN
The shipment type is TOFC (Trailer on Flat Car) or COFC (Container on Flat Car)
THEN
Set the conveying car initial to 'UNKN' and the conveying car number to '00000001'
Applied to: Clear Conveying Car Information
WHEN
The shipment type is neither TOFC nor COFC
THEN
Clear the conveying car initial and number fields
Context: A conveying car initial is present in the manifest
GIVEN
A conveying car initial is present in the manifest
Applied to: Validate Conveying Car ID Using GCCCARID Utility
WHEN
The car ID validation is performed using the GCCCARID utility
THEN
The utility validates the car ID format and returns either a validated ID or an error indicator
Context: A conveying car ID has been validated successfully
GIVEN
A conveying car ID has been validated successfully
Applied to: Update Conveying Car with Validated ID
WHEN
The validation utility returns a valid car ID
THEN
Update the conveying car field with the validated car ID
Context: A conveying car ID validation has been attempted
GIVEN
A conveying car ID validation has been attempted
Applied to: Generate Invalid Conveying Car Error Message
WHEN
The validation utility indicates the car ID is invalid
THEN
Generate an error message for invalid conveying car and add it to the message collection
R-GCX122A-cbl-00136 (+9) File: GCX122A.cbl Retrieve Error Message Text Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Error Message Text':
  • Context - an error processing request is being handled:
    For Message Number Available?:
    When the system checks for availability of a custom message number in gcw122-msg-num field, then if custom message number exists and is not spaces, use it for lookup, otherwise use the first 3 characters of the ted free-form message as the error code.
  • Context - a custom message number exists in gcw122-msg-num field:
    For Use Custom Message Number:
    When the system builds the lookup key for message table query, then concatenate 'b' prefix with the custom message number to form the sequence id for table lookup.
  • Context - no custom message number exists in gcw122-msg-num field:
    For Use Standard Error Code from TED Message:
    When the system builds the lookup key for message table query, then concatenate 'b' prefix with the first 3 characters of ted-02-free-form-msg to form the sequence id for table lookup.
  • Context - a lookup key has been constructed with table id 'ms' and sequence id:
    For Lookup Message in MS Table:
    When the system performs a table segment retrieval using function code 'gu', then query the ms table using the constructed key and return the table segment or error flag.
  • Context - a message table lookup has been performed:
    For Message Found in Table?:
    When the system checks the return flag from the table lookup operation, then if return flag equals 0, message was found in table, otherwise message was not found and raw error text should be used.
  • Context - message lookup was successful and table segment is available:
    For Retrieve Standardized English Text:
    When the system processes the retrieved ms table segment, then set message found flag to true, move table segment to ms segment structure, and extract english text to working storage.
  • Context - message table lookup failed to find standardized text:
    For Use Raw Error Message from TED:
    When the system needs to provide error message text, then set message not found flag to true and use ted-02-free-form-msg as the error message text.
  • Context - message text has been determined from either table lookup or raw ted message:
    For Format Message for Display:
    When the system prepares the message for display, then add the message text to both emi text line array and mst entry array at current index positions, and increment the text and mst index counters.
  • Context - message text has been formatted for display:
    For Prepare Message for Transaction Log:
    When the system prepares the message for transaction logging, then set security byte to high-value, populate sending transaction as 'gct1221e', set acf2 user id, date, time, action code as 'zzz', and reference number, then determine record type based on cargo or train classification.
  • Context - message was not found in the ms table during lookup:
    For Add Secondary Error Message:
    When the system processes the unfound message scenario, then add a secondary message 'error message not found on table :' with the error number, format it for display and logging, and increment message counters.
👨‍💻 Technical ACs (Gherkin)
Context: An error processing request is being handled
GIVEN
An error processing request is being handled
Applied to: Message Number Available?
WHEN
The system checks for availability of a custom message number in GCW122-MSG-NUM field
THEN
If custom message number exists and is not spaces, use it for lookup, otherwise use the first 3 characters of the TED free-form message as the error code
Context: A custom message number exists in GCW122-MSG-NUM field
GIVEN
A custom message number exists in GCW122-MSG-NUM field
Applied to: Use Custom Message Number
WHEN
The system builds the lookup key for message table query
THEN
Concatenate 'B' prefix with the custom message number to form the sequence ID for table lookup
Context: No custom message number exists in GCW122-MSG-NUM field
GIVEN
No custom message number exists in GCW122-MSG-NUM field
Applied to: Use Standard Error Code from TED Message
WHEN
The system builds the lookup key for message table query
THEN
Concatenate 'B' prefix with the first 3 characters of TED-02-FREE-FORM-MSG to form the sequence ID for table lookup
Context: A lookup key has been constructed with table ID 'MS' and sequence ID
GIVEN
A lookup key has been constructed with table ID 'MS' and sequence ID
Applied to: Lookup Message in MS Table
WHEN
The system performs a table segment retrieval using function code 'GU'
THEN
Query the MS table using the constructed key and return the table segment or error flag
Context: A message table lookup has been performed
GIVEN
A message table lookup has been performed
Applied to: Message Found in Table?
WHEN
The system checks the return flag from the table lookup operation
THEN
If return flag equals 0, message was found in table, otherwise message was not found and raw error text should be used
Context: Message lookup was successful and table segment is available
GIVEN
Message lookup was successful and table segment is available
Applied to: Retrieve Standardized English Text
WHEN
The system processes the retrieved MS table segment
THEN
Set message found flag to true, move table segment to MS segment structure, and extract English text to working storage
Context: Message table lookup failed to find standardized text
GIVEN
Message table lookup failed to find standardized text
Applied to: Use Raw Error Message from TED
WHEN
The system needs to provide error message text
THEN
Set message not found flag to true and use TED-02-FREE-FORM-MSG as the error message text
Context: Message text has been determined from either table lookup or raw TED message
GIVEN
Message text has been determined from either table lookup or raw TED message
Applied to: Format Message for Display
WHEN
The system prepares the message for display
THEN
Add the message text to both EMI text line array and MST entry array at current index positions, and increment the text and MST index counters
Context: Message text has been formatted for display
GIVEN
Message text has been formatted for display
Applied to: Prepare Message for Transaction Log
WHEN
The system prepares the message for transaction logging
THEN
Set security byte to high-value, populate sending transaction as 'GCT1221E', set ACF2 user ID, date, time, action code as 'ZZZ', and reference number, then determine record type based on cargo or train classification
Context: Message was not found in the MS table during lookup
GIVEN
Message was not found in the MS table during lookup
Applied to: Add Secondary Error Message
WHEN
The system processes the unfound message scenario
THEN
Add a secondary message 'ERROR MESSAGE NOT FOUND ON TABLE :' with the error number, format it for display and logging, and increment message counters
R-GCCS309C-cbl-00138 (+15) File: GCCS309C.cbl M11 Segment Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M11 Segment Processing':
  • Context - the system needs to create an m11 segment for bill of lading information:
    For Initialize M11 segment structure:
    When m11 segment processing begins, then the m11 segment structure should be initialized to clear any previous data.
  • Context - an m11 segment is being created for bill of lading information:
    For Set segment identifier to 'M11':
    When the segment identifier needs to be set, then the segment identifier should be set to 'm11'.
  • Context - a manifest has a ccn key identifier:
    For Set BOL/Waybill number from CCN key:
    When creating the m11 segment for bill of lading information, then the ccn key should be assigned as the bol/waybill number.
  • Context - a manifest has an originating station name:
    For Set location ID from manifest from-station name:
    When creating the m11 segment location information, then the manifest from-station name should be assigned as the location identifier.
  • Context - a manifest contains lading quantity information:
    For Set lading quantity from manifest data:
    When creating the m11 segment quantity information, then the manifest lading quantity should be assigned to the m11 segment.
  • Context - a manifest has a lading quantity qualifier:
    For Set manifest unit code from quantity qualifier:
    When creating the m11 segment unit information, then the lading quantity qualifier should be assigned as the manifest unit code.
  • Context - a manifest contains weight information:
    For Set weight from manifest data:
    When creating the m11 segment weight information, then the manifest weight should be assigned to the m11 segment.
  • Context - a manifest has a weight unit qualifier:
    For Weight unit is KG?:
    When the weight unit qualifier is 'kg ' or ' kg', then the weight unit code should be set to 'k' for kilograms, otherwise set to 'l' for pounds.
  • Context - a manifest has a consolidated indicator:
    For Shipment is consolidated?:
    When the consolidated indicator is 'y', then the bol type code should be set to 'y', otherwise it should be left as spaces.
  • Context - a manifest has an origin station name:
    For Set place of receipt from origin station name:
    When creating the m11 segment place of receipt information, then the origin station name should be assigned as the place of receipt.
  • Context - an m11 segment requires a scac code:
    For Set SCAC code to 'CPRS':
    When setting the primary scac code, then the scac code should be set to 'cprs'.
  • Context - an m11 segment has additional scac fields:
    For Clear additional SCAC fields:
    When processing the m11 segment, then the additional scac fields should be set to spaces.
  • Context - an m11 segment is being prepared for transmission:
    For Add sequence number:
    When the segment needs a sequence number, then the sequence number should be incremented by 1 and assigned to the segment.
  • Context - an m11 segment contains underscore characters:
    For Replace underscores with spaces in segment:
    When preparing the segment for transmission, then all underscore characters should be replaced with spaces.
  • Context - a formatted m11 segment is ready for transmission:
    For Store M11 segment in transmission data:
    When storing the segment data, then the m11 segment should be moved to the transmission data field.
  • Context - an m11 segment is stored in transmission data with a sequence number:
    For Create transmission department record:
    When the segment is ready for transmission, then a transmission department record should be created through the c200-create-trans-dept procedure.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to create an M11 segment for bill of lading information
GIVEN
The system needs to create an M11 segment for bill of lading information
Applied to: Initialize M11 segment structure
WHEN
M11 segment processing begins
THEN
The M11 segment structure should be initialized to clear any previous data
Context: An M11 segment is being created for bill of lading information
GIVEN
An M11 segment is being created for bill of lading information
Applied to: Set segment identifier to 'M11'
WHEN
The segment identifier needs to be set
THEN
The segment identifier should be set to 'M11'
Context: A manifest has a CCN key identifier
GIVEN
A manifest has a CCN key identifier
Applied to: Set BOL/Waybill number from CCN key
WHEN
Creating the M11 segment for bill of lading information
THEN
The CCN key should be assigned as the BOL/Waybill number
Context: A manifest has an originating station name
GIVEN
A manifest has an originating station name
Applied to: Set location ID from manifest from-station name
WHEN
Creating the M11 segment location information
THEN
The manifest from-station name should be assigned as the location identifier
Context: A manifest contains lading quantity information
GIVEN
A manifest contains lading quantity information
Applied to: Set lading quantity from manifest data
WHEN
Creating the M11 segment quantity information
THEN
The manifest lading quantity should be assigned to the M11 segment
Context: A manifest has a lading quantity qualifier
GIVEN
A manifest has a lading quantity qualifier
Applied to: Set manifest unit code from quantity qualifier
WHEN
Creating the M11 segment unit information
THEN
The lading quantity qualifier should be assigned as the manifest unit code
Context: A manifest contains weight information
GIVEN
A manifest contains weight information
Applied to: Set weight from manifest data
WHEN
Creating the M11 segment weight information
THEN
The manifest weight should be assigned to the M11 segment
Context: A manifest has a weight unit qualifier
GIVEN
A manifest has a weight unit qualifier
Applied to: Weight unit is KG?
WHEN
The weight unit qualifier is 'KG ' or ' KG'
THEN
The weight unit code should be set to 'K' for kilograms, otherwise set to 'L' for pounds
Context: A manifest has a consolidated indicator
GIVEN
A manifest has a consolidated indicator
Applied to: Shipment is consolidated?
WHEN
The consolidated indicator is 'Y'
THEN
The BOL type code should be set to 'Y', otherwise it should be left as spaces
Context: A manifest has an origin station name
GIVEN
A manifest has an origin station name
Applied to: Set place of receipt from origin station name
WHEN
Creating the M11 segment place of receipt information
THEN
The origin station name should be assigned as the place of receipt
Context: An M11 segment requires a SCAC code
GIVEN
An M11 segment requires a SCAC code
Applied to: Set SCAC code to 'CPRS'
WHEN
Setting the primary SCAC code
THEN
The SCAC code should be set to 'CPRS'
Context: An M11 segment has additional SCAC fields
GIVEN
An M11 segment has additional SCAC fields
Applied to: Clear additional SCAC fields
WHEN
Processing the M11 segment
THEN
The additional SCAC fields should be set to spaces
Context: An M11 segment is being prepared for transmission
GIVEN
An M11 segment is being prepared for transmission
Applied to: Add sequence number
WHEN
The segment needs a sequence number
THEN
The sequence number should be incremented by 1 and assigned to the segment
Context: An M11 segment contains underscore characters
GIVEN
An M11 segment contains underscore characters
Applied to: Replace underscores with spaces in segment
WHEN
Preparing the segment for transmission
THEN
All underscore characters should be replaced with spaces
Context: A formatted M11 segment is ready for transmission
GIVEN
A formatted M11 segment is ready for transmission
Applied to: Store M11 segment in transmission data
WHEN
Storing the segment data
THEN
The M11 segment should be moved to the transmission data field
Context: An M11 segment is stored in transmission data with a sequence number
GIVEN
An M11 segment is stored in transmission data with a sequence number
Applied to: Create transmission department record
WHEN
The segment is ready for transmission
THEN
A transmission department record should be created through the C200-CREATE-TRANS-DEPT procedure
R-GCCCCADD-cbl-00139 (+8) File: GCCCCADD.cbl Equipment Validation Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Equipment Validation':
  • Context - a shipment record exists with conveying car information:
    For Set Conveying Car Details from Shipment:
    When the conveying car initial field is not empty in the shipment data, then the system should set the conveying car initial and number from the shipment record.
  • Context - a shipment has no conveying car initial specified:
    For Set Default Conveying Car Initial: UNKN Number: 00000001:
    When the shipment type is tofc (t) or cofc (c), then the system should set conveying car initial to 'unkn' and conveying car number to '00000001'.
    For Clear Conveying Car Details:
    When the shipment type is not tofc (t) or cofc (c), then the system should clear the conveying car initial and number fields.
  • Context - a conveying car initial and number are specified:
    For Validate Car ID using GCCCARID Utility:
    When the car id validation is performed, then the system should call the gcccarid utility to validate the car format and return a validated car id or error indicator.
  • Context - a car id has been submitted for validation:
    For Generate Car ID Validation Error:
    When the car id validation utility returns an invalid result (all asterisks), then the system should generate an error message indicating invalid conveying car and include the original car value in the message.
  • Context - a shipment record contains equipment information:
    For Set Equipment Car Initial from Shipment & Set Equipment Car Number from Shipment:
    When processing equipment details for customs manifest, then the system should set equipment car initial from the shipment car initial field and the system should set equipment car number from the shipment car number field.
  • Context - a shipment record contains load/empty indicator:
    For Set Load/Empty Status from Shipment:
    When processing equipment status for customs manifest, then the system should set the load/empty status from the shipment el field.
  • Context - a shipment record contains waybill information:
    For Set Waybill Number from Shipment:
    When processing waybill details for customs manifest, then the system should set the waybill number from the shipment waybill number field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record exists with conveying car information
GIVEN
A shipment record exists with conveying car information
Applied to: Set Conveying Car Details from Shipment
WHEN
The conveying car initial field is not empty in the shipment data
THEN
The system should set the conveying car initial and number from the shipment record
Context: A shipment has no conveying car initial specified
GIVEN
A shipment has no conveying car initial specified
Applied to: Set Default Conveying Car Initial: UNKN Number: 00000001
WHEN
The shipment type is TOFC (T) or COFC (C)
THEN
The system should set conveying car initial to 'UNKN' and conveying car number to '00000001'
Applied to: Clear Conveying Car Details
WHEN
The shipment type is not TOFC (T) or COFC (C)
THEN
The system should clear the conveying car initial and number fields
Context: A conveying car initial and number are specified
GIVEN
A conveying car initial and number are specified
Applied to: Validate Car ID using GCCCARID Utility
WHEN
The car ID validation is performed
THEN
The system should call the GCCCARID utility to validate the car format and return a validated car ID or error indicator
Context: A car ID has been submitted for validation
GIVEN
A car ID has been submitted for validation
Applied to: Generate Car ID Validation Error
WHEN
The car ID validation utility returns an invalid result (all asterisks)
THEN
The system should generate an error message indicating invalid conveying car and include the original car value in the message
Context: A shipment record contains equipment information
GIVEN
A shipment record contains equipment information
Applied to: Set Equipment Car Initial from Shipment & Set Equipment Car Number from Shipment
WHEN
Processing equipment details for customs manifest
THEN
The system should set equipment car initial from the shipment car initial field AND The system should set equipment car number from the shipment car number field
Context: A shipment record contains load/empty indicator
GIVEN
A shipment record contains load/empty indicator
Applied to: Set Load/Empty Status from Shipment
WHEN
Processing equipment status for customs manifest
THEN
The system should set the load/empty status from the shipment EL field
Context: A shipment record contains waybill information
GIVEN
A shipment record contains waybill information
Applied to: Set Waybill Number from Shipment
WHEN
Processing waybill details for customs manifest
THEN
The system should set the waybill number from the shipment waybill number field
R-GCX122A-cbl-00146 (+8) File: GCX122A.cbl Update Train/Cargo Status Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train/Cargo Status':
  • Context - an error message is being processed for train or cargo:
    For Error Type = 'X' Info?:
    When the error type from the message table is 'x' (informational), then set current status to 'warning' if the original item was a warning, otherwise set to 'info', and exit without database updates.
  • Context - a train report is found and is not deleted or delete-pending:
    For Set Error Resend Flag:
    When processing an error message for the train, then set the security error resend flag to 'y' to indicate the record needs error processing.
  • Context - a train record is being updated with error information:
    For Copy Train Key to Error Fields:
    When the error resend flag has been set, then copy the train key to the security error train field and copy the position date to the security error date field.
    For Error Type = 'R' Reject?:
    When the message table error type is 'r', then set train status to 'reject' and current status to 'reject', otherwise set train status to 'error' and current status to 'error'.
  • Context - train record status and error information have been updated:
    For Update Train Record in Database:
    When all train record modifications are complete, then replace the train record in the database with the updated information.
  • Context - a train record has been updated with new status information:
    For Send AEI Message if Required:
    When the train record has aei send flag set to 'y', then send an aei message containing the train id and current status.
  • Context - a cargo report is found and needs error processing:
    For Set Error/Release Status Index:
    When processing an error message for cargo, then set the error or release status index to 'e' to indicate error processing mode.
  • Context - a cargo record is being updated with error information:
    For Error Type = 'R' Reject?:
    When the message table error type is 'r', then set cargo error status to 'r' and current status to 'reject', otherwise set cargo error status to 'e' and current status to 'error'.
  • Context - cargo record status and error information have been updated:
    For Update Cargo Record in Database:
    When all cargo record modifications are complete, then replace the cargo record in the database with the updated information.
👨‍💻 Technical ACs (Gherkin)
Context: An error message is being processed for train or cargo
GIVEN
An error message is being processed for train or cargo
Applied to: Error Type = 'X' Info?
WHEN
The error type from the message table is 'X' (informational)
THEN
Set current status to 'WARNING' if the original item was a warning, otherwise set to 'INFO', and exit without database updates
Context: A train report is found and is not deleted or delete-pending
GIVEN
A train report is found and is not deleted or delete-pending
Applied to: Set Error Resend Flag
WHEN
Processing an error message for the train
THEN
Set the security error resend flag to 'Y' to indicate the record needs error processing
Context: A train record is being updated with error information
GIVEN
A train record is being updated with error information
Applied to: Copy Train Key to Error Fields
WHEN
The error resend flag has been set
THEN
Copy the train key to the security error train field and copy the position date to the security error date field
Applied to: Error Type = 'R' Reject?
WHEN
The message table error type is 'R'
THEN
Set train status to 'REJECT' and current status to 'REJECT', otherwise set train status to 'ERROR' and current status to 'ERROR'
Context: Train record status and error information have been updated
GIVEN
Train record status and error information have been updated
Applied to: Update Train Record in Database
WHEN
All train record modifications are complete
THEN
Replace the train record in the database with the updated information
Context: A train record has been updated with new status information
GIVEN
A train record has been updated with new status information
Applied to: Send AEI Message if Required
WHEN
The train record has AEI send flag set to 'Y'
THEN
Send an AEI message containing the train ID and current status
Context: A cargo report is found and needs error processing
GIVEN
A cargo report is found and needs error processing
Applied to: Set Error/Release Status Index
WHEN
Processing an error message for cargo
THEN
Set the error or release status index to 'E' to indicate error processing mode
Context: A cargo record is being updated with error information
GIVEN
A cargo record is being updated with error information
Applied to: Error Type = 'R' Reject?
WHEN
The message table error type is 'R'
THEN
Set cargo error status to 'R' and current status to 'REJECT', otherwise set cargo error status to 'E' and current status to 'ERROR'
Context: Cargo record status and error information have been updated
GIVEN
Cargo record status and error information have been updated
Applied to: Update Cargo Record in Database
WHEN
All cargo record modifications are complete
THEN
Replace the cargo record in the database with the updated information
R-GCCCBOL-cbl-00147 (+9) File: GCCCBOL.cbl Find Multi Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Find Multi':
  • Context - a multi-bill shipment requires ccn processing:
    For Get First EBSBCCR Record:
    When the system starts the ccn retrieval process, then the system retrieves the first ebsbccr record and initializes sequence counter to 0.
  • Context - the system attempts to retrieve ebsbccr record for ccn processing:
    For EBSBCCR Record Found?:
    When the ebsbccr record retrieval is executed, then if ebsbccr record is found, continue with ccn index initialization, otherwise terminate ccn processing.
  • Context - ebsbccr record is successfully found:
    For Initialize CCN Index to 1:
    When ccn processing begins, then the ccn array index is set to 1 and ebsbccx indicator is cleared.
  • Context - ccn processing is active with valid ccn index:
    For Get EBSBCCX Segment with Type 'RF':
    When the system searches for ebsbccx segments, then the system retrieves ebsbccx segment with type 'rf' using current sequence number.
  • Context - the system attempts to retrieve ebsbccx segment with type 'rf':
    For EBSBCCX Segment Found?:
    When ebsbccx segment retrieval is executed or sequence reaches 99, then if ebsbccx segment is not found or sequence equals 99, terminate processing, otherwise continue with ebsbccy processing.
  • Context - valid ebsbccx segment with type 'rf' is found:
    For Initialize EBSBCCY Processing:
    When ebsbccy processing begins, then the system clears ebsbccy indicator and segment data, sets type to 'cr' and initializes sequence to 0.
  • Context - ebsbccy processing is initialized with type 'cr':
    For Search for EBSBCCY Segment:
    When the system searches for ebsbccy segments until sequence reaches 99 or segment is not found or xc qualifier is found, then the system increments sequence and retrieves ebsbccy segment until termination condition is met.
  • Context - ebsbccy segment search is completed:
    For Found EBSBCCY with Qualifier 'XC'?:
    When the system checks the segment qualification, then if ebsbccy segment is not found or qualifier is not 'xc', skip to next ebsbccx segment, otherwise proceed with ccn comparison.
  • Context - ebsbccy segment with 'xc' qualifier is found:
    For CCN Different from Current?:
    When the system compares the ccn reference number with current cargo control number, then if ccn equals current cargo control number, skip storage and continue to next segment, otherwise store the ccn.
  • Context - ccn is different from current cargo control number:
    For Store CCN in Array:
    When the system stores the ccn, then the ccn reference number is moved to ccn array at current index position and index is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: A multi-bill shipment requires CCN processing
GIVEN
A multi-bill shipment requires CCN processing
Applied to: Get First EBSBCCR Record
WHEN
The system starts the CCN retrieval process
THEN
The system retrieves the first EBSBCCR record and initializes sequence counter to 0
Context: The system attempts to retrieve EBSBCCR record for CCN processing
GIVEN
The system attempts to retrieve EBSBCCR record for CCN processing
Applied to: EBSBCCR Record Found?
WHEN
The EBSBCCR record retrieval is executed
THEN
If EBSBCCR record is found, continue with CCN index initialization, otherwise terminate CCN processing
Context: EBSBCCR record is successfully found
GIVEN
EBSBCCR record is successfully found
Applied to: Initialize CCN Index to 1
WHEN
CCN processing begins
THEN
The CCN array index is set to 1 and EBSBCCX indicator is cleared
Context: CCN processing is active with valid CCN index
GIVEN
CCN processing is active with valid CCN index
Applied to: Get EBSBCCX Segment with Type 'RF'
WHEN
The system searches for EBSBCCX segments
THEN
The system retrieves EBSBCCX segment with type 'RF' using current sequence number
Context: The system attempts to retrieve EBSBCCX segment with type 'RF'
GIVEN
The system attempts to retrieve EBSBCCX segment with type 'RF'
Applied to: EBSBCCX Segment Found?
WHEN
EBSBCCX segment retrieval is executed or sequence reaches 99
THEN
If EBSBCCX segment is not found or sequence equals 99, terminate processing, otherwise continue with EBSBCCY processing
Context: Valid EBSBCCX segment with type 'RF' is found
GIVEN
Valid EBSBCCX segment with type 'RF' is found
Applied to: Initialize EBSBCCY Processing
WHEN
EBSBCCY processing begins
THEN
The system clears EBSBCCY indicator and segment data, sets type to 'CR' and initializes sequence to 0
Context: EBSBCCY processing is initialized with type 'CR'
GIVEN
EBSBCCY processing is initialized with type 'CR'
Applied to: Search for EBSBCCY Segment
WHEN
The system searches for EBSBCCY segments until sequence reaches 99 or segment is not found or XC qualifier is found
THEN
The system increments sequence and retrieves EBSBCCY segment until termination condition is met
Context: EBSBCCY segment search is completed
GIVEN
EBSBCCY segment search is completed
Applied to: Found EBSBCCY with Qualifier 'XC'?
WHEN
The system checks the segment qualification
THEN
If EBSBCCY segment is not found or qualifier is not 'XC', skip to next EBSBCCX segment, otherwise proceed with CCN comparison
Context: EBSBCCY segment with 'XC' qualifier is found
GIVEN
EBSBCCY segment with 'XC' qualifier is found
Applied to: CCN Different from Current?
WHEN
The system compares the CCN reference number with current cargo control number
THEN
If CCN equals current cargo control number, skip storage and continue to next segment, otherwise store the CCN
Context: CCN is different from current cargo control number
GIVEN
CCN is different from current cargo control number
Applied to: Store CCN in Array
WHEN
The system stores the CCN
THEN
The CCN reference number is moved to CCN array at current index position and index is incremented by 1
R-GCCCCADD-cbl-00148 (+1) File: GCCCCADD.cbl Previous Carrier Control Processing Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Previous Carrier Control Processing':
  • Context - a shipment record with previous carrier number field:
    For Previous Carrier Number is '0000' or Spaces?:
    When the previous carrier number is '0000' or contains only spaces, then the system continues processing without setting any previous carrier control number data.
  • Context - a shipment record with a valid previous carrier number that is not '0000' or spaces:
    For Build Previous CCN - First 4 Characters:
    When the system processes the previous carrier information, then the system moves the previous carrier number to positions 1-4 of the previous ccn field and moves the previous cargo control number to positions 5-21 of the previous ccn field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with previous carrier number field
GIVEN
A shipment record with previous carrier number field
Applied to: Previous Carrier Number is '0000' or Spaces?
WHEN
The previous carrier number is '0000' or contains only spaces
THEN
The system continues processing without setting any previous carrier control number data
Context: A shipment record with a valid previous carrier number that is not '0000' or spaces
GIVEN
A shipment record with a valid previous carrier number that is not '0000' or spaces
Applied to: Build Previous CCN - First 4 Characters
WHEN
The system processes the previous carrier information
THEN
The system moves the previous carrier number to positions 1-4 of the previous CCN field and moves the previous cargo control number to positions 5-21 of the previous CCN field
R-GCCCCADD-cbl-00150 (+12) File: GCCCCADD.cbl Weight and Quantity Roll Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Weight and Quantity Roll':
  • Context - a waybill key is provided for processing:
    For Check for Valid EDI BOL Data:
    When the system checks for valid edi bol data by verifying the origin road number is not zero and retrieving the first shipmin segment with type 'e' and sequence '1', then the system sets the edi bol availability flag to valid if data is found, otherwise sets it to invalid, and extracts the edi bol key from the data line for subsequent processing.
  • Context - the system is ready to process commodity weight and quantity data:
    For Initialize Weight and Quantity Counters to Zero:
    When weight and quantity roll-up processing begins, then the system initializes commodity weight counter to zero and number of units counter to zero.
  • Context - valid edi bol data is available:
    For Process Each Commodity Segment from EDI BOL:
    When the system processes commodity segments starting from sequence 1 and continuing until no more segments are found or sequence exceeds 98, then the system retrieves each ebsbccm commodity segment using the edi bol key and commodity sequence number.
  • Context - a commodity segment is successfully retrieved from edi bol data:
    For Add Lading Quantity to Total Units:
    When the system processes the commodity segment, then the system adds the l0-lading-qty value to the running total of units.
  • Context - the first commodity segment is being processed:
    For Get EBSBCCR Weight Segment:
    When the system attempts to retrieve the corresponding ebsbccr weight segment with type 'cr' and dependent key 'cr001', then if the weight segment is found, the system extracts the n7-weight value, otherwise sets the weight to zero.
    For Set Quantity Qualifier from Lading Data:
    When the system extracts quantity information from the segment, then the system sets the lading quantity qualifier to the l0-lading-qty-qual value from the commodity segment.
  • Context - weight information has been extracted from the commodity data:
    For Determine Weight Unit Based on Metric Indicator:
    When the system checks the metric indicator from the shipment root data, then if the metric indicator is 'm' or 'l', the system sets the weight unit to kilograms, otherwise sets it to pounds.
  • Context - edi bol processing has completed with both weight and quantity totaling zero:
    For Fall Back to Fastway SHIPCOMM Data:
    When the system needs to obtain weight and quantity information, then the system switches to processing fastway shipcomm segments starting with the first segment using 'gu' function.
  • Context - the system is falling back to fastway data processing:
    For Get First SHIPCOMM Segment:
    When shipcomm segments are available, then the system adds num-units from shipcomm to the total units, sets quantity qualifier to 'pcs', and adds weight based on metric indicator (met-cmod-wgt for metric, cmod-wgt for standard).
  • Context - the first shipcomm segment has been processed successfully:
    For Get Next SHIPCOMM Segments:
    When additional shipcomm segments are available, then the system continues processing each subsequent segment using 'gn' function, accumulating units and weight until no more segments are found.
  • Context - weight and quantity processing has completed:
    For Set Default Quantity to 1:
    When the total number of units is zero or less, then the system sets the number of units to 1 and uses this value for the lading quantity.
  • Context - weight processing has completed:
    For Set Default Weight to 1:
    When the calculated weight is zero or less, then the system sets the weight to '00000001'.
  • Context - quantity processing has completed:
    For Set Default Qualifier to PCS:
    When the lading quantity qualifier is empty or spaces, then the system sets the lading quantity qualifier to 'pcs' (pieces).
👨‍💻 Technical ACs (Gherkin)
Context: A waybill key is provided for processing
GIVEN
A waybill key is provided for processing
Applied to: Check for Valid EDI BOL Data
WHEN
The system checks for valid EDI BOL data by verifying the origin road number is not zero and retrieving the first SHIPMIN segment with type 'E' and sequence '1'
THEN
The system sets the EDI BOL availability flag to valid if data is found, otherwise sets it to invalid, and extracts the EDI BOL key from the data line for subsequent processing
Context: The system is ready to process commodity weight and quantity data
GIVEN
The system is ready to process commodity weight and quantity data
Applied to: Initialize Weight and Quantity Counters to Zero
WHEN
Weight and quantity roll-up processing begins
THEN
The system initializes commodity weight counter to zero and number of units counter to zero
Context: Valid EDI BOL data is available
GIVEN
Valid EDI BOL data is available
Applied to: Process Each Commodity Segment from EDI BOL
WHEN
The system processes commodity segments starting from sequence 1 and continuing until no more segments are found or sequence exceeds 98
THEN
The system retrieves each EBSBCCM commodity segment using the EDI BOL key and commodity sequence number
Context: A commodity segment is successfully retrieved from EDI BOL data
GIVEN
A commodity segment is successfully retrieved from EDI BOL data
Applied to: Add Lading Quantity to Total Units
WHEN
The system processes the commodity segment
THEN
The system adds the L0-LADING-QTY value to the running total of units
Context: The first commodity segment is being processed
GIVEN
The first commodity segment is being processed
Applied to: Get EBSBCCR Weight Segment
WHEN
The system attempts to retrieve the corresponding EBSBCCR weight segment with type 'CR' and dependent key 'CR001'
THEN
If the weight segment is found, the system extracts the N7-WEIGHT value, otherwise sets the weight to zero
Applied to: Set Quantity Qualifier from Lading Data
WHEN
The system extracts quantity information from the segment
THEN
The system sets the lading quantity qualifier to the L0-LADING-QTY-QUAL value from the commodity segment
Context: Weight information has been extracted from the commodity data
GIVEN
Weight information has been extracted from the commodity data
Applied to: Determine Weight Unit Based on Metric Indicator
WHEN
The system checks the metric indicator from the shipment root data
THEN
If the metric indicator is 'M' or 'L', the system sets the weight unit to kilograms, otherwise sets it to pounds
Context: EDI BOL processing has completed with both weight and quantity totaling zero
GIVEN
EDI BOL processing has completed with both weight and quantity totaling zero
Applied to: Fall Back to Fastway SHIPCOMM Data
WHEN
The system needs to obtain weight and quantity information
THEN
The system switches to processing Fastway SHIPCOMM segments starting with the first segment using 'GU' function
Context: The system is falling back to Fastway data processing
GIVEN
The system is falling back to Fastway data processing
Applied to: Get First SHIPCOMM Segment
WHEN
SHIPCOMM segments are available
THEN
The system adds NUM-UNITS from SHIPCOMM to the total units, sets quantity qualifier to 'PCS', and adds weight based on metric indicator (MET-CMOD-WGT for metric, CMOD-WGT for standard)
Context: The first SHIPCOMM segment has been processed successfully
GIVEN
The first SHIPCOMM segment has been processed successfully
Applied to: Get Next SHIPCOMM Segments
WHEN
Additional SHIPCOMM segments are available
THEN
The system continues processing each subsequent segment using 'GN' function, accumulating units and weight until no more segments are found
Context: Weight and quantity processing has completed
GIVEN
Weight and quantity processing has completed
Applied to: Set Default Quantity to 1
WHEN
The total number of units is zero or less
THEN
The system sets the number of units to 1 and uses this value for the lading quantity
Context: Weight processing has completed
GIVEN
Weight processing has completed
Applied to: Set Default Weight to 1
WHEN
The calculated weight is zero or less
THEN
The system sets the weight to '00000001'
Context: Quantity processing has completed
GIVEN
Quantity processing has completed
Applied to: Set Default Qualifier to PCS
WHEN
The lading quantity qualifier is empty or spaces
THEN
The system sets the lading quantity qualifier to 'PCS' (pieces)
R-GCCS309C-cbl-00154 (+7) File: GCCS309C.cbl N9 Reference Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N9 Reference Processing':
  • Context - a manifest is being processed for n9 reference segments:
    For Destination Type Check:
    When the destination type is 309-destination-5040, then skip eta and csa indicator n9 segment creation and proceed directly to previous ccn processing.
    For Previous CCN Exists?:
    When previous ccn (gccc-prev-ccn) is not spaces, then create n9 segment with identifier 'n9', reference qualifier 'xp', and previous ccn as reference number.
  • Context - a manifest is being processed and destination type is not 309-destination-5040:
    For Create ETA Reference N9 Segment:
    When processing n9 reference segments, then create n9 segment with identifier 'n9', reference qualifier '76', reference number 'etd', and border arrival eta date.
  • Context - a manifest is being processed for csa indicator n9 segment and destination type is not 309-destination-5040:
    For CSA Indicator Status:
    When the csa indicator is on (gccc-csa-ind-on is true), then set n9 reference number to '01', otherwise set to '00'.
  • Context - a manifest has in-transit status 'l' and destination type is not 309-destination-5040:
    For Access Export Destination Table:
    When processing in-transit status validation, then access table with function code 'gu', table id 'ex', and destination station number as sequence id.
  • Context - a manifest is being processed for in-transit status and destination type is not 309-destination-5040:
    For Transit Status Validation:
    When in-transit status is 't', or (status is 'l' and origin country is not 'ca' and table lookup is successful), or (status is 'e' and origin country is not 'ca'), then create n9 segment with identifier 'n9', reference qualifier 'kd', and reference number 'in-transit'.
  • Context - a manifest has additional previous ccns stored in array gccc-prev-add-ccns:
    For Loop Through Additional Previous CCNs:
    When processing additional previous ccns from index 1 to 4, then for each non-space ccn, create n9 segment with same reference qualifier 'xp' and the ccn as reference number.
  • Context - a manifest has stored n9 reference data in arrays gccc-n901-ref-num-qual and gccc-n902-ref-num:
    For Loop Through Stored N9 References:
    When processing stored references from index 1 to 10 and reference qualifier is not spaces, high-values, or low-values, then create n9 segment with identifier 'n9', stored reference qualifier, and stored reference number.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for N9 reference segments
GIVEN
A manifest is being processed for N9 reference segments
Applied to: Destination Type Check
WHEN
The destination type is 309-DESTINATION-5040
THEN
Skip ETA and CSA indicator N9 segment creation and proceed directly to previous CCN processing
Applied to: Previous CCN Exists?
WHEN
Previous CCN (GCCC-PREV-CCN) is not spaces
THEN
Create N9 segment with identifier 'N9', reference qualifier 'XP', and previous CCN as reference number
Context: A manifest is being processed and destination type is not 309-DESTINATION-5040
GIVEN
A manifest is being processed and destination type is not 309-DESTINATION-5040
Applied to: Create ETA Reference N9 Segment
WHEN
Processing N9 reference segments
THEN
Create N9 segment with identifier 'N9', reference qualifier '76', reference number 'ETD', and border arrival ETA date
Context: A manifest is being processed for CSA indicator N9 segment and destination type is not 309-DESTINATION-5040
GIVEN
A manifest is being processed for CSA indicator N9 segment and destination type is not 309-DESTINATION-5040
Applied to: CSA Indicator Status
WHEN
The CSA indicator is on (GCCC-CSA-IND-ON is true)
THEN
Set N9 reference number to '01', otherwise set to '00'
Context: A manifest has in-transit status 'L' and destination type is not 309-DESTINATION-5040
GIVEN
A manifest has in-transit status 'L' and destination type is not 309-DESTINATION-5040
Applied to: Access Export Destination Table
WHEN
Processing in-transit status validation
THEN
Access table with function code 'GU', table ID 'EX', and destination station number as sequence ID
Context: A manifest is being processed for in-transit status and destination type is not 309-DESTINATION-5040
GIVEN
A manifest is being processed for in-transit status and destination type is not 309-DESTINATION-5040
Applied to: Transit Status Validation
WHEN
In-transit status is 'T', or (status is 'L' and origin country is not 'CA' and table lookup is successful), or (status is 'E' and origin country is not 'CA')
THEN
Create N9 segment with identifier 'N9', reference qualifier 'KD', and reference number 'IN-TRANSIT'
Context: A manifest has additional previous CCNs stored in array GCCC-PREV-ADD-CCNS
GIVEN
A manifest has additional previous CCNs stored in array GCCC-PREV-ADD-CCNS
Applied to: Loop Through Additional Previous CCNs
WHEN
Processing additional previous CCNs from index 1 to 4
THEN
For each non-space CCN, create N9 segment with same reference qualifier 'XP' and the CCN as reference number
Context: A manifest has stored N9 reference data in arrays GCCC-N901-REF-NUM-QUAL and GCCC-N902-REF-NUM
GIVEN
A manifest has stored N9 reference data in arrays GCCC-N901-REF-NUM-QUAL and GCCC-N902-REF-NUM
Applied to: Loop Through Stored N9 References
WHEN
Processing stored references from index 1 to 10 and reference qualifier is not spaces, high-values, or low-values
THEN
Create N9 segment with identifier 'N9', stored reference qualifier, and stored reference number
R-GCX122A-cbl-00155 (+7) File: GCX122A.cbl Handle Test Messages Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Test Messages':
  • Context - an error message is received with a reference number:
    For Identify as Test Train Message 6105ETESTTRAIN00000000000:
    When the reference number equals '6105etesttrain00000000000', then the message is identified as a train test message and test train indicator is set.
    For Identify as Test Cargo Message 6105ECPRSTESTCARGO or 6105ETESTCARGO:
    When the reference number starts with '6105ecprstestcargo' or starts with '6105etestcargo', then the message is identified as a cargo test message and test cargo indicator is set.
  • Context - a test message has been identified (train or cargo):
    For Retrieve T2 Test Table Entry:
    When the system needs to update test acknowledgment timestamps, then the t2 test table entry is retrieved using table lookup function.
  • Context - a request to retrieve t2 test table entry has been made:
    For Table Entry Found?:
    When the table lookup function returns a status indicating entry not found, then an error is reported indicating test table entry is missing.
  • Context - a train test message is being processed and t2 table entry exists:
    For Update Train Test ACK Date/Time T2-358-ACK:
    When the message type is identified as train test, then the current machine date and time are stored in t2-358-ack field with century, date, and time components.
  • Context - a cargo test message is being processed and t2 table entry exists:
    For Update Cargo Test ACK Date/Time T2-309-ACK:
    When the message type is identified as cargo test, then the current machine date and time are stored in t2-309-ack field with century, date, and time components.
  • Context - test acknowledgment timestamps have been updated in memory:
    For Save Updated Test Table:
    When the timestamp updates are complete, then the modified t2 table segment is saved using replace function.
  • Context - a message has been identified as a test message (train or cargo):
    For Skip Normal Error Processing:
    When test message processing is complete, then normal error processing is skipped and control proceeds to transaction logging.
👨‍💻 Technical ACs (Gherkin)
Context: An error message is received with a reference number
GIVEN
An error message is received with a reference number
Applied to: Identify as Test Train Message 6105ETESTTRAIN00000000000
WHEN
The reference number equals '6105ETESTTRAIN00000000000'
THEN
The message is identified as a train test message and test train indicator is set
Applied to: Identify as Test Cargo Message 6105ECPRSTESTCARGO or 6105ETESTCARGO
WHEN
The reference number starts with '6105ECPRSTESTCARGO' or starts with '6105ETESTCARGO'
THEN
The message is identified as a cargo test message and test cargo indicator is set
Context: A test message has been identified (train or cargo)
GIVEN
A test message has been identified (train or cargo)
Applied to: Retrieve T2 Test Table Entry
WHEN
The system needs to update test acknowledgment timestamps
THEN
The T2 test table entry is retrieved using table lookup function
Context: A request to retrieve T2 test table entry has been made
GIVEN
A request to retrieve T2 test table entry has been made
Applied to: Table Entry Found?
WHEN
The table lookup function returns a status indicating entry not found
THEN
An error is reported indicating test table entry is missing
Context: A train test message is being processed and T2 table entry exists
GIVEN
A train test message is being processed and T2 table entry exists
Applied to: Update Train Test ACK Date/Time T2-358-ACK
WHEN
The message type is identified as train test
THEN
The current machine date and time are stored in T2-358-ACK field with century, date, and time components
Context: A cargo test message is being processed and T2 table entry exists
GIVEN
A cargo test message is being processed and T2 table entry exists
Applied to: Update Cargo Test ACK Date/Time T2-309-ACK
WHEN
The message type is identified as cargo test
THEN
The current machine date and time are stored in T2-309-ACK field with century, date, and time components
Context: Test acknowledgment timestamps have been updated in memory
GIVEN
Test acknowledgment timestamps have been updated in memory
Applied to: Save Updated Test Table
WHEN
The timestamp updates are complete
THEN
The modified T2 table segment is saved using replace function
Context: A message has been identified as a test message (train or cargo)
GIVEN
A message has been identified as a test message (train or cargo)
Applied to: Skip Normal Error Processing
WHEN
Test message processing is complete
THEN
Normal error processing is skipped and control proceeds to transaction logging
R-GCCCBOL-cbl-00157 (+11) File: GCCCBOL.cbl Process Multi Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Multi':
  • Context - multi-bill n10 processing is starting:
    For Initialize EBSBCCX and EBSBCCY indicators:
    When the system begins processing multi-bill n10 data, then ebsbccx and ebsbccy processing indicators are cleared to spaces.
  • Context - multi-bill processing is active and a sequence number is provided:
    For Get EBSBCCX segment with type 'RF':
    When the system searches for ebsbccx segments, then the system retrieves segments with type 'rf' using the current sequence number.
  • Context - multi-bill n10 processing is active:
    For Set EBSBCCX not found:
    When the sequence number reaches 99, then the system sets ebsbccx not found indicator to terminate processing.
  • Context - a valid ebsbccx segment is found:
    For Set type to 'CR' and sequence to 0:
    When the system prepares to search for related cargo data, then the system sets type to 'cr', initializes sequence to 0, and clears ebsbccy indicator.
  • Context - cargo reference segment search is initiated:
    For Loop until sequence = 99 or CCN matches or segment not found:
    When the system loops through ebsbccy segments, then the system continues until sequence equals 99 or cargo control number matches current ccn or segment is not found.
  • Context - an ebsbccy segment is retrieved with reference number qualifier 'xc':
    For CCN matches cargo control number:
    When the system compares the reference number with the current cargo control number, then processing continues only if the reference number matches the cargo control number.
  • Context - a matching cargo control number is found:
    For Get QD type EBSBCCY segment with sequence 1:
    When the system searches for quantity description data, then the system retrieves ebsbccy segment with type 'qd' and sequence number 1.
  • Context - a qd type segment is found with n10 quantity data:
    For Extract quantity from N10 quantity field:
    When the system processes the quantity field, then the system extracts numeric characters from right to left, removes leading spaces, replaces them with zeros, and stores the formatted quantity in cargo lading quantity.
  • Context - a valid qd segment with n10 data is processed:
    For Move country code to origin country:
    When the system extracts country information, then the system moves the n10 country code to the cargo origin country field.
  • Context - a qd segment with sequence 1 is processed:
    For Store N10 description in description array:
    When the n10 description field is not empty and not low-values, then the system stores the n10 description in the description array at the current index and increments the index.
  • Context - the first qd segment has been processed:
    For Get QD type EBSBCCY segment with sequence 2:
    When the system searches for additional quantity description data, then the system retrieves ebsbccy segment with type 'qd' and sequence number 2.
  • Context - a second qd segment is found and processed:
    For Store second N10 description in array:
    When the second n10 description field is not empty and not low-values, then the system stores the second n10 description in the description array at the current index and increments the index.
👨‍💻 Technical ACs (Gherkin)
Context: Multi-bill N10 processing is starting
GIVEN
Multi-bill N10 processing is starting
Applied to: Initialize EBSBCCX and EBSBCCY indicators
WHEN
The system begins processing multi-bill N10 data
THEN
EBSBCCX and EBSBCCY processing indicators are cleared to spaces
Context: Multi-bill processing is active and a sequence number is provided
GIVEN
Multi-bill processing is active and a sequence number is provided
Applied to: Get EBSBCCX segment with type 'RF'
WHEN
The system searches for EBSBCCX segments
THEN
The system retrieves segments with type 'RF' using the current sequence number
Context: Multi-bill N10 processing is active
GIVEN
Multi-bill N10 processing is active
Applied to: Set EBSBCCX not found
WHEN
The sequence number reaches 99
THEN
The system sets EBSBCCX not found indicator to terminate processing
Context: A valid EBSBCCX segment is found
GIVEN
A valid EBSBCCX segment is found
Applied to: Set type to 'CR' and sequence to 0
WHEN
The system prepares to search for related cargo data
THEN
The system sets type to 'CR', initializes sequence to 0, and clears EBSBCCY indicator
Context: Cargo reference segment search is initiated
GIVEN
Cargo reference segment search is initiated
Applied to: Loop until sequence = 99 or CCN matches or segment not found
WHEN
The system loops through EBSBCCY segments
THEN
The system continues until sequence equals 99 OR cargo control number matches current CCN OR segment is not found
Context: An EBSBCCY segment is retrieved with reference number qualifier 'XC'
GIVEN
An EBSBCCY segment is retrieved with reference number qualifier 'XC'
Applied to: CCN matches cargo control number
WHEN
The system compares the reference number with the current cargo control number
THEN
Processing continues only if the reference number matches the cargo control number
Context: A matching cargo control number is found
GIVEN
A matching cargo control number is found
Applied to: Get QD type EBSBCCY segment with sequence 1
WHEN
The system searches for quantity description data
THEN
The system retrieves EBSBCCY segment with type 'QD' and sequence number 1
Context: A QD type segment is found with N10 quantity data
GIVEN
A QD type segment is found with N10 quantity data
Applied to: Extract quantity from N10 quantity field
WHEN
The system processes the quantity field
THEN
The system extracts numeric characters from right to left, removes leading spaces, replaces them with zeros, and stores the formatted quantity in cargo lading quantity
Context: A valid QD segment with N10 data is processed
GIVEN
A valid QD segment with N10 data is processed
Applied to: Move country code to origin country
WHEN
The system extracts country information
THEN
The system moves the N10 country code to the cargo origin country field
Context: A QD segment with sequence 1 is processed
GIVEN
A QD segment with sequence 1 is processed
Applied to: Store N10 description in description array
WHEN
The N10 description field is not empty and not low-values
THEN
The system stores the N10 description in the description array at the current index and increments the index
Context: The first QD segment has been processed
GIVEN
The first QD segment has been processed
Applied to: Get QD type EBSBCCY segment with sequence 2
WHEN
The system searches for additional quantity description data
THEN
The system retrieves EBSBCCY segment with type 'QD' and sequence number 2
Context: A second QD segment is found and processed
GIVEN
A second QD segment is found and processed
Applied to: Store second N10 description in array
WHEN
The second N10 description field is not empty and not low-values
THEN
The system stores the second N10 description in the description array at the current index and increments the index
R-GCCS309C-cbl-00162 (+15) File: GCCS309C.cbl N1 Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1':
  • Context - entity records exist in the database with a maximum sequence of gcsccs99-s55-max-seq:
    For Loop through entity records from database:
    When the system processes entity records sequentially from position 1, then the system continues processing until it reaches the maximum sequence number or encounters an empty record (spaces or low-values).
  • Context - an entity record at a specific sequence position:
    For Entity record exists?:
    When the system checks if the entity cargo data is not equal to spaces, then the system proceeds with entity processing if data exists, otherwise skips to the next record.
  • Context - a manifest with customs notification requirements:
    For Destination type check:
    When the system evaluates the destination type, then the system classifies as 4040 destination if 309-destination is true, otherwise as 5040 destination.
  • Context - an entity record with a 4040 destination type:
    For Validate entity code for 4040 destination:
    When the system validates the entity id code (gccs-n101-entity-id-cde) against the valid 4040 n1 code table, then the system proceeds with processing if the code is valid, otherwise skips the entity record.
  • Context - an entity record with a 5040 destination type:
    For Check consignee-importer address mapping:
    When the system processes the entity for consignee-importer address mapping, then the system executes the canadian importer check procedure (n20625-check-cn-importer).
  • Context - an entity record with a 5040 destination type after consignee-importer mapping:
    For Validate entity code for 5040 destination:
    When the system validates the entity id code (gccs-n101-entity-id-cde) against the valid 5040 n1 code table, then the system proceeds with address validation if the code is valid, otherwise skips the entity record.
  • Context - an entity record with valid entity code for 5040 destination:
    For Complete address available?:
    When the system checks address completeness for us or canadian entities, then the system requires city name, country code, postal code (for us/ca), and state/province code (for us/ca) to be present, otherwise the entity is considered incomplete.
  • Context - an entity record with incomplete address information for 5040 destination:
    For Copy consignee address to importer if incomplete:
    When the address validation fails due to missing required components, then the system initializes (clears) the entity record (gcsccs55) to spaces.
  • Context - a validated entity record with complete address information:
    For Create N1 entity segment with ID and name:
    When the system creates the n1 entity segment, then the system populates the n1 segment with identifier 'n1', entity id code, entity name, id code qualifier, and id code from the entity record.
  • Context - an entity record with n1 segment created:
    For N3 address data exists?:
    When the system checks for n3 address data availability, then the system proceeds to create n3 segment if address information (gcsccs55-n3-data) is not spaces, otherwise skips to n4 processing.
  • Context - an entity record with available n3 address data:
    For Create N3 address segment:
    When the system creates the n3 address segment, then the system populates the n3 segment with identifier 'n3', primary address line, and secondary address line from the entity record.
  • Context - an entity record with n1 and optionally n3 segments created:
    For N4 city/state data exists?:
    When the system checks for n4 location data availability, then the system proceeds to create n4 segment if location information (gcsccs55-n4-data) is not spaces, otherwise continues to next entity.
  • Context - an entity record with available n4 location data:
    For Create N4 location segment with city, state, postal code, country:
    When the system creates the n4 location segment, then the system populates city name, postal code, and country code in standard positions, but maps state/province code to position 2 for 309-destination or position 7 for other destinations.
  • Context - all entity records have been processed:
    For Create Canadian Pacific Railway entity:
    When the system creates the railway entity segment, then the system creates an n1 segment with identifier 'n1', entity id code 'rr', and name 'canadian pacific railway'.
  • Context - the canadian pacific railway entity segment has been created:
    For Create CPR address segment:
    When the system creates the cpr address segment, then the system creates an n3 segment with identifier 'n3' and address '7550 ogdendale rd s.e.'.
  • Context - the canadian pacific railway address segment has been created:
    For Create CPR location segment:
    When the system creates the cpr location segment, then the system creates an n4 segment with city 'calgary', country 'ca', postal code 't2c 4x9', and maps province code 'ab' to position 2 for 309-destination or position 7 for other destinations.
👨‍💻 Technical ACs (Gherkin)
Context: Entity records exist in the database with a maximum sequence of GCSCCS99-S55-MAX-SEQ
GIVEN
Entity records exist in the database with a maximum sequence of GCSCCS99-S55-MAX-SEQ
Applied to: Loop through entity records from database
WHEN
The system processes entity records sequentially from position 1
THEN
The system continues processing until it reaches the maximum sequence number or encounters an empty record (spaces or low-values)
Context: An entity record at a specific sequence position
GIVEN
An entity record at a specific sequence position
Applied to: Entity record exists?
WHEN
The system checks if the entity cargo data is not equal to spaces
THEN
The system proceeds with entity processing if data exists, otherwise skips to the next record
Context: A manifest with customs notification requirements
GIVEN
A manifest with customs notification requirements
Applied to: Destination type check
WHEN
The system evaluates the destination type
THEN
The system classifies as 4040 destination if 309-DESTINATION is true, otherwise as 5040 destination
Context: An entity record with a 4040 destination type
GIVEN
An entity record with a 4040 destination type
Applied to: Validate entity code for 4040 destination
WHEN
The system validates the entity ID code (GCCS-N101-ENTITY-ID-CDE) against the valid 4040 N1 code table
THEN
The system proceeds with processing if the code is valid, otherwise skips the entity record
Context: An entity record with a 5040 destination type
GIVEN
An entity record with a 5040 destination type
Applied to: Check consignee-importer address mapping
WHEN
The system processes the entity for consignee-importer address mapping
THEN
The system executes the Canadian importer check procedure (N20625-CHECK-CN-IMPORTER)
Context: An entity record with a 5040 destination type after consignee-importer mapping
GIVEN
An entity record with a 5040 destination type after consignee-importer mapping
Applied to: Validate entity code for 5040 destination
WHEN
The system validates the entity ID code (GCCS-N101-ENTITY-ID-CDE) against the valid 5040 N1 code table
THEN
The system proceeds with address validation if the code is valid, otherwise skips the entity record
Context: An entity record with valid entity code for 5040 destination
GIVEN
An entity record with valid entity code for 5040 destination
Applied to: Complete address available?
WHEN
The system checks address completeness for US or Canadian entities
THEN
The system requires city name, country code, postal code (for US/CA), and state/province code (for US/CA) to be present, otherwise the entity is considered incomplete
Context: An entity record with incomplete address information for 5040 destination
GIVEN
An entity record with incomplete address information for 5040 destination
Applied to: Copy consignee address to importer if incomplete
WHEN
The address validation fails due to missing required components
THEN
The system initializes (clears) the entity record (GCSCCS55) to spaces
Context: A validated entity record with complete address information
GIVEN
A validated entity record with complete address information
Applied to: Create N1 entity segment with ID and name
WHEN
The system creates the N1 entity segment
THEN
The system populates the N1 segment with identifier 'N1', entity ID code, entity name, ID code qualifier, and ID code from the entity record
Context: An entity record with N1 segment created
GIVEN
An entity record with N1 segment created
Applied to: N3 address data exists?
WHEN
The system checks for N3 address data availability
THEN
The system proceeds to create N3 segment if address information (GCSCCS55-N3-DATA) is not spaces, otherwise skips to N4 processing
Context: An entity record with available N3 address data
GIVEN
An entity record with available N3 address data
Applied to: Create N3 address segment
WHEN
The system creates the N3 address segment
THEN
The system populates the N3 segment with identifier 'N3', primary address line, and secondary address line from the entity record
Context: An entity record with N1 and optionally N3 segments created
GIVEN
An entity record with N1 and optionally N3 segments created
Applied to: N4 city/state data exists?
WHEN
The system checks for N4 location data availability
THEN
The system proceeds to create N4 segment if location information (GCSCCS55-N4-DATA) is not spaces, otherwise continues to next entity
Context: An entity record with available N4 location data
GIVEN
An entity record with available N4 location data
Applied to: Create N4 location segment with city, state, postal code, country
WHEN
The system creates the N4 location segment
THEN
The system populates city name, postal code, and country code in standard positions, but maps state/province code to position 2 for 309-DESTINATION or position 7 for other destinations
Context: All entity records have been processed
GIVEN
All entity records have been processed
Applied to: Create Canadian Pacific Railway entity
WHEN
The system creates the railway entity segment
THEN
The system creates an N1 segment with identifier 'N1', entity ID code 'RR', and name 'CANADIAN PACIFIC RAILWAY'
Context: The Canadian Pacific Railway entity segment has been created
GIVEN
The Canadian Pacific Railway entity segment has been created
Applied to: Create CPR address segment
WHEN
The system creates the CPR address segment
THEN
The system creates an N3 segment with identifier 'N3' and address '7550 OGDENDALE RD S.E.'
Context: The Canadian Pacific Railway address segment has been created
GIVEN
The Canadian Pacific Railway address segment has been created
Applied to: Create CPR location segment
WHEN
The system creates the CPR location segment
THEN
The system creates an N4 segment with city 'CALGARY', country 'CA', postal code 'T2C 4X9', and maps province code 'AB' to position 2 for 309-DESTINATION or position 7 for other destinations
R-GCCCCADD-cbl-00163 (+5) File: GCCCCADD.cbl Quantity Qualifier Setting Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Qualifier Setting':
  • Context - equipment load/empty status is available from shipment data:
    For Set Qualifier to 'UNT' for Empty Equipment:
    When equipment load/empty status equals 'e' (empty), then set lading quantity qualifier to 'unt'.
  • Context - equipment is loaded (not empty) and current lading quantity qualifier exists:
    For Set Qualifier to 'PCS' for Loaded Equipment:
    When current qualifier equals 'c/l' or 'cld' or 'cl ' or ' cl', then set lading quantity qualifier to 'pcs'.
  • Context - lading quantity qualifier processing is complete:
    For Set Default Qualifier to 'PCS':
    When lading quantity qualifier is spaces or empty, then set lading quantity qualifier to 'pcs'.
  • Context - a quantity qualifier has been determined and mu table lookup is available:
    For Validate Qualifier Against MU Table:
    When quantity qualifier is validated against mu table, then if qualifier not found in mu table, generate error message for invalid measurement unit.
  • Context - quantity qualifier validation is being performed:
    For Generate Error Message for Invalid Qualifier:
    When quantity qualifier is spaces or empty, then generate error message indicating required quantity qualifier is missing.
  • Context - quantity qualifier needs validation:
    For Validate Qualifier Against MU Table:
    When mu table lookup is invoked with qualifier code, then external gcctbio service validates qualifier against mu table.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment load/empty status is available from shipment data
GIVEN
Equipment load/empty status is available from shipment data
Applied to: Set Qualifier to 'UNT' for Empty Equipment
WHEN
Equipment load/empty status equals 'E' (Empty)
THEN
Set lading quantity qualifier to 'UNT'
Context: Equipment is loaded (not empty) and current lading quantity qualifier exists
GIVEN
Equipment is loaded (not empty) and current lading quantity qualifier exists
Applied to: Set Qualifier to 'PCS' for Loaded Equipment
WHEN
Current qualifier equals 'C/L' or 'CLD' or 'CL ' or ' CL'
THEN
Set lading quantity qualifier to 'PCS'
Context: Lading quantity qualifier processing is complete
GIVEN
Lading quantity qualifier processing is complete
Applied to: Set Default Qualifier to 'PCS'
WHEN
Lading quantity qualifier is spaces or empty
THEN
Set lading quantity qualifier to 'PCS'
Context: A quantity qualifier has been determined and MU table lookup is available
GIVEN
A quantity qualifier has been determined and MU table lookup is available
Applied to: Validate Qualifier Against MU Table
WHEN
Quantity qualifier is validated against MU table
THEN
If qualifier not found in MU table, generate error message for invalid measurement unit
Context: Quantity qualifier validation is being performed
GIVEN
Quantity qualifier validation is being performed
Applied to: Generate Error Message for Invalid Qualifier
WHEN
Quantity qualifier is spaces or empty
THEN
Generate error message indicating required quantity qualifier is missing
Context: Quantity qualifier needs validation
GIVEN
Quantity qualifier needs validation
Applied to: Validate Qualifier Against MU Table
WHEN
MU table lookup is invoked with qualifier code
THEN
External GCCTBIO service validates qualifier against MU table
R-GCX122A-cbl-00163 (+14) File: GCX122A.cbl Send AEI Messages Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send AEI Messages':
  • Context - an aei message process is starting:
    For Clear Message Fields:
    When the system begins aei message preparation, then all message fields including copy usercode, keywords, text, item sequence numbers, and return status flag are cleared to spaces or initialized.
  • Context - a train report exists with port of release information:
    For Get Port Code from Train Report:
    When the system needs to determine email recipients for aei notification, then the port code is extracted from the train report's port of release field and used as the lookup key.
  • Context - a port code has been extracted from the train report:
    For Call Database to Get Email Users for Port:
    When the system calls the database lookup service with the port code, then the database returns email user information for that port code and sets the return code to indicate success or failure.
  • Context - the database lookup for port email users returned successfully:
    For Load Retrieved Email Users as Recipients:
    When the return code indicates success, then the default merlin id is set as the sender and up to 10 retrieved email user ids are loaded as recipients.
  • Context - the database lookup for port email users failed:
    For Set Default Merlin ID as Both Sender and Recipient:
    When the return code indicates failure, then the default merlin id is set as both the sender and the first recipient.
  • Context - email recipients have been determined:
    For Prepare AEI Message Content:
    When the system prepares the aei message content, then message width is set to 080 characters, sequence numbers are cleared, text content is cleared, and return status flag is initialized.
  • Context - a train report has a canadian customs train id and current status:
    For Set Message Subject with Train ID and Status:
    When the system formats the aei message subject, then the subject line is formatted as 'train: [train_id] status: [current_status]'.
  • Context - aei message content and recipients are prepared:
    For Call Email Service to Send Message:
    When the system calls the email service to send the message, then the email service processes the message and returns a status flag indicating success or failure.
  • Context - the email service successfully sent the aei message:
    For AEI Message Sent Successfully:
    When the return status flag indicates successful transmission, then the system continues to message queue purging without further action.
  • Context - the primary aei message send failed:
    For Send to Default Recipients OM01247 and AEI9999:
    When the return status flag indicates transmission failure, then the system clears recipient fields and sets om01247 as first recipient and aei9999 as second recipient.
  • Context - default recipients om01247 and aei9999 have been set:
    For Call Email Service Again:
    When the system retries the email service call, then the email service processes the message to default recipients and returns a status flag.
  • Context - the retry to default recipients was attempted:
    For Second Send Successful:
    When the return status flag indicates successful transmission to defaults, then the system continues to message queue purging.
  • Context - both the primary message send and retry to default recipients failed:
    For Log Error - Send to OM01247 Failed:
    When the return status flag indicates failure for the second attempt, then the system logs an error message 'send to file of om01247 failed' and calls the error handler.
  • Context - aei message processing has completed either successfully or with errors:
    For Purge Message Queue:
    When the system needs to clean up resources, then the message queue is purged and communication status is initialized.
  • Context - a database error occurred during aei message processing:
    For Send DB2 Error Notification to Support:
    When the return code indicates a db2 error condition, then an error notification containing the sql code is sent to the support team and message queue is purged.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI message process is starting
GIVEN
An AEI message process is starting
Applied to: Clear Message Fields
WHEN
The system begins AEI message preparation
THEN
All message fields including copy usercode, keywords, text, item sequence numbers, and return status flag are cleared to spaces or initialized
Context: A train report exists with port of release information
GIVEN
A train report exists with port of release information
Applied to: Get Port Code from Train Report
WHEN
The system needs to determine email recipients for AEI notification
THEN
The port code is extracted from the train report's port of release field and used as the lookup key
Context: A port code has been extracted from the train report
GIVEN
A port code has been extracted from the train report
Applied to: Call Database to Get Email Users for Port
WHEN
The system calls the database lookup service with the port code
THEN
The database returns email user information for that port code and sets the return code to indicate success or failure
Context: The database lookup for port email users returned successfully
GIVEN
The database lookup for port email users returned successfully
Applied to: Load Retrieved Email Users as Recipients
WHEN
The return code indicates success
THEN
The default Merlin ID is set as the sender and up to 10 retrieved email user IDs are loaded as recipients
Context: The database lookup for port email users failed
GIVEN
The database lookup for port email users failed
Applied to: Set Default Merlin ID as Both Sender and Recipient
WHEN
The return code indicates failure
THEN
The default Merlin ID is set as both the sender and the first recipient
Context: Email recipients have been determined
GIVEN
Email recipients have been determined
Applied to: Prepare AEI Message Content
WHEN
The system prepares the AEI message content
THEN
Message width is set to 080 characters, sequence numbers are cleared, text content is cleared, and return status flag is initialized
Context: A train report has a Canadian customs train ID and current status
GIVEN
A train report has a Canadian customs train ID and current status
Applied to: Set Message Subject with Train ID and Status
WHEN
The system formats the AEI message subject
THEN
The subject line is formatted as 'TRAIN: [train_id] STATUS: [current_status]'
Context: AEI message content and recipients are prepared
GIVEN
AEI message content and recipients are prepared
Applied to: Call Email Service to Send Message
WHEN
The system calls the email service to send the message
THEN
The email service processes the message and returns a status flag indicating success or failure
Context: The email service successfully sent the AEI message
GIVEN
The email service successfully sent the AEI message
Applied to: AEI Message Sent Successfully
WHEN
The return status flag indicates successful transmission
THEN
The system continues to message queue purging without further action
Context: The primary AEI message send failed
GIVEN
The primary AEI message send failed
Applied to: Send to Default Recipients OM01247 and AEI9999
WHEN
The return status flag indicates transmission failure
THEN
The system clears recipient fields and sets OM01247 as first recipient and AEI9999 as second recipient
Context: Default recipients OM01247 and AEI9999 have been set
GIVEN
Default recipients OM01247 and AEI9999 have been set
Applied to: Call Email Service Again
WHEN
The system retries the email service call
THEN
The email service processes the message to default recipients and returns a status flag
Context: The retry to default recipients was attempted
GIVEN
The retry to default recipients was attempted
Applied to: Second Send Successful
WHEN
The return status flag indicates successful transmission to defaults
THEN
The system continues to message queue purging
Context: Both the primary message send and retry to default recipients failed
GIVEN
Both the primary message send and retry to default recipients failed
Applied to: Log Error - Send to OM01247 Failed
WHEN
The return status flag indicates failure for the second attempt
THEN
The system logs an error message 'SEND TO FILE OF OM01247 FAILED' and calls the error handler
Context: AEI message processing has completed either successfully or with errors
GIVEN
AEI message processing has completed either successfully or with errors
Applied to: Purge Message Queue
WHEN
The system needs to clean up resources
THEN
The message queue is purged and communication status is initialized
Context: A database error occurred during AEI message processing
GIVEN
A database error occurred during AEI message processing
Applied to: Send DB2 Error Notification to Support
WHEN
The return code indicates a DB2 error condition
THEN
An error notification containing the SQL code is sent to the support team and message queue is purged
R-GCCCBOL-cbl-00169 (+8) File: GCCCBOL.cbl Process Lading Descriptions Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Lading Descriptions':
  • Context - a bol segment sequence number 1 exists in ebsbccm:
    For Get First Lading Description from EBSBCCM:
    When the system processes the first lading description segment, then the primary lading description is extracted and added to the description array if not empty or low-values.
  • Context - a lading description is retrieved from l5-lading-desc field:
    For Lading Description Found?:
    When the description is not equal to spaces and not equal to low-values, then the description is considered valid and added to the description array with index increment.
  • Context - bol segments exist with sequence numbers from 2 to 25:
    For Loop Through Remaining EBSBCCM Segments:
    When the system loops through each segment until no more segments found or maximum reached, then each valid lading description is extracted and processed for additional content.
  • Context - a bol segment contains additional lading description fields:
    For Get Additional BOL Descriptions for Current Segment:
    When the system processes l5-additional-lading-desc array with index from 1 to 7, then each non-empty additional description line is added to the description array.
  • Context - special handling codes exist in fastway system with index from 1 to 7:
    For Extract Special Instructions from Fastway:
    When the special handling code equals 'va' or 'vs' or 'ev' and description index is less than 3, then the special handling code and instruction are formatted and added to special instruction array.
  • Context - automotive shipment data exists in mv or v2/co segments:
    For Retrieve VIN Numbers:
    When the system processes vehicle identification numbers from available segments, then each vin is prefixed with 'vin' text and added to description array up to maximum limit.
  • Context - description data has been collected and is not empty:
    For Compress All Descriptions Using GCCCOMP:
    When the system calls gcccomp program with description arrays and length parameters 45000 and 22500, then the descriptions are compressed and formatted into primary and extra description fields.
  • Context - extra description data exists after compression and first 2 positions are not spaces or low-values:
    For Store Extra Descriptions in GCSCCS53 Using GCCDESC:
    When the system processes extra descriptions beyond primary capacity, then gccdesc program is called to store extra descriptions with cargo control number and insert operation.
  • Context - description processing is complete and primary description is not empty:
    For Move Final Description to Cargo Report:
    When the system finalizes cargo description data, then the compressed primary description is moved to gccc-lading-description field.
👨‍💻 Technical ACs (Gherkin)
Context: A BOL segment sequence number 1 exists in EBSBCCM
GIVEN
A BOL segment sequence number 1 exists in EBSBCCM
Applied to: Get First Lading Description from EBSBCCM
WHEN
The system processes the first lading description segment
THEN
The primary lading description is extracted and added to the description array if not empty or low-values
Context: A lading description is retrieved from L5-LADING-DESC field
GIVEN
A lading description is retrieved from L5-LADING-DESC field
Applied to: Lading Description Found?
WHEN
The description is not equal to spaces and not equal to low-values
THEN
The description is considered valid and added to the description array with index increment
Context: BOL segments exist with sequence numbers from 2 to 25
GIVEN
BOL segments exist with sequence numbers from 2 to 25
Applied to: Loop Through Remaining EBSBCCM Segments
WHEN
The system loops through each segment until no more segments found or maximum reached
THEN
Each valid lading description is extracted and processed for additional content
Context: A BOL segment contains additional lading description fields
GIVEN
A BOL segment contains additional lading description fields
Applied to: Get Additional BOL Descriptions for Current Segment
WHEN
The system processes L5-ADDITIONAL-LADING-DESC array with index from 1 to 7
THEN
Each non-empty additional description line is added to the description array
Context: Special handling codes exist in Fastway system with index from 1 to 7
GIVEN
Special handling codes exist in Fastway system with index from 1 to 7
Applied to: Extract Special Instructions from Fastway
WHEN
The special handling code equals 'VA' or 'VS' or 'EV' and description index is less than 3
THEN
The special handling code and instruction are formatted and added to special instruction array
Context: Automotive shipment data exists in MV or V2/CO segments
GIVEN
Automotive shipment data exists in MV or V2/CO segments
Applied to: Retrieve VIN Numbers
WHEN
The system processes vehicle identification numbers from available segments
THEN
Each VIN is prefixed with 'VIN' text and added to description array up to maximum limit
Context: Description data has been collected and is not empty
GIVEN
Description data has been collected and is not empty
Applied to: Compress All Descriptions Using GCCCOMP
WHEN
The system calls GCCCOMP program with description arrays and length parameters 45000 and 22500
THEN
The descriptions are compressed and formatted into primary and extra description fields
Context: Extra description data exists after compression and first 2 positions are not spaces or low-values
GIVEN
Extra description data exists after compression and first 2 positions are not spaces or low-values
Applied to: Store Extra Descriptions in GCSCCS53 Using GCCDESC
WHEN
The system processes extra descriptions beyond primary capacity
THEN
GCCDESC program is called to store extra descriptions with cargo control number and insert operation
Context: Description processing is complete and primary description is not empty
GIVEN
Description processing is complete and primary description is not empty
Applied to: Move Final Description to Cargo Report
WHEN
The system finalizes cargo description data
THEN
The compressed primary description is moved to GCCC-LADING-DESCRIPTION field
R-GCCCCADD-cbl-00169 (+19) File: GCCCCADD.cbl Consolidated Load Indicator Retrieval Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Consolidated Load Indicator Retrieval':
  • Context - a consolidated load indicator retrieval process is starting:
    For Initialize CNS Indicator Search:
    When the system begins the search for cns indicator, then the cns indicator search flag is set to not found and sequence counter is initialized to 1.
  • Context - the consolidated load indicator search is initialized:
    For Set Search Parameters:
    When search parameters need to be configured for ebsbcks segment retrieval, then the search sequence counter is set and cns indicator flag is set to not found.
  • Context - search parameters are configured and sequence counter is set:
    For Loop Through EBSBCKS Segments:
    When the system retrieves an ebsbcks segment using the current sequence number, then the ebsbcks segment is retrieved from the edi bol database using the waybill key and sequence number.
  • Context - an ebsbcks segment retrieval attempt has been made:
    For EBSBCKS Segment Found?:
    When the system checks the retrieval status, then if the segment is found, processing continues to check the special handling code, otherwise the search continues to the next sequence.
  • Context - an ebsbcks segment has been successfully retrieved:
    For Check H3 Special Handling Code:
    When the system examines the h3 special handling code field, then the h3 special handling code value is extracted for comparison.
    For Check H3 Special Handling Code:
    When the h3 special handling code is examined, then the code is checked to determine if it equals 'cns' indicating consolidated load.
  • Context - the h3 special handling code has been extracted from the ebsbcks segment:
    For Code = 'CNS'?:
    When the system compares the special handling code value, then if the code equals 'cns', the consolidated indicator is found, otherwise the search continues.
  • Context - the h3 special handling code equals 'cns':
    For Set Consolidated Indicator Found:
    When the consolidated indicator is detected, then the cns indicator found flag is set to true.
    For Set CNS Indicator Found:
    When the consolidated load indicator is identified, then the cns indicator found flag is set to true.
  • Context - the current ebsbcks segment either doesn't exist or doesn't contain cns special handling code:
    For Continue Search Next Sequence:
    When the search needs to continue to the next sequence, then the sequence counter is incremented by 1.
  • Context - the search sequence has been incremented or cns indicator has not been found:
    For More Sequences to Check?:
    When the system checks if more sequences can be searched, then if the sequence counter is less than or equal to 98 and cns indicator is not found, continue searching, otherwise end the search.
  • Context - the cns indicator has been found in the ebsbcks segments:
    For Set Consolidated Load = 'Y':
    When the consolidated load indicator needs to be set, then the consolidated load field is set to 'y'.
  • Context - the cns indicator has not been found after searching all available ebsbcks segments:
    For Set Consolidated Load = Space:
    When the consolidated load indicator needs to be set, then the consolidated load field is set to space.
  • Context - a consolidated load indicator search is initiated:
    For Initialize CNS Search Variables:
    When the search parameters need to be initialized, then the cns sequence counter is set to 1 and the cns indicator flag is set to not found.
  • Context - a consolidated load indicator search is about to begin:
    For Set CNS Indicator Not Found:
    When the initial status needs to be set, then the consolidated load indicator flag is set to not found.
  • Context - a cns sequence number is available for lookup:
    For Retrieve EBSBCKS CNS Segment:
    When the ebsbcks segment is retrieved using the edi bol key and cns sequence, then the special handling segment data is made available for consolidated load checking.
  • Context - a cns indicator has been found in the special handling segments:
    For Set Consolidated Load = 'Y':
    When the consolidated load flag needs to be set, then the consolidated load indicator is set to 'y'.
  • Context - the current cns sequence does not contain a consolidated load indicator or the segment was not found:
    For Increment CNS Sequence Number:
    When the search needs to continue to the next sequence, then the cns sequence counter is incremented by 1.
  • Context - a cns sequence has been processed:
    For More Sequences to Check?:
    When the system determines whether to continue searching, then continue if cns indicator not found and sequence number is 98 or less, otherwise stop searching.
  • Context - all cns sequences from 1 to 98 have been searched and no cns indicator was found:
    For Set Consolidated Load = Space:
    When the consolidated load flag needs to be set to its default value, then the consolidated load indicator is set to space.
👨‍💻 Technical ACs (Gherkin)
Context: A consolidated load indicator retrieval process is starting
GIVEN
A consolidated load indicator retrieval process is starting
Applied to: Initialize CNS Indicator Search
WHEN
The system begins the search for CNS indicator
THEN
The CNS indicator search flag is set to not found and sequence counter is initialized to 1
Context: The consolidated load indicator search is initialized
GIVEN
The consolidated load indicator search is initialized
Applied to: Set Search Parameters
WHEN
Search parameters need to be configured for EBSBCKS segment retrieval
THEN
The search sequence counter is set and CNS indicator flag is set to not found
Context: Search parameters are configured and sequence counter is set
GIVEN
Search parameters are configured and sequence counter is set
Applied to: Loop Through EBSBCKS Segments
WHEN
The system retrieves an EBSBCKS segment using the current sequence number
THEN
The EBSBCKS segment is retrieved from the EDI BOL database using the waybill key and sequence number
Context: An EBSBCKS segment retrieval attempt has been made
GIVEN
An EBSBCKS segment retrieval attempt has been made
Applied to: EBSBCKS Segment Found?
WHEN
The system checks the retrieval status
THEN
If the segment is found, processing continues to check the special handling code, otherwise the search continues to the next sequence
Context: An EBSBCKS segment has been successfully retrieved
GIVEN
An EBSBCKS segment has been successfully retrieved
Applied to: Check H3 Special Handling Code
WHEN
The system examines the H3 special handling code field
THEN
The H3 special handling code value is extracted for comparison
Applied to: Check H3 Special Handling Code
WHEN
The H3 special handling code is examined
THEN
The code is checked to determine if it equals 'CNS' indicating consolidated load
Context: The H3 special handling code has been extracted from the EBSBCKS segment
GIVEN
The H3 special handling code has been extracted from the EBSBCKS segment
Applied to: Code = 'CNS'?
WHEN
The system compares the special handling code value
THEN
If the code equals 'CNS', the consolidated indicator is found, otherwise the search continues
Context: The H3 special handling code equals 'CNS'
GIVEN
The H3 special handling code equals 'CNS'
Applied to: Set Consolidated Indicator Found
WHEN
The consolidated indicator is detected
THEN
The CNS indicator found flag is set to true
Applied to: Set CNS Indicator Found
WHEN
The consolidated load indicator is identified
THEN
The CNS indicator found flag is set to true
Context: The current EBSBCKS segment either doesn't exist or doesn't contain CNS special handling code
GIVEN
The current EBSBCKS segment either doesn't exist or doesn't contain CNS special handling code
Applied to: Continue Search Next Sequence
WHEN
The search needs to continue to the next sequence
THEN
The sequence counter is incremented by 1
Context: The search sequence has been incremented or CNS indicator has not been found
GIVEN
The search sequence has been incremented or CNS indicator has not been found
Applied to: More Sequences to Check?
WHEN
The system checks if more sequences can be searched
THEN
If the sequence counter is less than or equal to 98 and CNS indicator is not found, continue searching, otherwise end the search
Context: The CNS indicator has been found in the EBSBCKS segments
GIVEN
The CNS indicator has been found in the EBSBCKS segments
Applied to: Set Consolidated Load = 'Y'
WHEN
The consolidated load indicator needs to be set
THEN
The consolidated load field is set to 'Y'
Context: The CNS indicator has not been found after searching all available EBSBCKS segments
GIVEN
The CNS indicator has not been found after searching all available EBSBCKS segments
Applied to: Set Consolidated Load = Space
WHEN
The consolidated load indicator needs to be set
THEN
The consolidated load field is set to space
Context: A consolidated load indicator search is initiated
GIVEN
A consolidated load indicator search is initiated
Applied to: Initialize CNS Search Variables
WHEN
The search parameters need to be initialized
THEN
The CNS sequence counter is set to 1 and the CNS indicator flag is set to not found
Context: A consolidated load indicator search is about to begin
GIVEN
A consolidated load indicator search is about to begin
Applied to: Set CNS Indicator Not Found
WHEN
The initial status needs to be set
THEN
The consolidated load indicator flag is set to not found
Context: A CNS sequence number is available for lookup
GIVEN
A CNS sequence number is available for lookup
Applied to: Retrieve EBSBCKS CNS Segment
WHEN
The EBSBCKS segment is retrieved using the EDI BOL key and CNS sequence
THEN
The special handling segment data is made available for consolidated load checking
Context: A CNS indicator has been found in the special handling segments
GIVEN
A CNS indicator has been found in the special handling segments
Applied to: Set Consolidated Load = 'Y'
WHEN
The consolidated load flag needs to be set
THEN
The consolidated load indicator is set to 'Y'
Context: The current CNS sequence does not contain a consolidated load indicator or the segment was not found
GIVEN
The current CNS sequence does not contain a consolidated load indicator or the segment was not found
Applied to: Increment CNS Sequence Number
WHEN
The search needs to continue to the next sequence
THEN
The CNS sequence counter is incremented by 1
Context: A CNS sequence has been processed
GIVEN
A CNS sequence has been processed
Applied to: More Sequences to Check?
WHEN
The system determines whether to continue searching
THEN
Continue if CNS indicator not found and sequence number is 98 or less, otherwise stop searching
Context: All CNS sequences from 1 to 98 have been searched and no CNS indicator was found
GIVEN
All CNS sequences from 1 to 98 have been searched and no CNS indicator was found
Applied to: Set Consolidated Load = Space
WHEN
The consolidated load flag needs to be set to its default value
THEN
The consolidated load indicator is set to space
R-GCCCBOL-cbl-00178 (+7) File: GCCCBOL.cbl Get Additional Descriptions Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Additional Descriptions':
  • Context - the system needs to retrieve additional lading descriptions from bol segments:
    For Initialize EBSBCRT-AD Found Flag:
    When the additional description retrieval process begins, then the ebsbcrt-ad found flag is set to true and description sequence counter is initialized to 1.
  • Context - the system is processing additional lading descriptions:
    For Description Sequence <= 10 AND EBSBCRT-AD Found?:
    When the description sequence counter is evaluated, then processing continues only if sequence counter is 10 or less and ebsbcrt-ad segments are still available.
  • Context - the system needs to get additional description data for current sequence:
    For Retrieve EBSBCRT-AD Segment from BOL:
    When ebsbcrt-ad segment retrieval is requested with current sequence number, then the system attempts to retrieve the ebsbcrt-ad segment from bol data.
  • Context - an ebsbcrt-ad segment retrieval has been attempted:
    For EBSBCRT-AD Segment Found?:
    When the system checks the retrieval result, then if segment is found, processing continues with description extraction, otherwise sequence counter is incremented.
  • Context - an ebsbcrt-ad segment has been successfully retrieved:
    For Additional Description Index <= 7?:
    When the system processes individual additional descriptions within the segment, then processing continues for additional description index from 1 to 7.
  • Context - an additional lading description field is being processed:
    For Additional Lading Description Not Empty?:
    When the system checks the description content, then if description is not empty (not spaces), it is moved to the description array, otherwise it is skipped.
  • Context - a valid additional lading description has been identified:
    For Move Additional Lading Description to Description Array:
    When the description needs to be stored, then the additional lading description is moved to the description array at the current index position.
  • Context - an additional lading description has been successfully stored:
    For Increment Description Array Index:
    When the system needs to prepare for the next description, then the description array index is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to retrieve additional lading descriptions from BOL segments
GIVEN
The system needs to retrieve additional lading descriptions from BOL segments
Applied to: Initialize EBSBCRT-AD Found Flag
WHEN
The additional description retrieval process begins
THEN
The EBSBCRT-AD found flag is set to TRUE and description sequence counter is initialized to 1
Context: The system is processing additional lading descriptions
GIVEN
The system is processing additional lading descriptions
Applied to: Description Sequence <= 10 AND EBSBCRT-AD Found?
WHEN
The description sequence counter is evaluated
THEN
Processing continues only if sequence counter is 10 or less AND EBSBCRT-AD segments are still available
Context: The system needs to get additional description data for current sequence
GIVEN
The system needs to get additional description data for current sequence
Applied to: Retrieve EBSBCRT-AD Segment from BOL
WHEN
EBSBCRT-AD segment retrieval is requested with current sequence number
THEN
The system attempts to retrieve the EBSBCRT-AD segment from BOL data
Context: An EBSBCRT-AD segment retrieval has been attempted
GIVEN
An EBSBCRT-AD segment retrieval has been attempted
Applied to: EBSBCRT-AD Segment Found?
WHEN
The system checks the retrieval result
THEN
If segment is found, processing continues with description extraction, otherwise sequence counter is incremented
Context: An EBSBCRT-AD segment has been successfully retrieved
GIVEN
An EBSBCRT-AD segment has been successfully retrieved
Applied to: Additional Description Index <= 7?
WHEN
The system processes individual additional descriptions within the segment
THEN
Processing continues for additional description index from 1 to 7
Context: An additional lading description field is being processed
GIVEN
An additional lading description field is being processed
Applied to: Additional Lading Description Not Empty?
WHEN
The system checks the description content
THEN
If description is not empty (not spaces), it is moved to the description array, otherwise it is skipped
Context: A valid additional lading description has been identified
GIVEN
A valid additional lading description has been identified
Applied to: Move Additional Lading Description to Description Array
WHEN
The description needs to be stored
THEN
The additional lading description is moved to the description array at the current index position
Context: An additional lading description has been successfully stored
GIVEN
An additional lading description has been successfully stored
Applied to: Increment Description Array Index
WHEN
The system needs to prepare for the next description
THEN
The description array index is incremented by 1
R-GCX122A-cbl-00178 (+13) File: GCX122A.cbl Process Message Routing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Message Routing':
  • Context - a message processing request is initiated:
    For MST Processing Required?:
    When the system checks the mst processing flag, then mst processing continues if the flag indicates processing is required, otherwise mst processing is bypassed.
  • Context - a reference number requires message routing:
    For LTERM Available for Reference?:
    When the system checks if lterm process information is available and not empty, then processing continues with lterm if available, otherwise an error message is generated indicating no lterm found.
  • Context - a valid lterm is available for processing:
    For Set MST Call Letters from LTERM:
    When the system needs to set up mst communication parameters, then the mst call letters are assigned from the lterm mst configuration.
  • Context - a valid lterm process terminal is identified:
    For Get Supervisor Merlin ID from Terminal:
    When the system looks up terminal configuration in the lt table, then the supervisor merlin id is retrieved from the terminal configuration if the table entry exists, otherwise terminal segment is cleared.
  • Context - a reference number requires processing but no lterm is available:
    For Add Error Message: No LTERM Found:
    When the system attempts to route messages, then an error message 'no lterm for this reference number' is added to the message text and mst entry.
  • Context - mst processing cannot proceed due to missing lterm or other conditions:
    For Set Flag: Don't Process MST:
    When the system encounters a blocking condition for mst processing, then the mst processing flag is set to indicate mst processing should not continue.
  • Context - merlin user ids are configured for message routing:
    For Check All Merlin User IDs:
    When the system validates each merlin id against the emtz user validation system, then valid merlin ids are confirmed for use, invalid ids trigger error handling.
  • Context - a dc&p merlin id is configured in the system:
    For DC&P Merlin ID Valid?:
    When the system validates the dc&p merlin id against the user validation system, then processing continues if the id is valid, otherwise an invalid id error is generated.
  • Context - the dc&p merlin id fails validation:
    For Add Error Message: DC&P Merlin ID Invalid:
    When the system processes the invalid merlin id, then an error message 'dc&p merlin userid invalid' is added with the invalid id number.
  • Context - merlin id validation is complete:
    For Determine Message Recipients:
    When the system needs to determine message routing recipients, then valid supervisor merlin ids are assigned as recipients, invalid ids result in empty recipient assignment.
  • Context - an error message needs to be routed:
    For Error Type?:
    When the system evaluates the error context (train vs cargo), then the message is routed to train-specific recipients if it's a train error, otherwise to cargo-specific recipients.
  • Context - a train-related error message needs distribution:
    For Route to Train Message Recipients:
    When the system routes the message to train recipients, then the message is sent to the supervisor merlin id and additionally routed to the caerror system with om01247 as recipient.
  • Context - a cargo-related error message needs distribution:
    For Route to Cargo Message Recipients:
    When the system routes the message to cargo recipients, then the message is sent to the supervisor merlin id, with fallback to om01247 if the primary send fails.
  • Context - messages are prepared for mst transmission with valid call letters:
    For Send Messages via MST System:
    When the system sends messages via mst using smstonly service, then each message entry is transmitted sequentially until all entries are processed, followed by a wrap command to complete the transmission.
👨‍💻 Technical ACs (Gherkin)
Context: A message processing request is initiated
GIVEN
A message processing request is initiated
Applied to: MST Processing Required?
WHEN
The system checks the MST processing flag
THEN
MST processing continues if the flag indicates processing is required, otherwise MST processing is bypassed
Context: A reference number requires message routing
GIVEN
A reference number requires message routing
Applied to: LTERM Available for Reference?
WHEN
The system checks if LTERM process information is available and not empty
THEN
Processing continues with LTERM if available, otherwise an error message is generated indicating no LTERM found
Context: A valid LTERM is available for processing
GIVEN
A valid LTERM is available for processing
Applied to: Set MST Call Letters from LTERM
WHEN
The system needs to set up MST communication parameters
THEN
The MST call letters are assigned from the LTERM MST configuration
Context: A valid LTERM process terminal is identified
GIVEN
A valid LTERM process terminal is identified
Applied to: Get Supervisor Merlin ID from Terminal
WHEN
The system looks up terminal configuration in the LT table
THEN
The supervisor Merlin ID is retrieved from the terminal configuration if the table entry exists, otherwise terminal segment is cleared
Context: A reference number requires processing but no LTERM is available
GIVEN
A reference number requires processing but no LTERM is available
Applied to: Add Error Message: No LTERM Found
WHEN
The system attempts to route messages
THEN
An error message 'NO LTERM FOR THIS REFERENCE NUMBER' is added to the message text and MST entry
Context: MST processing cannot proceed due to missing LTERM or other conditions
GIVEN
MST processing cannot proceed due to missing LTERM or other conditions
Applied to: Set Flag: Don't Process MST
WHEN
The system encounters a blocking condition for MST processing
THEN
The MST processing flag is set to indicate MST processing should not continue
Context: Merlin user IDs are configured for message routing
GIVEN
Merlin user IDs are configured for message routing
Applied to: Check All Merlin User IDs
WHEN
The system validates each Merlin ID against the EMTZ user validation system
THEN
Valid Merlin IDs are confirmed for use, invalid IDs trigger error handling
Context: A DC&P Merlin ID is configured in the system
GIVEN
A DC&P Merlin ID is configured in the system
Applied to: DC&P Merlin ID Valid?
WHEN
The system validates the DC&P Merlin ID against the user validation system
THEN
Processing continues if the ID is valid, otherwise an invalid ID error is generated
Context: The DC&P Merlin ID fails validation
GIVEN
The DC&P Merlin ID fails validation
Applied to: Add Error Message: DC&P Merlin ID Invalid
WHEN
The system processes the invalid Merlin ID
THEN
An error message 'DC&P MERLIN USERID INVALID' is added with the invalid ID number
Context: Merlin ID validation is complete
GIVEN
Merlin ID validation is complete
Applied to: Determine Message Recipients
WHEN
The system needs to determine message routing recipients
THEN
Valid supervisor Merlin IDs are assigned as recipients, invalid IDs result in empty recipient assignment
Context: An error message needs to be routed
GIVEN
An error message needs to be routed
Applied to: Error Type?
WHEN
The system evaluates the error context (train vs cargo)
THEN
The message is routed to train-specific recipients if it's a train error, otherwise to cargo-specific recipients
Context: A train-related error message needs distribution
GIVEN
A train-related error message needs distribution
Applied to: Route to Train Message Recipients
WHEN
The system routes the message to train recipients
THEN
The message is sent to the supervisor Merlin ID and additionally routed to the CAERROR system with OM01247 as recipient
Context: A cargo-related error message needs distribution
GIVEN
A cargo-related error message needs distribution
Applied to: Route to Cargo Message Recipients
WHEN
The system routes the message to cargo recipients
THEN
The message is sent to the supervisor Merlin ID, with fallback to OM01247 if the primary send fails
Context: Messages are prepared for MST transmission with valid call letters
GIVEN
Messages are prepared for MST transmission with valid call letters
Applied to: Send Messages via MST System
WHEN
The system sends messages via MST using SMSTONLY service
THEN
Each message entry is transmitted sequentially until all entries are processed, followed by a WRAP command to complete the transmission
R-GCCCCADD-cbl-00180 (+12) File: GCCCCADD.cbl Shipper Data Extraction Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shipper Data Extraction':
  • Context - a shipment requires shipper data extraction:
    For Check EDI BOL for Shipper Data:
    When the system checks for edi bol shipper segment availability, then if edi bol hn segment is found, extract shipper from edi bol, otherwise use fastway shiproot data.
  • Context - edi bol hn segment is available for shipper:
    For Get Shipper Name from F1-CONSIGNOR-NAME:
    When extracting shipper identification information, then set shipper entity id to 'sh', get shipper name from f1-consignor-name, and get shipper chop from f1-shpr-chop.
  • Context - edi bol ha address segment is available:
    For Extract Address from EDI HA Segment:
    When processing shipper address information, then extract address line 1 from f2-addl-name-addr-1 and address line 2 from f2-addl-name-addr-2, and if address line 1 is empty set it to 'na'.
  • Context - edi bol ha address segment is not available:
    For Use Fastway SHIPROOT Address Data:
    When processing shipper address information, then use shpr-addr array from shiproot, set address line 1 from shpr-addr(1) or 'na' if empty, and clear address line 2.
  • Context - edi bol hc city/state segment is available:
    For Extract City/State from EDI HC Segment:
    When processing shipper location information, then extract city from f4-city-name, state from f4-state-prov-code, postal code from f4-postal-code, and country from f4-country-code.
  • Context - edi bol hc segment is not available:
    For Parse Fastway Address for City/State:
    When processing shipper location information from fastway data, then parse shpr-addr(2) to extract city name, state/province code, postal code, and determine country code from state lookup table.
  • Context - edi bol gp contact segment is available:
    For Extract Contact from EDI GP Segment:
    When processing shipper contact information, then extract contact function code from per-contact-func-code, contact name from per-name, communication number qualifier from per-commun-no-qual, and communication number from per-commun-number.
  • Context - edi bol gp contact segment is not available:
    For No Contact Information Available:
    When processing shipper contact information, then leave all contact fields empty (contact function code, name, communication qualifier, and communication number).
  • Context - edi bol hn segment is not available:
    For Extract Shipper from Fastway SHIPROOT:
    When extracting shipper information, then set entity id to 'sh', get shipper name from shpr-nm, get shipper chop from shpr-chop, and clear id code qualifier and id code fields.
  • Context - shipper address line 1 is empty or spaces:
    For Set Default Address to 'NA':
    When processing shipper address information, then set address line 1 to 'na'.
  • Context - shipper address line 2 is empty or has only first character with remaining 18 characters as spaces:
    For Set Default Address to 'NA':
    When processing shipper address information, then set address line 2 first 18 characters to 'na' and set country code to 'us'.
  • Context - shipper state/province code is not empty and address line 2 is not empty or incomplete:
    For Determine Country Code from State:
    When processing shipper country information, then search state-country lookup table to find matching country code for the state, and if not found add error message for invalid state/province code.
  • Context - shipper information is being processed:
    For Validate Shipper Data Requirements:
    When validating shipper data completeness, then if shipper name is empty, add error message for invalid shipper name.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires shipper data extraction
GIVEN
A shipment requires shipper data extraction
Applied to: Check EDI BOL for Shipper Data
WHEN
The system checks for EDI BOL shipper segment availability
THEN
If EDI BOL HN segment is found, extract shipper from EDI BOL, otherwise use Fastway SHIPROOT data
Context: EDI BOL HN segment is available for shipper
GIVEN
EDI BOL HN segment is available for shipper
Applied to: Get Shipper Name from F1-CONSIGNOR-NAME
WHEN
Extracting shipper identification information
THEN
Set shipper entity ID to 'SH', get shipper name from F1-CONSIGNOR-NAME, and get shipper CHOP from F1-SHPR-CHOP
Context: EDI BOL HA address segment is available
GIVEN
EDI BOL HA address segment is available
Applied to: Extract Address from EDI HA Segment
WHEN
Processing shipper address information
THEN
Extract address line 1 from F2-ADDL-NAME-ADDR-1 and address line 2 from F2-ADDL-NAME-ADDR-2, and if address line 1 is empty set it to 'NA'
Context: EDI BOL HA address segment is not available
GIVEN
EDI BOL HA address segment is not available
Applied to: Use Fastway SHIPROOT Address Data
WHEN
Processing shipper address information
THEN
Use SHPR-ADDR array from SHIPROOT, set address line 1 from SHPR-ADDR(1) or 'NA' if empty, and clear address line 2
Context: EDI BOL HC city/state segment is available
GIVEN
EDI BOL HC city/state segment is available
Applied to: Extract City/State from EDI HC Segment
WHEN
Processing shipper location information
THEN
Extract city from F4-CITY-NAME, state from F4-STATE-PROV-CODE, postal code from F4-POSTAL-CODE, and country from F4-COUNTRY-CODE
Context: EDI BOL HC segment is not available
GIVEN
EDI BOL HC segment is not available
Applied to: Parse Fastway Address for City/State
WHEN
Processing shipper location information from Fastway data
THEN
Parse SHPR-ADDR(2) to extract city name, state/province code, postal code, and determine country code from state lookup table
Context: EDI BOL GP contact segment is available
GIVEN
EDI BOL GP contact segment is available
Applied to: Extract Contact from EDI GP Segment
WHEN
Processing shipper contact information
THEN
Extract contact function code from PER-CONTACT-FUNC-CODE, contact name from PER-NAME, communication number qualifier from PER-COMMUN-NO-QUAL, and communication number from PER-COMMUN-NUMBER
Context: EDI BOL GP contact segment is not available
GIVEN
EDI BOL GP contact segment is not available
Applied to: No Contact Information Available
WHEN
Processing shipper contact information
THEN
Leave all contact fields empty (contact function code, name, communication qualifier, and communication number)
Context: EDI BOL HN segment is not available
GIVEN
EDI BOL HN segment is not available
Applied to: Extract Shipper from Fastway SHIPROOT
WHEN
Extracting shipper information
THEN
Set entity ID to 'SH', get shipper name from SHPR-NM, get shipper CHOP from SHPR-CHOP, and clear ID code qualifier and ID code fields
Context: Shipper address line 1 is empty or spaces
GIVEN
Shipper address line 1 is empty or spaces
Applied to: Set Default Address to 'NA'
WHEN
Processing shipper address information
THEN
Set address line 1 to 'NA'
Context: Shipper address line 2 is empty or has only first character with remaining 18 characters as spaces
GIVEN
Shipper address line 2 is empty or has only first character with remaining 18 characters as spaces
Applied to: Set Default Address to 'NA'
WHEN
Processing shipper address information
THEN
Set address line 2 first 18 characters to 'NA' and set country code to 'US'
Context: Shipper state/province code is not empty and address line 2 is not empty or incomplete
GIVEN
Shipper state/province code is not empty and address line 2 is not empty or incomplete
Applied to: Determine Country Code from State
WHEN
Processing shipper country information
THEN
Search state-country lookup table to find matching country code for the state, and if not found add error message for invalid state/province code
Context: Shipper information is being processed
GIVEN
Shipper information is being processed
Applied to: Validate Shipper Data Requirements
WHEN
Validating shipper data completeness
THEN
If shipper name is empty, add error message for invalid shipper name
R-GCCCBOL-cbl-00186 (+7) File: GCCCBOL.cbl Extract Special Instructions Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Special Instructions':
  • Context - the system needs to process special handling instructions from fastway data:
    For Initialize Special Instruction Index to 1:
    When the special instruction extraction process begins, then the special instruction index should be set to 1 to start processing from the first available slot.
  • Context - special handling records exist in the fastway system:
    For Loop Through Special Handling Records Index 1 to 7:
    When processing special handling instructions, then the system should loop through special handling records from index 1 to 7 and continue until either all 7 records are processed or 3 special instructions are found.
  • Context - a special handling record is being processed:
    For Special Handling Code = VA, VS, or EV?:
    When the system checks the special handling code, then the record should be processed only if the special handling code equals 'va' or 'vs' or 'ev'.
  • Context - a special handling record has a code of va, vs, or ev:
    For Extract Special Handling Code:
    When the system processes the qualified record, then the special handling code should be extracted and stored in the work area.
  • Context - a special handling record has been qualified for processing:
    For Extract Special Handling Instruction:
    When the system extracts the special handling code, then the corresponding special handling instruction text should also be extracted and stored.
  • Context - special handling code and instruction have been extracted from a qualified record:
    For Store Code and Instruction in Work Area:
    When the system processes the extracted data, then the code and instruction should be combined and stored in the designated work area slot.
  • Context - a special instruction has been successfully stored in the work area:
    For Move to Next Special Instruction Slot:
    When the system completes processing of one special handling record, then the special instruction index should be incremented by 1 to point to the next available slot.
  • Context - the system is processing special handling records:
    For More Records to Process AND Less than 3 Instructions Found?:
    When evaluating whether to continue the processing loop, then processing should continue if the special handling index is less than or equal to 7 and the special instruction index is less than 3.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process special handling instructions from Fastway data
GIVEN
The system needs to process special handling instructions from Fastway data
Applied to: Initialize Special Instruction Index to 1
WHEN
The special instruction extraction process begins
THEN
The special instruction index should be set to 1 to start processing from the first available slot
Context: Special handling records exist in the Fastway system
GIVEN
Special handling records exist in the Fastway system
Applied to: Loop Through Special Handling Records Index 1 to 7
WHEN
Processing special handling instructions
THEN
The system should loop through special handling records from index 1 to 7 AND continue until either all 7 records are processed OR 3 special instructions are found
Context: A special handling record is being processed
GIVEN
A special handling record is being processed
Applied to: Special Handling Code = VA, VS, or EV?
WHEN
The system checks the special handling code
THEN
The record should be processed only if the special handling code equals 'VA' OR 'VS' OR 'EV'
Context: A special handling record has a code of VA, VS, or EV
GIVEN
A special handling record has a code of VA, VS, or EV
Applied to: Extract Special Handling Code
WHEN
The system processes the qualified record
THEN
The special handling code should be extracted and stored in the work area
Context: A special handling record has been qualified for processing
GIVEN
A special handling record has been qualified for processing
Applied to: Extract Special Handling Instruction
WHEN
The system extracts the special handling code
THEN
The corresponding special handling instruction text should also be extracted and stored
Context: Special handling code and instruction have been extracted from a qualified record
GIVEN
Special handling code and instruction have been extracted from a qualified record
Applied to: Store Code and Instruction in Work Area
WHEN
The system processes the extracted data
THEN
The code and instruction should be combined and stored in the designated work area slot
Context: A special instruction has been successfully stored in the work area
GIVEN
A special instruction has been successfully stored in the work area
Applied to: Move to Next Special Instruction Slot
WHEN
The system completes processing of one special handling record
THEN
The special instruction index should be incremented by 1 to point to the next available slot
Context: The system is processing special handling records
GIVEN
The system is processing special handling records
Applied to: More Records to Process AND Less than 3 Instructions Found?
WHEN
Evaluating whether to continue the processing loop
THEN
Processing should continue if the special handling index is less than or equal to 7 AND the special instruction index is less than 3
R-GCX122A-cbl-00192 (+6) File: GCX122A.cbl Get Supervisor Merlin ID Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Supervisor Merlin ID':
  • Context - a processing terminal identifier exists in ws-lterm-process:
    For Retrieve Terminal Configuration from LT Table:
    When the system queries the lt table with the terminal identifier, then the terminal configuration segment is retrieved and stored for further processing.
  • Context - a query has been made to retrieve terminal configuration from the lt table:
    For Terminal Configuration Found?:
    When the table lookup returns a non-zero status indicating no configuration found, then the terminal configuration segment is cleared to spaces.
  • Context - terminal configuration has been successfully retrieved from the lt table:
    For Alternate Terminal Configured?:
    When the alternate terminal field in the configuration is not empty, then the processing terminal is updated to the alternate terminal value and mst call letters are updated accordingly.
  • Context - a supervisor merlin id has been extracted from terminal configuration:
    For Validate Supervisor Merlin ID in System:
    When the system queries the emtz segment to validate the supervisor merlin id, then the validation result determines if the id is valid or invalid.
  • Context - the supervisor merlin id validation has completed successfully with no error status:
    For Set Valid Supervisor Merlin ID for Message Routing:
    When the system processes the validation result, then the supervisor merlin id is assigned to the user merlin variable for message routing.
  • Context - the supervisor merlin id validation has failed with a non-space status code:
    For Generate Invalid Supervisor ID Error Message:
    When the system processes the validation failure, then an error message 'supervisor merlin userid invalid' is added to both text and mst message arrays with the invalid id included.
  • Context - the supervisor merlin id validation has failed:
    For Clear Supervisor Merlin ID:
    When the system processes the validation failure, then the user merlin variable is set to spaces to clear any invalid value.
👨‍💻 Technical ACs (Gherkin)
Context: A processing terminal identifier exists in WS-LTERM-PROCESS
GIVEN
A processing terminal identifier exists in WS-LTERM-PROCESS
Applied to: Retrieve Terminal Configuration from LT Table
WHEN
The system queries the LT table with the terminal identifier
THEN
The terminal configuration segment is retrieved and stored for further processing
Context: A query has been made to retrieve terminal configuration from the LT table
GIVEN
A query has been made to retrieve terminal configuration from the LT table
Applied to: Terminal Configuration Found?
WHEN
The table lookup returns a non-zero status indicating no configuration found
THEN
The terminal configuration segment is cleared to spaces
Context: Terminal configuration has been successfully retrieved from the LT table
GIVEN
Terminal configuration has been successfully retrieved from the LT table
Applied to: Alternate Terminal Configured?
WHEN
The alternate terminal field in the configuration is not empty
THEN
The processing terminal is updated to the alternate terminal value and MST call letters are updated accordingly
Context: A supervisor Merlin ID has been extracted from terminal configuration
GIVEN
A supervisor Merlin ID has been extracted from terminal configuration
Applied to: Validate Supervisor Merlin ID in System
WHEN
The system queries the EMTZ segment to validate the supervisor Merlin ID
THEN
The validation result determines if the ID is valid or invalid
Context: The supervisor Merlin ID validation has completed successfully with no error status
GIVEN
The supervisor Merlin ID validation has completed successfully with no error status
Applied to: Set Valid Supervisor Merlin ID for Message Routing
WHEN
The system processes the validation result
THEN
The supervisor Merlin ID is assigned to the user Merlin variable for message routing
Context: The supervisor Merlin ID validation has failed with a non-space status code
GIVEN
The supervisor Merlin ID validation has failed with a non-space status code
Applied to: Generate Invalid Supervisor ID Error Message
WHEN
The system processes the validation failure
THEN
An error message 'SUPERVISOR MERLIN USERID INVALID' is added to both text and MST message arrays with the invalid ID included
Context: The supervisor Merlin ID validation has failed
GIVEN
The supervisor Merlin ID validation has failed
Applied to: Clear Supervisor Merlin ID
WHEN
The system processes the validation failure
THEN
The user Merlin variable is set to spaces to clear any invalid value
R-GCCCCADD-cbl-00193 (+16) File: GCCCCADD.cbl Consignee Data Extraction Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Consignee Data Extraction':
  • Context - a new consignee record needs to be created:
    For Initialize Consignee Record:
    When the consignee record initialization is triggered, then the consignee record is cleared, ccn key is set, record type is set to '55', and sequence number is set to '0002'.
  • Context - an edi bol key exists for the shipment:
    For Check EDI BOL for Consignee Data:
    When the system checks for consignee data in the edi bol, then the system retrieves the ebsnrsc segment with type 'cn' and sequence '01' and sets the found/not found status.
  • Context - edi bol consignee data is found:
    For Extract Consignee Name from EDI BOL:
    When the system processes the consignee segment, then the entity id code is set to 'cn', the consignee name is extracted from d1-shipper-name field, and the chop code is extracted from d1-cons-chop field.
  • Context - edi bol consignee data exists:
    For Check EDI BOL for Address Data:
    When the system checks for address data in the edi bol, then the system retrieves the ebsnrsa segment with type 'cn', sequence '01', address type 'ca', and address sequence '01'.
    For Check EDI BOL for City/State Data:
    When the system checks for city/state data in the edi bol, then the system retrieves the ebsnrsa segment with type 'cn', sequence '01', address type 'cc', and address sequence '01'.
    For Check EDI BOL for Contact Info:
    When the system checks for contact data in the edi bol, then the system retrieves the ebsnrsa segment with type 'cn', sequence '01', contact type 'gp', and contact sequence '01'.
  • Context - edi bol address data is found for the consignee:
    For Extract Address from EDI BOL:
    When the system processes the address segment, then address line 1 is set from d2-addl-name-addr-1, address line 2 is set from d2-addl-name-addr-2, and if address line 1 is empty, it is set to 'na'.
  • Context - edi bol address data is not found for the consignee:
    For Use Fastway Address Data:
    When the system falls back to fastway data, then address line 1 is set from cons-data(3) or 'na' if empty, and address line 2 is set to spaces.
  • Context - edi bol city/state data is found for the consignee:
    For Extract City/State/Postal from EDI BOL:
    When the system processes the city/state segment, then city name is set from d4-city-name, state/province code is set from d4-state-prov-code, postal code is set from d4-postal-code, and country code is set from d4-country-code.
  • Context - edi bol city/state data is not found for the consignee:
    For Use Fastway City/State Data:
    When the system falls back to fastway data, then cons-data(4) is parsed into city name, state/province code, and postal code components, and country code is determined from state/country lookup table.
  • Context - edi bol contact data is found for the consignee:
    For Extract Contact Information:
    When the system processes the contact segment, then contact function code is set from per-contact-func-code, contact name is set from per-name, communication number qualifier is set from per-commun-no-qual, and communication number is set from per-commun-number.
  • Context - edi bol consignee data is not found:
    For Use Fastway Consignee Data:
    When the system falls back to fastway data, then entity id is set to 'cn', consignee name is set from cons-data(1), chop code is set from cons-chop, and id code qualifier and id code are set to spaces.
  • Context - address data has been extracted from either edi bol or fastway:
    For Set Default Address if Missing:
    When address line 1 is empty or contains only spaces, then address line 1 is set to 'na' as the default value.
  • Context - a state or province code exists for the consignee:
    For Determine Country Code:
    When the system performs country code determination, then the state-country lookup table is searched to find the matching country code for the given state/province code.
  • Context - a state/province code exists for the consignee:
    For Lookup State/Country Combination:
    When the state-country lookup is performed, then if a valid country is found, the country code is set; if no valid country is found, an error message is generated for invalid consignee province/state code.
  • Context - consignee data has been extracted and processed:
    For Validate Consignee Data:
    When data validation is performed, then the system validates that consignee name is not empty, generates error message if consignee name is missing, and calls the n1 segment validation routine.
  • Context - consignee data has been validated and processed:
    For Store Consignee Record:
    When the consignee record is ready for storage, then the complete consignee record is moved to position 2 in the ws-gcsccs55-data array.
👨‍💻 Technical ACs (Gherkin)
Context: A new consignee record needs to be created
GIVEN
A new consignee record needs to be created
Applied to: Initialize Consignee Record
WHEN
The consignee record initialization is triggered
THEN
The consignee record is cleared, CCN key is set, record type is set to '55', and sequence number is set to '0002'
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Check EDI BOL for Consignee Data
WHEN
The system checks for consignee data in the EDI BOL
THEN
The system retrieves the EBSNRSC segment with type 'CN' and sequence '01' and sets the found/not found status
Context: EDI BOL consignee data is found
GIVEN
EDI BOL consignee data is found
Applied to: Extract Consignee Name from EDI BOL
WHEN
The system processes the consignee segment
THEN
The entity ID code is set to 'CN', the consignee name is extracted from D1-SHIPPER-NAME field, and the CHOP code is extracted from D1-CONS-CHOP field
Context: EDI BOL consignee data exists
GIVEN
EDI BOL consignee data exists
Applied to: Check EDI BOL for Address Data
WHEN
The system checks for address data in the EDI BOL
THEN
The system retrieves the EBSNRSA segment with type 'CN', sequence '01', address type 'CA', and address sequence '01'
Applied to: Check EDI BOL for City/State Data
WHEN
The system checks for city/state data in the EDI BOL
THEN
The system retrieves the EBSNRSA segment with type 'CN', sequence '01', address type 'CC', and address sequence '01'
Applied to: Check EDI BOL for Contact Info
WHEN
The system checks for contact data in the EDI BOL
THEN
The system retrieves the EBSNRSA segment with type 'CN', sequence '01', contact type 'GP', and contact sequence '01'
Context: EDI BOL address data is found for the consignee
GIVEN
EDI BOL address data is found for the consignee
Applied to: Extract Address from EDI BOL
WHEN
The system processes the address segment
THEN
Address line 1 is set from D2-ADDL-NAME-ADDR-1, address line 2 is set from D2-ADDL-NAME-ADDR-2, and if address line 1 is empty, it is set to 'NA'
Context: EDI BOL address data is not found for the consignee
GIVEN
EDI BOL address data is not found for the consignee
Applied to: Use Fastway Address Data
WHEN
The system falls back to Fastway data
THEN
Address line 1 is set from CONS-DATA(3) or 'NA' if empty, and address line 2 is set to spaces
Context: EDI BOL city/state data is found for the consignee
GIVEN
EDI BOL city/state data is found for the consignee
Applied to: Extract City/State/Postal from EDI BOL
WHEN
The system processes the city/state segment
THEN
City name is set from D4-CITY-NAME, state/province code is set from D4-STATE-PROV-CODE, postal code is set from D4-POSTAL-CODE, and country code is set from D4-COUNTRY-CODE
Context: EDI BOL city/state data is not found for the consignee
GIVEN
EDI BOL city/state data is not found for the consignee
Applied to: Use Fastway City/State Data
WHEN
The system falls back to Fastway data
THEN
CONS-DATA(4) is parsed into city name, state/province code, and postal code components, and country code is determined from state/country lookup table
Context: EDI BOL contact data is found for the consignee
GIVEN
EDI BOL contact data is found for the consignee
Applied to: Extract Contact Information
WHEN
The system processes the contact segment
THEN
Contact function code is set from PER-CONTACT-FUNC-CODE, contact name is set from PER-NAME, communication number qualifier is set from PER-COMMUN-NO-QUAL, and communication number is set from PER-COMMUN-NUMBER
Context: EDI BOL consignee data is not found
GIVEN
EDI BOL consignee data is not found
Applied to: Use Fastway Consignee Data
WHEN
The system falls back to Fastway data
THEN
Entity ID is set to 'CN', consignee name is set from CONS-DATA(1), CHOP code is set from CONS-CHOP, and ID code qualifier and ID code are set to spaces
Context: Address data has been extracted from either EDI BOL or Fastway
GIVEN
Address data has been extracted from either EDI BOL or Fastway
Applied to: Set Default Address if Missing
WHEN
Address line 1 is empty or contains only spaces
THEN
Address line 1 is set to 'NA' as the default value
Context: A state or province code exists for the consignee
GIVEN
A state or province code exists for the consignee
Applied to: Determine Country Code
WHEN
The system performs country code determination
THEN
The state-country lookup table is searched to find the matching country code for the given state/province code
Context: A state/province code exists for the consignee
GIVEN
A state/province code exists for the consignee
Applied to: Lookup State/Country Combination
WHEN
The state-country lookup is performed
THEN
If a valid country is found, the country code is set; if no valid country is found, an error message is generated for invalid consignee province/state code
Context: Consignee data has been extracted and processed
GIVEN
Consignee data has been extracted and processed
Applied to: Validate Consignee Data
WHEN
Data validation is performed
THEN
The system validates that consignee name is not empty, generates error message if consignee name is missing, and calls the N1 segment validation routine
Context: Consignee data has been validated and processed
GIVEN
Consignee data has been validated and processed
Applied to: Store Consignee Record
WHEN
The consignee record is ready for storage
THEN
The complete consignee record is moved to position 2 in the WS-GCSCCS55-DATA array
R-GCCCBOL-cbl-00194 (+10) File: GCCCBOL.cbl Retrieve VIN Numbers Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve VIN Numbers':
  • Context - a shipment contains motor vehicle segments with mv type records:
    For Get MV Loaded Shipments VINs:
    When the system processes vin retrieval and searches through mv segments sequentially, then each valid vehicle id number from mv segments is extracted, formatted with 'vin' prefix, and stored in the vin array with incremented counter.
  • Context - the vin retrieval process is starting for motor vehicle segments:
    For Initialize VIN Counter to Zero:
    When the system begins mv segment processing, then the vin quantity counter is set to zero to track the number of vins found.
  • Context - the system needs to retrieve motor vehicle segments:
    For Set MV Type Filter:
    When vin processing begins for mv segments, then the type filter is set to 'mv' to identify motor vehicle records.
  • Context - motor vehicle segments exist in the shipment data:
    For Loop Through MV Segments:
    When the system loops through mv segments with incrementing sequence numbers, then each mv segment is processed in order until either no more segments are found or the maximum vin limit is reached.
  • Context - a motor vehicle segment is found with a valid vehicle id number:
    For Extract Vehicle ID Number, Format VIN with 'VIN' Prefix, Store in VIN Array:
    When the vehicle id number is not spaces or low-values, then the system formats the vehicle id with 'vin' prefix and stores it in the vin description array, then increments the vin counter.
  • Context - motor vehicle segment processing has completed:
    For VIN Quantity = 0?:
    When the vin quantity counter equals zero indicating no vins were found in mv segments, then the system initiates co-loaded shipment vin processing as an alternative source.
  • Context - no vins were found in motor vehicle segments:
    For Initialize Co-Load Process:
    When co-loaded shipment processing begins, then the system resets vin counter to zero and prepares to search rf reference segments for consolidated shipments.
  • Context - co-loaded shipment processing is active:
    For Get RF Reference Segment:
    When the system searches for rf type segments with sequential numbering, then each rf segment is retrieved to check for consolidated shipment indicators.
  • Context - an rf reference segment has been retrieved:
    For Has Consolidated Shipment Number?:
    When the system checks the segment for consolidated shipment indicators, then if a consolidated shipment number is present, the system proceeds to process v2 motor vehicle segments within that consolidation.
  • Context - a consolidated shipment with rf segment has been identified:
    For Loop Through V2 Motor Vehicle Segments:
    When the system loops through v2 motor vehicle segments within the consolidation, then each v2 segment is processed sequentially until no more segments are found or maximum vehicle limit is reached.
  • Context - a v2 motor vehicle segment is found within a consolidated shipment:
    For Extract Co-Load Vehicle ID, Format Co-Load VIN with Prefix, Store Co-Load VIN in Array:
    When the vehicle id number in the v2 segment is not spaces or empty, then the system formats the vehicle id with 'vin' prefix, stores it in the vin array if under the maximum limit, and increments the vin counter.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment contains motor vehicle segments with MV type records
GIVEN
A shipment contains motor vehicle segments with MV type records
Applied to: Get MV Loaded Shipments VINs
WHEN
The system processes VIN retrieval and searches through MV segments sequentially
THEN
Each valid vehicle ID number from MV segments is extracted, formatted with 'VIN' prefix, and stored in the VIN array with incremented counter
Context: The VIN retrieval process is starting for motor vehicle segments
GIVEN
The VIN retrieval process is starting for motor vehicle segments
Applied to: Initialize VIN Counter to Zero
WHEN
The system begins MV segment processing
THEN
The VIN quantity counter is set to zero to track the number of VINs found
Context: The system needs to retrieve motor vehicle segments
GIVEN
The system needs to retrieve motor vehicle segments
Applied to: Set MV Type Filter
WHEN
VIN processing begins for MV segments
THEN
The type filter is set to 'MV' to identify motor vehicle records
Context: Motor vehicle segments exist in the shipment data
GIVEN
Motor vehicle segments exist in the shipment data
Applied to: Loop Through MV Segments
WHEN
The system loops through MV segments with incrementing sequence numbers
THEN
Each MV segment is processed in order until either no more segments are found or the maximum VIN limit is reached
Context: A motor vehicle segment is found with a valid vehicle ID number
GIVEN
A motor vehicle segment is found with a valid vehicle ID number
Applied to: Extract Vehicle ID Number, Format VIN with 'VIN' Prefix, Store in VIN Array
WHEN
The vehicle ID number is not spaces or low-values
THEN
The system formats the vehicle ID with 'VIN' prefix and stores it in the VIN description array, then increments the VIN counter
Context: Motor vehicle segment processing has completed
GIVEN
Motor vehicle segment processing has completed
Applied to: VIN Quantity = 0?
WHEN
The VIN quantity counter equals zero indicating no VINs were found in MV segments
THEN
The system initiates co-loaded shipment VIN processing as an alternative source
Context: No VINs were found in motor vehicle segments
GIVEN
No VINs were found in motor vehicle segments
Applied to: Initialize Co-Load Process
WHEN
Co-loaded shipment processing begins
THEN
The system resets VIN counter to zero and prepares to search RF reference segments for consolidated shipments
Context: Co-loaded shipment processing is active
GIVEN
Co-loaded shipment processing is active
Applied to: Get RF Reference Segment
WHEN
The system searches for RF type segments with sequential numbering
THEN
Each RF segment is retrieved to check for consolidated shipment indicators
Context: An RF reference segment has been retrieved
GIVEN
An RF reference segment has been retrieved
Applied to: Has Consolidated Shipment Number?
WHEN
The system checks the segment for consolidated shipment indicators
THEN
If a consolidated shipment number is present, the system proceeds to process V2 motor vehicle segments within that consolidation
Context: A consolidated shipment with RF segment has been identified
GIVEN
A consolidated shipment with RF segment has been identified
Applied to: Loop Through V2 Motor Vehicle Segments
WHEN
The system loops through V2 motor vehicle segments within the consolidation
THEN
Each V2 segment is processed sequentially until no more segments are found or maximum vehicle limit is reached
Context: A V2 motor vehicle segment is found within a consolidated shipment
GIVEN
A V2 motor vehicle segment is found within a consolidated shipment
Applied to: Extract Co-Load Vehicle ID, Format Co-Load VIN with Prefix, Store Co-Load VIN in Array
WHEN
The vehicle ID number in the V2 segment is not spaces or empty
THEN
The system formats the vehicle ID with 'VIN' prefix, stores it in the VIN array if under the maximum limit, and increments the VIN counter
R-GCCS309C-cbl-00198 (+5) File: GCCS309C.cbl M12 Segment Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M12 Segment Processing':
  • Context - a manifest requires m12 segment processing for customs:
    For Set in-bond type code to '61':
    When the system creates the m12 segment, then the in-bond type code is set to '61'.
  • Context - m12 segment processing is required:
    For Initialize M12 segment structure:
    When the system begins m12 segment creation, then the m12 segment structure is initialized to clear any previous values.
  • Context - m12 segment structure is initialized:
    For Set segment identifier to 'M12':
    When the system populates the segment identifier, then the segment identifier is set to 'm12'.
  • Context - m12 segment is populated with required data:
    For Prepare transmission data:
    When the system prepares the segment for transmission, then the m12 segment data is moved to the transmission data structure.
  • Context - m12 segment is ready for transmission:
    For Increment sequence number:
    When the system assigns sequence numbering, then the sequence number is incremented by 1 and assigned to the m12 segment.
  • Context - m12 segment is prepared with all required data and sequence number:
    For Create M12 segment for customs processing:
    When the system creates the segment for transmission, then the m12 segment is created in the transmission system for customs processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest requires M12 segment processing for customs
GIVEN
A manifest requires M12 segment processing for customs
Applied to: Set in-bond type code to '61'
WHEN
The system creates the M12 segment
THEN
The in-bond type code is set to '61'
Context: M12 segment processing is required
GIVEN
M12 segment processing is required
Applied to: Initialize M12 segment structure
WHEN
The system begins M12 segment creation
THEN
The M12 segment structure is initialized to clear any previous values
Context: M12 segment structure is initialized
GIVEN
M12 segment structure is initialized
Applied to: Set segment identifier to 'M12'
WHEN
The system populates the segment identifier
THEN
The segment identifier is set to 'M12'
Context: M12 segment is populated with required data
GIVEN
M12 segment is populated with required data
Applied to: Prepare transmission data
WHEN
The system prepares the segment for transmission
THEN
The M12 segment data is moved to the transmission data structure
Context: M12 segment is ready for transmission
GIVEN
M12 segment is ready for transmission
Applied to: Increment sequence number
WHEN
The system assigns sequence numbering
THEN
The sequence number is incremented by 1 and assigned to the M12 segment
Context: M12 segment is prepared with all required data and sequence number
GIVEN
M12 segment is prepared with all required data and sequence number
Applied to: Create M12 segment for customs processing
WHEN
The system creates the segment for transmission
THEN
The M12 segment is created in the transmission system for customs processing
R-GCX122A-cbl-00199 (+7) File: GCX122A.cbl Validate Merlin User IDs Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Merlin User IDs':
  • Context - the system needs to validate dc-p merlin user ids:
    For Get DC-P Merlin ID 1 from Admin Table:
    When the system retrieves dc-p merlin id 1 from the admin table with table id 'ad' and sequence id 'adminid', then the dc-p merlin id 1 is obtained from the admin table segment.
  • Context - dc-p merlin id 1 has been retrieved from the admin table:
    For Is DC-P Merlin ID 1 Valid?:
    When the system validates the dc-p merlin id 1 and the status code is blank (valid user found), then the dc-p merlin id 1 is set as valid and the dc-p id found flag is set to true.
    For Set Default 'OM01247' as DC-P Merlin ID 1:
    When the system validates the dc-p merlin id 1 and the status code is not blank (invalid user), then the system sets 'om01247' as the default dc-p merlin id 1 and marks the dc-p id 1 as not found.
  • Context - ifs merlin id 2 has been retrieved from the admin table:
    For Is IFS Merlin ID 2 Valid?:
    When the system validates the ifs merlin id 2, then if the status code is blank, the ifs merlin id 2 is set as valid, otherwise dc-p merlin id 1 is used as the ifs merlin id.
  • Context - hhs merlin id 3 has been retrieved from the admin table:
    For Is HHS Merlin ID 3 Valid?:
    When the system validates the hhs merlin id 3, then if the status code is blank, the hhs merlin id 3 is set as valid, otherwise dc-p merlin id 1 is used as the hhs merlin id.
  • Context - ims merlin id 4 has been retrieved from the admin table:
    For Is IMS Merlin ID 4 Valid?:
    When the system validates the ims merlin id 4, then if the status code is blank, the ims merlin id 4 is set as valid, otherwise dc-p merlin id 1 is used as the ims merlin id.
  • Context - a supervisor merlin id has been retrieved from the terminal table:
    For Is Supervisor Merlin ID Valid?:
    When the system validates the supervisor merlin id, then if the status code is blank, the supervisor merlin id is set as valid, otherwise an invalid supervisor id error message is added and the supervisor merlin id is cleared.
  • Context - the dc-p merlin id validation has been completed:
    For Add DC-P Invalid ID Error Message:
    When the dc-p id found flag is set to false (not found), then an error message 'dc&p merlin userid invalid' is added to the message text and mst entry.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to validate DC-P Merlin user IDs
GIVEN
The system needs to validate DC-P Merlin user IDs
Applied to: Get DC-P Merlin ID 1 from Admin Table
WHEN
The system retrieves DC-P Merlin ID 1 from the admin table with table ID 'AD' and sequence ID 'ADMINID'
THEN
The DC-P Merlin ID 1 is obtained from the admin table segment
Context: DC-P Merlin ID 1 has been retrieved from the admin table
GIVEN
DC-P Merlin ID 1 has been retrieved from the admin table
Applied to: Is DC-P Merlin ID 1 Valid?
WHEN
The system validates the DC-P Merlin ID 1 and the status code is blank (valid user found)
THEN
The DC-P Merlin ID 1 is set as valid and the DC-P ID found flag is set to true
Applied to: Set Default 'OM01247' as DC-P Merlin ID 1
WHEN
The system validates the DC-P Merlin ID 1 and the status code is not blank (invalid user)
THEN
The system sets 'OM01247' as the default DC-P Merlin ID 1 and marks the DC-P ID 1 as not found
Context: IFS Merlin ID 2 has been retrieved from the admin table
GIVEN
IFS Merlin ID 2 has been retrieved from the admin table
Applied to: Is IFS Merlin ID 2 Valid?
WHEN
The system validates the IFS Merlin ID 2
THEN
If the status code is blank, the IFS Merlin ID 2 is set as valid, otherwise DC-P Merlin ID 1 is used as the IFS Merlin ID
Context: HHS Merlin ID 3 has been retrieved from the admin table
GIVEN
HHS Merlin ID 3 has been retrieved from the admin table
Applied to: Is HHS Merlin ID 3 Valid?
WHEN
The system validates the HHS Merlin ID 3
THEN
If the status code is blank, the HHS Merlin ID 3 is set as valid, otherwise DC-P Merlin ID 1 is used as the HHS Merlin ID
Context: IMS Merlin ID 4 has been retrieved from the admin table
GIVEN
IMS Merlin ID 4 has been retrieved from the admin table
Applied to: Is IMS Merlin ID 4 Valid?
WHEN
The system validates the IMS Merlin ID 4
THEN
If the status code is blank, the IMS Merlin ID 4 is set as valid, otherwise DC-P Merlin ID 1 is used as the IMS Merlin ID
Context: A supervisor Merlin ID has been retrieved from the terminal table
GIVEN
A supervisor Merlin ID has been retrieved from the terminal table
Applied to: Is Supervisor Merlin ID Valid?
WHEN
The system validates the supervisor Merlin ID
THEN
If the status code is blank, the supervisor Merlin ID is set as valid, otherwise an invalid supervisor ID error message is added and the supervisor Merlin ID is cleared
Context: The DC-P Merlin ID validation has been completed
GIVEN
The DC-P Merlin ID validation has been completed
Applied to: Add DC-P Invalid ID Error Message
WHEN
The DC-P ID found flag is set to false (not found)
THEN
An error message 'DC&P MERLIN USERID INVALID' is added to the message text and MST entry
R-GCCS309C-cbl-00204 (+5) File: GCCS309C.cbl R4 Port Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'R4 Port Processing':
  • Context - a manifest is being processed for r4 origin port segment creation:
    For Set Port Function Code 'O' for Origin / Set Port Function Code 'J' for Junction:
    When the system checks the destination type (309-destination vs other), then if destination type is 309-destination, set port function code to 'o' (origin), otherwise set port function code to 'j' (junction).
  • Context - a manifest is being processed with origin country code and in-transit status:
    For Override Country Code to 'CA':
    When the in-transit status equals 'r' (return status), then override the country code to 'ca' regardless of the original origin country.
  • Context - a manifest is being processed for customs district r4 segment with port function code '4':
    For Use Manifest From Trans Code / Use Manifest To Trans Code:
    When the system checks the csa indicator status, then if csa indicator is on, use manifest from transaction code as location identifier, otherwise use manifest to transaction code as location identifier.
  • Context - a manifest is being processed for destination port r4 segment:
    For Set Sub-Location Code as Terminal Name:
    When the destination type is not 309-destination, then set the sub-location code as the terminal name in the r4 segment.
  • Context - a manifest is being processed for final destination r4 segment creation:
    For Set Port Function Code 'E' for Export / Set Port Function Code 'R' for Rail:
    When the system checks the destination type (309-destination vs other), then if destination type is 309-destination, set port function code to 'e' (export), otherwise set port function code to 'r' (rail destination).
  • Context - a manifest is being processed for origin and final destination r4 segments:
    For Set Destination Station State Code:
    When the system processes state/province codes for different destination types, then for 309-destination, assign origin station state code to r4-08-prov-state-code for origin segment, and for non-309 destinations, assign origin station state code to r4-08-prov-state-code for origin segment and destination station state code to r4-08-prov-state-code for final destination segment.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for R4 origin port segment creation
GIVEN
A manifest is being processed for R4 origin port segment creation
Applied to: Set Port Function Code 'O' for Origin / Set Port Function Code 'J' for Junction
WHEN
The system checks the destination type (309-DESTINATION vs other)
THEN
If destination type is 309-DESTINATION, set port function code to 'O' (Origin), otherwise set port function code to 'J' (Junction)
Context: A manifest is being processed with origin country code and in-transit status
GIVEN
A manifest is being processed with origin country code and in-transit status
Applied to: Override Country Code to 'CA'
WHEN
The in-transit status equals 'R' (return status)
THEN
Override the country code to 'CA' regardless of the original origin country
Context: A manifest is being processed for customs district R4 segment with port function code '4'
GIVEN
A manifest is being processed for customs district R4 segment with port function code '4'
Applied to: Use Manifest From Trans Code / Use Manifest To Trans Code
WHEN
The system checks the CSA indicator status
THEN
If CSA indicator is ON, use manifest from transaction code as location identifier, otherwise use manifest to transaction code as location identifier
Context: A manifest is being processed for destination port R4 segment
GIVEN
A manifest is being processed for destination port R4 segment
Applied to: Set Sub-Location Code as Terminal Name
WHEN
The destination type is NOT 309-DESTINATION
THEN
Set the sub-location code as the terminal name in the R4 segment
Context: A manifest is being processed for final destination R4 segment creation
GIVEN
A manifest is being processed for final destination R4 segment creation
Applied to: Set Port Function Code 'E' for Export / Set Port Function Code 'R' for Rail
WHEN
The system checks the destination type (309-DESTINATION vs other)
THEN
If destination type is 309-DESTINATION, set port function code to 'E' (Export), otherwise set port function code to 'R' (Rail destination)
Context: A manifest is being processed for origin and final destination R4 segments
GIVEN
A manifest is being processed for origin and final destination R4 segments
Applied to: Set Destination Station State Code
WHEN
The system processes state/province codes for different destination types
THEN
For 309-DESTINATION, assign origin station state code to R4-08-PROV-STATE-CODE for origin segment, and for non-309 destinations, assign origin station state code to R4-08-PROV-STATE-CODE for origin segment and destination station state code to R4-08-PROV-STATE-CODE for final destination segment
R-GCX122A-cbl-00207 (+7) File: GCX122A.cbl Send Cargo Messages to Merlin Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Cargo Messages to Merlin':
  • Context - a cargo error message needs to be sent to merlin users:
    For Clear Message Recipients:
    When the system prepares to route the message, then all recipient fields are cleared to spaces to ensure no residual data affects message routing.
  • Context - a cargo error message is ready to be sent and recipient fields are cleared:
    For Set Primary Merlin User as Recipient:
    When the system sets up the primary message recipient, then the supervisor merlin user id is assigned as the first recipient in the user codes array.
  • Context - a cargo error message is prepared with primary merlin user as recipient:
    For Send Message to Primary User:
    When the system attempts to send the message via emcsend2 service, then the message is transmitted to the merlin messaging system with all required message details including subject, keywords, and text content.
  • Context - a cargo error message has been sent to the primary merlin user:
    For Message Delivery Successful?:
    When the system checks the message delivery status, then if the return status flag equals 0, the message delivery is considered successful, otherwise it is considered failed.
  • Context - the primary cargo error message delivery has failed:
    For Clear Recipients for Fallback:
    When the system prepares for fallback message routing, then all recipient fields including copy usercode and to usercode are cleared to spaces.
  • Context - primary cargo error message delivery has failed and recipient fields are cleared:
    For Set Default User OM01247 as Recipient:
    When the system sets up fallback message routing, then the default user id 'om01247' is assigned as the first recipient in the user codes array.
  • Context - primary cargo message delivery failed and default user om01247 is set as recipient:
    For Send Message to Default User:
    When the system attempts fallback message delivery via emcsend2 service, then the message is transmitted to the default user with the same message content including subject, keywords, and text.
  • Context - cargo error message has been sent either successfully to primary user or to default user as fallback:
    For Purge Message Queue:
    When the system completes message processing, then the message queue is purged using cims service with purg function to clean up resources.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo error message needs to be sent to Merlin users
GIVEN
A cargo error message needs to be sent to Merlin users
Applied to: Clear Message Recipients
WHEN
The system prepares to route the message
THEN
All recipient fields are cleared to spaces to ensure no residual data affects message routing
Context: A cargo error message is ready to be sent and recipient fields are cleared
GIVEN
A cargo error message is ready to be sent and recipient fields are cleared
Applied to: Set Primary Merlin User as Recipient
WHEN
The system sets up the primary message recipient
THEN
The supervisor Merlin user ID is assigned as the first recipient in the user codes array
Context: A cargo error message is prepared with primary Merlin user as recipient
GIVEN
A cargo error message is prepared with primary Merlin user as recipient
Applied to: Send Message to Primary User
WHEN
The system attempts to send the message via EMCSEND2 service
THEN
The message is transmitted to the Merlin messaging system with all required message details including subject, keywords, and text content
Context: A cargo error message has been sent to the primary Merlin user
GIVEN
A cargo error message has been sent to the primary Merlin user
Applied to: Message Delivery Successful?
WHEN
The system checks the message delivery status
THEN
If the return status flag equals 0, the message delivery is considered successful, otherwise it is considered failed
Context: The primary cargo error message delivery has failed
GIVEN
The primary cargo error message delivery has failed
Applied to: Clear Recipients for Fallback
WHEN
The system prepares for fallback message routing
THEN
All recipient fields including copy usercode and to usercode are cleared to spaces
Context: Primary cargo error message delivery has failed and recipient fields are cleared
GIVEN
Primary cargo error message delivery has failed and recipient fields are cleared
Applied to: Set Default User OM01247 as Recipient
WHEN
The system sets up fallback message routing
THEN
The default user ID 'OM01247' is assigned as the first recipient in the user codes array
Context: Primary cargo message delivery failed and default user OM01247 is set as recipient
GIVEN
Primary cargo message delivery failed and default user OM01247 is set as recipient
Applied to: Send Message to Default User
WHEN
The system attempts fallback message delivery via EMCSEND2 service
THEN
The message is transmitted to the default user with the same message content including subject, keywords, and text
Context: Cargo error message has been sent either successfully to primary user or to default user as fallback
GIVEN
Cargo error message has been sent either successfully to primary user or to default user as fallback
Applied to: Purge Message Queue
WHEN
The system completes message processing
THEN
The message queue is purged using CIMS service with PURG function to clean up resources
R-GCCCCADD-cbl-00210 (+29) File: GCCCCADD.cblFile: GCCS309C.cbl Address Validation Merged 30 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Address Validation':
  • Context - a shipper record is being processed:
    For Set Default US Country Code:
    When shipper address line 2 is empty or (first position is not empty and positions 2-18 are all spaces), then set shipper country code to 'us' and shipper address line 2 to 'na'.
  • Context - a shipper record with a non-empty address line 2 and state/province code:
    For Lookup Shipper State/Province:
    When the shipper state/province code needs country determination, then search the state-country lookup table using the shipper state/province code to find the corresponding country code.
  • Context - a state-country lookup has been performed for shipper state/province code:
    For Set Shipper Country Code from Table:
    When a matching entry is found in the lookup table, then set the shipper country code to the country value from the matching table entry.
  • Context - a shipper record with a state/province code that requires country determination:
    For Generate Invalid State Error:
    When the shipper state/province code is not found in the state-country lookup table, then generate an invalid shipper province/state code error message and add it to the message collection.
  • Context - a consignee record is being processed:
    For Set Default CA Country Code:
    When consignee address line 2 is empty or (first position is not empty and positions 2-18 are all spaces), then set consignee country code to 'ca' and consignee address line 2 to 'na'.
  • Context - a consignee record with a non-empty address line 2 and state/province code:
    For Lookup Consignee State/Province:
    When the consignee state/province code needs country determination, then search the state-country lookup table using the consignee state/province code to find the corresponding country code.
  • Context - a state-country lookup has been performed for consignee state/province code:
    For Set Consignee Country Code from Table:
    When a matching entry is found in the lookup table, then set the consignee country code to the country value from the matching table entry.
  • Context - a consignee record with a state/province code that requires country determination:
    For Generate Invalid State Error:
    When the consignee state/province code is not found in the state-country lookup table, then generate an invalid consignee province/state code error message and add it to the message collection.
  • Context - a notify party name exists in the shipment record:
    For Copy Consignee Country Code to Notify Party:
    When processing notify party address information, then copy consignee address line 1, address line 2, and country code to the corresponding notify party fields.
  • Context - an entity record (n1 segment) with an entity id and name:
    For Generate Missing Address Error:
    When the address line 1 is empty, then generate a required address information error message.
  • Context - an address record with a city name:
    For Generate City Length Error:
    When the city name length is less than 2 characters, then generate a minimum length requirement error message for city name.
  • Context - an address record with a non-empty postal code:
    For Generate Postal Code Length Error:
    When the postal code length is less than 3 characters, then generate a minimum length requirement error message for postal code.
  • Context - an address record with country code of ca, us, or mx and a state/province code:
    For Generate Invalid State/Country Error:
    When the state/province code is not found in the lookup table for the specified country, then generate an invalid state/province code error message.
  • Context - an address record with empty country code but valid state/province code:
    For Validate State/Country Combination:
    When the country code field is empty, then search the state-country lookup table and set the country code based on the state/province match.
  • Context - an address record that has completed all validation steps:
    For Complete Address Validation:
    When the country code field is still empty, then generate a required country code error message.
  • Context - a manifest requires entity address processing:
    For Get Entity Record from Database:
    When the system processes entity records for n1-n3-n4 segment creation, then entity records are retrieved from gcsccs55 cargo data array up to maximum sequence number.
  • Context - an entity record is being processed for address validation:
    For Entity Record Exists?:
    When the system checks if the entity record contains valid data, then processing continues only if the record is not spaces or low-values, otherwise the record is skipped.
  • Context - an entity record exists and needs address processing:
    For Destination Type Check:
    When the system evaluates the destination configuration, then if 309-destination flag is set, apply 4040 validation rules, otherwise apply 5040 validation rules.
  • Context - the destination type is 4040 and an entity record exists:
    For Check 4040 Valid N1 Code:
    When the system validates the entity identification code, then the entity code is checked against ws-valid-4040-n1 validation table.
  • Context - the destination type is 5040 and an entity record exists:
    For Check 5040 Valid N1 Code:
    When the system validates the entity identification code, then the entity code is checked against ws-valid-5040-n1 validation table.
  • Context - an entity code has been validated against 4040 requirements:
    For Valid N1 Code for 4040?:
    When the system evaluates the validation result, then if the entity code is valid for 4040 destination, proceed to create segments, otherwise skip the entity.
  • Context - an entity code has been validated against 5040 requirements:
    For Valid N1 Code for 5040?:
    When the system evaluates the validation result, then if the entity code is valid for 5040 destination, proceed to additional address validation, otherwise skip the entity.
  • Context - an entity has passed 5040 code validation:
    For City Name Present?:
    When the system checks address completeness, then if city name (gccs-n401-city-name) is spaces, the entity is skipped, otherwise validation continues.
  • Context - an entity has city name present for 5040 destination:
    For Country Code Present?:
    When the system checks country code completeness, then if country code (gccs-n404-country-cde) is spaces, the entity is skipped, otherwise validation continues.
  • Context - an entity has country code present for 5040 destination:
    For Postal Code Present for US/CA?:
    When the system checks postal code requirements based on country, then if country is us or ca and postal code (gccs-n403-postal-cde) is spaces, the entity is skipped, otherwise validation continues.
  • Context - an entity has passed postal code validation for 5040 destination:
    For State/Province Code Present for US/CA?:
    When the system checks state/province code requirements based on country, then if country is us or ca and state/province code (gccs-n402-state-prov-cde) is spaces, the entity is skipped, otherwise proceed to address mapping check.
  • Context - an entity has passed all address validation checks for 5040 destination:
    For Check Consignee-Importer Address Mapping:
    When the system performs consignee-importer address mapping, then the n20625-check-cn-importer procedure is executed to validate address mapping relationships.
  • Context - an entity has passed all validation checks:
    For Create N1-N3-N4 Segments:
    When the system creates address segments, then n1, n3, n4, and per segments are created through n2063-each-n1-n3-n4-per procedure.
  • Context - an entity has failed validation checks:
    For Skip Entity - Initialize Record:
    When the system determines the entity should be skipped, then the gcsccs55 entity record is initialized to spaces to skip further processing.
  • Context - current entity processing is complete (either created segments or skipped):
    For Continue to Next Entity:
    When the system moves to process the next entity, then processing continues with the next entity record in the gcsccs55 array until maximum sequence is reached.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper record is being processed
GIVEN
A shipper record is being processed
Applied to: Set Default US Country Code
WHEN
Shipper address line 2 is empty OR (first position is not empty AND positions 2-18 are all spaces)
THEN
Set shipper country code to 'US' and shipper address line 2 to 'NA'
Context: A shipper record with a non-empty address line 2 and state/province code
GIVEN
A shipper record with a non-empty address line 2 and state/province code
Applied to: Lookup Shipper State/Province
WHEN
The shipper state/province code needs country determination
THEN
Search the state-country lookup table using the shipper state/province code to find the corresponding country code
Context: A state-country lookup has been performed for shipper state/province code
GIVEN
A state-country lookup has been performed for shipper state/province code
Applied to: Set Shipper Country Code from Table
WHEN
A matching entry is found in the lookup table
THEN
Set the shipper country code to the country value from the matching table entry
Context: A shipper record with a state/province code that requires country determination
GIVEN
A shipper record with a state/province code that requires country determination
Applied to: Generate Invalid State Error
WHEN
The shipper state/province code is not found in the state-country lookup table
THEN
Generate an invalid shipper province/state code error message and add it to the message collection
Context: A consignee record is being processed
GIVEN
A consignee record is being processed
Applied to: Set Default CA Country Code
WHEN
Consignee address line 2 is empty OR (first position is not empty AND positions 2-18 are all spaces)
THEN
Set consignee country code to 'CA' and consignee address line 2 to 'NA'
Context: A consignee record with a non-empty address line 2 and state/province code
GIVEN
A consignee record with a non-empty address line 2 and state/province code
Applied to: Lookup Consignee State/Province
WHEN
The consignee state/province code needs country determination
THEN
Search the state-country lookup table using the consignee state/province code to find the corresponding country code
Context: A state-country lookup has been performed for consignee state/province code
GIVEN
A state-country lookup has been performed for consignee state/province code
Applied to: Set Consignee Country Code from Table
WHEN
A matching entry is found in the lookup table
THEN
Set the consignee country code to the country value from the matching table entry
Context: A consignee record with a state/province code that requires country determination
GIVEN
A consignee record with a state/province code that requires country determination
Applied to: Generate Invalid State Error
WHEN
The consignee state/province code is not found in the state-country lookup table
THEN
Generate an invalid consignee province/state code error message and add it to the message collection
Context: A notify party name exists in the shipment record
GIVEN
A notify party name exists in the shipment record
Applied to: Copy Consignee Country Code to Notify Party
WHEN
Processing notify party address information
THEN
Copy consignee address line 1, address line 2, and country code to the corresponding notify party fields
Context: An entity record (N1 segment) with an entity ID and name
GIVEN
An entity record (N1 segment) with an entity ID and name
Applied to: Generate Missing Address Error
WHEN
The address line 1 is empty
THEN
Generate a required address information error message
Context: An address record with a city name
GIVEN
An address record with a city name
Applied to: Generate City Length Error
WHEN
The city name length is less than 2 characters
THEN
Generate a minimum length requirement error message for city name
Context: An address record with a non-empty postal code
GIVEN
An address record with a non-empty postal code
Applied to: Generate Postal Code Length Error
WHEN
The postal code length is less than 3 characters
THEN
Generate a minimum length requirement error message for postal code
Context: An address record with country code of CA, US, or MX and a state/province code
GIVEN
An address record with country code of CA, US, or MX and a state/province code
Applied to: Generate Invalid State/Country Error
WHEN
The state/province code is not found in the lookup table for the specified country
THEN
Generate an invalid state/province code error message
Context: An address record with empty country code but valid state/province code
GIVEN
An address record with empty country code but valid state/province code
Applied to: Validate State/Country Combination
WHEN
The country code field is empty
THEN
Search the state-country lookup table and set the country code based on the state/province match
Context: An address record that has completed all validation steps
GIVEN
An address record that has completed all validation steps
Applied to: Complete Address Validation
WHEN
The country code field is still empty
THEN
Generate a required country code error message
Context: A manifest requires entity address processing
GIVEN
A manifest requires entity address processing
Applied to: Get Entity Record from Database
WHEN
The system processes entity records for N1-N3-N4 segment creation
THEN
Entity records are retrieved from GCSCCS55 cargo data array up to maximum sequence number
Context: An entity record is being processed for address validation
GIVEN
An entity record is being processed for address validation
Applied to: Entity Record Exists?
WHEN
The system checks if the entity record contains valid data
THEN
Processing continues only if the record is not spaces or low-values, otherwise the record is skipped
Context: An entity record exists and needs address processing
GIVEN
An entity record exists and needs address processing
Applied to: Destination Type Check
WHEN
The system evaluates the destination configuration
THEN
If 309-DESTINATION flag is set, apply 4040 validation rules, otherwise apply 5040 validation rules
Context: The destination type is 4040 and an entity record exists
GIVEN
The destination type is 4040 and an entity record exists
Applied to: Check 4040 Valid N1 Code
WHEN
The system validates the entity identification code
THEN
The entity code is checked against WS-VALID-4040-N1 validation table
Context: The destination type is 5040 and an entity record exists
GIVEN
The destination type is 5040 and an entity record exists
Applied to: Check 5040 Valid N1 Code
WHEN
The system validates the entity identification code
THEN
The entity code is checked against WS-VALID-5040-N1 validation table
Context: An entity code has been validated against 4040 requirements
GIVEN
An entity code has been validated against 4040 requirements
Applied to: Valid N1 Code for 4040?
WHEN
The system evaluates the validation result
THEN
If the entity code is valid for 4040 destination, proceed to create segments, otherwise skip the entity
Context: An entity code has been validated against 5040 requirements
GIVEN
An entity code has been validated against 5040 requirements
Applied to: Valid N1 Code for 5040?
WHEN
The system evaluates the validation result
THEN
If the entity code is valid for 5040 destination, proceed to additional address validation, otherwise skip the entity
Context: An entity has passed 5040 code validation
GIVEN
An entity has passed 5040 code validation
Applied to: City Name Present?
WHEN
The system checks address completeness
THEN
If city name (GCCS-N401-CITY-NAME) is spaces, the entity is skipped, otherwise validation continues
Context: An entity has city name present for 5040 destination
GIVEN
An entity has city name present for 5040 destination
Applied to: Country Code Present?
WHEN
The system checks country code completeness
THEN
If country code (GCCS-N404-COUNTRY-CDE) is spaces, the entity is skipped, otherwise validation continues
Context: An entity has country code present for 5040 destination
GIVEN
An entity has country code present for 5040 destination
Applied to: Postal Code Present for US/CA?
WHEN
The system checks postal code requirements based on country
THEN
If country is US or CA and postal code (GCCS-N403-POSTAL-CDE) is spaces, the entity is skipped, otherwise validation continues
Context: An entity has passed postal code validation for 5040 destination
GIVEN
An entity has passed postal code validation for 5040 destination
Applied to: State/Province Code Present for US/CA?
WHEN
The system checks state/province code requirements based on country
THEN
If country is US or CA and state/province code (GCCS-N402-STATE-PROV-CDE) is spaces, the entity is skipped, otherwise proceed to address mapping check
Context: An entity has passed all address validation checks for 5040 destination
GIVEN
An entity has passed all address validation checks for 5040 destination
Applied to: Check Consignee-Importer Address Mapping
WHEN
The system performs consignee-importer address mapping
THEN
The N20625-CHECK-CN-IMPORTER procedure is executed to validate address mapping relationships
Context: An entity has passed all validation checks
GIVEN
An entity has passed all validation checks
Applied to: Create N1-N3-N4 Segments
WHEN
The system creates address segments
THEN
N1, N3, N4, and PER segments are created through N2063-EACH-N1-N3-N4-PER procedure
Context: An entity has failed validation checks
GIVEN
An entity has failed validation checks
Applied to: Skip Entity - Initialize Record
WHEN
The system determines the entity should be skipped
THEN
The GCSCCS55 entity record is initialized to spaces to skip further processing
Context: Current entity processing is complete (either created segments or skipped)
GIVEN
Current entity processing is complete (either created segments or skipped)
Applied to: Continue to Next Entity
WHEN
The system moves to process the next entity
THEN
Processing continues with the next entity record in the GCSCCS55 array until maximum sequence is reached
R-GCCS309C-cbl-00210 (+6) File: GCCS309C.cbl VID Equipment Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'VID Equipment Processing':
  • Context - a manifest record with equipment information is being processed for vid segment creation:
    For Set Equipment Description to 'CN' - Container / Set Equipment Description to 'RR' - Rail Car:
    When the system checks the conveying car field in the manifest data, then if conveying car field contains data, set equipment description code to 'cn' for container, otherwise set to 'rr' for rail car.
  • Context - a vid segment is being created for equipment identification:
    For Set Equipment Initial from Manifest:
    When the equipment initial field is populated from manifest data, then the equipment car initial from manifest is assigned to the vid equipment initial field.
    For Set Equipment Number from Manifest:
    When the equipment number field is populated from manifest data, then the equipment car number from manifest is assigned to the vid equipment number field.
  • Context - a vid segment requires an equipment initial identifier:
    For Default Equipment Initial to 'NONZ':
    When the equipment car initial field in manifest data is empty or spaces, then set the equipment initial to default value 'nonz'.
  • Context - a vid segment requires an equipment number identifier:
    For Default Equipment Number to '00000000':
    When the equipment car number field in manifest data is empty, spaces, or contains zeros, then set the equipment number to default value '00000000'.
  • Context - a vid segment is being created with equipment status information:
    For Set Load/Empty Status from Manifest:
    When the load empty status field is populated from manifest data, then the load empty status from manifest is assigned to the vid load empty status code field.
  • Context - a vid segment is being prepared for equipment identification:
    For Clear Seal Number Fields:
    When seal number fields need to be initialized, then set both seal number fields to spaces as seal data is processed in separate segments.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with equipment information is being processed for VID segment creation
GIVEN
A manifest record with equipment information is being processed for VID segment creation
Applied to: Set Equipment Description to 'CN' - Container / Set Equipment Description to 'RR' - Rail Car
WHEN
The system checks the conveying car field in the manifest data
THEN
If conveying car field contains data, set equipment description code to 'CN' for container, otherwise set to 'RR' for rail car
Context: A VID segment is being created for equipment identification
GIVEN
A VID segment is being created for equipment identification
Applied to: Set Equipment Initial from Manifest
WHEN
The equipment initial field is populated from manifest data
THEN
The equipment car initial from manifest is assigned to the VID equipment initial field
Applied to: Set Equipment Number from Manifest
WHEN
The equipment number field is populated from manifest data
THEN
The equipment car number from manifest is assigned to the VID equipment number field
Context: A VID segment requires an equipment initial identifier
GIVEN
A VID segment requires an equipment initial identifier
Applied to: Default Equipment Initial to 'NONZ'
WHEN
The equipment car initial field in manifest data is empty or spaces
THEN
Set the equipment initial to default value 'NONZ'
Context: A VID segment requires an equipment number identifier
GIVEN
A VID segment requires an equipment number identifier
Applied to: Default Equipment Number to '00000000'
WHEN
The equipment car number field in manifest data is empty, spaces, or contains zeros
THEN
Set the equipment number to default value '00000000'
Context: A VID segment is being created with equipment status information
GIVEN
A VID segment is being created with equipment status information
Applied to: Set Load/Empty Status from Manifest
WHEN
The load empty status field is populated from manifest data
THEN
The load empty status from manifest is assigned to the VID load empty status code field
Context: A VID segment is being prepared for equipment identification
GIVEN
A VID segment is being prepared for equipment identification
Applied to: Clear Seal Number Fields
WHEN
Seal number fields need to be initialized
THEN
Set both seal number fields to spaces as seal data is processed in separate segments
R-GCX122A-cbl-00215 (+10) File: GCX122A.cbl Send Train Messages to Merlin Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Train Messages to Merlin':
  • Context - a train error message needs to be sent to merlin users:
    For Clear Message Recipients:
    When the system prepares to send the message, then all message recipient fields are cleared to spaces.
  • Context - a train error message is being prepared for sending:
    For Set Primary Recipient to Supervisor Merlin ID:
    When the primary recipient needs to be determined, then the supervisor merlin id is set as the first recipient in the message.
  • Context - a train error message is prepared with primary recipient set:
    For Send Message to Primary Recipient via EMCSEND2:
    When the system attempts to send the message, then the message is sent via emcsend2 service to the primary recipient.
  • Context - a train error message was sent to the primary recipient:
    For Message Send Successful?:
    When the message send operation completes, then if the return status flag is not 0, the send failed and fallback processing is required.
  • Context - the primary train error message send has failed:
    For Set Default Recipient to OM01247:
    When a fallback recipient needs to be established, then the recipient is set to the default support id 'om01247'.
  • Context - the primary message send failed and default recipient is set to om01247:
    For Retry Send to Default Recipient:
    When the system retries the message send, then the message is sent via emcsend2 service to the default recipient.
  • Context - a train error message send attempt has been completed:
    For Purge Message Queue:
    When the message processing is finished, then the message queue is purged using cims purg function.
  • Context - a train error message has been processed:
    For Send Copy to CAERROR File:
    When additional logging is required, then a copy of the message is sent to the caerror destination file.
  • Context - a train error message copy needs to be sent to caerror file:
    For Set Recipient to OM01247 for Error File:
    When the error file recipient is being configured, then the recipient is set to 'om01247' for the error file destination.
  • Context - a train error message copy is prepared for caerror file with recipient set to om01247:
    For Send to CAERROR Destination:
    When the system sends the audit copy, then the message is sent via emcsend2 service to the caerror destination.
  • Context - all train error message sends including caerror copy have been completed:
    For Final Purge Message Queue:
    When the message processing workflow is finishing, then the message queue is purged using cims purg function for final cleanup.
👨‍💻 Technical ACs (Gherkin)
Context: A train error message needs to be sent to Merlin users
GIVEN
A train error message needs to be sent to Merlin users
Applied to: Clear Message Recipients
WHEN
The system prepares to send the message
THEN
All message recipient fields are cleared to spaces
Context: A train error message is being prepared for sending
GIVEN
A train error message is being prepared for sending
Applied to: Set Primary Recipient to Supervisor Merlin ID
WHEN
The primary recipient needs to be determined
THEN
The supervisor Merlin ID is set as the first recipient in the message
Context: A train error message is prepared with primary recipient set
GIVEN
A train error message is prepared with primary recipient set
Applied to: Send Message to Primary Recipient via EMCSEND2
WHEN
The system attempts to send the message
THEN
The message is sent via EMCSEND2 service to the primary recipient
Context: A train error message was sent to the primary recipient
GIVEN
A train error message was sent to the primary recipient
Applied to: Message Send Successful?
WHEN
The message send operation completes
THEN
If the return status flag is not 0, the send failed and fallback processing is required
Context: The primary train error message send has failed
GIVEN
The primary train error message send has failed
Applied to: Set Default Recipient to OM01247
WHEN
A fallback recipient needs to be established
THEN
The recipient is set to the default support ID 'OM01247'
Context: The primary message send failed and default recipient is set to OM01247
GIVEN
The primary message send failed and default recipient is set to OM01247
Applied to: Retry Send to Default Recipient
WHEN
The system retries the message send
THEN
The message is sent via EMCSEND2 service to the default recipient
Context: A train error message send attempt has been completed
GIVEN
A train error message send attempt has been completed
Applied to: Purge Message Queue
WHEN
The message processing is finished
THEN
The message queue is purged using CIMS PURG function
Context: A train error message has been processed
GIVEN
A train error message has been processed
Applied to: Send Copy to CAERROR File
WHEN
Additional logging is required
THEN
A copy of the message is sent to the CAERROR destination file
Context: A train error message copy needs to be sent to CAERROR file
GIVEN
A train error message copy needs to be sent to CAERROR file
Applied to: Set Recipient to OM01247 for Error File
WHEN
The error file recipient is being configured
THEN
The recipient is set to 'OM01247' for the error file destination
Context: A train error message copy is prepared for CAERROR file with recipient set to OM01247
GIVEN
A train error message copy is prepared for CAERROR file with recipient set to OM01247
Applied to: Send to CAERROR Destination
WHEN
The system sends the audit copy
THEN
The message is sent via EMCSEND2 service to the CAERROR destination
Context: All train error message sends including CAERROR copy have been completed
GIVEN
All train error message sends including CAERROR copy have been completed
Applied to: Final Purge Message Queue
WHEN
The message processing workflow is finishing
THEN
The message queue is purged using CIMS PURG function for final cleanup
R-GCCS309C-cbl-00217 (+8) File: GCCS309C.cbl M7 Seal Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'M7 Seal Processing':
  • Context - a seal processing operation is in progress with a current seal counter position:
    For Seal counter ≤ 20 AND seal number exists?:
    When the system checks if more seals need to be processed, then continue processing if seal counter is 20 or less and the seal number at current position is not empty or low-values, otherwise stop processing.
  • Context - a new m7 segment needs to be created for seal numbers:
    For Initialize M7 segment:
    When the system starts processing a group of up to 4 seals, then initialize the m7 segment structure to clear any previous data.
  • Context - an initialized m7 segment structure:
    For Set M7 identifier:
    When the system needs to identify the segment type, then set the m7 identifier to 'm7 ' to indicate this is a seal number segment.
  • Context - a seal counter position pointing to a potential seal number:
    For First seal number valid?:
    When the system checks if the first seal number is valid (not spaces or low-values), then if valid, move the seal number to m7-01-seal-number field.
  • Context - a seal counter incremented to the next position after processing first seal:
    For Second seal number valid?:
    When the system checks if the second seal number is valid (not spaces or low-values), then if valid, move the seal number to m7-02-seal-number field.
  • Context - a seal counter incremented to the next position after processing second seal:
    For Third seal number valid?:
    When the system checks if the third seal number is valid (not spaces or low-values), then if valid, move the seal number to m7-03-seal-number field.
  • Context - a seal counter incremented to the next position after processing third seal:
    For Fourth seal number valid?:
    When the system checks if the fourth seal number is valid (not spaces or low-values), then if valid, move the seal number to m7-04-seal-number field.
  • Context - a populated m7 segment with seal numbers:
    For Format M7 segment:
    When the system prepares the segment for transmission, then replace all underscore characters with spaces in the m7 segment.
  • Context - a formatted m7 segment with seal numbers and sequence number incremented:
    For Create M7 transmission segment:
    When the system creates the transmission segment, then move the m7 segment to transmission data, set accept status to spaces, and perform transmission creation.
👨‍💻 Technical ACs (Gherkin)
Context: A seal processing operation is in progress with a current seal counter position
GIVEN
A seal processing operation is in progress with a current seal counter position
Applied to: Seal counter ≤ 20 AND seal number exists?
WHEN
The system checks if more seals need to be processed
THEN
Continue processing if seal counter is 20 or less AND the seal number at current position is not empty or low-values, otherwise stop processing
Context: A new M7 segment needs to be created for seal numbers
GIVEN
A new M7 segment needs to be created for seal numbers
Applied to: Initialize M7 segment
WHEN
The system starts processing a group of up to 4 seals
THEN
Initialize the M7 segment structure to clear any previous data
Context: An initialized M7 segment structure
GIVEN
An initialized M7 segment structure
Applied to: Set M7 identifier
WHEN
The system needs to identify the segment type
THEN
Set the M7 identifier to 'M7 ' to indicate this is a seal number segment
Context: A seal counter position pointing to a potential seal number
GIVEN
A seal counter position pointing to a potential seal number
Applied to: First seal number valid?
WHEN
The system checks if the first seal number is valid (not spaces or low-values)
THEN
If valid, move the seal number to M7-01-SEAL-NUMBER field
Context: A seal counter incremented to the next position after processing first seal
GIVEN
A seal counter incremented to the next position after processing first seal
Applied to: Second seal number valid?
WHEN
The system checks if the second seal number is valid (not spaces or low-values)
THEN
If valid, move the seal number to M7-02-SEAL-NUMBER field
Context: A seal counter incremented to the next position after processing second seal
GIVEN
A seal counter incremented to the next position after processing second seal
Applied to: Third seal number valid?
WHEN
The system checks if the third seal number is valid (not spaces or low-values)
THEN
If valid, move the seal number to M7-03-SEAL-NUMBER field
Context: A seal counter incremented to the next position after processing third seal
GIVEN
A seal counter incremented to the next position after processing third seal
Applied to: Fourth seal number valid?
WHEN
The system checks if the fourth seal number is valid (not spaces or low-values)
THEN
If valid, move the seal number to M7-04-SEAL-NUMBER field
Context: A populated M7 segment with seal numbers
GIVEN
A populated M7 segment with seal numbers
Applied to: Format M7 segment
WHEN
The system prepares the segment for transmission
THEN
Replace all underscore characters with spaces in the M7 segment
Context: A formatted M7 segment with seal numbers and sequence number incremented
GIVEN
A formatted M7 segment with seal numbers and sequence number incremented
Applied to: Create M7 transmission segment
WHEN
The system creates the transmission segment
THEN
Move the M7 segment to transmission data, set accept status to spaces, and perform transmission creation
R-GCCCCADD-cbl-00225 (+6) File: GCCCCADD.cbl Default Address Setting Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Default Address Setting':
  • Context - a shipment record is being processed for customs manifest creation:
    For Set Shipper Address 1 to 'NA':
    When the shipper address line 1 field is empty or contains only spaces, then the system sets the shipper address line 1 to 'na' as the default value.
    For Set Consignee Address 1 to 'NA':
    When the consignee address line 1 field is empty or contains only spaces, then the system sets the consignee address line 1 to 'na' as the default value.
  • Context - a shipment record is being processed and shipper address line 1 has been validated:
    For Set Shipper Address 2 to 'NA' and Country to 'US':
    When the shipper address line 2 is empty or the first character is not empty but characters 2-18 are all spaces, then the system sets shipper address line 2 to 'na' for positions 1-18 and sets the shipper country code to 'us'.
  • Context - a shipment record is being processed and consignee address line 1 has been validated:
    For Set Consignee Address 2 to 'NA' and Country to 'CA':
    When the consignee address line 2 is empty or the first character is not empty but characters 2-18 are all spaces, then the system sets consignee address line 2 to 'na' for positions 1-18 and sets the consignee country code to 'ca'.
  • Context - the processing is called from gcx011 system and shipper postal code is not empty:
    For Pad Shipper Postal Code with Periods:
    When the shipper postal code length is less than 5 characters, then the system pads the shipper postal code with periods starting from position 5 to make it 5 characters total.
  • Context - the processing is called from gcx011 system and consignee postal code is not empty:
    For Pad Consignee Postal Code with Periods:
    When the consignee postal code length is less than 5 characters, then the system pads the consignee postal code with periods starting from position 5 to make it 5 characters total.
  • Context - the processing is called from gcx011 system and notify party postal code is not empty:
    For Pad Notify Party Postal Code with Periods:
    When the notify party postal code length is less than 5 characters, then the system pads the notify party postal code with periods starting from position 5 to make it 5 characters total.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record is being processed for customs manifest creation
GIVEN
A shipment record is being processed for customs manifest creation
Applied to: Set Shipper Address 1 to 'NA'
WHEN
The shipper address line 1 field is empty or contains only spaces
THEN
The system sets the shipper address line 1 to 'NA' as the default value
Applied to: Set Consignee Address 1 to 'NA'
WHEN
The consignee address line 1 field is empty or contains only spaces
THEN
The system sets the consignee address line 1 to 'NA' as the default value
Context: A shipment record is being processed and shipper address line 1 has been validated
GIVEN
A shipment record is being processed and shipper address line 1 has been validated
Applied to: Set Shipper Address 2 to 'NA' and Country to 'US'
WHEN
The shipper address line 2 is empty OR the first character is not empty but characters 2-18 are all spaces
THEN
The system sets shipper address line 2 to 'NA' for positions 1-18 and sets the shipper country code to 'US'
Context: A shipment record is being processed and consignee address line 1 has been validated
GIVEN
A shipment record is being processed and consignee address line 1 has been validated
Applied to: Set Consignee Address 2 to 'NA' and Country to 'CA'
WHEN
The consignee address line 2 is empty OR the first character is not empty but characters 2-18 are all spaces
THEN
The system sets consignee address line 2 to 'NA' for positions 1-18 and sets the consignee country code to 'CA'
Context: The processing is called from GCX011 system and shipper postal code is not empty
GIVEN
The processing is called from GCX011 system and shipper postal code is not empty
Applied to: Pad Shipper Postal Code with Periods
WHEN
The shipper postal code length is less than 5 characters
THEN
The system pads the shipper postal code with periods starting from position 5 to make it 5 characters total
Context: The processing is called from GCX011 system and consignee postal code is not empty
GIVEN
The processing is called from GCX011 system and consignee postal code is not empty
Applied to: Pad Consignee Postal Code with Periods
WHEN
The consignee postal code length is less than 5 characters
THEN
The system pads the consignee postal code with periods starting from position 5 to make it 5 characters total
Context: The processing is called from GCX011 system and notify party postal code is not empty
GIVEN
The processing is called from GCX011 system and notify party postal code is not empty
Applied to: Pad Notify Party Postal Code with Periods
WHEN
The notify party postal code length is less than 5 characters
THEN
The system pads the notify party postal code with periods starting from position 5 to make it 5 characters total
R-GCCS309C-cbl-00226 (+17) File: GCCS309C.cbl N10 Description Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N10 Description Processing':
  • Context - a manifest record requires n10 segment processing:
    For Initialize N10 segment:
    When the n10 processing begins, then the n10 segment structure is initialized to empty values.
  • Context - a manifest contains lading quantity information:
    For Set lading quantity from manifest:
    When processing the n10 segment for quantity data, then the manifest lading quantity is assigned to the n10 quantity field.
  • Context - a manifest contains shipper load and count information:
    For Set shipper load and count description:
    When processing the n10 segment description field, then the shipper load and count data is assigned to the n10 free form description field.
  • Context - a manifest has weight unit qualifier of 'kg ' or ' kg':
    For Set weight unit code to 'K' for KG:
    When determining the weight unit code for n10 segment, then the weight unit code is set to 'k'.
  • Context - a manifest has weight unit qualifier of 'lb ' or ' lb':
    For Set weight unit code to 'L' for LB:
    When determining the weight unit code for n10 segment, then the weight unit code is set to 'l'.
  • Context - a manifest has weight unit qualifier that is not 'kg', ' kg', 'lb', or ' lb':
    For Set weight unit code to 'E' for other:
    When determining the weight unit code for n10 segment, then the weight unit code is set to 'e'.
  • Context - a manifest contains weight information:
    For Set weight from manifest:
    When processing the n10 segment weight field, then the manifest weight value is assigned to the n10 weight field.
  • Context - a manifest record represents an idler car (ws-idler-car-found is true):
    For Set quantity to zero for idler:
    When setting the quantity for the n10 segment, then the quantity is set to zero regardless of the original lading quantity.
  • Context - a manifest record is not an idler car (ws-idler-car-found is false):
    For Keep original lading quantity:
    When setting the quantity for the n10 segment, then the original lading quantity from the manifest is retained.
  • Context - a manifest contains lading quantity qualifier information:
    For Set manifest unit code:
    When processing the n10 segment unit code field, then the lading quantity qualifier is assigned to the n10 manifest unit code field.
  • Context - all n10 segment fields have been populated with manifest data:
    For Create primary N10 segment:
    When creating the primary n10 transmission segment, then the n10 segment is created and added to the transmission with incremented sequence number.
  • Context - a manifest contains lading description information:
    For Extract lading description from manifest:
    When processing description data for additional n10 segments, then the lading description is extracted and prepared for segment creation.
  • Context - lading description data exists in an array format:
    For Process description array:
    When processing the description array for n10 segments, then each non-empty description line is identified for individual n10 segment creation.
  • Context - description processing is in progress with a current description index:
    For More description lines?:
    When checking for additional description lines to process, then continue processing if description index is within bounds and description line is not empty, otherwise end processing.
  • Context - additional description lines exist for processing:
    For Create additional N10 segment:
    When creating additional n10 segments for description data, then a new n10 segment structure is initialized for description-only content.
  • Context - an n10 segment is being created for description-only content:
    For Set quantity to zero for description:
    When setting the quantity field for the description n10 segment, then the quantity is set to zero since this segment contains only descriptive text.
  • Context - a specific description line from the description array is being processed:
    For Set description text:
    When setting the description field for an n10 segment, then the description line text is assigned to the n10 free form description field.
  • Context - an n10 segment with description text and zero quantity is prepared:
    For Create description N10 segment:
    When creating the description n10 transmission segment, then the n10 segment is created and added to the transmission with incremented sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record requires N10 segment processing
GIVEN
A manifest record requires N10 segment processing
Applied to: Initialize N10 segment
WHEN
The N10 processing begins
THEN
The N10 segment structure is initialized to empty values
Context: A manifest contains lading quantity information
GIVEN
A manifest contains lading quantity information
Applied to: Set lading quantity from manifest
WHEN
Processing the N10 segment for quantity data
THEN
The manifest lading quantity is assigned to the N10 quantity field
Context: A manifest contains shipper load and count information
GIVEN
A manifest contains shipper load and count information
Applied to: Set shipper load and count description
WHEN
Processing the N10 segment description field
THEN
The shipper load and count data is assigned to the N10 free form description field
Context: A manifest has weight unit qualifier of 'KG ' or ' KG'
GIVEN
A manifest has weight unit qualifier of 'KG ' or ' KG'
Applied to: Set weight unit code to 'K' for KG
WHEN
Determining the weight unit code for N10 segment
THEN
The weight unit code is set to 'K'
Context: A manifest has weight unit qualifier of 'LB ' or ' LB'
GIVEN
A manifest has weight unit qualifier of 'LB ' or ' LB'
Applied to: Set weight unit code to 'L' for LB
WHEN
Determining the weight unit code for N10 segment
THEN
The weight unit code is set to 'L'
Context: A manifest has weight unit qualifier that is not 'KG', ' KG', 'LB', or ' LB'
GIVEN
A manifest has weight unit qualifier that is not 'KG', ' KG', 'LB', or ' LB'
Applied to: Set weight unit code to 'E' for other
WHEN
Determining the weight unit code for N10 segment
THEN
The weight unit code is set to 'E'
Context: A manifest contains weight information
GIVEN
A manifest contains weight information
Applied to: Set weight from manifest
WHEN
Processing the N10 segment weight field
THEN
The manifest weight value is assigned to the N10 weight field
Context: A manifest record represents an idler car (WS-IDLER-CAR-FOUND is true)
GIVEN
A manifest record represents an idler car (WS-IDLER-CAR-FOUND is true)
Applied to: Set quantity to zero for idler
WHEN
Setting the quantity for the N10 segment
THEN
The quantity is set to zero regardless of the original lading quantity
Context: A manifest record is not an idler car (WS-IDLER-CAR-FOUND is false)
GIVEN
A manifest record is not an idler car (WS-IDLER-CAR-FOUND is false)
Applied to: Keep original lading quantity
WHEN
Setting the quantity for the N10 segment
THEN
The original lading quantity from the manifest is retained
Context: A manifest contains lading quantity qualifier information
GIVEN
A manifest contains lading quantity qualifier information
Applied to: Set manifest unit code
WHEN
Processing the N10 segment unit code field
THEN
The lading quantity qualifier is assigned to the N10 manifest unit code field
Context: All N10 segment fields have been populated with manifest data
GIVEN
All N10 segment fields have been populated with manifest data
Applied to: Create primary N10 segment
WHEN
Creating the primary N10 transmission segment
THEN
The N10 segment is created and added to the transmission with incremented sequence number
Context: A manifest contains lading description information
GIVEN
A manifest contains lading description information
Applied to: Extract lading description from manifest
WHEN
Processing description data for additional N10 segments
THEN
The lading description is extracted and prepared for segment creation
Context: Lading description data exists in an array format
GIVEN
Lading description data exists in an array format
Applied to: Process description array
WHEN
Processing the description array for N10 segments
THEN
Each non-empty description line is identified for individual N10 segment creation
Context: Description processing is in progress with a current description index
GIVEN
Description processing is in progress with a current description index
Applied to: More description lines?
WHEN
Checking for additional description lines to process
THEN
Continue processing if description index is within bounds and description line is not empty, otherwise end processing
Context: Additional description lines exist for processing
GIVEN
Additional description lines exist for processing
Applied to: Create additional N10 segment
WHEN
Creating additional N10 segments for description data
THEN
A new N10 segment structure is initialized for description-only content
Context: An N10 segment is being created for description-only content
GIVEN
An N10 segment is being created for description-only content
Applied to: Set quantity to zero for description
WHEN
Setting the quantity field for the description N10 segment
THEN
The quantity is set to zero since this segment contains only descriptive text
Context: A specific description line from the description array is being processed
GIVEN
A specific description line from the description array is being processed
Applied to: Set description text
WHEN
Setting the description field for an N10 segment
THEN
The description line text is assigned to the N10 free form description field
Context: An N10 segment with description text and zero quantity is prepared
GIVEN
An N10 segment with description text and zero quantity is prepared
Applied to: Create description N10 segment
WHEN
Creating the description N10 transmission segment
THEN
The N10 segment is created and added to the transmission with incremented sequence number
R-GCX122A-cbl-00226 (+5) File: GCX122A.cbl Send MST Messages Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send MST Messages':
  • Context - the system needs to send messages through mst:
    For Set MST Communication Parameters:
    When mst communication is being initialized, then the system sets origin terminal to 'ists' and transaction code to 'gct122'.
  • Context - mst communication parameters are configured:
    For Initialize MST Session:
    When starting mst message transmission, then the system calls smstonly with call letters and header record to establish the session.
  • Context - mst session is initialized:
    For Send Message Header:
    When beginning message transmission, then the system sends the message header record as the first entry in the message text array.
  • Context - message transmission is in progress:
    For More Message Entries?:
    When processing message entries, then the system continues sending entries until it encounters a blank entry indicating no more content.
  • Context - there are more message entries to send:
    For Send Next Message Entry:
    When processing each message entry, then the system calls smstonly with the current message entry content.
  • Context - all message entries have been sent:
    For Send Wrap-Up Command:
    When completing mst transmission, then the system sets user function code to 'wrap' and calls smstonly to close the session.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to send messages through MST
GIVEN
The system needs to send messages through MST
Applied to: Set MST Communication Parameters
WHEN
MST communication is being initialized
THEN
The system sets origin terminal to 'ISTS' and transaction code to 'GCT122'
Context: MST communication parameters are configured
GIVEN
MST communication parameters are configured
Applied to: Initialize MST Session
WHEN
Starting MST message transmission
THEN
The system calls SMSTONLY with call letters and header record to establish the session
Context: MST session is initialized
GIVEN
MST session is initialized
Applied to: Send Message Header
WHEN
Beginning message transmission
THEN
The system sends the message header record as the first entry in the message text array
Context: Message transmission is in progress
GIVEN
Message transmission is in progress
Applied to: More Message Entries?
WHEN
Processing message entries
THEN
The system continues sending entries until it encounters a blank entry indicating no more content
Context: There are more message entries to send
GIVEN
There are more message entries to send
Applied to: Send Next Message Entry
WHEN
Processing each message entry
THEN
The system calls SMSTONLY with the current message entry content
Context: All message entries have been sent
GIVEN
All message entries have been sent
Applied to: Send Wrap-Up Command
WHEN
Completing MST transmission
THEN
The system sets user function code to 'WRAP' and calls SMSTONLY to close the session
R-GCCCBOL-cbl-00227 (+5) File: GCCCBOL.cbl Compress Descriptions Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Compress Descriptions':
  • Context - the system has processed cargo shipment data:
    For Are cargo descriptions available?:
    When the description compression process is initiated, then the system should verify that cargo descriptions (ws-desc-1) contain actual data and are not empty spaces before proceeding with compression.
  • Context - cargo descriptions are available for compression:
    For Set compression parameters:
    When the compression parameters need to be set, then the system should set the primary description length to 45000 characters and secondary description length to 22500 characters.
  • Context - description compression parameters are configured with ws-length-1 set to 45000 and ws-length-2 set to 22500:
    For Call GCCCOMP program:
    When the description compression is required, then the system should call the gcccomp program with cccom control block, ws-desc-1 source descriptions, ws-desc-2 target descriptions, and the configured length parameters.
  • Context - the gcccomp program has successfully compressed the cargo descriptions into ws-desc-gccc-description:
    For Transfer compressed description to cargo report:
    When the compressed description is not empty spaces, then the system should move the compressed description from ws-desc-gccc-description to gccc-lading-description.
  • Context - the description compression process has completed:
    For Are there extra descriptions?:
    When checking for additional description content, then the system should verify if the first two characters of ws-desc-gccc-extra-description contain data that is not spaces or low-values.
  • Context - extra descriptions exist in ws-desc-gccc-extra-description with content that is not spaces or low-values:
    For Call GCCDESC to store excess descriptions:
    When excess description storage is required, then the system should call the gccdesc program with cccom control block, gccc-ccn-key cargo control number, ws-desc-2 extra descriptions, and isrt insert operation code.
👨‍💻 Technical ACs (Gherkin)
Context: The system has processed cargo shipment data
GIVEN
The system has processed cargo shipment data
Applied to: Are cargo descriptions available?
WHEN
The description compression process is initiated
THEN
The system should verify that cargo descriptions (WS-DESC-1) contain actual data and are not empty spaces before proceeding with compression
Context: Cargo descriptions are available for compression
GIVEN
Cargo descriptions are available for compression
Applied to: Set compression parameters
WHEN
The compression parameters need to be set
THEN
The system should set the primary description length to 45000 characters and secondary description length to 22500 characters
Context: Description compression parameters are configured with WS-LENGTH-1 set to 45000 and WS-LENGTH-2 set to 22500
GIVEN
Description compression parameters are configured with WS-LENGTH-1 set to 45000 and WS-LENGTH-2 set to 22500
Applied to: Call GCCCOMP program
WHEN
The description compression is required
THEN
The system should call the GCCCOMP program with CCCOM control block, WS-DESC-1 source descriptions, WS-DESC-2 target descriptions, and the configured length parameters
Context: The GCCCOMP program has successfully compressed the cargo descriptions into WS-DESC-GCCC-DESCRIPTION
GIVEN
The GCCCOMP program has successfully compressed the cargo descriptions into WS-DESC-GCCC-DESCRIPTION
Applied to: Transfer compressed description to cargo report
WHEN
The compressed description is not empty spaces
THEN
The system should move the compressed description from WS-DESC-GCCC-DESCRIPTION to GCCC-LADING-DESCRIPTION
Context: The description compression process has completed
GIVEN
The description compression process has completed
Applied to: Are there extra descriptions?
WHEN
Checking for additional description content
THEN
The system should verify if the first two characters of WS-DESC-GCCC-EXTRA-DESCRIPTION contain data that is not spaces or low-values
Context: Extra descriptions exist in WS-DESC-GCCC-EXTRA-DESCRIPTION with content that is not spaces or low-values
GIVEN
Extra descriptions exist in WS-DESC-GCCC-EXTRA-DESCRIPTION with content that is not spaces or low-values
Applied to: Call GCCDESC to store excess descriptions
WHEN
Excess description storage is required
THEN
The system should call the GCCDESC program with CCCOM control block, GCCC-CCN-KEY cargo control number, WS-DESC-2 extra descriptions, and ISRT insert operation code
R-GCCCCADD-cbl-00232 (+11) File: GCCCCADD.cbl Commodity Description Building Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Commodity Description Building':
  • Context - shipcomm data is available with commodity description fields:
    For Extract 10 Commodity Description Lines:
    When the system processes commodity description building, then all 10 commodity description lines from shipcomm are extracted and stored in working storage description array.
  • Context - shiproot data is available with free form description fields:
    For Extract 2 Free Form Description Lines from SHIPROOT:
    When the system processes commodity description building, then both free form description lines from shiproot are extracted and stored in working storage description array.
  • Context - special handling codes exist in the shipment data:
    For Check Special Handling Code:
    When the system processes each special handling code entry up to 7 entries, then each special handling code is evaluated for inclusion in commodity description.
  • Context - a special handling code is being processed:
    For Code = VA, EV, or VS?:
    When the special handling code is va (valuable), ev (extremely valuable), or vs (valuable shipment), then the code and its instructions are included in the commodity description.
  • Context - a special handling code of type va, ev, or vs is identified:
    For Extract Special Handling Code and Instructions:
    When the system processes the special handling entry, then both the special handling code and its instructions are extracted and formatted for inclusion.
  • Context - special handling code and instructions have been extracted:
    For Add to Special Handling Description Array:
    When the system adds the information to the description array, then the special handling information is placed in the first available position in the special handling description array (positions 1, 2, or 3).
  • Context - the system is processing special handling codes:
    For More Special Handling Codes?:
    When the current counter is less than 7 and more special handling codes exist, then the system continues to the next special handling code for evaluation.
  • Context - all description components have been extracted (shipcomm descriptions, shiproot free form descriptions, and special handling descriptions):
    For Combine All Description Components:
    When the system combines all description components, then all description elements are merged into a single comprehensive description structure.
  • Context - all description components have been combined:
    For Prepare Description for Compression:
    When the system prepares for compression, then description data is formatted with proper length parameters (45000 for source, 22500 for target) for compression utility.
  • Context - description data is prepared for compression with proper length parameters:
    For Call GCCCOMP Utility for Data Compression:
    When the gcccomp utility is called with the description data, then the description data is compressed according to the utility's compression algorithm.
  • Context - description data has been compressed by the gcccomp utility:
    For Store Compressed Description in GCCC-LADING-DESCRIPTION:
    When the system stores the compressed description, then the compressed description is stored in gccc-lading-description field for the customs record.
  • Context - compressed description data is available:
    For Distribute Description Data to GCSCCS53 Array:
    When the system distributes the description data, then the description data is distributed across all 46 positions of the gcsccs53 cargo data array.
👨‍💻 Technical ACs (Gherkin)
Context: SHIPCOMM data is available with commodity description fields
GIVEN
SHIPCOMM data is available with commodity description fields
Applied to: Extract 10 Commodity Description Lines
WHEN
The system processes commodity description building
THEN
All 10 commodity description lines from SHIPCOMM are extracted and stored in working storage description array
Context: SHIPROOT data is available with free form description fields
GIVEN
SHIPROOT data is available with free form description fields
Applied to: Extract 2 Free Form Description Lines from SHIPROOT
WHEN
The system processes commodity description building
THEN
Both free form description lines from SHIPROOT are extracted and stored in working storage description array
Context: Special handling codes exist in the shipment data
GIVEN
Special handling codes exist in the shipment data
Applied to: Check Special Handling Code
WHEN
The system processes each special handling code entry up to 7 entries
THEN
Each special handling code is evaluated for inclusion in commodity description
Context: A special handling code is being processed
GIVEN
A special handling code is being processed
Applied to: Code = VA, EV, or VS?
WHEN
The special handling code is VA (Valuable), EV (Extremely Valuable), or VS (Valuable Shipment)
THEN
The code and its instructions are included in the commodity description
Context: A special handling code of type VA, EV, or VS is identified
GIVEN
A special handling code of type VA, EV, or VS is identified
Applied to: Extract Special Handling Code and Instructions
WHEN
The system processes the special handling entry
THEN
Both the special handling code and its instructions are extracted and formatted for inclusion
Context: Special handling code and instructions have been extracted
GIVEN
Special handling code and instructions have been extracted
Applied to: Add to Special Handling Description Array
WHEN
The system adds the information to the description array
THEN
The special handling information is placed in the first available position in the special handling description array (positions 1, 2, or 3)
Context: The system is processing special handling codes
GIVEN
The system is processing special handling codes
Applied to: More Special Handling Codes?
WHEN
The current counter is less than 7 and more special handling codes exist
THEN
The system continues to the next special handling code for evaluation
Context: All description components have been extracted (SHIPCOMM descriptions, SHIPROOT free form descriptions, and special handling descriptions)
GIVEN
All description components have been extracted (SHIPCOMM descriptions, SHIPROOT free form descriptions, and special handling descriptions)
Applied to: Combine All Description Components
WHEN
The system combines all description components
THEN
All description elements are merged into a single comprehensive description structure
Context: All description components have been combined
GIVEN
All description components have been combined
Applied to: Prepare Description for Compression
WHEN
The system prepares for compression
THEN
Description data is formatted with proper length parameters (45000 for source, 22500 for target) for compression utility
Context: Description data is prepared for compression with proper length parameters
GIVEN
Description data is prepared for compression with proper length parameters
Applied to: Call GCCCOMP Utility for Data Compression
WHEN
The GCCCOMP utility is called with the description data
THEN
The description data is compressed according to the utility's compression algorithm
Context: Description data has been compressed by the GCCCOMP utility
GIVEN
Description data has been compressed by the GCCCOMP utility
Applied to: Store Compressed Description in GCCC-LADING-DESCRIPTION
WHEN
The system stores the compressed description
THEN
The compressed description is stored in GCCC-LADING-DESCRIPTION field for the customs record
Context: Compressed description data is available
GIVEN
Compressed description data is available
Applied to: Distribute Description Data to GCSCCS53 Array
WHEN
The system distributes the description data
THEN
The description data is distributed across all 46 positions of the GCSCCS53 cargo data array
R-GCX122A-cbl-00232 (+9) File: GCX122A.cbl Process Arrival Notifications Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Arrival Notifications':
  • Context - a cargo record exists with an arrival indicator field:
    For Check Cargo Arrival Indicator:
    When the system processes cargo acknowledgment, then the system checks if the arrival indicator equals 'y' to determine if arrival processing is required.
  • Context - cargo has arrival indicator set to 'y':
    For Initialize Arrival Transaction Input:
    When the system begins arrival processing, then the system initializes the arrival transaction input structure to prepare for transaction creation.
  • Context - arrival transaction input is initialized:
    For Set Security Parameters:
    When the system prepares arrival transaction, then the system sets security byte to high-value for transaction authorization.
  • Context - a cargo record with a valid cargo control number key:
    For Extract Cargo Control Number:
    When the system creates arrival transaction, then the system assigns the cargo control number key to the arrival transaction identifier field.
  • Context - an arrival transaction is being created for cargo:
    For Set Transaction Type to 'CAA':
    When the system configures transaction parameters, then the system sets the action code to 'caa' to identify this as a cargo arrival transaction.
  • Context - a cargo record contains manifest transaction code information:
    For Get Port Code from Manifest:
    When the system creates arrival transaction, then the system extracts the port code from the manifest from transaction code field and assigns it to the arrival transaction.
  • Context - all arrival transaction parameters are configured:
    For Prepare Arrival Message:
    When the system finalizes arrival processing, then the system copies the complete arrival input structure to the outbound message format.
  • Context - a complete arrival message is prepared:
    For Send Arrival Transaction to GCT1481E:
    When the system processes cargo arrival, then the system sends the arrival transaction to gct1481e system for further processing.
  • Context - an arrival transaction has been sent to gct1481e:
    For Write Message to Log:
    When the system completes arrival processing, then the system writes the arrival message details to the system log for audit trail.
  • Context - arrival transaction and logging are completed:
    For Purge Message Queue:
    When the system finalizes arrival processing, then the system purges the message queue to clean up transaction resources.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with an arrival indicator field
GIVEN
A cargo record exists with an arrival indicator field
Applied to: Check Cargo Arrival Indicator
WHEN
The system processes cargo acknowledgment
THEN
The system checks if the arrival indicator equals 'Y' to determine if arrival processing is required
Context: Cargo has arrival indicator set to 'Y'
GIVEN
Cargo has arrival indicator set to 'Y'
Applied to: Initialize Arrival Transaction Input
WHEN
The system begins arrival processing
THEN
The system initializes the arrival transaction input structure to prepare for transaction creation
Context: Arrival transaction input is initialized
GIVEN
Arrival transaction input is initialized
Applied to: Set Security Parameters
WHEN
The system prepares arrival transaction
THEN
The system sets security byte to high-value for transaction authorization
Context: A cargo record with a valid cargo control number key
GIVEN
A cargo record with a valid cargo control number key
Applied to: Extract Cargo Control Number
WHEN
The system creates arrival transaction
THEN
The system assigns the cargo control number key to the arrival transaction identifier field
Context: An arrival transaction is being created for cargo
GIVEN
An arrival transaction is being created for cargo
Applied to: Set Transaction Type to 'CAA'
WHEN
The system configures transaction parameters
THEN
The system sets the action code to 'CAA' to identify this as a cargo arrival transaction
Context: A cargo record contains manifest transaction code information
GIVEN
A cargo record contains manifest transaction code information
Applied to: Get Port Code from Manifest
WHEN
The system creates arrival transaction
THEN
The system extracts the port code from the manifest from transaction code field and assigns it to the arrival transaction
Context: All arrival transaction parameters are configured
GIVEN
All arrival transaction parameters are configured
Applied to: Prepare Arrival Message
WHEN
The system finalizes arrival processing
THEN
The system copies the complete arrival input structure to the outbound message format
Context: A complete arrival message is prepared
GIVEN
A complete arrival message is prepared
Applied to: Send Arrival Transaction to GCT1481E
WHEN
The system processes cargo arrival
THEN
The system sends the arrival transaction to GCT1481E system for further processing
Context: An arrival transaction has been sent to GCT1481E
GIVEN
An arrival transaction has been sent to GCT1481E
Applied to: Write Message to Log
WHEN
The system completes arrival processing
THEN
The system writes the arrival message details to the system log for audit trail
Context: Arrival transaction and logging are completed
GIVEN
Arrival transaction and logging are completed
Applied to: Purge Message Queue
WHEN
The system finalizes arrival processing
THEN
The system purges the message queue to clean up transaction resources
R-GCCCBOL-cbl-00233 (+2) File: GCCCBOL.cbl Store Extra Descriptions Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Store Extra Descriptions':
  • Context - the system has processed cargo description data and populated the extra description field:
    For Check Extra Description Data:
    When the extra description field contains data that is not empty spaces and not low-values, then the system calls the gccdesc program to store the extra description data in gcsccs53 segments using the cargo control number key and insert operation.
  • Context - the system has processed cargo description data:
    For Extra Description Not Empty?:
    When the extra description field is empty spaces or contains low-values in the first two positions, then the system skips the description storage process and continues with normal processing flow.
  • Context - extra description data exists and is valid for storage:
    For Call GCCDESC Program:
    When the system needs to store overflow description information, then the system calls the gccdesc program with the cargo control number key, extra description data, and insert operation flag.
👨‍💻 Technical ACs (Gherkin)
Context: The system has processed cargo description data and populated the extra description field
GIVEN
The system has processed cargo description data and populated the extra description field
Applied to: Check Extra Description Data
WHEN
The extra description field contains data that is not empty spaces and not low-values
THEN
The system calls the GCCDESC program to store the extra description data in GCSCCS53 segments using the cargo control number key and insert operation
Context: The system has processed cargo description data
GIVEN
The system has processed cargo description data
Applied to: Extra Description Not Empty?
WHEN
The extra description field is empty spaces or contains low-values in the first two positions
THEN
The system skips the description storage process and continues with normal processing flow
Context: Extra description data exists and is valid for storage
GIVEN
Extra description data exists and is valid for storage
Applied to: Call GCCDESC Program
WHEN
The system needs to store overflow description information
THEN
The system calls the GCCDESC program with the cargo control number key, extra description data, and insert operation flag
R-GCCCBOL-cbl-00236 (+7) File: GCCCBOL.cbl Process CSA Data Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process CSA Data':
  • Context - a shipment with destination and haulage carrier information:
    For Destination = 105 AND No Haulage Rights?:
    When the destination is 105 (canada) and there is no haulage rights carrier assigned, then the shipment is eligible for csa processing.
  • Context - an edi bol key is available for the shipment:
    For Check BOL for CSA:
    When searching for n1 importer segments with entity id 'im', non-blank name, qualifier 'm5'/'bn'/'ai', and non-blank id code, then return the importer segment if found, otherwise indicate not found.
  • Context - fastway shipment data is available and edi bol importer was not found:
    For Check Fastway for CSA:
    When searching for n1-01 'im' segments with n1-02 importer name, n1-03 qualifier ('m5'/'bn'/'ai'), and n1-04 business number, then extract and return the importer information if complete sequence is found.
  • Context - an importer record with entity id 'im', non-blank name, and business number qualifier:
    For Qualifies as CSA?:
    When the business number qualifier is 'm5', then set csa indicator to on and copy all importer data including name, qualifier, and business number.
    For Copy Importer Data:
    When the business number qualifier is 'bn' or 'ai' (not 'm5'), then copy importer data (name, qualifier, business number) without setting csa indicator.
  • Context - a shipment being processed for csa:
    For Set CSA Indicator OFF:
    When the shipment does not meet destination 105 criteria or has haulage carrier or no valid importer found, then set csa indicator to off.
  • Context - an n1 segment from edi bol data:
    For Extract Importer Information:
    When the segment has entity id code 'im' and name is not blank and id code qualifier is 'm5', 'bn', or 'ai' and id code is not blank, then consider the importer data valid and complete for csa processing.
  • Context - fastway shipment data segments:
    For Validate CSA Qualification:
    When a complete sequence exists with n1-01 'im', n1-02 importer name (not blank), n1-03 qualifier ('m5'/'bn'/'ai'), and n1-04 business number (not blank), then consider the importer information valid for csa processing.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with destination and haulage carrier information
GIVEN
A shipment with destination and haulage carrier information
Applied to: Destination = 105 AND No Haulage Rights?
WHEN
The destination is 105 (Canada) AND there is no haulage rights carrier assigned
THEN
The shipment is eligible for CSA processing
Context: An EDI BOL key is available for the shipment
GIVEN
An EDI BOL key is available for the shipment
Applied to: Check BOL for CSA
WHEN
Searching for N1 importer segments with entity ID 'IM', non-blank name, qualifier 'M5'/'BN'/'AI', and non-blank ID code
THEN
Return the importer segment if found, otherwise indicate not found
Context: Fastway shipment data is available and EDI BOL importer was not found
GIVEN
Fastway shipment data is available and EDI BOL importer was not found
Applied to: Check Fastway for CSA
WHEN
Searching for N1-01 'IM' segments with N1-02 importer name, N1-03 qualifier ('M5'/'BN'/'AI'), and N1-04 business number
THEN
Extract and return the importer information if complete sequence is found
Context: An importer record with entity ID 'IM', non-blank name, and business number qualifier
GIVEN
An importer record with entity ID 'IM', non-blank name, and business number qualifier
Applied to: Qualifies as CSA?
WHEN
The business number qualifier is 'M5'
THEN
Set CSA indicator to ON and copy all importer data including name, qualifier, and business number
Applied to: Copy Importer Data
WHEN
The business number qualifier is 'BN' or 'AI' (not 'M5')
THEN
Copy importer data (name, qualifier, business number) without setting CSA indicator
Context: A shipment being processed for CSA
GIVEN
A shipment being processed for CSA
Applied to: Set CSA Indicator OFF
WHEN
The shipment does not meet destination 105 criteria OR has haulage carrier OR no valid importer found
THEN
Set CSA indicator to OFF
Context: An N1 segment from EDI BOL data
GIVEN
An N1 segment from EDI BOL data
Applied to: Extract Importer Information
WHEN
The segment has entity ID code 'IM' AND name is not blank AND ID code qualifier is 'M5', 'BN', or 'AI' AND ID code is not blank
THEN
Consider the importer data valid and complete for CSA processing
Context: Fastway shipment data segments
GIVEN
Fastway shipment data segments
Applied to: Validate CSA Qualification
WHEN
A complete sequence exists with N1-01 'IM', N1-02 importer name (not blank), N1-03 qualifier ('M5'/'BN'/'AI'), and N1-04 business number (not blank)
THEN
Consider the importer information valid for CSA processing
R-GCX122A-cbl-00242 (+5) File: GCX122A.cbl Update Iron Highway Records Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Iron Highway Records':
  • Context - a cargo record has been processed and potentially updated:
    For Status Actually Changed?:
    When the system compares the saved original status with the current cargo status, then iron highway update processing continues only if the status values are different.
  • Context - a cargo status change requires iron highway notification:
    For Retrieve Iron Highway Configuration:
    When the system looks up iron highway configuration using the cargo origin station number as the key, then the system retrieves the ih table configuration if it exists.
  • Context - the system has attempted to retrieve iron highway configuration:
    For Iron Highway Config Found?:
    When the configuration lookup returns a status indicating success or failure, then iron highway processing continues only if configuration is found, otherwise the process terminates.
  • Context - iron highway configuration has been successfully retrieved:
    For Prepare Iron Highway Transaction Data:
    When the system prepares transaction data for iron highway update, then the system sets the record type from configuration, current cargo status, equipment id, waybill information, and cargo control number.
  • Context - iron highway transaction data is being prepared with cargo reference numbers:
    For Process Reference Numbers:
    When the system processes up to 10 reference number entries and finds a reference qualifier of 'cn', then the system extracts the corresponding reference number value and sets it as the shipment id.
  • Context - all iron highway transaction data has been prepared and validated:
    For Call Iron Highway System Update:
    When the system calls the iron highway interface program gccih, then the cargo status change is transmitted to the iron highway system with all relevant cargo details.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been processed and potentially updated
GIVEN
A cargo record has been processed and potentially updated
Applied to: Status Actually Changed?
WHEN
The system compares the saved original status with the current cargo status
THEN
Iron Highway update processing continues only if the status values are different
Context: A cargo status change requires Iron Highway notification
GIVEN
A cargo status change requires Iron Highway notification
Applied to: Retrieve Iron Highway Configuration
WHEN
The system looks up Iron Highway configuration using the cargo origin station number as the key
THEN
The system retrieves the IH table configuration if it exists
Context: The system has attempted to retrieve Iron Highway configuration
GIVEN
The system has attempted to retrieve Iron Highway configuration
Applied to: Iron Highway Config Found?
WHEN
The configuration lookup returns a status indicating success or failure
THEN
Iron Highway processing continues only if configuration is found, otherwise the process terminates
Context: Iron Highway configuration has been successfully retrieved
GIVEN
Iron Highway configuration has been successfully retrieved
Applied to: Prepare Iron Highway Transaction Data
WHEN
The system prepares transaction data for Iron Highway update
THEN
The system sets the record type from configuration, current cargo status, equipment ID, waybill information, and cargo control number
Context: Iron Highway transaction data is being prepared with cargo reference numbers
GIVEN
Iron Highway transaction data is being prepared with cargo reference numbers
Applied to: Process Reference Numbers
WHEN
The system processes up to 10 reference number entries and finds a reference qualifier of 'CN'
THEN
The system extracts the corresponding reference number value and sets it as the shipment ID
Context: All Iron Highway transaction data has been prepared and validated
GIVEN
All Iron Highway transaction data has been prepared and validated
Applied to: Call Iron Highway System Update
WHEN
The system calls the Iron Highway interface program GCCIH
THEN
The cargo status change is transmitted to the Iron Highway system with all relevant cargo details
R-GCCCCADD-cbl-00244 (+19) File: GCCCCADD.cbl Description Data Compression Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Description Data Compression':
  • Context - a shipment has commodity records with descriptions and shipment root with free-form descriptions:
    For Build Description from Multiple Sources:
    When the system builds the complete cargo description, then all commodity descriptions from shipcomm records (1-10) are included and all free-form descriptions from shiproot records (1-2) are included in the description workspace.
  • Context - shipment commodity records contain description data in fields 1 through 10:
    For Combine SHIPCOMM Commodity Descriptions:
    When the system processes commodity descriptions, then each commodity description line (cmod-desc 01 through 10) is moved to the corresponding workspace description field (ws-desc-fw-shipcomm 01 through 10).
  • Context - shipment root contains free-form description data in two fields:
    For Add SHIPROOT Free Form Descriptions:
    When the system processes free-form descriptions, then free-form description line 1 is moved to ws-desc-fw-shiproot field 1 and free-form description line 2 is moved to ws-desc-fw-shiproot field 2.
  • Context - a shipment has special handling codes and instructions defined:
    For Process Special Handling Codes:
    When the system processes special handling codes from positions 1 through 7, then each special handling code is evaluated to determine if it matches va, ev, or vs codes for inclusion in description.
  • Context - a special handling code is va, ev, or vs:
    For Add Special Handling Instructions:
    When the system processes the special handling code and instruction, then the handling code and instruction are combined and added to the first available special handling description field (ws-desc-fw-spcl-hndlg positions 1, 2, or 3).
  • Context - all description components have been collected from various sources:
    For Prepare Description for Compression:
    When the system prepares for description compression, then all description data is moved to ws-desc-2 workspace and compression length parameters are set to 45000 for input and 22500 for output.
  • Context - description data is prepared in ws-desc-2 with compression parameters set:
    For Call GCCCOMP Utility:
    When the system calls gcccomp utility with cccom, ws-desc-2, ws-desc, ws-desc-length, and ws-desc-length-2 parameters, then the description data is compressed and returned in ws-desc workspace.
  • Context - description data has been successfully compressed by gcccomp utility:
    For Store Compressed Description in GCCC-LADING-DESCRIPTION:
    When the system stores the compressed description, then the compressed description from ws-desc-db-gcsccrt is moved to gccc-lading-description field.
  • Context - compressed description data is available in ws-desc-db-gcsccs53 array format:
    For Distribute Compressed Data to GCSCCS53 Array:
    When the system distributes the compressed data, then each element from ws-desc-db-gcsccs53 array (positions 1 through 46) is moved to the corresponding ws-gcsccs53-cargo-data array element.
  • Context - a shipment with commodity data exists in shipcomm:
    For Collect SHIPCOMM Commodity Descriptions:
    When the system processes description data for customs manifest, then all 10 commodity description lines from shipcomm are collected and stored in description work area.
  • Context - a shipment with free form description data exists in shiproot:
    For Collect SHIPROOT Free Form Descriptions:
    When the system processes description data for customs manifest, then both free form description lines from shiproot are collected and stored in description work area.
  • Context - a shipment has special handling codes defined:
    For Collect Special Handling Code Descriptions:
    When the system processes special handling codes va, ev, or vs with instructions, then the special handling code and instruction are combined and stored in the first available special handling description slot (up to 3 slots).
  • Context - description data needs to be compressed for storage:
    For Set Compression Parameters:
    When the system prepares for description compression, then source length is set to 45000 bytes and target length is set to 22500 bytes.
  • Context - description data is prepared with compression parameters set:
    For Call GCCCOMP Utility:
    When the system needs to compress description data, then gcccomp utility is called with source data, target area, and length parameters to perform compression.
  • Context - description data has been successfully compressed:
    For Store Compressed Description in GCSCCRT:
    When the system stores the compressed description, then the compressed description is moved to gccc-lading-description field in the customs record.
  • Context - description data has been compressed into segments:
    For Store Compressed Data in GCSCCS53 Array:
    When the system stores segmented description data, then all 46 description segments are moved from compressed data to ws-gcsccs53-cargo-data array.
  • Context - a shipment is being processed for customs manifest:
    For Transit Action Required?:
    When the system checks if transit action is required, then if action code is 'us' or 'rt' and description from ccn is provided, transit description processing is initiated.
  • Context - transit action is required and description from ccn is specified:
    For Retrieve Description from Related CCN:
    When the system retrieves description from the related ccn, then description data is fetched from the specified ccn using gccccio2 and stored for enhancement.
  • Context - action code is 'us' and description from ccn is available:
    For Add 'MOVING IN TRANSIT THROUGH CANADA' text:
    When the system builds enhanced transit description, then description is enhanced by concatenating ccn identifier, ' moving in transit through canada ', and original description.
  • Context - action code is 'rt' and description from ccn is available:
    For Add 'MOVING IN TRANSIT THROUGH US' text:
    When the system builds enhanced transit description, then description is enhanced by concatenating ccn identifier, ' moving in transit through us ', and original description.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has commodity records with descriptions and shipment root with free-form descriptions
GIVEN
A shipment has commodity records with descriptions and shipment root with free-form descriptions
Applied to: Build Description from Multiple Sources
WHEN
The system builds the complete cargo description
THEN
All commodity descriptions from SHIPCOMM records (1-10) are included and all free-form descriptions from SHIPROOT records (1-2) are included in the description workspace
Context: Shipment commodity records contain description data in fields 1 through 10
GIVEN
Shipment commodity records contain description data in fields 1 through 10
Applied to: Combine SHIPCOMM Commodity Descriptions
WHEN
The system processes commodity descriptions
THEN
Each commodity description line (CMOD-DESC 01 through 10) is moved to the corresponding workspace description field (WS-DESC-FW-SHIPCOMM 01 through 10)
Context: Shipment root contains free-form description data in two fields
GIVEN
Shipment root contains free-form description data in two fields
Applied to: Add SHIPROOT Free Form Descriptions
WHEN
The system processes free-form descriptions
THEN
Free-form description line 1 is moved to WS-DESC-FW-SHIPROOT field 1 and free-form description line 2 is moved to WS-DESC-FW-SHIPROOT field 2
Context: A shipment has special handling codes and instructions defined
GIVEN
A shipment has special handling codes and instructions defined
Applied to: Process Special Handling Codes
WHEN
The system processes special handling codes from positions 1 through 7
THEN
Each special handling code is evaluated to determine if it matches VA, EV, or VS codes for inclusion in description
Context: A special handling code is VA, EV, or VS
GIVEN
A special handling code is VA, EV, or VS
Applied to: Add Special Handling Instructions
WHEN
The system processes the special handling code and instruction
THEN
The handling code and instruction are combined and added to the first available special handling description field (WS-DESC-FW-SPCL-HNDLG positions 1, 2, or 3)
Context: All description components have been collected from various sources
GIVEN
All description components have been collected from various sources
Applied to: Prepare Description for Compression
WHEN
The system prepares for description compression
THEN
All description data is moved to WS-DESC-2 workspace and compression length parameters are set to 45000 for input and 22500 for output
Context: Description data is prepared in WS-DESC-2 with compression parameters set
GIVEN
Description data is prepared in WS-DESC-2 with compression parameters set
Applied to: Call GCCCOMP Utility
WHEN
The system calls GCCCOMP utility with CCCOM, WS-DESC-2, WS-DESC, WS-DESC-LENGTH, and WS-DESC-LENGTH-2 parameters
THEN
The description data is compressed and returned in WS-DESC workspace
Context: Description data has been successfully compressed by GCCCOMP utility
GIVEN
Description data has been successfully compressed by GCCCOMP utility
Applied to: Store Compressed Description in GCCC-LADING-DESCRIPTION
WHEN
The system stores the compressed description
THEN
The compressed description from WS-DESC-DB-GCSCCRT is moved to GCCC-LADING-DESCRIPTION field
Context: Compressed description data is available in WS-DESC-DB-GCSCCS53 array format
GIVEN
Compressed description data is available in WS-DESC-DB-GCSCCS53 array format
Applied to: Distribute Compressed Data to GCSCCS53 Array
WHEN
The system distributes the compressed data
THEN
Each element from WS-DESC-DB-GCSCCS53 array (positions 1 through 46) is moved to the corresponding WS-GCSCCS53-CARGO-DATA array element
Context: A shipment with commodity data exists in SHIPCOMM
GIVEN
A shipment with commodity data exists in SHIPCOMM
Applied to: Collect SHIPCOMM Commodity Descriptions
WHEN
The system processes description data for customs manifest
THEN
All 10 commodity description lines from SHIPCOMM are collected and stored in description work area
Context: A shipment with free form description data exists in SHIPROOT
GIVEN
A shipment with free form description data exists in SHIPROOT
Applied to: Collect SHIPROOT Free Form Descriptions
WHEN
The system processes description data for customs manifest
THEN
Both free form description lines from SHIPROOT are collected and stored in description work area
Context: A shipment has special handling codes defined
GIVEN
A shipment has special handling codes defined
Applied to: Collect Special Handling Code Descriptions
WHEN
The system processes special handling codes VA, EV, or VS with instructions
THEN
The special handling code and instruction are combined and stored in the first available special handling description slot (up to 3 slots)
Context: Description data needs to be compressed for storage
GIVEN
Description data needs to be compressed for storage
Applied to: Set Compression Parameters
WHEN
The system prepares for description compression
THEN
Source length is set to 45000 bytes and target length is set to 22500 bytes
Context: Description data is prepared with compression parameters set
GIVEN
Description data is prepared with compression parameters set
Applied to: Call GCCCOMP Utility
WHEN
The system needs to compress description data
THEN
GCCCOMP utility is called with source data, target area, and length parameters to perform compression
Context: Description data has been successfully compressed
GIVEN
Description data has been successfully compressed
Applied to: Store Compressed Description in GCSCCRT
WHEN
The system stores the compressed description
THEN
The compressed description is moved to GCCC-LADING-DESCRIPTION field in the customs record
Context: Description data has been compressed into segments
GIVEN
Description data has been compressed into segments
Applied to: Store Compressed Data in GCSCCS53 Array
WHEN
The system stores segmented description data
THEN
All 46 description segments are moved from compressed data to WS-GCSCCS53-CARGO-DATA array
Context: A shipment is being processed for customs manifest
GIVEN
A shipment is being processed for customs manifest
Applied to: Transit Action Required?
WHEN
The system checks if transit action is required
THEN
If action code is 'US' or 'RT' and description from CCN is provided, transit description processing is initiated
Context: Transit action is required and description from CCN is specified
GIVEN
Transit action is required and description from CCN is specified
Applied to: Retrieve Description from Related CCN
WHEN
The system retrieves description from the related CCN
THEN
Description data is fetched from the specified CCN using GCCCCIO2 and stored for enhancement
Context: Action code is 'US' and description from CCN is available
GIVEN
Action code is 'US' and description from CCN is available
Applied to: Add 'MOVING IN TRANSIT THROUGH CANADA' text
WHEN
The system builds enhanced transit description
THEN
Description is enhanced by concatenating CCN identifier, ' MOVING IN TRANSIT THROUGH CANADA ', and original description
Context: Action code is 'RT' and description from CCN is available
GIVEN
Action code is 'RT' and description from CCN is available
Applied to: Add 'MOVING IN TRANSIT THROUGH US' text
WHEN
The system builds enhanced transit description
THEN
Description is enhanced by concatenating CCN identifier, ' MOVING IN TRANSIT THROUGH US ', and original description
R-GCCS309C-cbl-00244 (+9) File: GCCS309C.cbl Lading Description Expansion Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lading Description Expansion':
  • Context - a lading description expansion process needs to be started:
    For Start Lading Description Expansion:
    When the system begins processing extended lading descriptions, then the description index is initialized to position 1 to begin sequential processing.
  • Context - the system is processing lading descriptions sequentially:
    For Description index > 500?:
    When the description index reaches or exceeds position 500, then the description expansion process terminates to prevent exceeding system limits.
  • Context - the system is at a specific description index position:
    For Current description position empty?:
    When the description content at the current position is empty or contains only spaces, then the system skips processing for this position and moves to the next index.
  • Context - a valid description exists at the current index position:
    For Create N10 segment for description:
    When the system processes the description content, then a new n10 segment is created to hold the description data.
  • Context - an n10 segment is being created for description content:
    For Set segment identifier to 'N10':
    When the segment identifier field needs to be populated, then the segment identifier is set to 'n10' to comply with edi standards.
  • Context - an n10 segment is being created specifically for description text:
    For Set quantity to zero:
    When the quantity field needs to be populated, then the quantity is set to zero since this segment contains only descriptive information.
  • Context - valid description text exists at the current index position:
    For Move description text to free form description field:
    When the n10 segment is being populated with content, then the description text is moved to the free form description field of the n10 segment.
  • Context - a new n10 segment has been created for description content:
    For Increment sequence number:
    When the segment needs to be assigned a sequence number, then the sequence number is incremented by 1 to maintain proper edi transmission ordering.
  • Context - an n10 segment has been fully populated with description data and sequence number:
    For Create dependent segment in transmission:
    When the segment is ready for transmission, then the segment is created as a dependent segment in the edi transmission structure.
  • Context - the current description position has been processed or skipped:
    For Increment description index:
    When the system needs to continue with the next description position, then the description index is incremented by 1 to move to the next position.
👨‍💻 Technical ACs (Gherkin)
Context: A lading description expansion process needs to be started
GIVEN
A lading description expansion process needs to be started
Applied to: Start Lading Description Expansion
WHEN
The system begins processing extended lading descriptions
THEN
The description index is initialized to position 1 to begin sequential processing
Context: The system is processing lading descriptions sequentially
GIVEN
The system is processing lading descriptions sequentially
Applied to: Description index > 500?
WHEN
The description index reaches or exceeds position 500
THEN
The description expansion process terminates to prevent exceeding system limits
Context: The system is at a specific description index position
GIVEN
The system is at a specific description index position
Applied to: Current description position empty?
WHEN
The description content at the current position is empty or contains only spaces
THEN
The system skips processing for this position and moves to the next index
Context: A valid description exists at the current index position
GIVEN
A valid description exists at the current index position
Applied to: Create N10 segment for description
WHEN
The system processes the description content
THEN
A new N10 segment is created to hold the description data
Context: An N10 segment is being created for description content
GIVEN
An N10 segment is being created for description content
Applied to: Set segment identifier to 'N10'
WHEN
The segment identifier field needs to be populated
THEN
The segment identifier is set to 'N10' to comply with EDI standards
Context: An N10 segment is being created specifically for description text
GIVEN
An N10 segment is being created specifically for description text
Applied to: Set quantity to zero
WHEN
The quantity field needs to be populated
THEN
The quantity is set to zero since this segment contains only descriptive information
Context: Valid description text exists at the current index position
GIVEN
Valid description text exists at the current index position
Applied to: Move description text to free form description field
WHEN
The N10 segment is being populated with content
THEN
The description text is moved to the free form description field of the N10 segment
Context: A new N10 segment has been created for description content
GIVEN
A new N10 segment has been created for description content
Applied to: Increment sequence number
WHEN
The segment needs to be assigned a sequence number
THEN
The sequence number is incremented by 1 to maintain proper EDI transmission ordering
Context: An N10 segment has been fully populated with description data and sequence number
GIVEN
An N10 segment has been fully populated with description data and sequence number
Applied to: Create dependent segment in transmission
WHEN
The segment is ready for transmission
THEN
The segment is created as a dependent segment in the EDI transmission structure
Context: The current description position has been processed or skipped
GIVEN
The current description position has been processed or skipped
Applied to: Increment description index
WHEN
The system needs to continue with the next description position
THEN
The description index is incremented by 1 to move to the next position
R-GCX122A-cbl-00248 (+8) File: GCX122A.cbl Handle DB2 Errors Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle DB2 Errors':
  • Context - a db2 error has been detected:
    For Initialize Error Message Variables:
    When the system begins db2 error processing, then the email subject and text fields are cleared to prepare for error message formatting.
  • Context - a db2 error has occurred with a specific sqlcode:
    For Format DB2 Error Subject Line with SQLCODE:
    When the system formats the error notification subject, then the subject line contains 'gcx122 db2 sqlcode: ' followed by the actual sqlcode value.
  • Context - a db2 error notification needs to be sent:
    For Set Default Sender ID:
    When the system sets up the sender information, then the sender id is set to the default merlin id constant.
  • Context - a db2 error notification is being prepared:
    For Set Support Personnel as Recipient:
    When the system determines the recipient, then the support personnel id is set as the primary recipient.
  • Context - the db2 error subject line has been formatted:
    For Prepare Error Message Content:
    When the system prepares the message content, then the formatted subject line is copied to the first line of the message text.
  • Context - a db2 error notification is ready to be sent:
    For Set Message Destination to Support Inbox:
    When the system sets the delivery destination, then the destination filename is set to the support inbox constant.
  • Context - all db2 error message components are prepared:
    For Send Error Notification to Support:
    When the system sends the notification, then the messaging service is called with sender, recipient, subject, and message content.
  • Context - a db2 error notification has been attempted:
    For Log Error Message Send Failure:
    When the message send operation fails, then an error message 'send to file of om01247 failed' is logged and the system error handler is called.
  • Context - db2 error notification processing is complete:
    For Purge Message Queue:
    When the system performs cleanup operations, then the message queue is purged and system status is reset.
👨‍💻 Technical ACs (Gherkin)
Context: A DB2 error has been detected
GIVEN
A DB2 error has been detected
Applied to: Initialize Error Message Variables
WHEN
The system begins DB2 error processing
THEN
The email subject and text fields are cleared to prepare for error message formatting
Context: A DB2 error has occurred with a specific SQLCODE
GIVEN
A DB2 error has occurred with a specific SQLCODE
Applied to: Format DB2 Error Subject Line with SQLCODE
WHEN
The system formats the error notification subject
THEN
The subject line contains 'GCX122 DB2 SQLCODE: ' followed by the actual SQLCODE value
Context: A DB2 error notification needs to be sent
GIVEN
A DB2 error notification needs to be sent
Applied to: Set Default Sender ID
WHEN
The system sets up the sender information
THEN
The sender ID is set to the default Merlin ID constant
Context: A DB2 error notification is being prepared
GIVEN
A DB2 error notification is being prepared
Applied to: Set Support Personnel as Recipient
WHEN
The system determines the recipient
THEN
The support personnel ID is set as the primary recipient
Context: The DB2 error subject line has been formatted
GIVEN
The DB2 error subject line has been formatted
Applied to: Prepare Error Message Content
WHEN
The system prepares the message content
THEN
The formatted subject line is copied to the first line of the message text
Context: A DB2 error notification is ready to be sent
GIVEN
A DB2 error notification is ready to be sent
Applied to: Set Message Destination to Support Inbox
WHEN
The system sets the delivery destination
THEN
The destination filename is set to the support inbox constant
Context: All DB2 error message components are prepared
GIVEN
All DB2 error message components are prepared
Applied to: Send Error Notification to Support
WHEN
The system sends the notification
THEN
The messaging service is called with sender, recipient, subject, and message content
Context: A DB2 error notification has been attempted
GIVEN
A DB2 error notification has been attempted
Applied to: Log Error Message Send Failure
WHEN
The message send operation fails
THEN
An error message 'SEND TO FILE OF OM01247 FAILED' is logged and the system error handler is called
Context: DB2 error notification processing is complete
GIVEN
DB2 error notification processing is complete
Applied to: Purge Message Queue
WHEN
The system performs cleanup operations
THEN
The message queue is purged and system status is reset
R-GCCCCADD-cbl-00253 (+14) File: GCCCCADD.cbl Hazardous Material Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Hazardous Material Processing':
  • Context - hazardous material processing is starting:
    For Initialize Hazmat Fields:
    When the system begins hazmat information extraction, then the commodity description danger field and un number field are cleared to spaces.
  • Context - a shipment requires hazmat processing:
    For Check for EDI BOL Hazmat Data:
    When the system checks for edi bol hazmat data in commodity segments with type 'ch', then the system identifies if hazmat segments exist and sets the appropriate processing flag.
  • Context - edi bol hazmat data is found in commodity segments:
    For Process EDI BOL Hazmat Data:
    When the system processes hazmat information from edi bol, then the system extracts un numbers and proper shipping names from the edi bol hazmat segments.
  • Context - hazmat data exists in edi bol commodity segments:
    For UN Number Found in EDI?:
    When the system examines the un/na identification code, then if the first two characters equal 'un', the system accepts it as a valid un number, otherwise continues searching.
  • Context - a valid un number is found in edi bol hazmat data:
    For Extract UN Number from EDI:
    When the un/na identification code starts with 'un', then the system moves the complete un/na identification code to the commodity un number field and sets hazmat found flag.
  • Context - a valid un number has been extracted from edi bol:
    For Get Proper Shipping Name from EDI:
    When the system looks up the corresponding hazmat information segment, then if the hazmat information segment is found, the proper shipping name is moved to the commodity description danger field.
  • Context - current edi bol hazmat record does not contain valid un number:
    For Check Next EDI Hazmat Record:
    When the un/na identification code does not start with 'un', then the system increments the commodity sequence number and continues searching if sequence is 98 or less and hazmat not yet found.
  • Context - no valid hazmat data found in edi bol or edi bol is not available:
    For Check Fastway Hazmat Data:
    When the system checks fastway shipment commodity data, then the system retrieves shipment commodity information and looks up emergency response data.
  • Context - fastway shipment commodity data is available:
    For Fastway Hazmat Found?:
    When the system examines the emergency response un/na code, then if emergency response data is found and the un/na code starts with 'un', the system accepts it as valid hazmat data.
  • Context - valid fastway emergency response data with un number is found:
    For Extract UN Number from Fastway:
    When the un/na code starts with 'un', then the system moves the un/na code to the commodity un number field and sets hazmat found flag.
  • Context - valid un number has been extracted from fastway data:
    For Get Hazmat Description from Fastway:
    When the system looks up emergency response description data, then if description data is found, the first 15 characters of hazmat description are moved to commodity description danger field.
  • Context - no hazmat data found in edi bol or fastway sources:
    For Use Commodity Table for Hazmat Info:
    When the system accesses the commodity master table using the commodity code, then the system retrieves commodity description and looks up associated hazmat codes.
  • Context - commodity master record is successfully retrieved:
    For Extract Description from Commodity:
    When the commodity table contains hazmat information, then the system moves the commodity description to the commodity description danger field.
  • Context - commodity description has been extracted from master table:
    For Extract UN Number from Commodity:
    When the system looks up hazmat codes for the commodity, then if hazmat codes are found, the dot id is moved to the un number field, otherwise both fields are cleared.
  • Context - no hazmat information found in edi bol, fastway, or commodity table sources:
    For Set Hazmat Fields to Spaces:
    When all hazmat data sources have been exhausted without finding valid information, then the system clears both the un number field and commodity description danger field to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: Hazardous material processing is starting
GIVEN
Hazardous material processing is starting
Applied to: Initialize Hazmat Fields
WHEN
The system begins hazmat information extraction
THEN
The commodity description danger field and UN number field are cleared to spaces
Context: A shipment requires hazmat processing
GIVEN
A shipment requires hazmat processing
Applied to: Check for EDI BOL Hazmat Data
WHEN
The system checks for EDI BOL hazmat data in commodity segments with type 'CH'
THEN
The system identifies if hazmat segments exist and sets the appropriate processing flag
Context: EDI BOL hazmat data is found in commodity segments
GIVEN
EDI BOL hazmat data is found in commodity segments
Applied to: Process EDI BOL Hazmat Data
WHEN
The system processes hazmat information from EDI BOL
THEN
The system extracts UN numbers and proper shipping names from the EDI BOL hazmat segments
Context: Hazmat data exists in EDI BOL commodity segments
GIVEN
Hazmat data exists in EDI BOL commodity segments
Applied to: UN Number Found in EDI?
WHEN
The system examines the UN/NA identification code
THEN
If the first two characters equal 'UN', the system accepts it as a valid UN number, otherwise continues searching
Context: A valid UN number is found in EDI BOL hazmat data
GIVEN
A valid UN number is found in EDI BOL hazmat data
Applied to: Extract UN Number from EDI
WHEN
The UN/NA identification code starts with 'UN'
THEN
The system moves the complete UN/NA identification code to the commodity UN number field and sets hazmat found flag
Context: A valid UN number has been extracted from EDI BOL
GIVEN
A valid UN number has been extracted from EDI BOL
Applied to: Get Proper Shipping Name from EDI
WHEN
The system looks up the corresponding hazmat information segment
THEN
If the hazmat information segment is found, the proper shipping name is moved to the commodity description danger field
Context: Current EDI BOL hazmat record does not contain valid UN number
GIVEN
Current EDI BOL hazmat record does not contain valid UN number
Applied to: Check Next EDI Hazmat Record
WHEN
The UN/NA identification code does not start with 'UN'
THEN
The system increments the commodity sequence number and continues searching if sequence is 98 or less and hazmat not yet found
Context: No valid hazmat data found in EDI BOL or EDI BOL is not available
GIVEN
No valid hazmat data found in EDI BOL or EDI BOL is not available
Applied to: Check Fastway Hazmat Data
WHEN
The system checks Fastway shipment commodity data
THEN
The system retrieves shipment commodity information and looks up emergency response data
Context: Fastway shipment commodity data is available
GIVEN
Fastway shipment commodity data is available
Applied to: Fastway Hazmat Found?
WHEN
The system examines the emergency response UN/NA code
THEN
If emergency response data is found and the UN/NA code starts with 'UN', the system accepts it as valid hazmat data
Context: Valid Fastway emergency response data with UN number is found
GIVEN
Valid Fastway emergency response data with UN number is found
Applied to: Extract UN Number from Fastway
WHEN
The UN/NA code starts with 'UN'
THEN
The system moves the UN/NA code to the commodity UN number field and sets hazmat found flag
Context: Valid UN number has been extracted from Fastway data
GIVEN
Valid UN number has been extracted from Fastway data
Applied to: Get Hazmat Description from Fastway
WHEN
The system looks up emergency response description data
THEN
If description data is found, the first 15 characters of hazmat description are moved to commodity description danger field
Context: No hazmat data found in EDI BOL or Fastway sources
GIVEN
No hazmat data found in EDI BOL or Fastway sources
Applied to: Use Commodity Table for Hazmat Info
WHEN
The system accesses the commodity master table using the commodity code
THEN
The system retrieves commodity description and looks up associated hazmat codes
Context: Commodity master record is successfully retrieved
GIVEN
Commodity master record is successfully retrieved
Applied to: Extract Description from Commodity
WHEN
The commodity table contains hazmat information
THEN
The system moves the commodity description to the commodity description danger field
Context: Commodity description has been extracted from master table
GIVEN
Commodity description has been extracted from master table
Applied to: Extract UN Number from Commodity
WHEN
The system looks up hazmat codes for the commodity
THEN
If hazmat codes are found, the DOT ID is moved to the UN number field, otherwise both fields are cleared
Context: No hazmat information found in EDI BOL, Fastway, or commodity table sources
GIVEN
No hazmat information found in EDI BOL, Fastway, or commodity table sources
Applied to: Set Hazmat Fields to Spaces
WHEN
All hazmat data sources have been exhausted without finding valid information
THEN
The system clears both the UN number field and commodity description danger field to spaces
R-GCCS309C-cbl-00254 (+4) File: GCCS309C.cbl H1 Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'H1':
  • Context - a manifest contains commodity information:
    For UN Number exists and not 'NA'? AND Commodity danger description exists?:
    When the system checks for hazardous material processing requirements, then processing continues only if un number exists, is not 'na', and commodity danger description is present, otherwise hazmat processing is skipped.
  • Context - a manifest has valid hazardous material information and destination type is determined:
    For Destination Type Check:
    When the system processes h1 hazardous material segment, then if destination is 309-destination, use full un number in h1-01 field, otherwise use only last 4 digits of un number.
  • Context - valid hazardous material information exists and destination type is determined:
    For Initialize H1 Segment AND Set Full UN Number in H1-01 AND Set Last 4 Digits of UN Number in H1-01 AND Set Commodity Danger Description in H1-04 AND Clear Contact and Packing Group Fields:
    When the system creates h1 hazardous material segment, then initialize h1 segment, set appropriate un number format in h1-01, set commodity danger description in h1-04, and clear contact and packing group fields to spaces.
  • Context - h1 segment has been created and description lines are available for processing:
    For Process H2 Description Segments AND Initialize H2 Segment AND Description Line Available? AND Set Description in H2-01:
    When the system processes h2 description segments, then for each available description line up to 8 lines, initialize h2 segment and set description text in h2-01 field.
  • Context - an h2 description segment contains a single character in the first position and spaces in positions 2-29:
    For Format Single Character Descriptions:
    When the system formats the h2 description field, then append a period after the single character to create proper formatting (e.g., 'a' becomes 'a.').
👨‍💻 Technical ACs (Gherkin)
Context: A manifest contains commodity information
GIVEN
A manifest contains commodity information
Applied to: UN Number exists and not 'NA'? AND Commodity danger description exists?
WHEN
The system checks for hazardous material processing requirements
THEN
Processing continues only if UN number exists, is not 'NA', and commodity danger description is present, otherwise hazmat processing is skipped
Context: A manifest has valid hazardous material information and destination type is determined
GIVEN
A manifest has valid hazardous material information and destination type is determined
Applied to: Destination Type Check
WHEN
The system processes H1 hazardous material segment
THEN
If destination is 309-DESTINATION, use full UN number in H1-01 field, otherwise use only last 4 digits of UN number
Context: Valid hazardous material information exists and destination type is determined
GIVEN
Valid hazardous material information exists and destination type is determined
Applied to: Initialize H1 Segment AND Set Full UN Number in H1-01 AND Set Last 4 Digits of UN Number in H1-01 AND Set Commodity Danger Description in H1-04 AND Clear Contact and Packing Group Fields
WHEN
The system creates H1 hazardous material segment
THEN
Initialize H1 segment, set appropriate UN number format in H1-01, set commodity danger description in H1-04, and clear contact and packing group fields to spaces
Context: H1 segment has been created and description lines are available for processing
GIVEN
H1 segment has been created and description lines are available for processing
Applied to: Process H2 Description Segments AND Initialize H2 Segment AND Description Line Available? AND Set Description in H2-01
WHEN
The system processes H2 description segments
THEN
For each available description line up to 8 lines, initialize H2 segment and set description text in H2-01 field
Context: An H2 description segment contains a single character in the first position and spaces in positions 2-29
GIVEN
An H2 description segment contains a single character in the first position and spaces in positions 2-29
Applied to: Format Single Character Descriptions
WHEN
The system formats the H2 description field
THEN
Append a period after the single character to create proper formatting (e.g., 'A' becomes 'A.')
R-GCX122A-cbl-00257 (+10) File: GCX122A.cbl Log Transaction Activities Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Log Transaction Activities':
  • Context - a transaction logging process is initiated:
    For Initialize Log Message Structure:
    When the system begins to create a log entry, then the log message structure is cleared and initialized with spaces.
  • Context - a log message structure is initialized:
    For Set Security and Transaction Details:
    When security and transaction details need to be recorded, then the security byte is set to high-value and sending transaction is set to 'gct1221e'.
  • Context - a transaction log entry is being created:
    For Set Current Date and Time:
    When date and time information needs to be recorded, then the current system date from bgn-03-date is recorded in the log date field and current system time from bgn-04-time is recorded in the log time field.
  • Context - a transaction log entry is being prepared:
    For Set Action Code to 'ZZZ':
    When an action code needs to be assigned to the log entry, then the action code is set to 'zzz' to indicate standard transaction logging.
  • Context - a transaction with a reference number is being logged:
    For Add Reference Number to Log:
    When the reference number needs to be recorded in the log, then the reference number from oti-03-ref-num is recorded in the train or ccn field of the log entry.
  • Context - a transaction has a current status that needs to be logged:
    For Add Current Status to Log Message:
    When the transaction status is being recorded in the log, then the current status from ws-current-status is recorded in the log message field.
  • Context - a transaction with ack status is being logged:
    For Add BGN Reference Number to Log:
    When the transaction status equals 'ack ', then the bgn reference number from bgn-02-ref-num is recorded in the transaction field of the log.
  • Context - a transaction log entry needs to be classified by type:
    For Set Log Type as Cargo/Train/Other:
    When the transaction type is evaluated, then if the transaction is cargo type, set log type as cargo; if the transaction is train type, set log type as train; otherwise set log type as other.
  • Context - a complete log message has been prepared:
    For Send Log Message to GCT1051E:
    When the log message needs to be sent to the audit system, then the log message is sent to the gct1051e audit logging system using the cims interface.
  • Context - a log message has been sent to the audit system:
    For Write Log Message to System:
    When the message needs to be written to the system log, then the log message is written using writmsgl service with the message code, content, length, and module name.
  • Context - a log message has been successfully written to the system log:
    For Purge Message Queue:
    When the logging process is complete, then the message queue is purged using cims purg function to clean up processed messages.
👨‍💻 Technical ACs (Gherkin)
Context: A transaction logging process is initiated
GIVEN
A transaction logging process is initiated
Applied to: Initialize Log Message Structure
WHEN
The system begins to create a log entry
THEN
The log message structure is cleared and initialized with spaces
Context: A log message structure is initialized
GIVEN
A log message structure is initialized
Applied to: Set Security and Transaction Details
WHEN
Security and transaction details need to be recorded
THEN
The security byte is set to high-value and sending transaction is set to 'GCT1221E'
Context: A transaction log entry is being created
GIVEN
A transaction log entry is being created
Applied to: Set Current Date and Time
WHEN
Date and time information needs to be recorded
THEN
The current system date from BGN-03-DATE is recorded in the log date field and current system time from BGN-04-TIME is recorded in the log time field
Context: A transaction log entry is being prepared
GIVEN
A transaction log entry is being prepared
Applied to: Set Action Code to 'ZZZ'
WHEN
An action code needs to be assigned to the log entry
THEN
The action code is set to 'ZZZ' to indicate standard transaction logging
Context: A transaction with a reference number is being logged
GIVEN
A transaction with a reference number is being logged
Applied to: Add Reference Number to Log
WHEN
The reference number needs to be recorded in the log
THEN
The reference number from OTI-03-REF-NUM is recorded in the train or CCN field of the log entry
Context: A transaction has a current status that needs to be logged
GIVEN
A transaction has a current status that needs to be logged
Applied to: Add Current Status to Log Message
WHEN
The transaction status is being recorded in the log
THEN
The current status from WS-CURRENT-STATUS is recorded in the log message field
Context: A transaction with ACK status is being logged
GIVEN
A transaction with ACK status is being logged
Applied to: Add BGN Reference Number to Log
WHEN
The transaction status equals 'ACK '
THEN
The BGN reference number from BGN-02-REF-NUM is recorded in the transaction field of the log
Context: A transaction log entry needs to be classified by type
GIVEN
A transaction log entry needs to be classified by type
Applied to: Set Log Type as Cargo/Train/Other
WHEN
The transaction type is evaluated
THEN
If the transaction is cargo type, set log type as cargo; if the transaction is train type, set log type as train; otherwise set log type as other
Context: A complete log message has been prepared
GIVEN
A complete log message has been prepared
Applied to: Send Log Message to GCT1051E
WHEN
The log message needs to be sent to the audit system
THEN
The log message is sent to the GCT1051E audit logging system using the CIMS interface
Context: A log message has been sent to the audit system
GIVEN
A log message has been sent to the audit system
Applied to: Write Log Message to System
WHEN
The message needs to be written to the system log
THEN
The log message is written using WRITMSGL service with the message code, content, length, and module name
Context: A log message has been successfully written to the system log
GIVEN
A log message has been successfully written to the system log
Applied to: Purge Message Queue
WHEN
The logging process is complete
THEN
The message queue is purged using CIMS PURG function to clean up processed messages
R-GCCS309C-cbl-00259 (+12) File: GCCS309C.cbl Idler Car Processing Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Idler Car Processing':
  • Context - a manifest record with shipment classification data:
    For Is Idler Shipment?:
    When the system evaluates the shipment type for idler car processing, then the system identifies whether the shipment is an idler shipment based on the gccc-idler-shipment flag.
  • Context - an idler shipment that requires follower car processing:
    For Notify Customs?:
    When the system checks notification requirements, then the system verifies that customs notification flag gcws309c-notify-customs is enabled.
  • Context - an idler shipment requiring customs notification:
    For Initialize Follower Processing:
    When the system begins follower car processing, then the system initializes the end-of-followers flag to spaces and sets the database function to gu (get unique).
  • Context - initialized follower processing environment:
    For Set CCN Key for Follower Search:
    When the system prepares to search for follower cars, then the system assigns the main manifest ccn key (gccc-ccn-key) to the follower search key (gcb0rt-ccn-key).
  • Context - a search key established for follower cars:
    For Get Next Idler Car:
    When the system requests the next idler car record, then the system calls the database interface to retrieve the next follower car using the current function code.
  • Context - a database call to retrieve the next follower car:
    For End of Followers?:
    When the system evaluates the database response, then if the database status code is not spaces, the system sets the end-of-followers flag to 'y', otherwise continues processing.
  • Context - a successfully retrieved follower car record:
    For Is Follower Manifest?:
    When the system validates the follower car data, then the system checks if gccc-follower-mfst flag indicates a valid manifest entry.
  • Context - a valid follower manifest record:
    For Create VID Segment for Follower:
    When the system processes the follower car equipment information, then the system creates a vid (vehicle identification) segment containing the follower car details.
  • Context - a follower car with vid segment created:
    For Destination Type?:
    When the system evaluates the destination configuration, then if the destination is 309-destination type, the system proceeds with n10 description processing, otherwise skips to next follower.
  • Context - a follower car with 309 destination type:
    For Create N10 Description Segment:
    When the system processes the follower car cargo description, then the system creates an n10 segment containing quantity and description information for the follower car.
  • Context - a follower car with n10 description segment created:
    For Has Hazardous Material?:
    When the system checks for hazardous material indicators, then if un-number is not spaces and not starting with 'na' and commodity danger description is not spaces, the system identifies hazardous material presence.
  • Context - a follower car identified as containing hazardous materials:
    For Create H1-H2 Hazmat Segments:
    When the system processes the hazardous material information, then the system creates h1 and h2 segments containing the un number, hazard class, and danger descriptions for the follower car.
  • Context - completion of current follower car processing (with or without additional segments):
    For Continue to Next Follower:
    When the system prepares for the next iteration, then the system changes the database function to gn (get next) and returns to retrieve the next follower car.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with shipment classification data
GIVEN
A manifest record with shipment classification data
Applied to: Is Idler Shipment?
WHEN
The system evaluates the shipment type for idler car processing
THEN
The system identifies whether the shipment is an idler shipment based on the GCCC-IDLER-SHIPMENT flag
Context: An idler shipment that requires follower car processing
GIVEN
An idler shipment that requires follower car processing
Applied to: Notify Customs?
WHEN
The system checks notification requirements
THEN
The system verifies that customs notification flag GCWS309C-NOTIFY-CUSTOMS is enabled
Context: An idler shipment requiring customs notification
GIVEN
An idler shipment requiring customs notification
Applied to: Initialize Follower Processing
WHEN
The system begins follower car processing
THEN
The system initializes the end-of-followers flag to SPACES and sets the database function to GU (Get Unique)
Context: Initialized follower processing environment
GIVEN
Initialized follower processing environment
Applied to: Set CCN Key for Follower Search
WHEN
The system prepares to search for follower cars
THEN
The system assigns the main manifest CCN key (GCCC-CCN-KEY) to the follower search key (GCB0RT-CCN-KEY)
Context: A search key established for follower cars
GIVEN
A search key established for follower cars
Applied to: Get Next Idler Car
WHEN
The system requests the next idler car record
THEN
The system calls the database interface to retrieve the next follower car using the current function code
Context: A database call to retrieve the next follower car
GIVEN
A database call to retrieve the next follower car
Applied to: End of Followers?
WHEN
The system evaluates the database response
THEN
If the database status code is not SPACES, the system sets the end-of-followers flag to 'Y', otherwise continues processing
Context: A successfully retrieved follower car record
GIVEN
A successfully retrieved follower car record
Applied to: Is Follower Manifest?
WHEN
The system validates the follower car data
THEN
The system checks if GCCC-FOLLOWER-MFST flag indicates a valid manifest entry
Context: A valid follower manifest record
GIVEN
A valid follower manifest record
Applied to: Create VID Segment for Follower
WHEN
The system processes the follower car equipment information
THEN
The system creates a VID (Vehicle Identification) segment containing the follower car details
Context: A follower car with VID segment created
GIVEN
A follower car with VID segment created
Applied to: Destination Type?
WHEN
The system evaluates the destination configuration
THEN
If the destination is 309-DESTINATION type, the system proceeds with N10 description processing, otherwise skips to next follower
Context: A follower car with 309 destination type
GIVEN
A follower car with 309 destination type
Applied to: Create N10 Description Segment
WHEN
The system processes the follower car cargo description
THEN
The system creates an N10 segment containing quantity and description information for the follower car
Context: A follower car with N10 description segment created
GIVEN
A follower car with N10 description segment created
Applied to: Has Hazardous Material?
WHEN
The system checks for hazardous material indicators
THEN
If UN-NUMBER is not SPACES and not starting with 'NA' and commodity danger description is not SPACES, the system identifies hazardous material presence
Context: A follower car identified as containing hazardous materials
GIVEN
A follower car identified as containing hazardous materials
Applied to: Create H1-H2 Hazmat Segments
WHEN
The system processes the hazardous material information
THEN
The system creates H1 and H2 segments containing the UN number, hazard class, and danger descriptions for the follower car
Context: Completion of current follower car processing (with or without additional segments)
GIVEN
Completion of current follower car processing (with or without additional segments)
Applied to: Continue to Next Follower
WHEN
The system prepares for the next iteration
THEN
The system changes the database function to GN (Get Next) and returns to retrieve the next follower car
R-GCCCBOL-cbl-00263 (+12) File: GCCCBOL.cbl Extract Importer Information Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Importer Information':
  • Context - a valid edi bol key exists for the shipment:
    For Get N1 Importer Segment from BOL:
    When the system searches for n1 importer segment with type 'sc' and sequence number 1, then the system retrieves the importer segment data and sets the found indicator.
  • Context - an n1 segment has been retrieved from the edi bol:
    For Check Entity ID Code = 'IM':
    When the system checks the entity id code in the n1 segment, then the system proceeds only if the entity id code equals 'im' (importer).
  • Context - an n1 segment with entity id code 'im' has been found:
    For Valid Importer Name?:
    When the system checks the n1 name field, then the system proceeds only if the name field is not spaces.
  • Context - a valid importer n1 segment with name and id code exists:
    For Qualifier = 'M5'?:
    When the system checks if the id code qualifier equals 'm5', then the system sets csa indicator on and copies importer data to output fields.
  • Context - a valid importer n1 segment exists with id code qualifier not equal to 'm5':
    For Qualifier = 'BN'?:
    When the system checks if the id code qualifier equals 'bn', then the system copies importer data to output fields without setting csa indicator.
  • Context - a valid importer n1 segment exists with id code qualifier not equal to 'm5' or 'bn':
    For Qualifier = 'AI'?:
    When the system checks if the id code qualifier equals 'ai', then the system copies importer data to output fields without setting csa indicator.
  • Context - a valid n1 importer segment with acceptable qualifier (m5, bn, or ai) has been found:
    For Copy BOL Importer Data:
    When the system processes the importer data, then the system moves n1 name to importer field, id code qualifier to business number qualifier field, and id code to business number field.
  • Context - no valid importer segment was found in edi bol data:
    For Search Fastway for N1-01 IM:
    When the system searches through fastway shipment mine segments, then the system looks for data lines containing 'n1-01 im' pattern.
  • Context - an n1-01 im segment has been found in fastway data:
    For Extract N1-02 Importer Name:
    When the system processes the next data line expecting n1-02 format, then the system extracts the importer name from positions 8-28 of the n1-02 data line.
  • Context - n1-02 importer name has been extracted from fastway data:
    For Check N1-03 Qualifier:
    When the system checks the next data line for n1-03 format, then the system validates if the qualifier is 'm5', 'bn', or 'ai' and extracts the qualifier type.
  • Context - a valid n1-03 qualifier has been found in fastway data:
    For Extract N1-04 Business Number:
    When the system processes the next data line expecting n1-04 format, then the system extracts the business number from positions 8-17 of the n1-04 data line.
  • Context - business number has been extracted from fastway n1-04 segment:
    For Set CSA Indicator ON:
    When the system checks if the business number qualifier equals 'm5', then the system sets csa indicator on.
  • Context - complete importer information has been extracted from fastway segments:
    For Store Importer Information:
    When the system finalizes the importer data processing, then the system moves the extracted business number to business number field and importer name to importer field.
👨‍💻 Technical ACs (Gherkin)
Context: A valid EDI BOL key exists for the shipment
GIVEN
A valid EDI BOL key exists for the shipment
Applied to: Get N1 Importer Segment from BOL
WHEN
The system searches for N1 importer segment with type 'SC' and sequence number 1
THEN
The system retrieves the importer segment data and sets the found indicator
Context: An N1 segment has been retrieved from the EDI BOL
GIVEN
An N1 segment has been retrieved from the EDI BOL
Applied to: Check Entity ID Code = 'IM'
WHEN
The system checks the entity ID code in the N1 segment
THEN
The system proceeds only if the entity ID code equals 'IM' (Importer)
Context: An N1 segment with entity ID code 'IM' has been found
GIVEN
An N1 segment with entity ID code 'IM' has been found
Applied to: Valid Importer Name?
WHEN
The system checks the N1 name field
THEN
The system proceeds only if the name field is not spaces
Context: A valid importer N1 segment with name and ID code exists
GIVEN
A valid importer N1 segment with name and ID code exists
Applied to: Qualifier = 'M5'?
WHEN
The system checks if the ID code qualifier equals 'M5'
THEN
The system sets CSA indicator ON and copies importer data to output fields
Context: A valid importer N1 segment exists with ID code qualifier not equal to 'M5'
GIVEN
A valid importer N1 segment exists with ID code qualifier not equal to 'M5'
Applied to: Qualifier = 'BN'?
WHEN
The system checks if the ID code qualifier equals 'BN'
THEN
The system copies importer data to output fields without setting CSA indicator
Context: A valid importer N1 segment exists with ID code qualifier not equal to 'M5' or 'BN'
GIVEN
A valid importer N1 segment exists with ID code qualifier not equal to 'M5' or 'BN'
Applied to: Qualifier = 'AI'?
WHEN
The system checks if the ID code qualifier equals 'AI'
THEN
The system copies importer data to output fields without setting CSA indicator
Context: A valid N1 importer segment with acceptable qualifier (M5, BN, or AI) has been found
GIVEN
A valid N1 importer segment with acceptable qualifier (M5, BN, or AI) has been found
Applied to: Copy BOL Importer Data
WHEN
The system processes the importer data
THEN
The system moves N1 name to importer field, ID code qualifier to business number qualifier field, and ID code to business number field
Context: No valid importer segment was found in EDI BOL data
GIVEN
No valid importer segment was found in EDI BOL data
Applied to: Search Fastway for N1-01 IM
WHEN
The system searches through Fastway shipment mine segments
THEN
The system looks for data lines containing 'N1-01 IM' pattern
Context: An N1-01 IM segment has been found in Fastway data
GIVEN
An N1-01 IM segment has been found in Fastway data
Applied to: Extract N1-02 Importer Name
WHEN
The system processes the next data line expecting N1-02 format
THEN
The system extracts the importer name from positions 8-28 of the N1-02 data line
Context: N1-02 importer name has been extracted from Fastway data
GIVEN
N1-02 importer name has been extracted from Fastway data
Applied to: Check N1-03 Qualifier
WHEN
The system checks the next data line for N1-03 format
THEN
The system validates if the qualifier is 'M5', 'BN', or 'AI' and extracts the qualifier type
Context: A valid N1-03 qualifier has been found in Fastway data
GIVEN
A valid N1-03 qualifier has been found in Fastway data
Applied to: Extract N1-04 Business Number
WHEN
The system processes the next data line expecting N1-04 format
THEN
The system extracts the business number from positions 8-17 of the N1-04 data line
Context: Business number has been extracted from Fastway N1-04 segment
GIVEN
Business number has been extracted from Fastway N1-04 segment
Applied to: Set CSA Indicator ON
WHEN
The system checks if the business number qualifier equals 'M5'
THEN
The system sets CSA indicator ON
Context: Complete importer information has been extracted from Fastway segments
GIVEN
Complete importer information has been extracted from Fastway segments
Applied to: Store Importer Information
WHEN
The system finalizes the importer data processing
THEN
The system moves the extracted business number to business number field and importer name to importer field
R-GCCCCADD-cbl-00268 (+15) File: GCCCCADD.cbl Bill of Lading Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bill of Lading Processing':
  • Context - a cargo manifest is being created with valid shipment data:
    For Call GCCCBOL Program:
    When the system needs to process bill of lading information, then the gcccbol program is called with shipment root, customs records, and bol parameters to extract related ccn data.
  • Context - the gcccbol program has been executed successfully:
    For Extract Multiple CCN Array:
    When the system checks for multiple related cargo control numbers, then the ccn array table is examined to determine if multiple ccns exist for processing.
  • Context - the ccn array has been extracted from bol processing results:
    For Multiple CCNs Found?:
    When the system checks if the ccn array contains data, then if the ccn array is not spaces or low-values, multiple ccns are considered found.
  • Context - multiple ccns have been found in the bol processing results:
    For Process Each Related CCN:
    When the system processes related ccns, then for each ccn from index 1 to 99, if the ccn is not spaces, it is processed for manifest creation.
  • Context - a related ccn needs to be processed for manifest creation:
    For Set Spawn Parameters:
    When the system sets up spawn parameters, then the waybill key, waybill date, ccn, and action code 'am' are set for the spawn process.
  • Context - spawn parameters have been set for a related ccn:
    For Create Manifest for Related CCN:
    When the system creates a manifest for the related ccn, then the gct0111e process is spawned with the configured parameters to create the manifest.
  • Context - a shipment is being processed for customs manifest creation:
    For EDI BOL Data Available?:
    When the system checks for edi bol data availability, then if the origin road number is not zero, the system attempts to retrieve edi bol data from shipmin segment.
  • Context - edi bol data is available for processing:
    For Extract Shipper Information from EDI:
    When the system extracts shipper information, then the ebsnrsc segment with entity type 'hn' and sequence '01' is retrieved to get shipper name and identification.
    For Extract Consignee Information from EDI:
    When the system extracts consignee information, then the ebsnrsc segment with entity type 'cn' and sequence '01' is retrieved to get consignee name and identification.
    For Extract Entity Segments from EDI:
    When the system extracts entity segments, then various entity types (sf, uc, bn, c1, n1, pf, ss, 11, mc, oo, fw, nn) are retrieved from ebsnrsc segments based on their specific entity codes.
    For Extract Commodity Information:
    When the system extracts commodity information, then commodity segments (cm type) and hazmat segments (ch type) are retrieved from ebsbccm segments to get lading quantity, weight, and hazardous material information.
    For Process Transportation Segments:
    When the system processes transportation segments, then transportation segments (tn, t2, ta, t3 types) are retrieved from ebsnrtd segments to get transportation details, additional addresses, and contact information.
    For Extract MCOA Charge Information:
    When the system extracts mcoa charge information, then mcoa segments (ot, on, oc types) are retrieved from ebsmcoa segments to get organization details, addresses, and charge information for entities like freight forwarders and bill recipients.
  • Context - entity information has been extracted from edi bol:
    For Extract Address Information:
    When the system extracts address information, then address segments (n3 and n4 types) are retrieved from ebsnrsa segments to get street addresses, city, state, postal code, and country information.
  • Context - entity and address information has been extracted from edi bol:
    For Process Contact Information:
    When the system processes contact information, then contact segments (per type) are retrieved from ebsnrsa segments to get contact function code, name, communication number qualifier, and communication number.
  • Context - all edi bol segments have been extracted and processed:
    For Validate EDI BOL Structure:
    When the system validates the edi bol structure, then each n1 segment is validated for required fields (entity id, name), address information is validated for completeness, and contact information is validated for proper format.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being created with valid shipment data
GIVEN
A cargo manifest is being created with valid shipment data
Applied to: Call GCCCBOL Program
WHEN
The system needs to process bill of lading information
THEN
The GCCCBOL program is called with shipment root, customs records, and BOL parameters to extract related CCN data
Context: The GCCCBOL program has been executed successfully
GIVEN
The GCCCBOL program has been executed successfully
Applied to: Extract Multiple CCN Array
WHEN
The system checks for multiple related cargo control numbers
THEN
The CCN array table is examined to determine if multiple CCNs exist for processing
Context: The CCN array has been extracted from BOL processing results
GIVEN
The CCN array has been extracted from BOL processing results
Applied to: Multiple CCNs Found?
WHEN
The system checks if the CCN array contains data
THEN
If the CCN array is not spaces or low-values, multiple CCNs are considered found
Context: Multiple CCNs have been found in the BOL processing results
GIVEN
Multiple CCNs have been found in the BOL processing results
Applied to: Process Each Related CCN
WHEN
The system processes related CCNs
THEN
For each CCN from index 1 to 99, if the CCN is not spaces, it is processed for manifest creation
Context: A related CCN needs to be processed for manifest creation
GIVEN
A related CCN needs to be processed for manifest creation
Applied to: Set Spawn Parameters
WHEN
The system sets up spawn parameters
THEN
The waybill key, waybill date, CCN, and action code 'AM' are set for the spawn process
Context: Spawn parameters have been set for a related CCN
GIVEN
Spawn parameters have been set for a related CCN
Applied to: Create Manifest for Related CCN
WHEN
The system creates a manifest for the related CCN
THEN
The GCT0111E process is spawned with the configured parameters to create the manifest
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: EDI BOL Data Available?
WHEN
The system checks for EDI BOL data availability
THEN
If the origin road number is not zero, the system attempts to retrieve EDI BOL data from SHIPMIN segment
Context: EDI BOL data is available for processing
GIVEN
EDI BOL data is available for processing
Applied to: Extract Shipper Information from EDI
WHEN
The system extracts shipper information
THEN
The EBSNRSC segment with entity type 'HN' and sequence '01' is retrieved to get shipper name and identification
Applied to: Extract Consignee Information from EDI
WHEN
The system extracts consignee information
THEN
The EBSNRSC segment with entity type 'CN' and sequence '01' is retrieved to get consignee name and identification
Applied to: Extract Entity Segments from EDI
WHEN
The system extracts entity segments
THEN
Various entity types (SF, UC, BN, C1, N1, PF, SS, 11, MC, OO, FW, NN) are retrieved from EBSNRSC segments based on their specific entity codes
Applied to: Extract Commodity Information
WHEN
The system extracts commodity information
THEN
Commodity segments (CM type) and hazmat segments (CH type) are retrieved from EBSBCCM segments to get lading quantity, weight, and hazardous material information
Applied to: Process Transportation Segments
WHEN
The system processes transportation segments
THEN
Transportation segments (TN, T2, TA, T3 types) are retrieved from EBSNRTD segments to get transportation details, additional addresses, and contact information
Applied to: Extract MCOA Charge Information
WHEN
The system extracts MCOA charge information
THEN
MCOA segments (OT, ON, OC types) are retrieved from EBSMCOA segments to get organization details, addresses, and charge information for entities like freight forwarders and bill recipients
Context: Entity information has been extracted from EDI BOL
GIVEN
Entity information has been extracted from EDI BOL
Applied to: Extract Address Information
WHEN
The system extracts address information
THEN
Address segments (N3 and N4 types) are retrieved from EBSNRSA segments to get street addresses, city, state, postal code, and country information
Context: Entity and address information has been extracted from EDI BOL
GIVEN
Entity and address information has been extracted from EDI BOL
Applied to: Process Contact Information
WHEN
The system processes contact information
THEN
Contact segments (PER type) are retrieved from EBSNRSA segments to get contact function code, name, communication number qualifier, and communication number
Context: All EDI BOL segments have been extracted and processed
GIVEN
All EDI BOL segments have been extracted and processed
Applied to: Validate EDI BOL Structure
WHEN
The system validates the EDI BOL structure
THEN
Each N1 segment is validated for required fields (entity ID, name), address information is validated for completeness, and contact information is validated for proper format
R-GCX122A-cbl-00268 (+6) File: GCX122A.cbl Process Special Checks Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Special Checks':
  • Context - a special test message needs to be processed:
    For Access Test Configuration Table T2:
    When the system attempts to access the test configuration table t2, then the system retrieves the t2 table segment for test processing.
  • Context - the system is attempting to process a test message:
    For Table T2 Found?:
    When the test configuration table t2 lookup is performed, then if the table is not found, an error message 't2 check table entry not found' is reported and processing stops.
  • Context - the system is processing a test message:
    For Report Table Not Found Error:
    When the test configuration table t2 cannot be found or accessed, then the system reports error message 't2 check table entry not found' and terminates processing.
  • Context - a test message is being processed and the t2 configuration table is available:
    For Test Message Type?:
    When the system evaluates the message type indicator, then if the message is train type, process train test acknowledgment; if cargo type, process cargo test acknowledgment.
  • Context - a train test message is being processed and the t2 table is accessible:
    For Update Train Test Acknowledgment:
    When the system processes the train test acknowledgment, then the system updates the t2-358-ack field with current machine date (century and date) and current machine time (first 4 digits).
  • Context - a cargo test message is being processed and the t2 table is accessible:
    For Update Cargo Test Acknowledgment:
    When the system processes the cargo test acknowledgment, then the system updates the t2-309-ack field with current machine date (century and date) and current machine time (first 4 digits).
  • Context - test acknowledgment timestamps have been updated in the t2 table:
    For Save Updated Test Table:
    When the system completes the timestamp update process, then the system saves the updated t2 table segment back to the database using replace function.
👨‍💻 Technical ACs (Gherkin)
Context: A special test message needs to be processed
GIVEN
A special test message needs to be processed
Applied to: Access Test Configuration Table T2
WHEN
The system attempts to access the test configuration table T2
THEN
The system retrieves the T2 table segment for test processing
Context: The system is attempting to process a test message
GIVEN
The system is attempting to process a test message
Applied to: Table T2 Found?
WHEN
The test configuration table T2 lookup is performed
THEN
If the table is not found, an error message 'T2 CHECK TABLE ENTRY NOT FOUND' is reported and processing stops
Context: The system is processing a test message
GIVEN
The system is processing a test message
Applied to: Report Table Not Found Error
WHEN
The test configuration table T2 cannot be found or accessed
THEN
The system reports error message 'T2 CHECK TABLE ENTRY NOT FOUND' and terminates processing
Context: A test message is being processed and the T2 configuration table is available
GIVEN
A test message is being processed and the T2 configuration table is available
Applied to: Test Message Type?
WHEN
The system evaluates the message type indicator
THEN
If the message is train type, process train test acknowledgment; if cargo type, process cargo test acknowledgment
Context: A train test message is being processed and the T2 table is accessible
GIVEN
A train test message is being processed and the T2 table is accessible
Applied to: Update Train Test Acknowledgment
WHEN
The system processes the train test acknowledgment
THEN
The system updates the T2-358-ACK field with current machine date (century and date) and current machine time (first 4 digits)
Context: A cargo test message is being processed and the T2 table is accessible
GIVEN
A cargo test message is being processed and the T2 table is accessible
Applied to: Update Cargo Test Acknowledgment
WHEN
The system processes the cargo test acknowledgment
THEN
The system updates the T2-309-ACK field with current machine date (century and date) and current machine time (first 4 digits)
Context: Test acknowledgment timestamps have been updated in the T2 table
GIVEN
Test acknowledgment timestamps have been updated in the T2 table
Applied to: Save Updated Test Table
WHEN
The system completes the timestamp update process
THEN
The system saves the updated T2 table segment back to the database using replace function
R-GCCS309C-cbl-00272 (+5) File: GCCS309C.cbl Table Access Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Table Access':
  • Context - a manifest with consignee chop and commodity code information:
    For Access AU Table for Automotive Check:
    When both consignee chop and commodity code are not empty, then retrieve automotive type information from au table using chop and commodity code as lookup keys.
  • Context - an au table entry is successfully retrieved and origin country and csa indicator are available:
    For Set Automotive Flag Based on Country and CSA Status:
    When origin country is us, ca, or blank or origin country is mx and au type second character is c, and csa indicator is off, then set automotive flag to true, otherwise set to false.
  • Context - a manifest with from-station information:
    For Access SC Table for Station Codes:
    When station code lookup is performed using from-station as key, then retrieve corresponding station code entry from sc table.
  • Context - a station code lookup has been performed:
    For Retrieve Station Code Entry for From-Station:
    When sc table entry is not found or canadian station code is '0000', then generate error message indicating sc table entry not found for the station.
  • Context - a shipment with in-transit status of 'l' (local):
    For Access EX Table for Export Destination:
    When export destination lookup is performed using destination station number, then retrieve export destination entry from ex table if available.
  • Context - transit status and origin country information are available:
    For Store Export Destination Information:
    When transit status is 't' or (transit status is 'l' and origin country is not ca and export destination lookup is successful) or (transit status is 'e' and origin country is not ca), then add reference segment with qualifier 'kd' and value 'in-transit'.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest with consignee CHOP and commodity code information
GIVEN
A manifest with consignee CHOP and commodity code information
Applied to: Access AU Table for Automotive Check
WHEN
Both consignee CHOP and commodity code are not empty
THEN
Retrieve automotive type information from AU table using CHOP and commodity code as lookup keys
Context: An AU table entry is successfully retrieved and origin country and CSA indicator are available
GIVEN
An AU table entry is successfully retrieved and origin country and CSA indicator are available
Applied to: Set Automotive Flag Based on Country and CSA Status
WHEN
Origin country is US, CA, or blank OR origin country is MX and AU type second character is C, AND CSA indicator is off
THEN
Set automotive flag to true, otherwise set to false
Context: A manifest with from-station information
GIVEN
A manifest with from-station information
Applied to: Access SC Table for Station Codes
WHEN
Station code lookup is performed using from-station as key
THEN
Retrieve corresponding station code entry from SC table
Context: A station code lookup has been performed
GIVEN
A station code lookup has been performed
Applied to: Retrieve Station Code Entry for From-Station
WHEN
SC table entry is not found OR Canadian station code is '0000'
THEN
Generate error message indicating SC table entry not found for the station
Context: A shipment with in-transit status of 'L' (Local)
GIVEN
A shipment with in-transit status of 'L' (Local)
Applied to: Access EX Table for Export Destination
WHEN
Export destination lookup is performed using destination station number
THEN
Retrieve export destination entry from EX table if available
Context: Transit status and origin country information are available
GIVEN
Transit status and origin country information are available
Applied to: Store Export Destination Information
WHEN
Transit status is 'T' OR (transit status is 'L' and origin country is not CA and export destination lookup is successful) OR (transit status is 'E' and origin country is not CA)
THEN
Add reference segment with qualifier 'KD' and value 'IN-TRANSIT'
R-GCX122A-cbl-00275 (+6) File: GCX122A.cbl Process Message Header Setup Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Message Header Setup':
  • Context - an input message contains a reference number in oti-03-ref-num:
    For Set Reference Number from Input Message:
    When the system processes the message header setup, then the reference number is copied to emi-ref, mst-ref, msg-ref-key, and ws-ref-number fields for consistent message tracking.
  • Context - a new message is being processed:
    For Initialize Message Processing Flags:
    When the system initializes message processing flags, then sw-process-mst is set to true, sw-process-merlin is set to true, sw-not-train-error is set to true, and sw-not-cargo-error is set to true.
  • Context - a message is being prepared for processing:
    For Clear Message Content Areas:
    When the system clears message content areas, then emi-to-usercode, emi-copy-usercode, emi-keywords, emi-text, emi-return-status-flag, mst-table, mst-call-lettrs, and ws-lterm-process are set to spaces.
  • Context - the input message is identified as a train message (oti-02-train is true):
    For Set Train Report Header Text:
    When the system determines the message header text, then msg-lib is set to 'train report number :'.
  • Context - the input message is identified as a cargo message (oti-02-cargo is true) and not a train message:
    For Set Cargo Control Header Text:
    When the system determines the message header text, then msg-lib is set to 'cargo control number :'.
  • Context - the input message is neither a train message nor a cargo message:
    For Set Generic Reference Header Text:
    When the system determines the message header text, then msg-lib is set to 'reference number :'.
  • Context - message processing is being initialized:
    For Initialize Message Indicators:
    When the system sets up message indicators, then ws-ind-text is set to line-mess-min, ws-ind-mst is set to line-mess-min-mst, ws-ind-user is set to zero, mst-indx is set to zero, and ws-ind-err is set to zero.
👨‍💻 Technical ACs (Gherkin)
Context: An input message contains a reference number in OTI-03-REF-NUM
GIVEN
An input message contains a reference number in OTI-03-REF-NUM
Applied to: Set Reference Number from Input Message
WHEN
The system processes the message header setup
THEN
The reference number is copied to EMI-REF, MST-REF, MSG-REF-KEY, and WS-REF-NUMBER fields for consistent message tracking
Context: A new message is being processed
GIVEN
A new message is being processed
Applied to: Initialize Message Processing Flags
WHEN
The system initializes message processing flags
THEN
SW-PROCESS-MST is set to TRUE, SW-PROCESS-MERLIN is set to TRUE, SW-NOT-TRAIN-ERROR is set to TRUE, and SW-NOT-CARGO-ERROR is set to TRUE
Context: A message is being prepared for processing
GIVEN
A message is being prepared for processing
Applied to: Clear Message Content Areas
WHEN
The system clears message content areas
THEN
EMI-TO-USERCODE, EMI-COPY-USERCODE, EMI-KEYWORDS, EMI-TEXT, EMI-RETURN-STATUS-FLAG, MST-TABLE, MST-CALL-LETTRS, and WS-LTERM-PROCESS are set to SPACES
Context: The input message is identified as a train message (OTI-02-TRAIN is true)
GIVEN
The input message is identified as a train message (OTI-02-TRAIN is true)
Applied to: Set Train Report Header Text
WHEN
The system determines the message header text
THEN
MSG-LIB is set to 'TRAIN REPORT NUMBER :'
Context: The input message is identified as a cargo message (OTI-02-CARGO is true) and not a train message
GIVEN
The input message is identified as a cargo message (OTI-02-CARGO is true) and not a train message
Applied to: Set Cargo Control Header Text
WHEN
The system determines the message header text
THEN
MSG-LIB is set to 'CARGO CONTROL NUMBER :'
Context: The input message is neither a train message nor a cargo message
GIVEN
The input message is neither a train message nor a cargo message
Applied to: Set Generic Reference Header Text
WHEN
The system determines the message header text
THEN
MSG-LIB is set to 'REFERENCE NUMBER :'
Context: Message processing is being initialized
GIVEN
Message processing is being initialized
Applied to: Initialize Message Indicators
WHEN
The system sets up message indicators
THEN
WS-IND-TEXT is set to LINE-MESS-MIN, WS-IND-MST is set to LINE-MESS-MIN-MST, WS-IND-USER is set to ZERO, MST-INDX is set to ZERO, and WS-IND-ERR is set to ZERO
R-GCCCBOL-cbl-00276 (+7) File: GCCCBOL.cbl Validate CSA Qualification Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate CSA Qualification':
  • Context - a shipment with destination road number information:
    For Destination Road Number = 105?:
    When the destination road number is evaluated for csa qualification, then if destination road number equals 105, proceed to check haulage carrier; otherwise set csa indicator off.
  • Context - a shipment with destination road number 105:
    For Haulage Right Carrier = SPACES?:
    When the haulage right carrier field is evaluated, then if haulage right carrier is empty (spaces), proceed to check for csa data; otherwise set csa indicator off.
  • Context - a qualified shipment for csa processing:
    For Check BOL for CSA Data:
    When edi bol system is checked for importer segment data, then retrieve n1 importer segment and evaluate for valid csa data.
  • Context - n1 importer segment retrieved from edi bol:
    For CSA Data Found in BOL?:
    When the importer data is evaluated for csa validity, then if entity id is 'im' with non-empty name and id code qualifier is 'm5' with non-empty id code, set csa indicator on and copy data; if qualifier is 'bn' or 'ai' with valid data, copy data only; otherwise check fastway system.
  • Context - no valid csa data found in edi bol system:
    For Check Fastway for CSA Data:
    When fastway system is searched for csa importer information, then search shipment mine segments for n1-01 im entity data.
  • Context - shipment mine segments searched for n1-01 im entity:
    For CSA Data Found in Fastway?:
    When the fastway importer data is evaluated for csa validity, then if n1-01 im entity found with n1-02 name, n1-03 qualifier ('m5', 'bn', or 'ai'), and n1-04 id code, then if qualifier is 'm5' set csa indicator on and copy all data; otherwise copy data without setting csa indicator; if no valid data found, set csa indicator off.
  • Context - valid csa importer data found with m5 qualification:
    For Set CSA Indicator ON:
    When csa indicator is set to active status, then set csa indicator on, copy importer name to gccc-importer, copy id code qualifier to gccc-business-nbr-qual, and copy id code to gccc-business-nbr.
  • Context - shipment does not meet csa qualification criteria or no valid csa data found:
    For Set CSA Indicator OFF:
    When csa processing determination is completed, then set csa indicator off to indicate no csa processing required.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with destination road number information
GIVEN
A shipment with destination road number information
Applied to: Destination Road Number = 105?
WHEN
The destination road number is evaluated for CSA qualification
THEN
If destination road number equals 105, proceed to check haulage carrier; otherwise set CSA indicator OFF
Context: A shipment with destination road number 105
GIVEN
A shipment with destination road number 105
Applied to: Haulage Right Carrier = SPACES?
WHEN
The haulage right carrier field is evaluated
THEN
If haulage right carrier is empty (SPACES), proceed to check for CSA data; otherwise set CSA indicator OFF
Context: A qualified shipment for CSA processing
GIVEN
A qualified shipment for CSA processing
Applied to: Check BOL for CSA Data
WHEN
EDI BOL system is checked for importer segment data
THEN
Retrieve N1 importer segment and evaluate for valid CSA data
Context: N1 importer segment retrieved from EDI BOL
GIVEN
N1 importer segment retrieved from EDI BOL
Applied to: CSA Data Found in BOL?
WHEN
The importer data is evaluated for CSA validity
THEN
If entity ID is 'IM' with non-empty name and ID code qualifier is 'M5' with non-empty ID code, set CSA indicator ON and copy data; if qualifier is 'BN' or 'AI' with valid data, copy data only; otherwise check Fastway system
Context: No valid CSA data found in EDI BOL system
GIVEN
No valid CSA data found in EDI BOL system
Applied to: Check Fastway for CSA Data
WHEN
Fastway system is searched for CSA importer information
THEN
Search shipment mine segments for N1-01 IM entity data
Context: Shipment mine segments searched for N1-01 IM entity
GIVEN
Shipment mine segments searched for N1-01 IM entity
Applied to: CSA Data Found in Fastway?
WHEN
The Fastway importer data is evaluated for CSA validity
THEN
If N1-01 IM entity found with N1-02 name, N1-03 qualifier ('M5', 'BN', or 'AI'), and N1-04 ID code, then if qualifier is 'M5' set CSA indicator ON and copy all data; otherwise copy data without setting CSA indicator; if no valid data found, set CSA indicator OFF
Context: Valid CSA importer data found with M5 qualification
GIVEN
Valid CSA importer data found with M5 qualification
Applied to: Set CSA Indicator ON
WHEN
CSA indicator is set to active status
THEN
Set CSA indicator ON, copy importer name to GCCC-IMPORTER, copy ID code qualifier to GCCC-BUSINESS-NBR-QUAL, and copy ID code to GCCC-BUSINESS-NBR
Context: Shipment does not meet CSA qualification criteria or no valid CSA data found
GIVEN
Shipment does not meet CSA qualification criteria or no valid CSA data found
Applied to: Set CSA Indicator OFF
WHEN
CSA processing determination is completed
THEN
Set CSA indicator OFF to indicate no CSA processing required
R-GCCS309C-cbl-00278 (+11) File: GCCS309C.cbl Date Conversion Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Date Conversion':
  • Context - a manifest record with ccn creation date field:
    For Is CCN Creation Date Numeric and Not Zero?:
    When the ccn creation date is not numeric or equals zero, then use current machine century and date for edi processing.
  • Context - ccn creation date is not numeric or equals zero:
    For Use Current Machine Date:
    When date conversion process requires a valid date, then concatenate machine century and machine date into gregorian format for input date.
  • Context - a valid numeric ccn creation date that is not zero:
    For Extract Year from CCN Creation Date:
    When processing date for edi transmission, then move ccn creation date to year-month-day format for century determination.
  • Context - a two-digit year extracted from ccn creation date:
    For Year < 90?:
    When the year value is less than 90, then assign century as '20' for years 00-89, otherwise assign '19' for years 90-99.
  • Context - a two-digit year less than 90:
    For Set Century to '20':
    When building complete gregorian date, then set century component to '20'.
  • Context - a two-digit year greater than or equal to 90:
    For Set Century to '19':
    When building complete gregorian date, then set century component to '19'.
  • Context - century component and year-month-day components are determined:
    For Build Complete Gregorian Date with Century:
    When preparing date for conversion module, then move complete gregorian date to input date field for conversion processing.
  • Context - input date in gregorian format is prepared:
    For Call ISCDATCV Date Conversion Module:
    When date conversion is required for edi transmission, then call iscdatcv module with function codes 2 for input and 1 for output format.
  • Context - date conversion module has been called:
    For Date Conversion Successful?:
    When conversion module returns success status, then use converted output date for edi flight voyage number field.
  • Context - date conversion module returned success status:
    For Use Converted Date for EDI Format:
    When populating edi m10 segment, then move conversion output to m10-06-flight-voyage-num field.
  • Context - date conversion module did not return success status:
    For Set Error Message for Invalid Date:
    When date conversion fails, then set error message 'module iscdatcv said input date is invalid' in common communication area.
  • Context - date conversion has failed and error message is set:
    For Clear Date Field:
    When preparing edi segment with invalid date, then move spaces to m10-06-flight-voyage-num field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with CCN creation date field
GIVEN
A manifest record with CCN creation date field
Applied to: Is CCN Creation Date Numeric and Not Zero?
WHEN
The CCN creation date is not numeric or equals zero
THEN
Use current machine century and date for EDI processing
Context: CCN creation date is not numeric or equals zero
GIVEN
CCN creation date is not numeric or equals zero
Applied to: Use Current Machine Date
WHEN
Date conversion process requires a valid date
THEN
Concatenate machine century and machine date into Gregorian format for input date
Context: A valid numeric CCN creation date that is not zero
GIVEN
A valid numeric CCN creation date that is not zero
Applied to: Extract Year from CCN Creation Date
WHEN
Processing date for EDI transmission
THEN
Move CCN creation date to year-month-day format for century determination
Context: A two-digit year extracted from CCN creation date
GIVEN
A two-digit year extracted from CCN creation date
Applied to: Year < 90?
WHEN
The year value is less than 90
THEN
Assign century as '20' for years 00-89, otherwise assign '19' for years 90-99
Context: A two-digit year less than 90
GIVEN
A two-digit year less than 90
Applied to: Set Century to '20'
WHEN
Building complete Gregorian date
THEN
Set century component to '20'
Context: A two-digit year greater than or equal to 90
GIVEN
A two-digit year greater than or equal to 90
Applied to: Set Century to '19'
WHEN
Building complete Gregorian date
THEN
Set century component to '19'
Context: Century component and year-month-day components are determined
GIVEN
Century component and year-month-day components are determined
Applied to: Build Complete Gregorian Date with Century
WHEN
Preparing date for conversion module
THEN
Move complete Gregorian date to input date field for conversion processing
Context: Input date in Gregorian format is prepared
GIVEN
Input date in Gregorian format is prepared
Applied to: Call ISCDATCV Date Conversion Module
WHEN
Date conversion is required for EDI transmission
THEN
Call ISCDATCV module with function codes 2 for input and 1 for output format
Context: Date conversion module has been called
GIVEN
Date conversion module has been called
Applied to: Date Conversion Successful?
WHEN
Conversion module returns success status
THEN
Use converted output date for EDI flight voyage number field
Context: Date conversion module returned success status
GIVEN
Date conversion module returned success status
Applied to: Use Converted Date for EDI Format
WHEN
Populating EDI M10 segment
THEN
Move conversion output to M10-06-FLIGHT-VOYAGE-NUM field
Context: Date conversion module did not return success status
GIVEN
Date conversion module did not return success status
Applied to: Set Error Message for Invalid Date
WHEN
Date conversion fails
THEN
Set error message 'MODULE ISCDATCV SAID INPUT DATE IS INVALID' in common communication area
Context: Date conversion has failed and error message is set
GIVEN
Date conversion has failed and error message is set
Applied to: Clear Date Field
WHEN
Preparing EDI segment with invalid date
THEN
Move spaces to M10-06-FLIGHT-VOYAGE-NUM field
R-GCX122A-cbl-00282 (+7) File: GCX122A.cbl Validate Message Reference Numbers Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Message Reference Numbers':
  • Context - an incoming message contains a reference number in field oti-03-ref-num:
    For Extract Reference Number from Message:
    When the system processes the message for reference number extraction, then the reference number is copied to emi-ref, mst-ref, msg-ref-key, and ws-ref-number variables.
  • Context - the system is initializing reference processing:
    For Initialize Processing Flags:
    When processing flags need to be established, then sw-process-mst and sw-process-merlin are set to true, and sw-not-train-error and sw-not-cargo-error are set to true.
    For Initialize Message Indicators:
    When message indicators need to be set up, then ws-ind-text is set to line-mess-min and ws-ind-mst is set to line-mess-min-mst.
    For Clear User and Error Counters:
    When counters need to be reset, then ws-ind-user, mst-indx, and ws-ind-err are all set to zero.
    For Clear Message Fields:
    When message fields need to be cleared, then emi-to-usercode, emi-copy-usercode, emi-keywords, emi-text, emi-return-status-flag, mst-table, mst-call-lettrs, and ws-lterm-process are all set to spaces.
  • Context - the incoming message is identified as a train message (oti-02-train is true):
    For Set Train Report Label:
    When the system determines the message label, then msg-lib is set to 'train report number :'.
  • Context - the incoming message is identified as a cargo message (oti-02-cargo is true) and is not a train message:
    For Set Cargo Control Number Label:
    When the system determines the message label, then msg-lib is set to 'cargo control number :'.
  • Context - the incoming message is neither a train message nor a cargo message:
    For Set Generic Reference Label:
    When the system determines the message label, then msg-lib is set to 'reference number :'.
👨‍💻 Technical ACs (Gherkin)
Context: An incoming message contains a reference number in field OTI-03-REF-NUM
GIVEN
An incoming message contains a reference number in field OTI-03-REF-NUM
Applied to: Extract Reference Number from Message
WHEN
The system processes the message for reference number extraction
THEN
The reference number is copied to EMI-REF, MST-REF, MSG-REF-KEY, and WS-REF-NUMBER variables
Context: The system is initializing reference processing
GIVEN
The system is initializing reference processing
Applied to: Initialize Processing Flags
WHEN
Processing flags need to be established
THEN
SW-PROCESS-MST and SW-PROCESS-MERLIN are set to TRUE, and SW-NOT-TRAIN-ERROR and SW-NOT-CARGO-ERROR are set to TRUE
Applied to: Initialize Message Indicators
WHEN
Message indicators need to be set up
THEN
WS-IND-TEXT is set to LINE-MESS-MIN and WS-IND-MST is set to LINE-MESS-MIN-MST
Applied to: Clear User and Error Counters
WHEN
Counters need to be reset
THEN
WS-IND-USER, MST-INDX, and WS-IND-ERR are all set to ZERO
Applied to: Clear Message Fields
WHEN
Message fields need to be cleared
THEN
EMI-TO-USERCODE, EMI-COPY-USERCODE, EMI-KEYWORDS, EMI-TEXT, EMI-RETURN-STATUS-FLAG, MST-TABLE, MST-CALL-LETTRS, and WS-LTERM-PROCESS are all set to SPACES
Context: The incoming message is identified as a train message (OTI-02-TRAIN is true)
GIVEN
The incoming message is identified as a train message (OTI-02-TRAIN is true)
Applied to: Set Train Report Label
WHEN
The system determines the message label
THEN
MSG-LIB is set to 'TRAIN REPORT NUMBER :'
Context: The incoming message is identified as a cargo message (OTI-02-CARGO is true) and is not a train message
GIVEN
The incoming message is identified as a cargo message (OTI-02-CARGO is true) and is not a train message
Applied to: Set Cargo Control Number Label
WHEN
The system determines the message label
THEN
MSG-LIB is set to 'CARGO CONTROL NUMBER :'
Context: The incoming message is neither a train message nor a cargo message
GIVEN
The incoming message is neither a train message nor a cargo message
Applied to: Set Generic Reference Label
WHEN
The system determines the message label
THEN
MSG-LIB is set to 'REFERENCE NUMBER :'
R-GCCCBOL-cbl-00284 (+3) File: GCCCBOL.cbl Copy Importer Data Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Copy Importer Data':
  • Context - a valid n1 importer segment has been found in edi bol data with entity id code 'im' and the importer name is not empty:
    For Transfer Importer Name to Cargo Report:
    When the copy importer data process is executed, then the n1-name field value is transferred to the gccc-importer field in the cargo report segment.
  • Context - a valid n1 importer segment contains a business number qualifier code (m5, bn, or ai):
    For Transfer Business Number Qualifier to Cargo Report:
    When the copy importer data process is executed, then the n1-id-code-qualifier field value is transferred to the gccc-business-nbr-qual field in the cargo report segment.
  • Context - a valid n1 importer segment contains a business registration number that is not empty:
    For Transfer Business Number to Cargo Report:
    When the copy importer data process is executed, then the n1-id-code field value is transferred to the gccc-business-nbr field in the cargo report segment.
  • Context - the csa importer data transfer process has completed successfully:
    For Log Transfer Completion with Details:
    When all importer data fields have been copied to the cargo report segment, then the system logs the completion with timestamp, root key, car id, edi bol key, importer name, business number qualifier, and business number to the system error log.
👨‍💻 Technical ACs (Gherkin)
Context: A valid N1 importer segment has been found in EDI BOL data with entity ID code 'IM' and the importer name is not empty
GIVEN
A valid N1 importer segment has been found in EDI BOL data with entity ID code 'IM' and the importer name is not empty
Applied to: Transfer Importer Name to Cargo Report
WHEN
The copy importer data process is executed
THEN
The N1-NAME field value is transferred to the GCCC-IMPORTER field in the cargo report segment
Context: A valid N1 importer segment contains a business number qualifier code (M5, BN, or AI)
GIVEN
A valid N1 importer segment contains a business number qualifier code (M5, BN, or AI)
Applied to: Transfer Business Number Qualifier to Cargo Report
WHEN
The copy importer data process is executed
THEN
The N1-ID-CODE-QUALIFIER field value is transferred to the GCCC-BUSINESS-NBR-QUAL field in the cargo report segment
Context: A valid N1 importer segment contains a business registration number that is not empty
GIVEN
A valid N1 importer segment contains a business registration number that is not empty
Applied to: Transfer Business Number to Cargo Report
WHEN
The copy importer data process is executed
THEN
The N1-ID-CODE field value is transferred to the GCCC-BUSINESS-NBR field in the cargo report segment
Context: The CSA importer data transfer process has completed successfully
GIVEN
The CSA importer data transfer process has completed successfully
Applied to: Log Transfer Completion with Details
WHEN
All importer data fields have been copied to the cargo report segment
THEN
The system logs the completion with timestamp, root key, car ID, EDI BOL key, importer name, business number qualifier, and business number to the system error log
R-GCCCCADD-cbl-00284 (+3) File: GCCCCADD.cbl Multiple CCN Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multiple CCN Processing':
  • Context - a cargo manifest processing request with potential multiple ccns:
    For CCN Array from EDI BOL Available?:
    When the system checks for ccn array data from edi bol processing, then the system determines if ccn array contains valid data or is empty/low-values to decide processing path.
  • Context - a ccn array with multiple entries for processing:
    For More CCNs to Process?:
    When the system iterates through ccn entries using index counter, then the system continues processing while ccn index is less than or equal to 99 and current ccn entry is not spaces.
  • Context - a valid ccn entry from the array requiring manifest creation:
    For Set Spawn Parameters:
    When the system prepares to spawn manifest creation process, then the system sets waybill key from input, waybill date from shipment, current ccn from array, and action code to 'am'.
  • Context - spawn parameters are properly configured for a ccn entry:
    For Spawn GCT0111E for Manifest Creation:
    When the system invokes the gct0111e manifest creation program, then the system calls gct0111e with the spawn message containing waybill, date, ccn, and action code information.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest processing request with potential multiple CCNs
GIVEN
A cargo manifest processing request with potential multiple CCNs
Applied to: CCN Array from EDI BOL Available?
WHEN
The system checks for CCN array data from EDI BOL processing
THEN
The system determines if CCN array contains valid data or is empty/low-values to decide processing path
Context: A CCN array with multiple entries for processing
GIVEN
A CCN array with multiple entries for processing
Applied to: More CCNs to Process?
WHEN
The system iterates through CCN entries using index counter
THEN
The system continues processing while CCN index is less than or equal to 99 and current CCN entry is not spaces
Context: A valid CCN entry from the array requiring manifest creation
GIVEN
A valid CCN entry from the array requiring manifest creation
Applied to: Set Spawn Parameters
WHEN
The system prepares to spawn manifest creation process
THEN
The system sets waybill key from input, waybill date from shipment, current CCN from array, and action code to 'AM'
Context: Spawn parameters are properly configured for a CCN entry
GIVEN
Spawn parameters are properly configured for a CCN entry
Applied to: Spawn GCT0111E for Manifest Creation
WHEN
The system invokes the GCT0111E manifest creation program
THEN
The system calls GCT0111E with the spawn message containing waybill, date, CCN, and action code information
R-GCCCBOL-cbl-00288 (+6) File: GCCCBOL.cbl Get Additional Cargo Description Data Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Additional Cargo Description Data':
  • Context - a cargo shipment exists with bol data and current description sequence counter and description array index are initialized:
    For Get Additional Cargo Description Data:
    When the system processes additional cargo description segments from ebsbcrt-ad bol segments, then the system should retrieve up to 10 description sequences, each containing up to 7 additional lading descriptions, and store non-empty descriptions in the description array while incrementing the array index.
  • Context - the system is processing additional cargo descriptions with a current description sequence counter:
    For Description Sequence <= 10?:
    When the description sequence counter exceeds 10, then the system should stop processing additional description sequences and complete the operation.
  • Context - the system attempts to retrieve an ebsbcrt-ad segment from bol for a specific sequence:
    For EBSBCRT-AD Segment Found?:
    When the ebsbcrt-ad segment is successfully found, then the system should initialize description index to 1 and begin processing the segment's description data.
    For EBSBCRT-AD Segment Found?:
    When the ebsbcrt-ad segment is not found, then the system should increment the description sequence counter and continue to the next sequence without processing description data.
  • Context - the system is processing descriptions within an ebsbcrt-ad segment with a current description index:
    For Description Index <= 7?:
    When the description index exceeds 7, then the system should stop processing descriptions for the current segment and increment the description sequence counter.
  • Context - the system is processing an additional lading description from an ebsbcrt-ad segment:
    For Additional Lading Description Not Empty?:
    When the additional lading description is not empty (not spaces), then the system should store the description in the description array at the current array index and increment both the description array index and description index.
    For Additional Lading Description Not Empty?:
    When the additional lading description is empty (contains only spaces), then the system should skip storing the description and only increment the description index to continue processing the next description.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo shipment exists with BOL data and current description sequence counter and description array index are initialized
GIVEN
A cargo shipment exists with BOL data and current description sequence counter and description array index are initialized
Applied to: Get Additional Cargo Description Data
WHEN
The system processes additional cargo description segments from EBSBCRT-AD BOL segments
THEN
The system should retrieve up to 10 description sequences, each containing up to 7 additional lading descriptions, and store non-empty descriptions in the description array while incrementing the array index
Context: The system is processing additional cargo descriptions with a current description sequence counter
GIVEN
The system is processing additional cargo descriptions with a current description sequence counter
Applied to: Description Sequence <= 10?
WHEN
The description sequence counter exceeds 10
THEN
The system should stop processing additional description sequences and complete the operation
Context: The system attempts to retrieve an EBSBCRT-AD segment from BOL for a specific sequence
GIVEN
The system attempts to retrieve an EBSBCRT-AD segment from BOL for a specific sequence
Applied to: EBSBCRT-AD Segment Found?
WHEN
The EBSBCRT-AD segment is successfully found
THEN
The system should initialize description index to 1 and begin processing the segment's description data
Applied to: EBSBCRT-AD Segment Found?
WHEN
The EBSBCRT-AD segment is not found
THEN
The system should increment the description sequence counter and continue to the next sequence without processing description data
Context: The system is processing descriptions within an EBSBCRT-AD segment with a current description index
GIVEN
The system is processing descriptions within an EBSBCRT-AD segment with a current description index
Applied to: Description Index <= 7?
WHEN
The description index exceeds 7
THEN
The system should stop processing descriptions for the current segment and increment the description sequence counter
Context: The system is processing an additional lading description from an EBSBCRT-AD segment
GIVEN
The system is processing an additional lading description from an EBSBCRT-AD segment
Applied to: Additional Lading Description Not Empty?
WHEN
The additional lading description is not empty (not spaces)
THEN
The system should store the description in the description array at the current array index and increment both the description array index and description index
Applied to: Additional Lading Description Not Empty?
WHEN
The additional lading description is empty (contains only spaces)
THEN
The system should skip storing the description and only increment the description index to continue processing the next description
R-GCCCCADD-cbl-00288 (+9) File: GCCCCADD.cbl Related Manifest Creation Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Related Manifest Creation':
  • Context - an edi bill of lading record exists with potential multiple ccns:
    For Process EDI Bill of Lading Data:
    When the system processes the edi bol data through gcccbol program, then the system extracts ccn array data and makes it available for further processing.
  • Context - edi bol processing has completed and ccn array data is available:
    For Multiple CCNs Found in EDI BOL?:
    When the system checks if gcwcbol-ccn-array-tbl contains data and is not spaces or low-values, then the system identifies whether multiple ccns need to be processed for manifest creation.
  • Context - multiple ccns have been identified in the edi bol array:
    For Initialize CCN Processing Loop:
    When the system begins processing the ccn array, then the system initializes ccn index counter starting from 1 and prepares for loop iteration.
  • Context - ccn processing loop is active with a valid index counter:
    For Get Next CCN from Array:
    When the system accesses the ccn array at the current index position, then the system extracts the specific ccn value for manifest creation processing.
  • Context - ccn processing loop is active with current index position:
    For More CCNs to Process?:
    When the system checks if current ccn index is within array bounds (≤ 99) and current ccn is not spaces, then the system determines whether to continue processing more ccns or complete the loop.
  • Context - a valid ccn has been extracted from the array for processing:
    For Prepare Spawn Message for GCT0111E:
    When the system prepares spawn message data, then the system sets up waybill key, waybill date, extracted ccn, and action code 'am' in the spawn message structure.
  • Context - spawn message structure is being prepared for gct0111e:
    For Set Waybill Key and Date:
    When the system sets waybill information in the spawn message, then the system moves original waybill key to spawn-waybill and waybill date to spawn-waybill-date.
  • Context - a specific ccn has been extracted from the ccn array:
    For Set Current CCN:
    When the system assigns ccn to the spawn message, then the system moves the current ccn value to spawn-ccn field in the message structure.
  • Context - spawn message is being prepared for related manifest creation:
    For Set Action Code to 'AM':
    When the system sets the action code in the spawn message, then the system assigns action code 'am' to spawn-action-code to indicate manifest creation action.
  • Context - spawn message has been fully prepared with waybill, ccn, and action code information:
    For Call GCT0111E Program:
    When the system invokes the z700-spawn-gct0111e procedure, then the system executes gct0111e program with the prepared message data for manifest creation.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI Bill of Lading record exists with potential multiple CCNs
GIVEN
An EDI Bill of Lading record exists with potential multiple CCNs
Applied to: Process EDI Bill of Lading Data
WHEN
The system processes the EDI BOL data through GCCCBOL program
THEN
The system extracts CCN array data and makes it available for further processing
Context: EDI BOL processing has completed and CCN array data is available
GIVEN
EDI BOL processing has completed and CCN array data is available
Applied to: Multiple CCNs Found in EDI BOL?
WHEN
The system checks if GCWCBOL-CCN-ARRAY-TBL contains data and is not spaces or low-values
THEN
The system identifies whether multiple CCNs need to be processed for manifest creation
Context: Multiple CCNs have been identified in the EDI BOL array
GIVEN
Multiple CCNs have been identified in the EDI BOL array
Applied to: Initialize CCN Processing Loop
WHEN
The system begins processing the CCN array
THEN
The system initializes CCN index counter starting from 1 and prepares for loop iteration
Context: CCN processing loop is active with a valid index counter
GIVEN
CCN processing loop is active with a valid index counter
Applied to: Get Next CCN from Array
WHEN
The system accesses the CCN array at the current index position
THEN
The system extracts the specific CCN value for manifest creation processing
Context: CCN processing loop is active with current index position
GIVEN
CCN processing loop is active with current index position
Applied to: More CCNs to Process?
WHEN
The system checks if current CCN index is within array bounds (≤ 99) and current CCN is not spaces
THEN
The system determines whether to continue processing more CCNs or complete the loop
Context: A valid CCN has been extracted from the array for processing
GIVEN
A valid CCN has been extracted from the array for processing
Applied to: Prepare Spawn Message for GCT0111E
WHEN
The system prepares spawn message data
THEN
The system sets up waybill key, waybill date, extracted CCN, and action code 'AM' in the spawn message structure
Context: Spawn message structure is being prepared for GCT0111E
GIVEN
Spawn message structure is being prepared for GCT0111E
Applied to: Set Waybill Key and Date
WHEN
The system sets waybill information in the spawn message
THEN
The system moves original waybill key to SPAWN-WAYBILL and waybill date to SPAWN-WAYBILL-DATE
Context: A specific CCN has been extracted from the CCN array
GIVEN
A specific CCN has been extracted from the CCN array
Applied to: Set Current CCN
WHEN
The system assigns CCN to the spawn message
THEN
The system moves the current CCN value to SPAWN-CCN field in the message structure
Context: Spawn message is being prepared for related manifest creation
GIVEN
Spawn message is being prepared for related manifest creation
Applied to: Set Action Code to 'AM'
WHEN
The system sets the action code in the spawn message
THEN
The system assigns action code 'AM' to SPAWN-ACTION-CODE to indicate manifest creation action
Context: Spawn message has been fully prepared with waybill, CCN, and action code information
GIVEN
Spawn message has been fully prepared with waybill, CCN, and action code information
Applied to: Call GCT0111E Program
WHEN
The system invokes the Z700-SPAWN-GCT0111E procedure
THEN
The system executes GCT0111E program with the prepared message data for manifest creation
R-GCCS309C-cbl-00290 (+7) File: GCCS309C.cbl ETA Calculation Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'ETA Calculation':
  • Context - a manifest requires eta date processing for p4 segment:
    For Is Border Arrival ETA empty?:
    When the system checks if gccc-border-arrival-eta is empty or contains low-values, then if gccc-border-arrival-eta is spaces or low-values, proceed to calculate new eta, otherwise use the existing gccc-border-arrival-eta value.
  • Context - border arrival eta needs to be calculated and waybill date is available:
    For Extract waybill date from manifest:
    When the system processes eta calculation, then extract gccc-waybill-date-index and move it to dtcal-orig-date positions 3 through 6.
  • Context - waybill date has been extracted for eta calculation:
    For Get current machine century:
    When the system prepares date calculation parameters, then move cc-machine-century from cccom to dtcal-orig-date-yr positions 1 through 2.
  • Context - base date components have been prepared for eta calculation:
    For Set calculation parameters for adding days:
    When the system sets up date calculation parameters, then set dtcal-add to true, set dtcal-days to true, and move ws-days-for-eta to dtcal-amount.
  • Context - date calculation parameters have been properly configured:
    For Call date calculation service:
    When the system needs to calculate the estimated arrival date, then call 'iscdtcal' using dtcal-parameter-list to perform the date arithmetic.
  • Context - date calculation service has been invoked:
    For Date calculation successful?:
    When the system checks the calculation result status, then if dtcal-success is true, move dtcal-new-date to gccc-border-arrival-eta, otherwise continue with existing processing.
  • Context - date calculation service completed successfully:
    For Use calculated ETA date:
    When the system processes the calculated result, then move dtcal-new-date to gccc-border-arrival-eta for use in p4 segment.
  • Context - eta date has been determined (either calculated or existing gccc-border-arrival-eta):
    For Set ETA date in P4 segment:
    When the system builds the p4 segment for transmission, then move gccc-border-arrival-eta to p4-02-eta-date.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest requires ETA date processing for P4 segment
GIVEN
A manifest requires ETA date processing for P4 segment
Applied to: Is Border Arrival ETA empty?
WHEN
The system checks if GCCC-BORDER-ARRIVAL-ETA is empty or contains low-values
THEN
If GCCC-BORDER-ARRIVAL-ETA is spaces or low-values, proceed to calculate new ETA, otherwise use the existing GCCC-BORDER-ARRIVAL-ETA value
Context: Border arrival ETA needs to be calculated and waybill date is available
GIVEN
Border arrival ETA needs to be calculated and waybill date is available
Applied to: Extract waybill date from manifest
WHEN
The system processes ETA calculation
THEN
Extract GCCC-WAYBILL-DATE-INDEX and move it to DTCAL-ORIG-DATE positions 3 through 6
Context: Waybill date has been extracted for ETA calculation
GIVEN
Waybill date has been extracted for ETA calculation
Applied to: Get current machine century
WHEN
The system prepares date calculation parameters
THEN
Move CC-MACHINE-CENTURY from CCCOM to DTCAL-ORIG-DATE-YR positions 1 through 2
Context: Base date components have been prepared for ETA calculation
GIVEN
Base date components have been prepared for ETA calculation
Applied to: Set calculation parameters for adding days
WHEN
The system sets up date calculation parameters
THEN
Set DTCAL-ADD to TRUE, set DTCAL-DAYS to TRUE, and move WS-DAYS-FOR-ETA to DTCAL-AMOUNT
Context: Date calculation parameters have been properly configured
GIVEN
Date calculation parameters have been properly configured
Applied to: Call date calculation service
WHEN
The system needs to calculate the estimated arrival date
THEN
Call 'ISCDTCAL' using DTCAL-PARAMETER-LIST to perform the date arithmetic
Context: Date calculation service has been invoked
GIVEN
Date calculation service has been invoked
Applied to: Date calculation successful?
WHEN
The system checks the calculation result status
THEN
If DTCAL-SUCCESS is true, move DTCAL-NEW-DATE to GCCC-BORDER-ARRIVAL-ETA, otherwise continue with existing processing
Context: Date calculation service completed successfully
GIVEN
Date calculation service completed successfully
Applied to: Use calculated ETA date
WHEN
The system processes the calculated result
THEN
Move DTCAL-NEW-DATE to GCCC-BORDER-ARRIVAL-ETA for use in P4 segment
Context: ETA date has been determined (either calculated or existing GCCC-BORDER-ARRIVAL-ETA)
GIVEN
ETA date has been determined (either calculated or existing GCCC-BORDER-ARRIVAL-ETA)
Applied to: Set ETA date in P4 segment
WHEN
The system builds the P4 segment for transmission
THEN
Move GCCC-BORDER-ARRIVAL-ETA to P4-02-ETA-DATE
R-GCX122A-cbl-00290 (+13) File: GCX122A.cbl Process Message Text Formatting Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Message Text Formatting':
  • Context - a transaction message is being processed:
    For Format Train Report Message:
    When the transaction type is identified as train operation, then the message library text is set to 'train report number :' to indicate train-specific reference numbering.
    For Format Cargo Control Message:
    When the transaction type is identified as cargo operation, then the message library text is set to 'cargo control number :' to indicate cargo-specific reference numbering.
    For Format Reference Number Message:
    When the transaction type is neither train nor cargo operation, then the message library text is set to 'reference number :' as the default reference numbering format.
  • Context - an error message needs to be formatted and a message number is available:
    For Get Standardized Error Text:
    When the system looks up the error code in the ms table using either gcw122-msg-num or the first 3 characters of the free-form message, then the system retrieves the corresponding english text from the message table if the lookup is successful.
  • Context - an error message lookup has been performed in the ms table:
    For Use Standard Error Message:
    When the table lookup returns a successful result with error text found, then the system uses the english text from the message table (gcstbrt-ms-eng-text) as the error message content.
    For Use Free-Form Error Message:
    When the table lookup fails to find standardized error text, then the system uses the original free-form message text (ted-02-free-form-msg) and adds an additional error message indicating the lookup failure.
  • Context - error message text has been determined (either standard or free-form):
    For Add Error Context Information:
    When the error message is being prepared for distribution, then the system adds the copy of bad data element (ted-07-copy-bad-data-elmt) to provide context about what caused the error.
  • Context - error message content has been prepared with context information:
    For Format Message for EMI Channel:
    When the message needs to be distributed through electronic mail interface, then the system formats the message into emi-text-line structure for email distribution.
  • Context - error message content has been prepared and formatted for emi channel:
    For Format Message for MST Channel:
    When the message needs to be distributed through message switch terminal, then the system formats the message into mst-entry structure for terminal distribution.
  • Context - error message content has been prepared and formatted for emi and mst channels:
    For Format Message for Log Channel:
    When the message needs to be logged for audit and tracking purposes, then the system formats the message into gcx105-message structure for logging distribution.
  • Context - error message content has been formatted for all distribution channels:
    For Prepare Message Headers:
    When message headers need to be prepared for transmission, then the system sets security byte to high-value, sending transaction to 'gct1221e', acf2 user id from common area, and action code to 'zzz'.
  • Context - message headers are being prepared:
    For Set Message Reference Numbers:
    When reference number information needs to be included in the message, then the system assigns the transaction reference number (oti-03-ref-num) to the train or ccn field in the message header.
  • Context - message headers are being prepared with reference numbers:
    For Add Date/Time Stamps:
    When timestamp information needs to be added to the message, then the system assigns the current date (bgn-03-date) and time (bgn-04-time) to the message header timestamp fields.
  • Context - message headers are being prepared with timestamps:
    For Format Subject Line:
    When transaction type classification is needed for message routing, then the system sets gcx105-ca-cargo flag for cargo transactions, gcx105-new-ca-train flag for train transactions, or continues without specific classification for other transaction types.
👨‍💻 Technical ACs (Gherkin)
Context: A transaction message is being processed
GIVEN
A transaction message is being processed
Applied to: Format Train Report Message
WHEN
The transaction type is identified as train operation
THEN
The message library text is set to 'TRAIN REPORT NUMBER :' to indicate train-specific reference numbering
Applied to: Format Cargo Control Message
WHEN
The transaction type is identified as cargo operation
THEN
The message library text is set to 'CARGO CONTROL NUMBER :' to indicate cargo-specific reference numbering
Applied to: Format Reference Number Message
WHEN
The transaction type is neither train nor cargo operation
THEN
The message library text is set to 'REFERENCE NUMBER :' as the default reference numbering format
Context: An error message needs to be formatted and a message number is available
GIVEN
An error message needs to be formatted and a message number is available
Applied to: Get Standardized Error Text
WHEN
The system looks up the error code in the MS table using either GCW122-MSG-NUM or the first 3 characters of the free-form message
THEN
The system retrieves the corresponding English text from the message table if the lookup is successful
Context: An error message lookup has been performed in the MS table
GIVEN
An error message lookup has been performed in the MS table
Applied to: Use Standard Error Message
WHEN
The table lookup returns a successful result with error text found
THEN
The system uses the English text from the message table (GCSTBRT-MS-ENG-TEXT) as the error message content
Applied to: Use Free-Form Error Message
WHEN
The table lookup fails to find standardized error text
THEN
The system uses the original free-form message text (TED-02-FREE-FORM-MSG) and adds an additional error message indicating the lookup failure
Context: Error message text has been determined (either standard or free-form)
GIVEN
Error message text has been determined (either standard or free-form)
Applied to: Add Error Context Information
WHEN
The error message is being prepared for distribution
THEN
The system adds the copy of bad data element (TED-07-COPY-BAD-DATA-ELMT) to provide context about what caused the error
Context: Error message content has been prepared with context information
GIVEN
Error message content has been prepared with context information
Applied to: Format Message for EMI Channel
WHEN
The message needs to be distributed through electronic mail interface
THEN
The system formats the message into EMI-TEXT-LINE structure for email distribution
Context: Error message content has been prepared and formatted for EMI channel
GIVEN
Error message content has been prepared and formatted for EMI channel
Applied to: Format Message for MST Channel
WHEN
The message needs to be distributed through message switch terminal
THEN
The system formats the message into MST-ENTRY structure for terminal distribution
Context: Error message content has been prepared and formatted for EMI and MST channels
GIVEN
Error message content has been prepared and formatted for EMI and MST channels
Applied to: Format Message for Log Channel
WHEN
The message needs to be logged for audit and tracking purposes
THEN
The system formats the message into GCX105-MESSAGE structure for logging distribution
Context: Error message content has been formatted for all distribution channels
GIVEN
Error message content has been formatted for all distribution channels
Applied to: Prepare Message Headers
WHEN
Message headers need to be prepared for transmission
THEN
The system sets security byte to HIGH-VALUE, sending transaction to 'GCT1221E', ACF2 user ID from common area, and action code to 'ZZZ'
Context: Message headers are being prepared
GIVEN
Message headers are being prepared
Applied to: Set Message Reference Numbers
WHEN
Reference number information needs to be included in the message
THEN
The system assigns the transaction reference number (OTI-03-REF-NUM) to the train or CCN field in the message header
Context: Message headers are being prepared with reference numbers
GIVEN
Message headers are being prepared with reference numbers
Applied to: Add Date/Time Stamps
WHEN
Timestamp information needs to be added to the message
THEN
The system assigns the current date (BGN-03-DATE) and time (BGN-04-TIME) to the message header timestamp fields
Context: Message headers are being prepared with timestamps
GIVEN
Message headers are being prepared with timestamps
Applied to: Format Subject Line
WHEN
Transaction type classification is needed for message routing
THEN
The system sets GCX105-CA-CARGO flag for cargo transactions, GCX105-NEW-CA-TRAIN flag for train transactions, or continues without specific classification for other transaction types
R-GCCCBOL-cbl-00295 (+6) File: GCCCBOL.cbl Initialize EBSBCCX Database Access Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize EBSBCCX Database Access':
  • Context - a database access request needs to be prepared for ebsbccx segment retrieval:
    For Clear Database Access Parameters:
    When the system initializes the database access setup process, then all database access parameters are cleared to ensure clean state.
  • Context - database access parameters are being configured for segment retrieval:
    For Set Segment Type to EBSBCCX:
    When the system sets the segment type parameter, then the segment type is set to ebsbccx-lit to identify the target data structure.
  • Context - database access parameters are being configured:
    For Set Function Code to GU - Get Unique:
    When the system sets the function code parameter, then the function code is set to 'gu' to perform a get unique operation.
  • Context - database access parameters are being configured for record matching:
    For Set Operator to Equal:
    When the system sets the operator parameter, then the operator is set to '=' to perform exact match comparison.
  • Context - database access parameters are being configured and edi bol key is available:
    For Set EDI BOL Key as Root Key:
    When the system sets the root key parameter, then the root key is set to the work-edi-bol-key value for record identification.
  • Context - database access parameters are being configured for ebsbccx segment retrieval:
    For Set Dependent Key to CR001:
    When the system sets the dependent key parameter, then the dependent key is set to 'cr001' to identify the specific segment hierarchy.
  • Context - database access parameters are being finalized:
    For Set Accept Status to GE - Get Equal:
    When the system sets the accept status parameter, then the accept status is set to 'ge' to accept successful get equal operations.
👨‍💻 Technical ACs (Gherkin)
Context: A database access request needs to be prepared for EBSBCCX segment retrieval
GIVEN
A database access request needs to be prepared for EBSBCCX segment retrieval
Applied to: Clear Database Access Parameters
WHEN
The system initializes the database access setup process
THEN
All database access parameters are cleared to ensure clean state
Context: Database access parameters are being configured for segment retrieval
GIVEN
Database access parameters are being configured for segment retrieval
Applied to: Set Segment Type to EBSBCCX
WHEN
The system sets the segment type parameter
THEN
The segment type is set to EBSBCCX-LIT to identify the target data structure
Context: Database access parameters are being configured
GIVEN
Database access parameters are being configured
Applied to: Set Function Code to GU - Get Unique
WHEN
The system sets the function code parameter
THEN
The function code is set to 'GU' to perform a Get Unique operation
Context: Database access parameters are being configured for record matching
GIVEN
Database access parameters are being configured for record matching
Applied to: Set Operator to Equal
WHEN
The system sets the operator parameter
THEN
The operator is set to '=' to perform exact match comparison
Context: Database access parameters are being configured and EDI BOL key is available
GIVEN
Database access parameters are being configured and EDI BOL key is available
Applied to: Set EDI BOL Key as Root Key
WHEN
The system sets the root key parameter
THEN
The root key is set to the WORK-EDI-BOL-KEY value for record identification
Context: Database access parameters are being configured for EBSBCCX segment retrieval
GIVEN
Database access parameters are being configured for EBSBCCX segment retrieval
Applied to: Set Dependent Key to CR001
WHEN
The system sets the dependent key parameter
THEN
The dependent key is set to 'CR001' to identify the specific segment hierarchy
Context: Database access parameters are being finalized
GIVEN
Database access parameters are being finalized
Applied to: Set Accept Status to GE - Get Equal
WHEN
The system sets the accept status parameter
THEN
The accept status is set to 'GE' to accept successful Get Equal operations
R-GCCCCADD-cbl-00298 (+15) File: GCCCCADD.cbl Importer Data Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Processing':
  • Context - the system is processing importer data and csa indicator is already on:
    For CSA Indicator ON?:
    When the importer processing logic is executed, then skip au table lookup and importer data processing.
  • Context - the system is checking for au table data availability and csa indicator is off:
    For AU Table Data Available?:
    When au table data is not available (gcstbrtau is spaces), then skip importer data processing and continue with next steps.
  • Context - the system has au table data available and csa indicator is off and importer data has already been found and set from previous processing:
    For Importer Already Set?:
    When the system checks if importer is already set (ws-au-imp-found is true), then skip au table lookup and importer data processing.
  • Context - the system needs to find importer data and csa indicator is off and au table data is available and importer is not already set:
    For Lookup AU Table by Consignee CHOP and Commodity Code:
    When the system performs au table lookup using consignee chop code and commodity code, then retrieve au table record with matching consignee chop and commodity code.
  • Context - the system has performed au table lookup using consignee chop and commodity code:
    For AU Record Found?:
    When au table lookup returns no matching record (gcctbio-return-flag not equal to successful), then skip importer data processing and continue with next steps.
  • Context - a valid au table record has been found with matching consignee chop and commodity code:
    For Set Importer Name from AU Table:
    When the system processes the au record data, then set importer name to the value from au table importer field (gcstbrt-au-importer).
  • Context - a valid au table record has been found and importer name has been set:
    For Set Business Number from AU Table:
    When the system processes the au record business number data, then set business number to the value from au table business number field (gcstbrt-au-business-nbr).
  • Context - importer data is being set from au table record and business number has been assigned:
    For Set Business Number Qualifier to 'M5':
    When the system sets the business number qualifier, then set business number qualifier to 'm5' to indicate au table source.
  • Context - importer data has been successfully set from au table including name, business number, and qualifier:
    For Turn CSA Indicator ON:
    When the system finalizes the au table importer setup, then turn csa indicator on to indicate canada-us agreement processing.
  • Context - importer data has been successfully set from au table and csa indicator has been turned on:
    For Mark AU Importer Found:
    When the system completes au table importer processing, then set au importer found flag (ws-au-imp-found) to true.
  • Context - au table importer data has been processed and au importer found flag is set:
    For Check for EDI Importer Data:
    When the system checks for additional edi importer data, then verify if edi importer data exists (ws-s55-imp-found) for further processing decisions.
  • Context - au importer data has been processed and edi importer data also exists:
    For Business Number Qualifier BN or Blank?:
    When the system evaluates the edi business number qualifier, then check if business number qualifier is 'bn' or blank (spaces) to determine csa indicator action.
  • Context - au importer data has been processed with csa indicator on and edi importer data exists with business number qualifier 'bn' or blank:
    For Turn CSA Indicator OFF:
    When the system determines csa indicator setting based on data source priority, then turn csa indicator off to prioritize edi importer data over au table data.
  • Context - importer data has been processed from au table and csa indicator decisions have been made:
    For Create Final Importer Record:
    When the system creates the final importer record, then build customs record 55 with importer entity type, name, business number, qualifier, and address information.
  • Context - final importer record needs to be created and the system has reached the maximum of 24 n1 records:
    For Replace Last N1 Record:
    When the system attempts to add the importer record, then replace the last n1 record (sequence 24) with the new importer record using repl function.
  • Context - final importer record needs to be created and the system has not reached the maximum of 24 n1 records:
    For Insert New N1 Record:
    When the system adds the importer record, then insert new n1 record at the next available sequence position with importer information.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing importer data and CSA indicator is already ON
GIVEN
The system is processing importer data and CSA indicator is already ON
Applied to: CSA Indicator ON?
WHEN
The importer processing logic is executed
THEN
Skip AU table lookup and importer data processing
Context: The system is checking for AU table data availability and CSA indicator is OFF
GIVEN
The system is checking for AU table data availability and CSA indicator is OFF
Applied to: AU Table Data Available?
WHEN
AU table data is not available (GCSTBRTAU is spaces)
THEN
Skip importer data processing and continue with next steps
Context: The system has AU table data available and CSA indicator is OFF and importer data has already been found and set from previous processing
GIVEN
The system has AU table data available and CSA indicator is OFF and importer data has already been found and set from previous processing
Applied to: Importer Already Set?
WHEN
The system checks if importer is already set (WS-AU-IMP-FOUND is true)
THEN
Skip AU table lookup and importer data processing
Context: The system needs to find importer data and CSA indicator is OFF and AU table data is available and importer is not already set
GIVEN
The system needs to find importer data and CSA indicator is OFF and AU table data is available and importer is not already set
Applied to: Lookup AU Table by Consignee CHOP and Commodity Code
WHEN
The system performs AU table lookup using consignee CHOP code and commodity code
THEN
Retrieve AU table record with matching consignee CHOP and commodity code
Context: The system has performed AU table lookup using consignee CHOP and commodity code
GIVEN
The system has performed AU table lookup using consignee CHOP and commodity code
Applied to: AU Record Found?
WHEN
AU table lookup returns no matching record (GCCTBIO-RETURN-FLAG not equal to SUCCESSFUL)
THEN
Skip importer data processing and continue with next steps
Context: A valid AU table record has been found with matching consignee CHOP and commodity code
GIVEN
A valid AU table record has been found with matching consignee CHOP and commodity code
Applied to: Set Importer Name from AU Table
WHEN
The system processes the AU record data
THEN
Set importer name to the value from AU table importer field (GCSTBRT-AU-IMPORTER)
Context: A valid AU table record has been found and importer name has been set
GIVEN
A valid AU table record has been found and importer name has been set
Applied to: Set Business Number from AU Table
WHEN
The system processes the AU record business number data
THEN
Set business number to the value from AU table business number field (GCSTBRT-AU-BUSINESS-NBR)
Context: Importer data is being set from AU table record and business number has been assigned
GIVEN
Importer data is being set from AU table record and business number has been assigned
Applied to: Set Business Number Qualifier to 'M5'
WHEN
The system sets the business number qualifier
THEN
Set business number qualifier to 'M5' to indicate AU table source
Context: Importer data has been successfully set from AU table including name, business number, and qualifier
GIVEN
Importer data has been successfully set from AU table including name, business number, and qualifier
Applied to: Turn CSA Indicator ON
WHEN
The system finalizes the AU table importer setup
THEN
Turn CSA indicator ON to indicate Canada-US agreement processing
Context: Importer data has been successfully set from AU table and CSA indicator has been turned ON
GIVEN
Importer data has been successfully set from AU table and CSA indicator has been turned ON
Applied to: Mark AU Importer Found
WHEN
The system completes AU table importer processing
THEN
Set AU importer found flag (WS-AU-IMP-FOUND) to true
Context: AU table importer data has been processed and AU importer found flag is set
GIVEN
AU table importer data has been processed and AU importer found flag is set
Applied to: Check for EDI Importer Data
WHEN
The system checks for additional EDI importer data
THEN
Verify if EDI importer data exists (WS-S55-IMP-FOUND) for further processing decisions
Context: AU importer data has been processed and EDI importer data also exists
GIVEN
AU importer data has been processed and EDI importer data also exists
Applied to: Business Number Qualifier BN or Blank?
WHEN
The system evaluates the EDI business number qualifier
THEN
Check if business number qualifier is 'BN' or blank (spaces) to determine CSA indicator action
Context: AU importer data has been processed with CSA indicator ON and EDI importer data exists with business number qualifier 'BN' or blank
GIVEN
AU importer data has been processed with CSA indicator ON and EDI importer data exists with business number qualifier 'BN' or blank
Applied to: Turn CSA Indicator OFF
WHEN
The system determines CSA indicator setting based on data source priority
THEN
Turn CSA indicator OFF to prioritize EDI importer data over AU table data
Context: Importer data has been processed from AU table and CSA indicator decisions have been made
GIVEN
Importer data has been processed from AU table and CSA indicator decisions have been made
Applied to: Create Final Importer Record
WHEN
The system creates the final importer record
THEN
Build customs record 55 with importer entity type, name, business number, qualifier, and address information
Context: Final importer record needs to be created and the system has reached the maximum of 24 N1 records
GIVEN
Final importer record needs to be created and the system has reached the maximum of 24 N1 records
Applied to: Replace Last N1 Record
WHEN
The system attempts to add the importer record
THEN
Replace the last N1 record (sequence 24) with the new importer record using REPL function
Context: Final importer record needs to be created and the system has not reached the maximum of 24 N1 records
GIVEN
Final importer record needs to be created and the system has not reached the maximum of 24 N1 records
Applied to: Insert New N1 Record
WHEN
The system adds the importer record
THEN
Insert new N1 record at the next available sequence position with importer information
R-GCCS309C-cbl-00298 (+3) File: GCCS309C.cbl Country Code Processing Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Country Code Processing':
  • Context - a manifest record with in-transit status indicator:
    For Set Application Type to '29' for Transit:
    When the in-transit status equals 't' (transit), then the application type should be set to '29' for transit shipments.
    For Set Application Type to '27' for Non-Transit:
    When the in-transit status is not equal to 't' (transit), then the application type should be set to '27' for regular shipments.
  • Context - a manifest record with in-transit status and original country code:
    For Override Country Code to 'CA':
    When the in-transit status equals the return status indicator, then the country code should be overridden to 'ca' (canada) in the r4 segment.
    For Keep Original Country Code:
    When the in-transit status does not equal the return status indicator, then the original country code from the manifest should be preserved in the r4 segment.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with in-transit status indicator
GIVEN
A manifest record with in-transit status indicator
Applied to: Set Application Type to '29' for Transit
WHEN
The in-transit status equals 'T' (Transit)
THEN
The application type should be set to '29' for transit shipments
Applied to: Set Application Type to '27' for Non-Transit
WHEN
The in-transit status is not equal to 'T' (Transit)
THEN
The application type should be set to '27' for regular shipments
Context: A manifest record with in-transit status and original country code
GIVEN
A manifest record with in-transit status and original country code
Applied to: Override Country Code to 'CA'
WHEN
The in-transit status equals the return status indicator
THEN
The country code should be overridden to 'CA' (Canada) in the R4 segment
Applied to: Keep Original Country Code
WHEN
The in-transit status does not equal the return status indicator
THEN
The original country code from the manifest should be preserved in the R4 segment
R-GCCCBOL-cbl-00302 (+2) File: GCCCBOL.cbl Copy Importer Data to Cargo Report Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Copy Importer Data to Cargo Report':
  • Context - a valid n1 importer segment exists in the edi bol data:
    For Move N1-NAME to GCCC-IMPORTER:
    When the system processes csa importer data transfer, then the importer name from n1-name field is copied to gccc-importer field in the cargo report.
  • Context - a valid n1 importer segment exists in the edi bol data with a business number qualifier:
    For Move N1-ID-CODE-QUALIFIER to GCCC-BUSINESS-NBR-QUAL:
    When the system processes csa importer data transfer, then the business number qualifier from n1-id-code-qualifier field is copied to gccc-business-nbr-qual field in the cargo report.
  • Context - a valid n1 importer segment exists in the edi bol data with a business identification number:
    For Move N1-ID-CODE to GCCC-BUSINESS-NBR:
    When the system processes csa importer data transfer, then the business number from n1-id-code field is copied to gccc-business-nbr field in the cargo report.
👨‍💻 Technical ACs (Gherkin)
Context: A valid N1 importer segment exists in the EDI BOL data
GIVEN
A valid N1 importer segment exists in the EDI BOL data
Applied to: Move N1-NAME to GCCC-IMPORTER
WHEN
The system processes CSA importer data transfer
THEN
The importer name from N1-NAME field is copied to GCCC-IMPORTER field in the cargo report
Context: A valid N1 importer segment exists in the EDI BOL data with a business number qualifier
GIVEN
A valid N1 importer segment exists in the EDI BOL data with a business number qualifier
Applied to: Move N1-ID-CODE-QUALIFIER to GCCC-BUSINESS-NBR-QUAL
WHEN
The system processes CSA importer data transfer
THEN
The business number qualifier from N1-ID-CODE-QUALIFIER field is copied to GCCC-BUSINESS-NBR-QUAL field in the cargo report
Context: A valid N1 importer segment exists in the EDI BOL data with a business identification number
GIVEN
A valid N1 importer segment exists in the EDI BOL data with a business identification number
Applied to: Move N1-ID-CODE to GCCC-BUSINESS-NBR
WHEN
The system processes CSA importer data transfer
THEN
The business number from N1-ID-CODE field is copied to GCCC-BUSINESS-NBR field in the cargo report
R-GCCS309C-cbl-00302 (+17) File: GCCS309C.cbl Transaction Completion Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transaction Completion':
  • Context - a completed edi transmission processing session:
    For Initialize GCX121 Input Parameters:
    When the system begins transaction completion finalization, then the gcx121 input parameters are initialized to default values.
  • Context - transaction completion parameters are being initialized:
    For Set Security Byte to High Values:
    When security authorization needs to be established, then the security byte is set to high values indicating maximum authorization level.
  • Context - a transmission has been processed with a unique transmission number:
    For Move Transmission Number to GCX121:
    When transaction completion notification is being prepared, then the transmission number is associated with the completion request parameters.
  • Context - transaction completion processing is ready to execute:
    For Running Environment?:
    When the system needs to determine the execution environment, then the system routes to bpe environment processing if running in bpe, otherwise routes to tpe environment processing.
  • Context - the system is running in bpe environment:
    For BPE Environment: Use CSIEXCI Call:
    When transaction completion needs to be executed, then the system uses csiexci call mechanism for processing the completion notification.
  • Context - the system is running in tpe environment:
    For TPE Environment: Use CIMS Call:
    When transaction completion needs to be executed, then the system uses cims call mechanism with message logging and purging operations.
  • Context - bpe environment processing is selected for transaction completion:
    For Set Transaction Name to GCT1211E:
    When the external transaction service needs to be identified, then the transaction name is set to gct1211e for completion processing.
  • Context - bpe environment transaction completion is being prepared:
    For Calculate Communication Length:
    When communication parameters need to be sized, then the communication length is calculated as message length plus 4 bytes for header.
  • Context - bpe environment external call parameters are being prepared:
    For Move Message Data to Communication Area:
    When message data needs to be transferred for external processing, then the message data is moved to the communication area for the external call.
  • Context - all bpe environment call parameters are prepared:
    For Execute CSIEXCI Call:
    When the external transaction completion service needs to be invoked, then the csiexci call is executed with the prepared parameters.
  • Context - an external transaction completion call has been executed:
    For EXCI Call Successful?:
    When the system needs to determine call success, then the call is considered successful if response code is zero, response2 is zero, abort code is space, and message length is zero.
  • Context - external transaction completion call executed successfully:
    For Set Success Return Code:
    When the system needs to record the successful completion, then the return code is set to success status.
  • Context - external transaction completion call failed:
    For Set Failure Return Code:
    When the system needs to record the failed completion, then the return code is set to failure status and error message pointer is processed if available.
  • Context - tpe environment processing is selected for transaction completion:
    For Move GCX121 Input to GCT1211E Message:
    When message content needs to be prepared for internal processing, then the gcx121 input parameters are moved to the gct1211e message structure.
  • Context - tpe environment message is prepared for processing:
    For Change Alt-PCB Status:
    When message queue status needs to be updated, then the alternate pcb status is changed using cims call.
  • Context - tpe environment message processing is active:
    For Write Message Log Entry:
    When transaction completion needs to be logged, then a message log entry is written with completion details including message code, content, length, and module name.
  • Context - tpe environment message has been logged:
    For Purge Alt-PCB:
    When message queue cleanup is required, then the alternate pcb is purged using cims call.
  • Context - either bpe or tpe environment processing has completed:
    For Transaction Completion Finalized:
    When all completion processing steps are finished, then the transaction completion is finalized and control returns to the calling process.
👨‍💻 Technical ACs (Gherkin)
Context: A completed EDI transmission processing session
GIVEN
A completed EDI transmission processing session
Applied to: Initialize GCX121 Input Parameters
WHEN
The system begins transaction completion finalization
THEN
The GCX121 input parameters are initialized to default values
Context: Transaction completion parameters are being initialized
GIVEN
Transaction completion parameters are being initialized
Applied to: Set Security Byte to High Values
WHEN
Security authorization needs to be established
THEN
The security byte is set to high values indicating maximum authorization level
Context: A transmission has been processed with a unique transmission number
GIVEN
A transmission has been processed with a unique transmission number
Applied to: Move Transmission Number to GCX121
WHEN
Transaction completion notification is being prepared
THEN
The transmission number is associated with the completion request parameters
Context: Transaction completion processing is ready to execute
GIVEN
Transaction completion processing is ready to execute
Applied to: Running Environment?
WHEN
The system needs to determine the execution environment
THEN
The system routes to BPE environment processing if running in BPE, otherwise routes to TPE environment processing
Context: The system is running in BPE environment
GIVEN
The system is running in BPE environment
Applied to: BPE Environment: Use CSIEXCI Call
WHEN
Transaction completion needs to be executed
THEN
The system uses CSIEXCI call mechanism for processing the completion notification
Context: The system is running in TPE environment
GIVEN
The system is running in TPE environment
Applied to: TPE Environment: Use CIMS Call
WHEN
Transaction completion needs to be executed
THEN
The system uses CIMS call mechanism with message logging and purging operations
Context: BPE environment processing is selected for transaction completion
GIVEN
BPE environment processing is selected for transaction completion
Applied to: Set Transaction Name to GCT1211E
WHEN
The external transaction service needs to be identified
THEN
The transaction name is set to GCT1211E for completion processing
Context: BPE environment transaction completion is being prepared
GIVEN
BPE environment transaction completion is being prepared
Applied to: Calculate Communication Length
WHEN
Communication parameters need to be sized
THEN
The communication length is calculated as message length plus 4 bytes for header
Context: BPE environment external call parameters are being prepared
GIVEN
BPE environment external call parameters are being prepared
Applied to: Move Message Data to Communication Area
WHEN
Message data needs to be transferred for external processing
THEN
The message data is moved to the communication area for the external call
Context: All BPE environment call parameters are prepared
GIVEN
All BPE environment call parameters are prepared
Applied to: Execute CSIEXCI Call
WHEN
The external transaction completion service needs to be invoked
THEN
The CSIEXCI call is executed with the prepared parameters
Context: An external transaction completion call has been executed
GIVEN
An external transaction completion call has been executed
Applied to: EXCI Call Successful?
WHEN
The system needs to determine call success
THEN
The call is considered successful if response code is zero, response2 is zero, abort code is space, and message length is zero
Context: External transaction completion call executed successfully
GIVEN
External transaction completion call executed successfully
Applied to: Set Success Return Code
WHEN
The system needs to record the successful completion
THEN
The return code is set to success status
Context: External transaction completion call failed
GIVEN
External transaction completion call failed
Applied to: Set Failure Return Code
WHEN
The system needs to record the failed completion
THEN
The return code is set to failure status and error message pointer is processed if available
Context: TPE environment processing is selected for transaction completion
GIVEN
TPE environment processing is selected for transaction completion
Applied to: Move GCX121 Input to GCT1211E Message
WHEN
Message content needs to be prepared for internal processing
THEN
The GCX121 input parameters are moved to the GCT1211E message structure
Context: TPE environment message is prepared for processing
GIVEN
TPE environment message is prepared for processing
Applied to: Change Alt-PCB Status
WHEN
Message queue status needs to be updated
THEN
The alternate PCB status is changed using CIMS call
Context: TPE environment message processing is active
GIVEN
TPE environment message processing is active
Applied to: Write Message Log Entry
WHEN
Transaction completion needs to be logged
THEN
A message log entry is written with completion details including message code, content, length, and module name
Context: TPE environment message has been logged
GIVEN
TPE environment message has been logged
Applied to: Purge Alt-PCB
WHEN
Message queue cleanup is required
THEN
The alternate PCB is purged using CIMS call
Context: Either BPE or TPE environment processing has completed
GIVEN
Either BPE or TPE environment processing has completed
Applied to: Transaction Completion Finalized
WHEN
All completion processing steps are finished
THEN
The transaction completion is finalized and control returns to the calling process
R-GCX122A-cbl-00304 (+9) File: GCX122A.cbl Handle Message Delivery Failures Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Message Delivery Failures':
  • Context - a message needs to be sent to primary recipients:
    For Attempt Primary Message Delivery:
    When the system calls the messaging service with primary recipient information, then the message delivery is attempted and a return status is provided.
  • Context - a message delivery attempt has been made to primary recipients:
    For Primary Delivery Successful?:
    When the system checks the return status flag from the messaging service, then if return status flag equals zero or successful indicator, delivery is considered successful, otherwise it is considered failed.
  • Context - primary message delivery has been successful:
    For Message Delivered Successfully:
    When the system confirms successful delivery, then the system proceeds to purge the message queue and complete processing.
  • Context - primary message delivery has failed:
    For Clear Message Recipients:
    When the system needs to attempt fallback delivery, then all existing recipient fields are cleared to spaces.
  • Context - primary message delivery has failed and recipients have been cleared:
    For Set Default Recipient 'OM01247':
    When the system needs to set a fallback recipient, then the recipient is set to 'om01247' as the default fallback recipient.
  • Context - primary delivery has failed and default recipient has been set:
    For Retry Message Delivery to Default:
    When the system calls the messaging service with default recipient information, then the message delivery is attempted to the default recipient and a return status is provided.
  • Context - a message delivery attempt has been made to the default recipient:
    For Default Delivery Successful?:
    When the system checks the return status flag from the messaging service, then if return status flag equals zero or successful indicator, delivery is considered successful, otherwise it is considered failed.
  • Context - fallback message delivery to default recipient has been successful:
    For Message Delivered to Default:
    When the system confirms successful delivery to default recipient, then the system proceeds to purge the message queue and complete processing.
  • Context - message delivery processing has completed either successfully or unsuccessfully:
    For Purge Message Queue:
    When the system needs to clean up the message queue, then the message queue is purged using the purg function.
  • Context - all message delivery attempts have been completed and queue has been purged:
    For End Message Processing:
    When the system finishes message processing, then control is returned to the calling process and message processing ends.
👨‍💻 Technical ACs (Gherkin)
Context: A message needs to be sent to primary recipients
GIVEN
A message needs to be sent to primary recipients
Applied to: Attempt Primary Message Delivery
WHEN
The system calls the messaging service with primary recipient information
THEN
The message delivery is attempted and a return status is provided
Context: A message delivery attempt has been made to primary recipients
GIVEN
A message delivery attempt has been made to primary recipients
Applied to: Primary Delivery Successful?
WHEN
The system checks the return status flag from the messaging service
THEN
If return status flag equals zero or successful indicator, delivery is considered successful, otherwise it is considered failed
Context: Primary message delivery has been successful
GIVEN
Primary message delivery has been successful
Applied to: Message Delivered Successfully
WHEN
The system confirms successful delivery
THEN
The system proceeds to purge the message queue and complete processing
Context: Primary message delivery has failed
GIVEN
Primary message delivery has failed
Applied to: Clear Message Recipients
WHEN
The system needs to attempt fallback delivery
THEN
All existing recipient fields are cleared to spaces
Context: Primary message delivery has failed and recipients have been cleared
GIVEN
Primary message delivery has failed and recipients have been cleared
Applied to: Set Default Recipient 'OM01247'
WHEN
The system needs to set a fallback recipient
THEN
The recipient is set to 'OM01247' as the default fallback recipient
Context: Primary delivery has failed and default recipient has been set
GIVEN
Primary delivery has failed and default recipient has been set
Applied to: Retry Message Delivery to Default
WHEN
The system calls the messaging service with default recipient information
THEN
The message delivery is attempted to the default recipient and a return status is provided
Context: A message delivery attempt has been made to the default recipient
GIVEN
A message delivery attempt has been made to the default recipient
Applied to: Default Delivery Successful?
WHEN
The system checks the return status flag from the messaging service
THEN
If return status flag equals zero or successful indicator, delivery is considered successful, otherwise it is considered failed
Context: Fallback message delivery to default recipient has been successful
GIVEN
Fallback message delivery to default recipient has been successful
Applied to: Message Delivered to Default
WHEN
The system confirms successful delivery to default recipient
THEN
The system proceeds to purge the message queue and complete processing
Context: Message delivery processing has completed either successfully or unsuccessfully
GIVEN
Message delivery processing has completed either successfully or unsuccessfully
Applied to: Purge Message Queue
WHEN
The system needs to clean up the message queue
THEN
The message queue is purged using the PURG function
Context: All message delivery attempts have been completed and queue has been purged
GIVEN
All message delivery attempts have been completed and queue has been purged
Applied to: End Message Processing
WHEN
The system finishes message processing
THEN
Control is returned to the calling process and message processing ends
R-GCCCBOL-cbl-00305 (+9) File: GCCCBOL.cbl Get Broker from BOL Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Broker from BOL':
  • Context - the system is processing broker information from bol data:
    For EDI BOL Key Available?:
    When the edi bol key (work-edi-bol-key) is spaces or empty, then the system should skip edi bol broker search and exit the process.
  • Context - the system is starting the broker search from bol data:
    For Initialize Search Variables:
    When the search process begins, then the system should set customs broker not found flag to true, ebsnrtd found flag to true, ebsbcbc found flag to true, and temporary customs broker not found flag to true.
  • Context - the system finds an ebsnrtd segment with organization data:
    For Org ID = 'XQ'?:
    When the organization id custom field equals 'xq', then the system should immediately set the organization name as the primary broker name, mark xq broker as found, set temporary customs broker as not found, and stop searching for other broker types.
  • Context - the system finds an ebsnrtd segment and no xq broker has been found yet:
    For Org ID = 'CB' AND No XQ Found?:
    When the organization id equals 'cb' and the temporary customs broker is not found and the organization id custom is not equal to 'xr' and not equal to 'xu', then the system should store the organization name as temporary broker name and mark temporary customs broker as found.
  • Context - the broker search from bol data is complete:
    For CB Broker Found?:
    When a temporary cb broker was found during the search process, then the system should move the temporary broker name to the final broker long name field.
  • Context - the system is processing broker information retrieval:
    For EDI BOL Key Available?:
    When the edi bol key is checked for availability, then if edi bol key is spaces, set indicators to not found and exit, otherwise proceed with broker search.
  • Context - an ebsnrtd segment is found with organization data:
    For Organization ID = 'CB'?:
    When the organization id is 'cb' and temporary customs broker is not found and custom id is not 'xr' or 'xu', then store the organization name as temporary broker name and set temporary customs broker found indicator.
    For Organization ID = 'XQ'?:
    When the organization custom id is 'xq', then set the organization name as the final broker name, mark customs broker as found, and reset temporary customs broker indicator.
  • Context - all ebsnrtd segments have been processed and no xq type customs broker was found:
    For Temporary Broker Available?:
    When a temporary customs broker was found during the search, then use the temporary broker name as the final broker long name.
  • Context - the system is searching for customs broker information in ebsnrtd segments:
    For More Sequences Available?:
    When current sequence processing is complete, then continue to next sequence if customs broker not found and more segments available, otherwise end search.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing broker information from BOL data
GIVEN
The system is processing broker information from BOL data
Applied to: EDI BOL Key Available?
WHEN
The EDI BOL key (WORK-EDI-BOL-KEY) is spaces or empty
THEN
The system should skip EDI BOL broker search and exit the process
Context: The system is starting the broker search from BOL data
GIVEN
The system is starting the broker search from BOL data
Applied to: Initialize Search Variables
WHEN
The search process begins
THEN
The system should set customs broker not found flag to true, EBSNRTD found flag to true, EBSBCBC found flag to true, and temporary customs broker not found flag to true
Context: The system finds an EBSNRTD segment with organization data
GIVEN
The system finds an EBSNRTD segment with organization data
Applied to: Org ID = 'XQ'?
WHEN
The organization ID custom field equals 'XQ'
THEN
The system should immediately set the organization name as the primary broker name, mark XQ broker as found, set temporary customs broker as not found, and stop searching for other broker types
Context: The system finds an EBSNRTD segment and no XQ broker has been found yet
GIVEN
The system finds an EBSNRTD segment and no XQ broker has been found yet
Applied to: Org ID = 'CB' AND No XQ Found?
WHEN
The organization ID equals 'CB' and the temporary customs broker is not found and the organization ID custom is not equal to 'XR' and not equal to 'XU'
THEN
The system should store the organization name as temporary broker name and mark temporary customs broker as found
Context: The broker search from BOL data is complete
GIVEN
The broker search from BOL data is complete
Applied to: CB Broker Found?
WHEN
A temporary CB broker was found during the search process
THEN
The system should move the temporary broker name to the final broker long name field
Context: The system is processing broker information retrieval
GIVEN
The system is processing broker information retrieval
Applied to: EDI BOL Key Available?
WHEN
The EDI BOL key is checked for availability
THEN
If EDI BOL key is spaces, set indicators to not found and exit, otherwise proceed with broker search
Context: An EBSNRTD segment is found with organization data
GIVEN
An EBSNRTD segment is found with organization data
Applied to: Organization ID = 'CB'?
WHEN
The organization ID is 'CB' and temporary customs broker is not found and custom ID is not 'XR' or 'XU'
THEN
Store the organization name as temporary broker name and set temporary customs broker found indicator
Applied to: Organization ID = 'XQ'?
WHEN
The organization custom ID is 'XQ'
THEN
Set the organization name as the final broker name, mark customs broker as found, and reset temporary customs broker indicator
Context: All EBSNRTD segments have been processed and no XQ type customs broker was found
GIVEN
All EBSNRTD segments have been processed and no XQ type customs broker was found
Applied to: Temporary Broker Available?
WHEN
A temporary customs broker was found during the search
THEN
Use the temporary broker name as the final broker long name
Context: The system is searching for customs broker information in EBSNRTD segments
GIVEN
The system is searching for customs broker information in EBSNRTD segments
Applied to: More Sequences Available?
WHEN
Current sequence processing is complete
THEN
Continue to next sequence if customs broker not found and more segments available, otherwise end search
R-GCCCBOL-cbl-00310 (+19) File: GCCCBOL.cbl Get Broker from Fastway Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Broker from Fastway':
  • Context - the system needs to search for broker information in fastway data:
    For Initialize Search Variables:
    When the fastway broker search process begins, then all search control flags are set to not found state and temporary broker name is cleared.
  • Context - special handling data contains up to 7 entries that may contain broker information:
    For Loop Through Special Handling Codes 1-7:
    When the system searches for broker data and has not found a special data customs broker and the current index is less than 7, then the system continues to the next special handling entry.
  • Context - a special handling code entry is being evaluated for broker information:
    For Special Handling Code = 'XQ'?:
    When the special handling code equals 'xq', then the system recognizes this as the highest priority broker type and processes the xq broker instruction.
  • Context - a special handling code of type 'xq' is found:
    For Extract Broker Name from XQ Instruction:
    When the xq special handling instruction is processed, then the broker name is extracted from the instruction, the special data customs broker found flag is set to true, and any temporary broker flag is reset to not found.
  • Context - a special handling code entry is being evaluated and no xq broker has been found:
    For Special Handling Code = 'CB'?:
    When the special handling code equals 'cb', then the system recognizes this as a secondary priority broker type.
  • Context - a cb type special handling code is found:
    For XQ Broker Already Found?:
    When the system checks if a temporary cb broker should be stored, then the cb broker is only stored as temporary if no xq broker has been found and the temporary cb flag is not found.
  • Context - a cb type special handling code is found and no xq broker has been identified and no temporary cb broker exists:
    For Set CB as Temporary Broker:
    When the cb special handling instruction is processed, then the broker name is stored as temporary broker and the temporary cb found flag is set to true.
  • Context - the system is searching through special handling codes for broker information:
    For More Special Handling Codes?:
    When the current special handling index is less than or equal to 7 and no special data customs broker has been found, then the system continues to the next special handling code entry.
  • Context - all special handling codes have been processed and no xq broker was found:
    For Temporary CB Broker Found?:
    When a temporary cb broker was stored during the search, then the temporary cb broker name is moved to the final broker name for parsing.
  • Context - a temporary cb broker was found and no xq broker exists:
    For Use Temporary CB Broker Name:
    When the final broker selection is made, then the temporary broker name is moved to the special handling instruction field for final parsing.
  • Context - a broker name exists in special handling instruction format:
    For Parse Final Broker Name:
    When the broker name needs to be cleaned and formatted, then standard parsing rules are applied to remove prefixes like 'customs broker', 'broker', 'cb', or 'xq' and extract the actual broker name.
  • Context - the system needs to search for customs broker information in fastway system:
    For Initialize broker search flags:
    When the broker search process begins, then all broker search flags are set to not found state and temporary broker name storage is cleared.
  • Context - special handling codes array contains up to 7 positions:
    For Loop through special handling codes 1-7:
    When searching for customs broker information, then process each special handling code position from 1 to 7 or until customs broker with xq code is found.
  • Context - a special handling code position contains data:
    For Special handling code = 'XQ'?:
    When the special handling code equals 'xq', then extract the broker name from the handling instruction and set xq broker found flag to true.
  • Context - special handling code is 'xq' type:
    For Extract broker name from XQ instruction:
    When processing the xq handling instruction, then move the handling instruction to broker name field and set customs broker found flag to true and temporary cb not found flag to true.
  • Context - a special handling code position contains data and no temporary cb broker has been found:
    For Special handling code = 'CB' and no temp broker found?:
    When the special handling code equals 'cb', then store the handling instruction as temporary broker name and set temporary cb found flag to true.
  • Context - special handling code is 'cb' type and no temporary broker found yet:
    For Store CB instruction as temporary broker name:
    When processing the cb handling instruction, then move the handling instruction to temporary broker name field and set temporary cb found flag to true.
  • Context - currently processing special handling codes array:
    For More special handling codes to check?:
    When current position is less than 7 and xq customs broker has not been found, then continue to next special handling code position.
  • Context - all special handling codes have been processed and temporary cb found flag is true:
    For Temporary CB broker found?:
    When no xq type customs broker was found, then move the temporary broker name to the special handling instruction field for parsing.
  • Context - a broker name string contains standard prefixes:
    For Parse broker name using standard formats:
    When the string starts with 'customs broker ', 'customs broker: ', 'broker ', 'broker: ', 'cb ', 'cb: ', 'xq ', or 'xq: ', then remove the prefix and extract the remaining text as the broker long name, otherwise use the entire string as broker long name.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to search for broker information in Fastway data
GIVEN
The system needs to search for broker information in Fastway data
Applied to: Initialize Search Variables
WHEN
The Fastway broker search process begins
THEN
All search control flags are set to not found state and temporary broker name is cleared
Context: Special handling data contains up to 7 entries that may contain broker information
GIVEN
Special handling data contains up to 7 entries that may contain broker information
Applied to: Loop Through Special Handling Codes 1-7
WHEN
The system searches for broker data and has not found a special data customs broker and the current index is less than 7
THEN
The system continues to the next special handling entry
Context: A special handling code entry is being evaluated for broker information
GIVEN
A special handling code entry is being evaluated for broker information
Applied to: Special Handling Code = 'XQ'?
WHEN
The special handling code equals 'XQ'
THEN
The system recognizes this as the highest priority broker type and processes the XQ broker instruction
Context: A special handling code of type 'XQ' is found
GIVEN
A special handling code of type 'XQ' is found
Applied to: Extract Broker Name from XQ Instruction
WHEN
The XQ special handling instruction is processed
THEN
The broker name is extracted from the instruction, the special data customs broker found flag is set to true, and any temporary broker flag is reset to not found
Context: A special handling code entry is being evaluated and no XQ broker has been found
GIVEN
A special handling code entry is being evaluated and no XQ broker has been found
Applied to: Special Handling Code = 'CB'?
WHEN
The special handling code equals 'CB'
THEN
The system recognizes this as a secondary priority broker type
Context: A CB type special handling code is found
GIVEN
A CB type special handling code is found
Applied to: XQ Broker Already Found?
WHEN
The system checks if a temporary CB broker should be stored
THEN
The CB broker is only stored as temporary if no XQ broker has been found and the temporary CB flag is not found
Context: A CB type special handling code is found and no XQ broker has been identified and no temporary CB broker exists
GIVEN
A CB type special handling code is found and no XQ broker has been identified and no temporary CB broker exists
Applied to: Set CB as Temporary Broker
WHEN
The CB special handling instruction is processed
THEN
The broker name is stored as temporary broker and the temporary CB found flag is set to true
Context: The system is searching through special handling codes for broker information
GIVEN
The system is searching through special handling codes for broker information
Applied to: More Special Handling Codes?
WHEN
The current special handling index is less than or equal to 7 and no special data customs broker has been found
THEN
The system continues to the next special handling code entry
Context: All special handling codes have been processed and no XQ broker was found
GIVEN
All special handling codes have been processed and no XQ broker was found
Applied to: Temporary CB Broker Found?
WHEN
A temporary CB broker was stored during the search
THEN
The temporary CB broker name is moved to the final broker name for parsing
Context: A temporary CB broker was found and no XQ broker exists
GIVEN
A temporary CB broker was found and no XQ broker exists
Applied to: Use Temporary CB Broker Name
WHEN
The final broker selection is made
THEN
The temporary broker name is moved to the special handling instruction field for final parsing
Context: A broker name exists in special handling instruction format
GIVEN
A broker name exists in special handling instruction format
Applied to: Parse Final Broker Name
WHEN
The broker name needs to be cleaned and formatted
THEN
Standard parsing rules are applied to remove prefixes like 'CUSTOMS BROKER', 'BROKER', 'CB', or 'XQ' and extract the actual broker name
Context: The system needs to search for customs broker information in Fastway system
GIVEN
The system needs to search for customs broker information in Fastway system
Applied to: Initialize broker search flags
WHEN
The broker search process begins
THEN
All broker search flags are set to not found state and temporary broker name storage is cleared
Context: Special handling codes array contains up to 7 positions
GIVEN
Special handling codes array contains up to 7 positions
Applied to: Loop through special handling codes 1-7
WHEN
Searching for customs broker information
THEN
Process each special handling code position from 1 to 7 or until customs broker with XQ code is found
Context: A special handling code position contains data
GIVEN
A special handling code position contains data
Applied to: Special handling code = 'XQ'?
WHEN
The special handling code equals 'XQ'
THEN
Extract the broker name from the handling instruction and set XQ broker found flag to true
Context: Special handling code is 'XQ' type
GIVEN
Special handling code is 'XQ' type
Applied to: Extract broker name from XQ instruction
WHEN
Processing the XQ handling instruction
THEN
Move the handling instruction to broker name field and set customs broker found flag to true and temporary CB not found flag to true
Context: A special handling code position contains data and no temporary CB broker has been found
GIVEN
A special handling code position contains data and no temporary CB broker has been found
Applied to: Special handling code = 'CB' and no temp broker found?
WHEN
The special handling code equals 'CB'
THEN
Store the handling instruction as temporary broker name and set temporary CB found flag to true
Context: Special handling code is 'CB' type and no temporary broker found yet
GIVEN
Special handling code is 'CB' type and no temporary broker found yet
Applied to: Store CB instruction as temporary broker name
WHEN
Processing the CB handling instruction
THEN
Move the handling instruction to temporary broker name field and set temporary CB found flag to true
Context: Currently processing special handling codes array
GIVEN
Currently processing special handling codes array
Applied to: More special handling codes to check?
WHEN
Current position is less than 7 and XQ customs broker has not been found
THEN
Continue to next special handling code position
Context: All special handling codes have been processed and temporary CB found flag is true
GIVEN
All special handling codes have been processed and temporary CB found flag is true
Applied to: Temporary CB broker found?
WHEN
No XQ type customs broker was found
THEN
Move the temporary broker name to the special handling instruction field for parsing
Context: A broker name string contains standard prefixes
GIVEN
A broker name string contains standard prefixes
Applied to: Parse broker name using standard formats
WHEN
The string starts with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', 'CB: ', 'XQ ', or 'XQ: '
THEN
Remove the prefix and extract the remaining text as the broker long name, otherwise use the entire string as broker long name
R-GCCCCADD-cbl-00314 (+10) File: GCCCCADD.cbl CSA Indicator Management Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Indicator Management':
  • Context - a shipment is being processed for customs:
    For CSA Indicator Already On?:
    When the csa indicator is already set to on, then skip csa indicator management and proceed to transit/return validation.
  • Context - a shipment requires csa indicator evaluation:
    For AU Table Data Available?:
    When the au table lookup returns no importer data, then skip csa indicator activation and proceed to transit/return validation.
  • Context - au table contains importer data and csa indicator is not already on:
    For Importer Data Present in Input?:
    When importer data is already present in the input, then skip au table importer retrieval and proceed to transit/return validation.
  • Context - csa indicator is off, au table has data, and no importer data exists in input:
    For Retrieve AU Table Importer Data:
    When au table lookup is performed for the consignee and commodity combination, then retrieve importer name and business number from au table if found.
  • Context - importer data has been successfully retrieved from au table:
    For Set CSA Indicator ON:
    When au table contains valid importer information, then set the csa indicator to on to enable csa processing.
  • Context - csa indicator has been set to on:
    For Set Importer Name from AU Table:
    When au table importer data is available, then set the importer name field to the value from au table.
  • Context - importer name has been set from au table:
    For Set Business Number from AU Table:
    When au table contains business number information, then set the business number field to the value from au table.
  • Context - business number has been set from au table:
    For Set Business Number Qualifier to M5:
    When au table importer data is being processed, then set the business number qualifier to 'm5'.
  • Context - a shipment has been processed for csa indicator management:
    For Reset CSA Indicator OFF:
    When the shipment is classified as transit (moving through canada) or return (moving back to origin), then set the csa indicator to off to disable csa processing.
  • Context - csa indicator has been reset to off for transit or return shipment:
    For Clear Importer Data:
    When the shipment does not require importer information, then clear all importer data fields including name, business number, and business number qualifier.
  • Context - shipment is not transit or return type:
    For Reset CSA Indicator OFF for Duplicate Sources:
    When au table importer data is found and edi bol importer data exists with business number qualifier (bn or spaces), then set csa indicator to off to resolve data source conflict.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs
GIVEN
A shipment is being processed for customs
Applied to: CSA Indicator Already On?
WHEN
The CSA indicator is already set to ON
THEN
Skip CSA indicator management and proceed to transit/return validation
Context: A shipment requires CSA indicator evaluation
GIVEN
A shipment requires CSA indicator evaluation
Applied to: AU Table Data Available?
WHEN
The AU table lookup returns no importer data
THEN
Skip CSA indicator activation and proceed to transit/return validation
Context: AU table contains importer data and CSA indicator is not already on
GIVEN
AU table contains importer data and CSA indicator is not already on
Applied to: Importer Data Present in Input?
WHEN
Importer data is already present in the input
THEN
Skip AU table importer retrieval and proceed to transit/return validation
Context: CSA indicator is off, AU table has data, and no importer data exists in input
GIVEN
CSA indicator is off, AU table has data, and no importer data exists in input
Applied to: Retrieve AU Table Importer Data
WHEN
AU table lookup is performed for the consignee and commodity combination
THEN
Retrieve importer name and business number from AU table if found
Context: Importer data has been successfully retrieved from AU table
GIVEN
Importer data has been successfully retrieved from AU table
Applied to: Set CSA Indicator ON
WHEN
AU table contains valid importer information
THEN
Set the CSA indicator to ON to enable CSA processing
Context: CSA indicator has been set to ON
GIVEN
CSA indicator has been set to ON
Applied to: Set Importer Name from AU Table
WHEN
AU table importer data is available
THEN
Set the importer name field to the value from AU table
Context: Importer name has been set from AU table
GIVEN
Importer name has been set from AU table
Applied to: Set Business Number from AU Table
WHEN
AU table contains business number information
THEN
Set the business number field to the value from AU table
Context: Business number has been set from AU table
GIVEN
Business number has been set from AU table
Applied to: Set Business Number Qualifier to M5
WHEN
AU table importer data is being processed
THEN
Set the business number qualifier to 'M5'
Context: A shipment has been processed for CSA indicator management
GIVEN
A shipment has been processed for CSA indicator management
Applied to: Reset CSA Indicator OFF
WHEN
The shipment is classified as transit (moving through Canada) or return (moving back to origin)
THEN
Set the CSA indicator to OFF to disable CSA processing
Context: CSA indicator has been reset to OFF for transit or return shipment
GIVEN
CSA indicator has been reset to OFF for transit or return shipment
Applied to: Clear Importer Data
WHEN
The shipment does not require importer information
THEN
Clear all importer data fields including name, business number, and business number qualifier
Context: Shipment is not transit or return type
GIVEN
Shipment is not transit or return type
Applied to: Reset CSA Indicator OFF for Duplicate Sources
WHEN
AU table importer data is found AND EDI BOL importer data exists with business number qualifier (BN or spaces)
THEN
Set CSA indicator to OFF to resolve data source conflict
R-GCX122A-cbl-00314 (+1) File: GCX122A.cbl Process Message Wrapping Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Message Wrapping':
  • Context - all message entries have been processed and sent to the message switching terminal:
    For Set Function Code to 'WRAP':
    When the system needs to complete the message transmission process, then the system sets the user function code to 'wrap' and sends the wrap command to finalize the message transmission.
  • Context - the user function code is set to 'wrap' and message switching terminal parameters are prepared:
    For Send Wrap Command to MST:
    When the system executes the wrap command transmission, then the system calls the message switching terminal service with the wrap command, communication control block, alternate pcb, call letters, and message header record.
👨‍💻 Technical ACs (Gherkin)
Context: All message entries have been processed and sent to the message switching terminal
GIVEN
All message entries have been processed and sent to the message switching terminal
Applied to: Set Function Code to 'WRAP'
WHEN
The system needs to complete the message transmission process
THEN
The system sets the user function code to 'WRAP' and sends the wrap command to finalize the message transmission
Context: The user function code is set to 'WRAP' and message switching terminal parameters are prepared
GIVEN
The user function code is set to 'WRAP' and message switching terminal parameters are prepared
Applied to: Send Wrap Command to MST
WHEN
The system executes the wrap command transmission
THEN
The system calls the message switching terminal service with the wrap command, communication control block, alternate PCB, call letters, and message header record
R-GCX122A-cbl-00316 (+8) File: GCX122A.cbl Update Test Acknowledgment Tables Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Test Acknowledgment Tables':
  • Context - a reference number is provided in the message:
    For Check Reference Number Pattern:
    When the reference number equals '6105etesttrain00000000000' or starts with '6105ecprstestcargo' or starts with '6105etestcargo', then the message is classified as test data and special test processing is triggered.
  • Context - a test message has been identified:
    For Retrieve T2 Test Table Entry:
    When the system attempts to retrieve the t2 table entry with empty sequence id, then the t2 test table segment is loaded for timestamp updates.
  • Context - the system has attempted to retrieve the t2 test table entry:
    For Table Entry Found?:
    When the table entry retrieval returns a non-zero status code, then an error message 't2 check table entry not found' is displayed and processing terminates.
  • Context - a valid t2 test table entry has been retrieved:
    For Message Type?:
    When the message type indicator shows train (oti-02-train is true), then the system prepares to update the train test acknowledgment field (t2-358-ack).
  • Context - the message is identified as a train test message and t2 table entry is available:
    For Update Train Test Acknowledgment Field:
    When the system processes the train test acknowledgment, then the t2-358-ack field is updated with current date (century + date) and time.
  • Context - the message is identified as a cargo test message and t2 table entry is available:
    For Update Cargo Test Acknowledgment Field:
    When the system processes the cargo test acknowledgment, then the t2-309-ack field is updated with current date (century + date) and time.
  • Context - the appropriate test acknowledgment field has been identified (train or cargo):
    For Set Current Date/Century to ACK Field:
    When the system updates the timestamp, then the current machine century is placed in positions 1-2 and current machine date is placed in positions 3-8 of the acknowledgment field.
  • Context - the date portion of the test acknowledgment field has been updated:
    For Set Current Time to ACK Field:
    When the system completes the timestamp update, then the first 4 digits of current machine time are placed in positions 9-12 of the acknowledgment field.
  • Context - the t2 test table entry has been updated with current timestamp information:
    For Save Updated Table Entry:
    When the system saves the changes, then the updated t2 table segment is written back to the database using replace function.
👨‍💻 Technical ACs (Gherkin)
Context: A reference number is provided in the message
GIVEN
A reference number is provided in the message
Applied to: Check Reference Number Pattern
WHEN
The reference number equals '6105ETESTTRAIN00000000000' OR starts with '6105ECPRSTESTCARGO' OR starts with '6105ETESTCARGO'
THEN
The message is classified as test data and special test processing is triggered
Context: A test message has been identified
GIVEN
A test message has been identified
Applied to: Retrieve T2 Test Table Entry
WHEN
The system attempts to retrieve the T2 table entry with empty sequence ID
THEN
The T2 test table segment is loaded for timestamp updates
Context: The system has attempted to retrieve the T2 test table entry
GIVEN
The system has attempted to retrieve the T2 test table entry
Applied to: Table Entry Found?
WHEN
The table entry retrieval returns a non-zero status code
THEN
An error message 'T2 CHECK TABLE ENTRY NOT FOUND' is displayed and processing terminates
Context: A valid T2 test table entry has been retrieved
GIVEN
A valid T2 test table entry has been retrieved
Applied to: Message Type?
WHEN
The message type indicator shows train (OTI-02-TRAIN is true)
THEN
The system prepares to update the train test acknowledgment field (T2-358-ACK)
Context: The message is identified as a train test message and T2 table entry is available
GIVEN
The message is identified as a train test message and T2 table entry is available
Applied to: Update Train Test Acknowledgment Field
WHEN
The system processes the train test acknowledgment
THEN
The T2-358-ACK field is updated with current date (century + date) and time
Context: The message is identified as a cargo test message and T2 table entry is available
GIVEN
The message is identified as a cargo test message and T2 table entry is available
Applied to: Update Cargo Test Acknowledgment Field
WHEN
The system processes the cargo test acknowledgment
THEN
The T2-309-ACK field is updated with current date (century + date) and time
Context: The appropriate test acknowledgment field has been identified (train or cargo)
GIVEN
The appropriate test acknowledgment field has been identified (train or cargo)
Applied to: Set Current Date/Century to ACK Field
WHEN
The system updates the timestamp
THEN
The current machine century is placed in positions 1-2 and current machine date is placed in positions 3-8 of the acknowledgment field
Context: The date portion of the test acknowledgment field has been updated
GIVEN
The date portion of the test acknowledgment field has been updated
Applied to: Set Current Time to ACK Field
WHEN
The system completes the timestamp update
THEN
The first 4 digits of current machine time are placed in positions 9-12 of the acknowledgment field
Context: The T2 test table entry has been updated with current timestamp information
GIVEN
The T2 test table entry has been updated with current timestamp information
Applied to: Save Updated Table Entry
WHEN
The system saves the changes
THEN
The updated T2 table segment is written back to the database using replace function
R-GCCS309C-cbl-00320 (+2) File: GCCS309C.cbl Action Code Conversion Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Action Code Conversion':
  • Context - a manifest with an action code and border arrival information:
    For Action Code = 04, 05, or 06?:
    When the action code is 04, 05, or 06 and the border arrival date exists and the manifest is not a pre-emanifest, then set the transaction purpose code to 'co' and mark as post-emanifest amendment.
  • Context - a manifest with an action code:
    For Use Original Action Code as Transaction Purpose Code:
    When the action code is not 04, 05, or 06 or the border arrival date does not exist or the manifest is a pre-emanifest, then use the original action code as the transaction purpose code.
  • Context - a manifest meeting post-emanifest amendment criteria:
    For Set Post-Emanifest Amendment Flag to TRUE:
    When the action code is 04, 05, or 06 and the border arrival date exists and the manifest is not a pre-emanifest, then set the post-emanifest amendment flag to true for subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest with an action code and border arrival information
GIVEN
A manifest with an action code and border arrival information
Applied to: Action Code = 04, 05, or 06?
WHEN
The action code is 04, 05, or 06 AND the border arrival date exists AND the manifest is not a pre-emanifest
THEN
Set the transaction purpose code to 'CO' and mark as post-emanifest amendment
Context: A manifest with an action code
GIVEN
A manifest with an action code
Applied to: Use Original Action Code as Transaction Purpose Code
WHEN
The action code is not 04, 05, or 06 OR the border arrival date does not exist OR the manifest is a pre-emanifest
THEN
Use the original action code as the transaction purpose code
Context: A manifest meeting post-emanifest amendment criteria
GIVEN
A manifest meeting post-emanifest amendment criteria
Applied to: Set Post-Emanifest Amendment Flag to TRUE
WHEN
The action code is 04, 05, or 06 AND the border arrival date exists AND the manifest is not a pre-emanifest
THEN
Set the post-emanifest amendment flag to TRUE for subsequent processing
R-GCCCBOL-cbl-00321 (+17) File: GCCCBOL.cbl Get N9 from BOL Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get N9 from BOL':
  • Context - the system needs to process n9 reference numbers from bol data:
    For Initialize N9 Processing Variables:
    When the n9 processing begins, then the system initializes sequence counter to 0, n9 array index to 1, sets ebsbccr found flag to true, and sets bm and si not found flags to true, and sets blank n9 not found flag to true.
  • Context - the n9 reference array needs to store new reference numbers:
    For Initialize N9 Processing Variables:
    When the system searches for available array positions, then the system iterates through array positions 1 to 10 until it finds an empty reference qualifier field or reaches the limit, and sets the blank n9 found flag when an empty position is located.
  • Context - a valid edi bol key exists for reference data retrieval:
    For Get First EBSBCCR Segment:
    When the system retrieves ebsbccr segments with type cr, then the system increments the sequence counter and attempts to get the next ebsbccr segment, setting the found flag based on retrieval success.
  • Context - an ebsbccr segment has been successfully retrieved:
    For Reference Qualifier = BM or SI?:
    When the system checks the reference number qualifier, then the system continues processing only if the qualifier equals 'bm ' or 'si ', otherwise it retrieves the next segment.
  • Context - a bm or si reference qualifier has been found in the bol data:
    For Set Reference Number to N/A:
    When the reference number field is empty or contains only spaces, then the system sets the reference number to 'n/a' to indicate no available reference.
  • Context - a reference with qualifier 'bm ' has been found and bm reference has not been previously stored:
    For Store BM Reference Number:
    When the system processes the bm reference, then the system stores 'bm' as the reference qualifier and the reference number in the current n9 array position, sets bm found flag to true, and increments the array index.
  • Context - a reference with qualifier 'si ' has been found and si reference has not been previously stored:
    For Store SI Reference Number:
    When the system processes the si reference, then the system stores 'si' as the reference qualifier and the reference number in the current n9 array position, sets si found flag to true, and increments the array index.
  • Context - the system has processed a reference number and incremented the array index:
    For More Array Space Available?:
    When the array index exceeds 10, then the system sets blank n9 not found flag to true to stop further processing and prevent array overflow.
  • Context - ebsbcbc segment data is available for the current bol:
    For Store Payment Method:
    When the system retrieves the ebsbcbc segment and the shipment method payment field is not empty, then the system stores the shipment method payment value in the cargo report payment method field.
  • Context - ebsbcbc segment data is available and contains shipment information:
    For Store CN Reference Number:
    When the shipment id number field is not empty and array space is available, then the system increments the n9 array index, stores 'cn' as the reference qualifier, and stores the shipment id number as the reference number.
  • Context - an edi bol key exists and reference number processing is required:
    For Get EBSBCCR Segment from BOL:
    When the system attempts to retrieve ebsbccr segments from the electronic bill of lading, then the system should sequentially read ebsbccr segments until no more segments are found or required reference types are located.
  • Context - an ebsbccr segment has been retrieved from the electronic bill of lading:
    For Reference Qualifier = BM or SI?:
    When the system checks the reference number qualifier, then the system should continue processing only if the qualifier equals 'bm ' or 'si ', otherwise skip to the next segment.
  • Context - a reference number segment with bm or si qualifier has been found:
    For Set Reference Number to 'N/A':
    When the reference number field is empty or contains only spaces, then the system should set the reference number to 'n/a'.
  • Context - a reference number with qualifier 'bm ' has been processed and no bm reference has been stored yet:
    For Store BM Reference Number:
    When the system evaluates whether to store the bm reference, then the system should store the bm reference number in the output array and mark bm as found.
  • Context - a reference number with qualifier 'si ' has been processed and no si reference has been stored yet:
    For Store SI Reference Number:
    When the system evaluates whether to store the si reference, then the system should store the si reference number in the output array and mark si as found.
  • Context - bm or si reference numbers have been processed from ebsbccr segments:
    For Get EBSBCBC Segment:
    When the system attempts to retrieve the ebsbcbc segment, then the system should read the ebsbcbc segment to extract payment method and shipment identification information.
  • Context - an ebsbcbc segment has been successfully retrieved:
    For Store Payment Method:
    When the shipment payment method field is not empty or spaces, then the system should store the payment method in the cargo report output structure.
  • Context - an ebsbcbc segment has been retrieved and payment method has been processed:
    For Store Shipment ID as CN Reference:
    When the shipment identification number field is not empty or spaces, then the system should store the shipment id as a 'cn' qualified reference number in the next available array position.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process N9 reference numbers from BOL data
GIVEN
The system needs to process N9 reference numbers from BOL data
Applied to: Initialize N9 Processing Variables
WHEN
The N9 processing begins
THEN
The system initializes sequence counter to 0, N9 array index to 1, sets EBSBCCR found flag to true, and sets BM and SI not found flags to true, and sets blank N9 not found flag to true
Context: The N9 reference array needs to store new reference numbers
GIVEN
The N9 reference array needs to store new reference numbers
Applied to: Initialize N9 Processing Variables
WHEN
The system searches for available array positions
THEN
The system iterates through array positions 1 to 10 until it finds an empty reference qualifier field or reaches the limit, and sets the blank N9 found flag when an empty position is located
Context: A valid EDI BOL key exists for reference data retrieval
GIVEN
A valid EDI BOL key exists for reference data retrieval
Applied to: Get First EBSBCCR Segment
WHEN
The system retrieves EBSBCCR segments with type CR
THEN
The system increments the sequence counter and attempts to get the next EBSBCCR segment, setting the found flag based on retrieval success
Context: An EBSBCCR segment has been successfully retrieved
GIVEN
An EBSBCCR segment has been successfully retrieved
Applied to: Reference Qualifier = BM or SI?
WHEN
The system checks the reference number qualifier
THEN
The system continues processing only if the qualifier equals 'BM ' or 'SI ', otherwise it retrieves the next segment
Context: A BM or SI reference qualifier has been found in the BOL data
GIVEN
A BM or SI reference qualifier has been found in the BOL data
Applied to: Set Reference Number to N/A
WHEN
The reference number field is empty or contains only spaces
THEN
The system sets the reference number to 'N/A' to indicate no available reference
Context: A reference with qualifier 'BM ' has been found and BM reference has not been previously stored
GIVEN
A reference with qualifier 'BM ' has been found and BM reference has not been previously stored
Applied to: Store BM Reference Number
WHEN
The system processes the BM reference
THEN
The system stores 'BM' as the reference qualifier and the reference number in the current N9 array position, sets BM found flag to true, and increments the array index
Context: A reference with qualifier 'SI ' has been found and SI reference has not been previously stored
GIVEN
A reference with qualifier 'SI ' has been found and SI reference has not been previously stored
Applied to: Store SI Reference Number
WHEN
The system processes the SI reference
THEN
The system stores 'SI' as the reference qualifier and the reference number in the current N9 array position, sets SI found flag to true, and increments the array index
Context: The system has processed a reference number and incremented the array index
GIVEN
The system has processed a reference number and incremented the array index
Applied to: More Array Space Available?
WHEN
The array index exceeds 10
THEN
The system sets blank N9 not found flag to true to stop further processing and prevent array overflow
Context: EBSBCBC segment data is available for the current BOL
GIVEN
EBSBCBC segment data is available for the current BOL
Applied to: Store Payment Method
WHEN
The system retrieves the EBSBCBC segment and the shipment method payment field is not empty
THEN
The system stores the shipment method payment value in the cargo report payment method field
Context: EBSBCBC segment data is available and contains shipment information
GIVEN
EBSBCBC segment data is available and contains shipment information
Applied to: Store CN Reference Number
WHEN
The shipment ID number field is not empty and array space is available
THEN
The system increments the N9 array index, stores 'CN' as the reference qualifier, and stores the shipment ID number as the reference number
Context: An EDI BOL key exists and reference number processing is required
GIVEN
An EDI BOL key exists and reference number processing is required
Applied to: Get EBSBCCR Segment from BOL
WHEN
The system attempts to retrieve EBSBCCR segments from the Electronic Bill of Lading
THEN
The system should sequentially read EBSBCCR segments until no more segments are found or required reference types are located
Context: An EBSBCCR segment has been retrieved from the Electronic Bill of Lading
GIVEN
An EBSBCCR segment has been retrieved from the Electronic Bill of Lading
Applied to: Reference Qualifier = BM or SI?
WHEN
The system checks the reference number qualifier
THEN
The system should continue processing only if the qualifier equals 'BM ' or 'SI ', otherwise skip to the next segment
Context: A reference number segment with BM or SI qualifier has been found
GIVEN
A reference number segment with BM or SI qualifier has been found
Applied to: Set Reference Number to 'N/A'
WHEN
The reference number field is empty or contains only spaces
THEN
The system should set the reference number to 'N/A'
Context: A reference number with qualifier 'BM ' has been processed and no BM reference has been stored yet
GIVEN
A reference number with qualifier 'BM ' has been processed and no BM reference has been stored yet
Applied to: Store BM Reference Number
WHEN
The system evaluates whether to store the BM reference
THEN
The system should store the BM reference number in the output array and mark BM as found
Context: A reference number with qualifier 'SI ' has been processed and no SI reference has been stored yet
GIVEN
A reference number with qualifier 'SI ' has been processed and no SI reference has been stored yet
Applied to: Store SI Reference Number
WHEN
The system evaluates whether to store the SI reference
THEN
The system should store the SI reference number in the output array and mark SI as found
Context: BM or SI reference numbers have been processed from EBSBCCR segments
GIVEN
BM or SI reference numbers have been processed from EBSBCCR segments
Applied to: Get EBSBCBC Segment
WHEN
The system attempts to retrieve the EBSBCBC segment
THEN
The system should read the EBSBCBC segment to extract payment method and shipment identification information
Context: An EBSBCBC segment has been successfully retrieved
GIVEN
An EBSBCBC segment has been successfully retrieved
Applied to: Store Payment Method
WHEN
The shipment payment method field is not empty or spaces
THEN
The system should store the payment method in the cargo report output structure
Context: An EBSBCBC segment has been retrieved and payment method has been processed
GIVEN
An EBSBCBC segment has been retrieved and payment method has been processed
Applied to: Store Shipment ID as CN Reference
WHEN
The shipment identification number field is not empty or spaces
THEN
The system should store the shipment ID as a 'CN' qualified reference number in the next available array position
R-GCCS309C-cbl-00323 (+5) File: GCCS309C.cbl Post Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Post':
  • Context - a manifest transaction is being processed:
    For Initialize amendment flag to SPACES:
    When the post-emanifest amendment processing begins, then the post-emanifest amendment flag should be initialized to spaces.
  • Context - a manifest transaction with a specific action code:
    For Action code is 04, 05, or 06?:
    When the action code is evaluated for amendment eligibility, then the system should identify if the action code is 04, 05, or 06 to proceed with amendment logic.
  • Context - a manifest transaction with qualifying action code (04, 05, or 06):
    For Border arrival date exists AND not pre-emanifest?:
    When the border arrival date and pre-emanifest status are evaluated, then the system should confirm that border arrival date is not empty/spaces and the manifest is not a pre-emanifest.
  • Context - a manifest transaction with action code 04, 05, or 06 and border arrival date exists and not pre-emanifest:
    For Set purpose code to 'CO' & Set post-emanifest amendment flag to TRUE:
    When the amendment conditions are met, then the transaction set purpose code should be set to 'co' and the post-emanifest amendment flag should be set to true.
  • Context - a manifest transaction that does not meet post-emanifest amendment criteria:
    For Use action code as purpose code:
    When either the action code is not 04/05/06 or border arrival date is empty or it is a pre-emanifest, then the transaction set purpose code should be set to the original action code value.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest transaction is being processed
GIVEN
A manifest transaction is being processed
Applied to: Initialize amendment flag to SPACES
WHEN
The post-emanifest amendment processing begins
THEN
The post-emanifest amendment flag should be initialized to SPACES
Context: A manifest transaction with a specific action code
GIVEN
A manifest transaction with a specific action code
Applied to: Action code is 04, 05, or 06?
WHEN
The action code is evaluated for amendment eligibility
THEN
The system should identify if the action code is 04, 05, or 06 to proceed with amendment logic
Context: A manifest transaction with qualifying action code (04, 05, or 06)
GIVEN
A manifest transaction with qualifying action code (04, 05, or 06)
Applied to: Border arrival date exists AND not pre-emanifest?
WHEN
The border arrival date and pre-emanifest status are evaluated
THEN
The system should confirm that border arrival date is not empty/spaces AND the manifest is not a pre-emanifest
Context: A manifest transaction with action code 04, 05, or 06 AND border arrival date exists AND not pre-emanifest
GIVEN
A manifest transaction with action code 04, 05, or 06 AND border arrival date exists AND not pre-emanifest
Applied to: Set purpose code to 'CO' & Set post-emanifest amendment flag to TRUE
WHEN
The amendment conditions are met
THEN
The transaction set purpose code should be set to 'CO' AND The post-emanifest amendment flag should be set to TRUE
Context: A manifest transaction that does not meet post-emanifest amendment criteria
GIVEN
A manifest transaction that does not meet post-emanifest amendment criteria
Applied to: Use action code as purpose code
WHEN
Either the action code is not 04/05/06 OR border arrival date is empty OR it is a pre-emanifest
THEN
The transaction set purpose code should be set to the original action code value
R-GCCCCADD-cbl-00325 (+23) File: GCCCCADD.cbl Description Capture from Related CCN Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Description Capture from Related CCN':
  • Context - a request to capture description from a related ccn is initiated:
    For Save Current Description Data:
    When the system begins the description capture process, then the current manifest data (gcsccrt), cargo segment data (gcsccs52), and all cargo description array elements (46 elements) are saved to backup variables for potential restoration.
  • Context - a source ccn is specified in the description-from-ccn field:
    For Set CCN Key to Source CCN:
    When the system prepares to retrieve description data, then the ccn key is set to the source ccn value and the accept status is set to 'ge' for retrieval operations.
  • Context - a valid source ccn is set and the system is configured for retrieval:
    For Retrieve Description from Source CCN:
    When the description retrieval process is executed, then the gccccio2 program is called to fetch all segments (gcsccs00, gcsccrt, gcsccs52, gcsccs53, gcsccs54, gcsccs55, gcsccs56) from the source ccn.
  • Context - an attempt to retrieve description data from source ccn has been made:
    For Description Retrieved Successfully?:
    When the retrieval operation completes, then if the error number is spaces (no error), the retrieval is considered successful and processing continues; otherwise, the original data is restored.
    For Description Retrieved Successfully?:
    When the system evaluates the retrieval operation result, then if the error number is spaces then description retrieval is successful, otherwise it failed.
  • Context - description data has been successfully retrieved from the source ccn:
    For Extract Description Components:
    When the system processes the retrieved data, then the lading description is extracted from gccc-lading-description and all 46 cargo data elements are extracted from the cargo data array into the working description structure.
    For Extract Description Components:
    When the system processes the retrieved description data, then the system moves the first cargo description segment to gcsccs53 and the first description array element to gcsccs55, then extracts lading description and all cargo data elements from the description arrays into working storage.
  • Context - the action code is 'us' and description data has been extracted from source ccn:
    For Build Transit Description for US Action:
    When the system builds the enhanced description, then the description is formatted as: source ccn + ' moving in transit through canada ' + original description.
  • Context - the action code is 'rt' and description data has been extracted from source ccn:
    For Build Transit Description for RT Action:
    When the system builds the enhanced description, then the description is formatted as: source ccn + ' moving in transit through us ' + original description.
  • Context - the action code is neither 'us' nor 'rt' and description data has been extracted:
    For Use Original Description:
    When the system processes the description, then the original retrieved description is used without any transit-specific formatting.
  • Context - an enhanced description has been built (either transit-formatted or original):
    For Compress Enhanced Description:
    When the description compression process is executed, then the gcccomp program is called with source description (45000 length) and target description (22500 length) to compress the content appropriately.
  • Context - the description has been successfully compressed and processed:
    For Update Current Description Data:
    When the system updates the current description data, then the compressed description is moved to gccc-lading-description and all 46 cargo data elements are moved to the cargo data array.
  • Context - description processing (successful or failed) has completed:
    For Restore Original CCN Context:
    When the system finalizes the description capture process, then the original gcsccrt and gcsccs52 data is restored from the saved backup, and the cargo data array is cleared to spaces.
  • Context - description retrieval from source ccn has failed (error number is not spaces):
    For Restore Original Data - No Changes:
    When the system handles the retrieval failure, then all original data (gcsccrt, gcsccs52, and all 46 cargo data array elements) is restored from backup variables without any changes.
  • Context - a cargo manifest with existing description data needs to be processed for description capture from related ccn:
    For Save Current Description Data:
    When the description capture process begins, then the system saves the current cargo manifest record, cargo description segments, and all description array data to temporary storage for potential restoration.
  • Context - a description from ccn parameter is provided for description capture:
    For Set CCN Key to Source CCN:
    When the system prepares to retrieve description data from the source ccn, then the system sets the ccn key to the description from ccn parameter value.
  • Context - a valid source ccn key is set for description retrieval:
    For Retrieve Description from Source CCN:
    When the system attempts to retrieve description data from the source ccn, then the system calls gccccio2 program with fetch all segments flag to retrieve cargo description records including gcsccrt, gcsccs52, gcsccs53, gcsccs54, gcsccs55, and gcsccs56 segments.
  • Context - description data has been extracted from the source ccn and an action code is specified:
    For Action Code Check:
    When the system evaluates the action code for description formatting, then if action code is 'us' then format for us transit, if action code is 'rt' then format for return transit, otherwise use original description without modification.
  • Context - action code is 'us' and description data is available from source ccn:
    For Build US Transit Description:
    When the system formats the description for us transit, then the system concatenates the description from ccn parameter, the text ' moving in transit through canada ', and the extracted description into the description work area.
  • Context - action code is 'rt' and description data is available from source ccn:
    For Build RT Transit Description:
    When the system formats the description for return transit, then the system concatenates the description from ccn parameter, the text ' moving in transit through us ', and the extracted description into the description work area.
  • Context - action code is neither 'us' nor 'rt' and description data is available from source ccn:
    For Use Original Description:
    When the system processes the description for formatting, then the system moves the extracted description to the description work area without any modifications.
  • Context - a formatted description is ready for compression with description length set to 45000 and compressed length set to 22500:
    For Compress Enhanced Description:
    When the system compresses the description data, then the system calls gcccomp program to compress the description work area and updates the lading description and cargo data arrays with the compressed results.
  • Context - description data has been successfully enhanced and compressed:
    For Update Current Description Data:
    When the system updates the current description data, then the system moves the compressed description to the lading description field and updates all cargo data array elements with the compressed description segments.
  • Context - description retrieval from source ccn has failed and original data was previously saved:
    For Restore Original Data on Error:
    When the system handles the retrieval failure, then the system restores the saved cargo manifest record, cargo description segments, and clears all description array elements, then restores the saved description array data.
👨‍💻 Technical ACs (Gherkin)
Context: A request to capture description from a related CCN is initiated
GIVEN
A request to capture description from a related CCN is initiated
Applied to: Save Current Description Data
WHEN
The system begins the description capture process
THEN
The current manifest data (GCSCCRT), cargo segment data (GCSCCS52), and all cargo description array elements (46 elements) are saved to backup variables for potential restoration
Context: A source CCN is specified in the description-from-CCN field
GIVEN
A source CCN is specified in the description-from-CCN field
Applied to: Set CCN Key to Source CCN
WHEN
The system prepares to retrieve description data
THEN
The CCN key is set to the source CCN value and the accept status is set to 'GE' for retrieval operations
Context: A valid source CCN is set and the system is configured for retrieval
GIVEN
A valid source CCN is set and the system is configured for retrieval
Applied to: Retrieve Description from Source CCN
WHEN
The description retrieval process is executed
THEN
The GCCCCIO2 program is called to fetch all segments (GCSCCS00, GCSCCRT, GCSCCS52, GCSCCS53, GCSCCS54, GCSCCS55, GCSCCS56) from the source CCN
Context: An attempt to retrieve description data from source CCN has been made
GIVEN
An attempt to retrieve description data from source CCN has been made
Applied to: Description Retrieved Successfully?
WHEN
The retrieval operation completes
THEN
If the error number is spaces (no error), the retrieval is considered successful and processing continues; otherwise, the original data is restored
Applied to: Description Retrieved Successfully?
WHEN
The system evaluates the retrieval operation result
THEN
If the error number is spaces then description retrieval is successful, otherwise it failed
Context: Description data has been successfully retrieved from the source CCN
GIVEN
Description data has been successfully retrieved from the source CCN
Applied to: Extract Description Components
WHEN
The system processes the retrieved data
THEN
The lading description is extracted from GCCC-LADING-DESCRIPTION and all 46 cargo data elements are extracted from the cargo data array into the working description structure
Applied to: Extract Description Components
WHEN
The system processes the retrieved description data
THEN
The system moves the first cargo description segment to GCSCCS53 and the first description array element to GCSCCS55, then extracts lading description and all cargo data elements from the description arrays into working storage
Context: The action code is 'US' and description data has been extracted from source CCN
GIVEN
The action code is 'US' and description data has been extracted from source CCN
Applied to: Build Transit Description for US Action
WHEN
The system builds the enhanced description
THEN
The description is formatted as: source CCN + ' MOVING IN TRANSIT THROUGH CANADA ' + original description
Context: The action code is 'RT' and description data has been extracted from source CCN
GIVEN
The action code is 'RT' and description data has been extracted from source CCN
Applied to: Build Transit Description for RT Action
WHEN
The system builds the enhanced description
THEN
The description is formatted as: source CCN + ' MOVING IN TRANSIT THROUGH US ' + original description
Context: The action code is neither 'US' nor 'RT' and description data has been extracted
GIVEN
The action code is neither 'US' nor 'RT' and description data has been extracted
Applied to: Use Original Description
WHEN
The system processes the description
THEN
The original retrieved description is used without any transit-specific formatting
Context: An enhanced description has been built (either transit-formatted or original)
GIVEN
An enhanced description has been built (either transit-formatted or original)
Applied to: Compress Enhanced Description
WHEN
The description compression process is executed
THEN
The GCCCOMP program is called with source description (45000 length) and target description (22500 length) to compress the content appropriately
Context: The description has been successfully compressed and processed
GIVEN
The description has been successfully compressed and processed
Applied to: Update Current Description Data
WHEN
The system updates the current description data
THEN
The compressed description is moved to GCCC-LADING-DESCRIPTION and all 46 cargo data elements are moved to the cargo data array
Context: Description processing (successful or failed) has completed
GIVEN
Description processing (successful or failed) has completed
Applied to: Restore Original CCN Context
WHEN
The system finalizes the description capture process
THEN
The original GCSCCRT and GCSCCS52 data is restored from the saved backup, and the cargo data array is cleared to spaces
Context: Description retrieval from source CCN has failed (error number is not spaces)
GIVEN
Description retrieval from source CCN has failed (error number is not spaces)
Applied to: Restore Original Data - No Changes
WHEN
The system handles the retrieval failure
THEN
All original data (GCSCCRT, GCSCCS52, and all 46 cargo data array elements) is restored from backup variables without any changes
Context: A cargo manifest with existing description data needs to be processed for description capture from related CCN
GIVEN
A cargo manifest with existing description data needs to be processed for description capture from related CCN
Applied to: Save Current Description Data
WHEN
The description capture process begins
THEN
The system saves the current cargo manifest record, cargo description segments, and all description array data to temporary storage for potential restoration
Context: A description from CCN parameter is provided for description capture
GIVEN
A description from CCN parameter is provided for description capture
Applied to: Set CCN Key to Source CCN
WHEN
The system prepares to retrieve description data from the source CCN
THEN
The system sets the CCN key to the description from CCN parameter value
Context: A valid source CCN key is set for description retrieval
GIVEN
A valid source CCN key is set for description retrieval
Applied to: Retrieve Description from Source CCN
WHEN
The system attempts to retrieve description data from the source CCN
THEN
The system calls GCCCCIO2 program with fetch all segments flag to retrieve cargo description records including GCSCCRT, GCSCCS52, GCSCCS53, GCSCCS54, GCSCCS55, and GCSCCS56 segments
Context: Description data has been extracted from the source CCN and an action code is specified
GIVEN
Description data has been extracted from the source CCN and an action code is specified
Applied to: Action Code Check
WHEN
The system evaluates the action code for description formatting
THEN
If action code is 'US' then format for US transit, if action code is 'RT' then format for return transit, otherwise use original description without modification
Context: Action code is 'US' and description data is available from source CCN
GIVEN
Action code is 'US' and description data is available from source CCN
Applied to: Build US Transit Description
WHEN
The system formats the description for US transit
THEN
The system concatenates the description from CCN parameter, the text ' MOVING IN TRANSIT THROUGH CANADA ', and the extracted description into the description work area
Context: Action code is 'RT' and description data is available from source CCN
GIVEN
Action code is 'RT' and description data is available from source CCN
Applied to: Build RT Transit Description
WHEN
The system formats the description for return transit
THEN
The system concatenates the description from CCN parameter, the text ' MOVING IN TRANSIT THROUGH US ', and the extracted description into the description work area
Context: Action code is neither 'US' nor 'RT' and description data is available from source CCN
GIVEN
Action code is neither 'US' nor 'RT' and description data is available from source CCN
Applied to: Use Original Description
WHEN
The system processes the description for formatting
THEN
The system moves the extracted description to the description work area without any modifications
Context: A formatted description is ready for compression with description length set to 45000 and compressed length set to 22500
GIVEN
A formatted description is ready for compression with description length set to 45000 and compressed length set to 22500
Applied to: Compress Enhanced Description
WHEN
The system compresses the description data
THEN
The system calls GCCCOMP program to compress the description work area and updates the lading description and cargo data arrays with the compressed results
Context: Description data has been successfully enhanced and compressed
GIVEN
Description data has been successfully enhanced and compressed
Applied to: Update Current Description Data
WHEN
The system updates the current description data
THEN
The system moves the compressed description to the lading description field and updates all cargo data array elements with the compressed description segments
Context: Description retrieval from source CCN has failed and original data was previously saved
GIVEN
Description retrieval from source CCN has failed and original data was previously saved
Applied to: Restore Original Data on Error
WHEN
The system handles the retrieval failure
THEN
The system restores the saved cargo manifest record, cargo description segments, and clears all description array elements, then restores the saved description array data
R-GCX122A-cbl-00325 (+9) File: GCX122A.cbl Process Iron Highway Status Updates Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Iron Highway Status Updates':
  • Context - a cargo record has been processed and updated:
    For Has Cargo Status Changed?:
    When the system checks if the saved status differs from the current status, then iron highway processing is triggered only when status has changed.
  • Context - a cargo status change has been detected:
    For Retrieve Iron Highway Configuration:
    When the system retrieves iron highway configuration using the cargo origin station number as the key, then the configuration data is loaded from the ih table for further processing.
  • Context - iron highway configuration lookup has been performed:
    For Configuration Found?:
    When the system checks if configuration data was successfully retrieved, then processing continues only if valid configuration is found, otherwise the process terminates.
  • Context - valid iron highway configuration has been found:
    For Set Up Iron Highway Transaction Record:
    When the system sets up the transaction record, then the record type is set to cargo and the current cargo status is mapped to the transaction.
  • Context - iron highway transaction record has been initialized:
    For Map Cargo Control Number Data:
    When the system maps cargo data to the transaction record, then the cargo control number key and current status are transferred to the iron highway record.
  • Context - cargo control number data has been mapped:
    For Map Equipment ID and Waybill:
    When the system maps equipment and waybill data, then the equipment id and first 15 characters of waybill key are transferred to the iron highway record.
  • Context - equipment and waybill data has been mapped:
    For Search for Shipment ID Reference:
    When the system searches through up to 10 reference number entries, then each reference number qualifier is checked to identify cn type references.
  • Context - reference number search has been performed:
    For Found CN Reference Number?:
    When the system finds a reference number with qualifier 'cn', then the corresponding reference number value is identified as the shipment id.
  • Context - a cn qualified reference number has been found:
    For Set Shipment ID from Reference:
    When the system assigns the shipment id, then the reference number value associated with cn qualifier is moved to the shipment id field.
  • Context - iron highway transaction record has been fully populated:
    For Call Iron Highway Interface:
    When the system calls the iron highway interface program, then the transaction data is submitted to the iron highway system for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been processed and updated
GIVEN
A cargo record has been processed and updated
Applied to: Has Cargo Status Changed?
WHEN
The system checks if the saved status differs from the current status
THEN
Iron Highway processing is triggered only when status has changed
Context: A cargo status change has been detected
GIVEN
A cargo status change has been detected
Applied to: Retrieve Iron Highway Configuration
WHEN
The system retrieves Iron Highway configuration using the cargo origin station number as the key
THEN
The configuration data is loaded from the IH table for further processing
Context: Iron Highway configuration lookup has been performed
GIVEN
Iron Highway configuration lookup has been performed
Applied to: Configuration Found?
WHEN
The system checks if configuration data was successfully retrieved
THEN
Processing continues only if valid configuration is found, otherwise the process terminates
Context: Valid Iron Highway configuration has been found
GIVEN
Valid Iron Highway configuration has been found
Applied to: Set Up Iron Highway Transaction Record
WHEN
The system sets up the transaction record
THEN
The record type is set to cargo and the current cargo status is mapped to the transaction
Context: Iron Highway transaction record has been initialized
GIVEN
Iron Highway transaction record has been initialized
Applied to: Map Cargo Control Number Data
WHEN
The system maps cargo data to the transaction record
THEN
The cargo control number key and current status are transferred to the Iron Highway record
Context: Cargo control number data has been mapped
GIVEN
Cargo control number data has been mapped
Applied to: Map Equipment ID and Waybill
WHEN
The system maps equipment and waybill data
THEN
The equipment ID and first 15 characters of waybill key are transferred to the Iron Highway record
Context: Equipment and waybill data has been mapped
GIVEN
Equipment and waybill data has been mapped
Applied to: Search for Shipment ID Reference
WHEN
The system searches through up to 10 reference number entries
THEN
Each reference number qualifier is checked to identify CN type references
Context: Reference number search has been performed
GIVEN
Reference number search has been performed
Applied to: Found CN Reference Number?
WHEN
The system finds a reference number with qualifier 'CN'
THEN
The corresponding reference number value is identified as the shipment ID
Context: A CN qualified reference number has been found
GIVEN
A CN qualified reference number has been found
Applied to: Set Shipment ID from Reference
WHEN
The system assigns the shipment ID
THEN
The reference number value associated with CN qualifier is moved to the shipment ID field
Context: Iron Highway transaction record has been fully populated
GIVEN
Iron Highway transaction record has been fully populated
Applied to: Call Iron Highway Interface
WHEN
The system calls the Iron Highway interface program
THEN
The transaction data is submitted to the Iron Highway system for processing
R-GCCS309C-cbl-00329 (+8) File: GCCS309C.cbl Broker Notification Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Notification Processing':
  • Context - a manifest processing request is received:
    For Check if Broker Notification Required:
    When the system checks the broker notification flag gcws309c-notify-broker, then the system should proceed to broker notification processing if the flag is true, otherwise skip broker notification.
  • Context - broker notification is required:
    For Set Broker as Destination Address:
    When the system processes the broker notification setup, then the system should set gcws309c-x12-broker as both work-destination and log-edi-address.
  • Context - broker notification processing is initiated:
    For Set Security and CCN Key:
    When the system initializes the gcx105 input structure, then the system should set high-values to gcx105-security-byte, assign gccc-ccn-key to gcx105-train-or-us-ccn, and set gcx105-ca-cargo to true.
  • Context - broker message parameters are being configured:
    For Set Action Code to ZZZ:
    When the system sets up the action code for the broker message, then the system should assign 'zzz' to gcx105-action-code.
  • Context - broker message structure is being populated:
    For Set Message Content:
    When the system assigns message content, then the system should move log-edi-message to gcx105-message.
  • Context - broker message metadata is being configured:
    For Set Sending Transaction ID:
    When the system sets the sending transaction identifier, then the system should assign 'gccs309c' to gcx105-sending-transaction.
  • Context - broker message audit information is being recorded:
    For Set User ID and Timestamp:
    When the system captures user and timing information, then the system should assign cc-acf2-userid from cccom to gcx105-acf2-id.
  • Context - broker message timing information is being set:
    For Set Date and Time Information:
    When the system processes date and time configuration, then the system should move cc-machine-century and cc-machine-date from cccom to ws-gcx105-cc and ws-gcx105-yymmdd respectively, then move ws-gcx105-ccyymmdd to gcx105-date and cc-machine-time to gcx105-time.
  • Context - all broker message parameters are configured:
    For Spawn GCT1051E Transaction:
    When the system initiates broker notification transmission, then the system should perform z600-spawn-gct1051e to execute the broker edi transaction.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is received
GIVEN
A manifest processing request is received
Applied to: Check if Broker Notification Required
WHEN
The system checks the broker notification flag GCWS309C-NOTIFY-BROKER
THEN
The system should proceed to broker notification processing if the flag is true, otherwise skip broker notification
Context: Broker notification is required
GIVEN
Broker notification is required
Applied to: Set Broker as Destination Address
WHEN
The system processes the broker notification setup
THEN
The system should set GCWS309C-X12-BROKER as both WORK-DESTINATION and LOG-EDI-ADDRESS
Context: Broker notification processing is initiated
GIVEN
Broker notification processing is initiated
Applied to: Set Security and CCN Key
WHEN
The system initializes the GCX105 input structure
THEN
The system should set HIGH-VALUES to GCX105-SECURITY-BYTE, assign GCCC-CCN-KEY to GCX105-TRAIN-OR-US-CCN, and set GCX105-CA-CARGO to TRUE
Context: Broker message parameters are being configured
GIVEN
Broker message parameters are being configured
Applied to: Set Action Code to ZZZ
WHEN
The system sets up the action code for the broker message
THEN
The system should assign 'ZZZ' to GCX105-ACTION-CODE
Context: Broker message structure is being populated
GIVEN
Broker message structure is being populated
Applied to: Set Message Content
WHEN
The system assigns message content
THEN
The system should move LOG-EDI-MESSAGE to GCX105-MESSAGE
Context: Broker message metadata is being configured
GIVEN
Broker message metadata is being configured
Applied to: Set Sending Transaction ID
WHEN
The system sets the sending transaction identifier
THEN
The system should assign 'GCCS309C' to GCX105-SENDING-TRANSACTION
Context: Broker message audit information is being recorded
GIVEN
Broker message audit information is being recorded
Applied to: Set User ID and Timestamp
WHEN
The system captures user and timing information
THEN
The system should assign CC-ACF2-USERID from CCCOM to GCX105-ACF2-ID
Context: Broker message timing information is being set
GIVEN
Broker message timing information is being set
Applied to: Set Date and Time Information
WHEN
The system processes date and time configuration
THEN
The system should move CC-MACHINE-CENTURY and CC-MACHINE-DATE from CCCOM to WS-GCX105-CC and WS-GCX105-YYMMDD respectively, then move WS-GCX105-CCYYMMDD to GCX105-DATE and CC-MACHINE-TIME to GCX105-TIME
Context: All broker message parameters are configured
GIVEN
All broker message parameters are configured
Applied to: Spawn GCT1051E Transaction
WHEN
The system initiates broker notification transmission
THEN
The system should perform Z600-SPAWN-GCT1051E to execute the broker EDI transaction
R-GCCCBOL-cbl-00331 (+7) File: GCCCBOL.cbl Get N9 from Fastway Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get N9 from Fastway':
  • Context - bm reference number was not found in edi bol data and shipper bill number exists in fastway data:
    For BM Reference Number Missing?:
    When the system processes n9 reference numbers from fastway source, then extract bm reference from shipper bill number and set bm found flag to true and increment reference array index.
  • Context - special handling code equals 'si' and si reference number has not been found yet and reference array is not full:
    For Special Handling Code = 'SI' AND SI Not Found?:
    When the system processes special handling codes from fastway data, then extract si reference from special handling instruction and set si found flag to true and increment reference array index.
  • Context - reference number array index exceeds 10:
    For Reference Number Array Full?:
    When the system attempts to add another reference number, then set blank n9 not found flag to true and stop processing additional references.
  • Context - special handling data contains multiple codes and current index is less than or equal to 7 and si reference has not been found or reference array is not full:
    For More Special Handling Codes to Check?:
    When the system processes special handling codes, then continue to next special handling code in sequence.
  • Context - bm reference number was not found in edi bol data and there is available space in the reference array:
    For Set BM Reference Number:
    When the system processes fastway data for missing references, then the system sets 'bm' as the reference qualifier, uses the shipper bill number as the reference value, marks bm as found, and increments to the next reference position.
  • Context - si reference number is missing and a special handling record has code 'si':
    For Set SI Reference Number:
    When the system processes special handling data, then the system sets the special handling code as the reference qualifier, uses the special handling instruction as the reference value, marks si as found, and increments to the next reference position.
  • Context - the system is processing reference numbers from fastway data:
    For Reference Position Limit Reached:
    When the reference position counter exceeds 10, then the system sets the blank reference indicator to not found and stops processing additional references.
  • Context - there are special handling records available and si reference is still missing:
    For Loop Through Special Handling Data:
    When the system loops through special handling data, then the system processes each record from position 1 to 7 until either si is found, reference limit is reached, or all records are processed.
👨‍💻 Technical ACs (Gherkin)
Context: BM reference number was not found in EDI BOL data AND shipper bill number exists in Fastway data
GIVEN
BM reference number was not found in EDI BOL data AND shipper bill number exists in Fastway data
Applied to: BM Reference Number Missing?
WHEN
the system processes N9 reference numbers from Fastway source
THEN
extract BM reference from shipper bill number AND set BM found flag to true AND increment reference array index
Context: special handling code equals 'SI' AND SI reference number has not been found yet AND reference array is not full
GIVEN
special handling code equals 'SI' AND SI reference number has not been found yet AND reference array is not full
Applied to: Special Handling Code = 'SI' AND SI Not Found?
WHEN
the system processes special handling codes from Fastway data
THEN
extract SI reference from special handling instruction AND set SI found flag to true AND increment reference array index
Context: reference number array index exceeds 10
GIVEN
reference number array index exceeds 10
Applied to: Reference Number Array Full?
WHEN
the system attempts to add another reference number
THEN
set blank N9 not found flag to true AND stop processing additional references
Context: special handling data contains multiple codes AND current index is less than or equal to 7 AND SI reference has not been found OR reference array is not full
GIVEN
special handling data contains multiple codes AND current index is less than or equal to 7 AND SI reference has not been found OR reference array is not full
Applied to: More Special Handling Codes to Check?
WHEN
the system processes special handling codes
THEN
continue to next special handling code in sequence
Context: BM reference number was not found in EDI BOL data and there is available space in the reference array
GIVEN
BM reference number was not found in EDI BOL data and there is available space in the reference array
Applied to: Set BM Reference Number
WHEN
the system processes Fastway data for missing references
THEN
the system sets 'BM' as the reference qualifier, uses the shipper bill number as the reference value, marks BM as found, and increments to the next reference position
Context: SI reference number is missing and a special handling record has code 'SI'
GIVEN
SI reference number is missing and a special handling record has code 'SI'
Applied to: Set SI Reference Number
WHEN
the system processes special handling data
THEN
the system sets the special handling code as the reference qualifier, uses the special handling instruction as the reference value, marks SI as found, and increments to the next reference position
Context: the system is processing reference numbers from Fastway data
GIVEN
the system is processing reference numbers from Fastway data
Applied to: Reference Position Limit Reached
WHEN
the reference position counter exceeds 10
THEN
the system sets the blank reference indicator to not found and stops processing additional references
Context: there are special handling records available and SI reference is still missing
GIVEN
there are special handling records available and SI reference is still missing
Applied to: Loop Through Special Handling Data
WHEN
the system loops through special handling data
THEN
the system processes each record from position 1 to 7 until either SI is found, reference limit is reached, or all records are processed
R-GCCCBOL-cbl-00335 (+13) File: GCCCBOL.cbl Retrieve CCNs Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve CCNs':
  • Context - a multi-bill shipment requires ccn extraction:
    For Start CCN Retrieval:
    When the ccn retrieval process begins, then the system initializes ccn counter to 1 and clears ebsbccx indicators.
  • Context - ccn retrieval process is active:
    For Set RF Type for EBSBCCX Search:
    When searching for reference segments in ebsbccx, then the system sets the type to 'rf' for reference segment identification.
  • Context - rf type is set and sequence counter is positioned:
    For Get EBSBCCX RF Segment:
    When retrieving ebsbccx segment with rf type, then the system fetches the corresponding rf segment from ebsbccx.
  • Context - an attempt to retrieve ebsbccx rf segment has been made:
    For EBSBCCX Found?:
    When checking the retrieval result, then the system determines if the ebsbccx segment was found or not found.
  • Context - ebsbccx segment processing is in progress:
    For Reached Max Segments?:
    When the sequence counter equals 99, then the system sets ebsbccx not found indicator to terminate processing.
  • Context - a valid ebsbccx rf segment has been found:
    For Initialize EBSBCCY Search:
    When preparing to search for related ebsbccy segments, then the system clears ebsbccy indicators and resets sequence counter to 0.
  • Context - ebsbccy search is initialized:
    For Set CR Type for EBSBCCY:
    When setting up cargo reference segment search, then the system sets the type to 'cr' for cargo reference identification.
  • Context - cr type is set and sequence counter is incremented:
    For Get EBSBCCY Segment:
    When searching for ebsbccy segments with xc qualifier and sequence is less than 99, then the system retrieves ebsbccy segments until xc qualifier is found or search limit is reached.
  • Context - an attempt to retrieve ebsbccy segment has been made:
    For EBSBCCY Found?:
    When checking the retrieval result, then the system determines if the ebsbccy segment was found or not found.
  • Context - a valid ebsbccy segment has been retrieved:
    For Reference Qualifier = XC?:
    When the reference qualifier is evaluated, then the system checks if the reference qualifier equals 'xc' for cargo control number identification.
  • Context - a valid xc qualified reference number has been found:
    For CCN Same as Current?:
    When comparing the reference number with the current cargo control number, then the system checks if the ccn matches the current cargo control number to prevent duplicate storage.
  • Context - a unique ccn has been identified that differs from current cargo control number:
    For Store CCN in Array:
    When storing the ccn in the array, then the system moves the ccn reference number to the ccn array at the current index position.
  • Context - a ccn has been successfully stored in the array:
    For Increment CCN Index:
    When preparing for the next ccn storage, then the system increments the ccn index by 1 to point to the next available array position.
  • Context - current ebsbccx segment processing is complete:
    For Increment CX Counter:
    When moving to the next segment, then the system increments the cx counter by 1 to process the next ebsbccx rf segment.
👨‍💻 Technical ACs (Gherkin)
Context: A multi-bill shipment requires CCN extraction
GIVEN
A multi-bill shipment requires CCN extraction
Applied to: Start CCN Retrieval
WHEN
The CCN retrieval process begins
THEN
The system initializes CCN counter to 1 and clears EBSBCCX indicators
Context: CCN retrieval process is active
GIVEN
CCN retrieval process is active
Applied to: Set RF Type for EBSBCCX Search
WHEN
Searching for reference segments in EBSBCCX
THEN
The system sets the type to 'RF' for reference segment identification
Context: RF type is set and sequence counter is positioned
GIVEN
RF type is set and sequence counter is positioned
Applied to: Get EBSBCCX RF Segment
WHEN
Retrieving EBSBCCX segment with RF type
THEN
The system fetches the corresponding RF segment from EBSBCCX
Context: An attempt to retrieve EBSBCCX RF segment has been made
GIVEN
An attempt to retrieve EBSBCCX RF segment has been made
Applied to: EBSBCCX Found?
WHEN
Checking the retrieval result
THEN
The system determines if the EBSBCCX segment was found or not found
Context: EBSBCCX segment processing is in progress
GIVEN
EBSBCCX segment processing is in progress
Applied to: Reached Max Segments?
WHEN
The sequence counter equals 99
THEN
The system sets EBSBCCX not found indicator to terminate processing
Context: A valid EBSBCCX RF segment has been found
GIVEN
A valid EBSBCCX RF segment has been found
Applied to: Initialize EBSBCCY Search
WHEN
Preparing to search for related EBSBCCY segments
THEN
The system clears EBSBCCY indicators and resets sequence counter to 0
Context: EBSBCCY search is initialized
GIVEN
EBSBCCY search is initialized
Applied to: Set CR Type for EBSBCCY
WHEN
Setting up cargo reference segment search
THEN
The system sets the type to 'CR' for cargo reference identification
Context: CR type is set and sequence counter is incremented
GIVEN
CR type is set and sequence counter is incremented
Applied to: Get EBSBCCY Segment
WHEN
Searching for EBSBCCY segments with XC qualifier and sequence is less than 99
THEN
The system retrieves EBSBCCY segments until XC qualifier is found or search limit is reached
Context: An attempt to retrieve EBSBCCY segment has been made
GIVEN
An attempt to retrieve EBSBCCY segment has been made
Applied to: EBSBCCY Found?
WHEN
Checking the retrieval result
THEN
The system determines if the EBSBCCY segment was found or not found
Context: A valid EBSBCCY segment has been retrieved
GIVEN
A valid EBSBCCY segment has been retrieved
Applied to: Reference Qualifier = XC?
WHEN
The reference qualifier is evaluated
THEN
The system checks if the reference qualifier equals 'XC' for cargo control number identification
Context: A valid XC qualified reference number has been found
GIVEN
A valid XC qualified reference number has been found
Applied to: CCN Same as Current?
WHEN
Comparing the reference number with the current cargo control number
THEN
The system checks if the CCN matches the current cargo control number to prevent duplicate storage
Context: A unique CCN has been identified that differs from current cargo control number
GIVEN
A unique CCN has been identified that differs from current cargo control number
Applied to: Store CCN in Array
WHEN
Storing the CCN in the array
THEN
The system moves the CCN reference number to the CCN array at the current index position
Context: A CCN has been successfully stored in the array
GIVEN
A CCN has been successfully stored in the array
Applied to: Increment CCN Index
WHEN
Preparing for the next CCN storage
THEN
The system increments the CCN index by 1 to point to the next available array position
Context: Current EBSBCCX segment processing is complete
GIVEN
Current EBSBCCX segment processing is complete
Applied to: Increment CX Counter
WHEN
Moving to the next segment
THEN
The system increments the CX counter by 1 to process the next EBSBCCX RF segment
R-GCX122A-cbl-00335 (+3) File: GCX122A.cbl Retrieve Administration Table Entry Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Administration Table Entry':
  • Context - the system needs to access administration configuration data:
    For Retrieve Administration Table Entry - Access GCSTBRT table with 'AD' table ID and 'ADMINID' sequence to get Merlin user configuration data:
    When a request is made to retrieve the administration table entry with table id 'ad' and sequence id 'adminid', then the system should retrieve the administration segment containing merlin user configuration data.
  • Context - the system is preparing to access the administration table:
    For Set Function Code to 'GU' - Get Unique, Clear Key Values and Flags, Set Table ID to 'AD', Set Sequence ID to 'ADMINID':
    When setting up table access parameters, then the function code should be set to 'gu' for unique retrieval, table id should be 'ad', sequence id should be 'adminid', and all key values and flags should be cleared.
  • Context - a table segment retrieval operation has been executed for administration data:
    For Return Flag = 0?, Move Retrieved Segment to Administration Segment:
    When the return flag equals 0 indicating successful retrieval, then the retrieved table segment should be moved to the administration segment structure for further processing.
    For Set Error Message: Admin Table Not Found, Call Error Handler:
    When the return flag is not equal to 0 indicating retrieval failure, then an error message should be set indicating admin table not found and the error handler should be called.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to access administration configuration data
GIVEN
The system needs to access administration configuration data
Applied to: Retrieve Administration Table Entry - Access GCSTBRT table with 'AD' table ID and 'ADMINID' sequence to get Merlin user configuration data
WHEN
A request is made to retrieve the administration table entry with table ID 'AD' and sequence ID 'ADMINID'
THEN
The system should retrieve the administration segment containing Merlin user configuration data
Context: The system is preparing to access the administration table
GIVEN
The system is preparing to access the administration table
Applied to: Set Function Code to 'GU' - Get Unique, Clear Key Values and Flags, Set Table ID to 'AD', Set Sequence ID to 'ADMINID'
WHEN
Setting up table access parameters
THEN
The function code should be set to 'GU' for unique retrieval, table ID should be 'AD', sequence ID should be 'ADMINID', and all key values and flags should be cleared
Context: A table segment retrieval operation has been executed for administration data
GIVEN
A table segment retrieval operation has been executed for administration data
Applied to: Return Flag = 0?, Move Retrieved Segment to Administration Segment
WHEN
The return flag equals 0 indicating successful retrieval
THEN
The retrieved table segment should be moved to the administration segment structure for further processing
Applied to: Set Error Message: Admin Table Not Found, Call Error Handler
WHEN
The return flag is not equal to 0 indicating retrieval failure
THEN
An error message should be set indicating admin table not found and the error handler should be called
R-GCCCCADD-cbl-00337 (+20) File: GCCCCADD.cbl Transit Description Enhancement Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transit Description Enhancement':
  • Context - a cargo manifest is being processed for transit description enhancement:
    For Save Current Description Data:
    When the system begins the description enhancement process, then the current manifest description data and cargo data array are saved to working storage for potential restoration.
    For Save Current Description Data:
    When the system begins the transit description enhancement process, then the current manifest data (gcsccrt), commodity segment data (gcsccs52), and all cargo description segments (gcsccs53 array) are saved to working storage variables for potential restoration.
  • Context - a related ccn is specified for description enhancement:
    For Retrieve Description from Related CCN:
    When the system retrieves description data from the related ccn, then the system fetches all description segments including main description and cargo data array from the specified ccn.
    For Retrieve Description from Related CCN:
    When the system needs to retrieve description data from the related ccn, then the system calls gccccio2 to fetch all segments (gcsccs00, gcsccrt, gcsccs52, gcsccs53, gcsccs54, gcsccs55, gcsccs56) from the specified ccn using gu function with fetch-all option.
  • Context - an attempt has been made to retrieve description from a related ccn:
    For Description Retrieved Successfully?:
    When the system checks the retrieval operation result, then if retrieval was successful, proceed with description enhancement, otherwise restore original data.
  • Context - description data has been successfully retrieved from a related ccn:
    For Extract Description Components:
    When the system processes the retrieved description data, then the main description and cargo data array components are extracted and prepared for enhancement.
    For Extract Commodity Description:
    When the system processes the retrieved data, then the lading description is moved from gccc-lading-description to the description work area, and all 46 cargo data segments are moved from ws-gcsccs53-cargo-data array to the description database work area.
  • Context - description components have been extracted for enhancement:
    For Action Code Check:
    When the system evaluates the shipment action code, then route to us transit description for 'us' action, rt transit description for 'rt' action, or use original description for other actions.
  • Context - the action code is 'us' and description components are available:
    For Build US Transit Description:
    When the system builds the enhanced description, then the description is formatted as: '[ccn] moving in transit through canada [original description]'.
  • Context - the action code is 'rt' and description components are available:
    For Build RT Transit Description:
    When the system builds the enhanced description, then the description is formatted as: '[ccn] moving in transit through us [original description]'.
  • Context - the action code is neither 'us' nor 'rt':
    For Use Original Description:
    When the system processes the description, then the original retrieved description is used without transit-specific enhancement.
    For Use Original Description:
    When the system processes the description enhancement, then the original commodity description is used without modification in the enhanced description work area.
  • Context - an enhanced description has been built:
    For Compress Enhanced Description:
    When the system processes the description for storage, then the description is compressed using the gcccomp utility to fit within the 45000/22500 character limits.
  • Context - the enhanced description has been compressed successfully:
    For Update Cargo Description Fields:
    When the system updates the cargo manifest, then the main lading description and cargo data array are updated with the enhanced description components.
  • Context - description enhancement has failed due to retrieval error or processing failure:
    For Restore Original Data if Error:
    When the system handles the enhancement failure, then the original manifest description and cargo data array are restored from the saved working storage.
  • Context - an attempt has been made to retrieve description data from a related ccn:
    For Description Retrieved Successfully?:
    When the system checks the result of the retrieval operation, then if gcwccio2-error-num equals spaces, the retrieval is considered successful and processing continues; otherwise, the original data is restored.
  • Context - the action code is 'us' and commodity description data is available:
    For Build US Transit Description:
    When the system builds the enhanced description for us transit, then the description is constructed by concatenating the ccn from gcwccadd-desc-from-ccn, the text ' moving in transit through canada ', and the original commodity description.
  • Context - the action code is 'rt' and commodity description data is available:
    For Build Return Transit Description:
    When the system builds the enhanced description for return transit, then the description is constructed by concatenating the ccn from gcwccadd-desc-from-ccn, the text ' moving in transit through us ', and the original commodity description.
  • Context - an enhanced description has been built for the shipment:
    For Compress Enhanced Description:
    When the system needs to compress the description to fit field constraints, then the system calls gcccomp with the enhanced description (45000 character limit) and compresses it to fit the target length (22500 characters) for database storage.
  • Context - the enhanced description has been successfully compressed:
    For Update Cargo Description Fields:
    When the system updates the cargo manifest fields, then the compressed description is moved from the work area to gccc-lading-description, and all 46 cargo data segments are moved from the description work area to ws-gcsccs53-cargo-data array.
  • Context - the description enhancement process has failed (gcwccio2-error-num is not spaces):
    For Restore Original Data if Error:
    When the system needs to handle the enhancement failure, then the original manifest data is restored from working storage: ws-save-gcsccrt to gcsccrt, ws-save-gcsccs52 to gcsccs52, and all 46 saved cargo description segments are restored to ws-gcsccs53-data array.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed for transit description enhancement
GIVEN
A cargo manifest is being processed for transit description enhancement
Applied to: Save Current Description Data
WHEN
The system begins the description enhancement process
THEN
The current manifest description data and cargo data array are saved to working storage for potential restoration
Applied to: Save Current Description Data
WHEN
The system begins the transit description enhancement process
THEN
The current manifest data (GCSCCRT), commodity segment data (GCSCCS52), and all cargo description segments (GCSCCS53 array) are saved to working storage variables for potential restoration
Context: A related CCN is specified for description enhancement
GIVEN
A related CCN is specified for description enhancement
Applied to: Retrieve Description from Related CCN
WHEN
The system retrieves description data from the related CCN
THEN
The system fetches all description segments including main description and cargo data array from the specified CCN
Applied to: Retrieve Description from Related CCN
WHEN
The system needs to retrieve description data from the related CCN
THEN
The system calls GCCCCIO2 to fetch all segments (GCSCCS00, GCSCCRT, GCSCCS52, GCSCCS53, GCSCCS54, GCSCCS55, GCSCCS56) from the specified CCN using GU function with fetch-all option
Context: An attempt has been made to retrieve description from a related CCN
GIVEN
An attempt has been made to retrieve description from a related CCN
Applied to: Description Retrieved Successfully?
WHEN
The system checks the retrieval operation result
THEN
If retrieval was successful, proceed with description enhancement, otherwise restore original data
Context: Description data has been successfully retrieved from a related CCN
GIVEN
Description data has been successfully retrieved from a related CCN
Applied to: Extract Description Components
WHEN
The system processes the retrieved description data
THEN
The main description and cargo data array components are extracted and prepared for enhancement
Applied to: Extract Commodity Description
WHEN
The system processes the retrieved data
THEN
The lading description is moved from GCCC-LADING-DESCRIPTION to the description work area, and all 46 cargo data segments are moved from WS-GCSCCS53-CARGO-DATA array to the description database work area
Context: Description components have been extracted for enhancement
GIVEN
Description components have been extracted for enhancement
Applied to: Action Code Check
WHEN
The system evaluates the shipment action code
THEN
Route to US transit description for 'US' action, RT transit description for 'RT' action, or use original description for other actions
Context: The action code is 'US' and description components are available
GIVEN
The action code is 'US' and description components are available
Applied to: Build US Transit Description
WHEN
The system builds the enhanced description
THEN
The description is formatted as: '[CCN] MOVING IN TRANSIT THROUGH CANADA [Original Description]'
Context: The action code is 'RT' and description components are available
GIVEN
The action code is 'RT' and description components are available
Applied to: Build RT Transit Description
WHEN
The system builds the enhanced description
THEN
The description is formatted as: '[CCN] MOVING IN TRANSIT THROUGH US [Original Description]'
Context: The action code is neither 'US' nor 'RT'
GIVEN
The action code is neither 'US' nor 'RT'
Applied to: Use Original Description
WHEN
The system processes the description
THEN
The original retrieved description is used without transit-specific enhancement
Applied to: Use Original Description
WHEN
The system processes the description enhancement
THEN
The original commodity description is used without modification in the enhanced description work area
Context: An enhanced description has been built
GIVEN
An enhanced description has been built
Applied to: Compress Enhanced Description
WHEN
The system processes the description for storage
THEN
The description is compressed using the GCCCOMP utility to fit within the 45000/22500 character limits
Context: The enhanced description has been compressed successfully
GIVEN
The enhanced description has been compressed successfully
Applied to: Update Cargo Description Fields
WHEN
The system updates the cargo manifest
THEN
The main lading description and cargo data array are updated with the enhanced description components
Context: Description enhancement has failed due to retrieval error or processing failure
GIVEN
Description enhancement has failed due to retrieval error or processing failure
Applied to: Restore Original Data if Error
WHEN
The system handles the enhancement failure
THEN
The original manifest description and cargo data array are restored from the saved working storage
Context: An attempt has been made to retrieve description data from a related CCN
GIVEN
An attempt has been made to retrieve description data from a related CCN
Applied to: Description Retrieved Successfully?
WHEN
The system checks the result of the retrieval operation
THEN
If GCWCCIO2-ERROR-NUM equals SPACES, the retrieval is considered successful and processing continues; otherwise, the original data is restored
Context: The action code is 'US' and commodity description data is available
GIVEN
The action code is 'US' and commodity description data is available
Applied to: Build US Transit Description
WHEN
The system builds the enhanced description for US transit
THEN
The description is constructed by concatenating the CCN from GCWCCADD-DESC-FROM-CCN, the text ' MOVING IN TRANSIT THROUGH CANADA ', and the original commodity description
Context: The action code is 'RT' and commodity description data is available
GIVEN
The action code is 'RT' and commodity description data is available
Applied to: Build Return Transit Description
WHEN
The system builds the enhanced description for return transit
THEN
The description is constructed by concatenating the CCN from GCWCCADD-DESC-FROM-CCN, the text ' MOVING IN TRANSIT THROUGH US ', and the original commodity description
Context: An enhanced description has been built for the shipment
GIVEN
An enhanced description has been built for the shipment
Applied to: Compress Enhanced Description
WHEN
The system needs to compress the description to fit field constraints
THEN
The system calls GCCCOMP with the enhanced description (45000 character limit) and compresses it to fit the target length (22500 characters) for database storage
Context: The enhanced description has been successfully compressed
GIVEN
The enhanced description has been successfully compressed
Applied to: Update Cargo Description Fields
WHEN
The system updates the cargo manifest fields
THEN
The compressed description is moved from the work area to GCCC-LADING-DESCRIPTION, and all 46 cargo data segments are moved from the description work area to WS-GCSCCS53-CARGO-DATA array
Context: The description enhancement process has failed (GCWCCIO2-ERROR-NUM is not SPACES)
GIVEN
The description enhancement process has failed (GCWCCIO2-ERROR-NUM is not SPACES)
Applied to: Restore Original Data if Error
WHEN
The system needs to handle the enhancement failure
THEN
The original manifest data is restored from working storage: WS-SAVE-GCSCCRT to GCSCCRT, WS-SAVE-GCSCCS52 to GCSCCS52, and all 46 saved cargo description segments are restored to WS-GCSCCS53-DATA array
R-GCCS309C-cbl-00338 (+12) File: GCCS309C.cbl Transaction Completion Notification Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transaction Completion Notification':
  • Context - edi transmission processing has been completed:
    For EDI Transmission Finalized:
    When the system needs to send completion notification, then initialize gcx121 input parameters and set security byte to high values.
  • Context - a completed edi transmission with transmission number:
    For Move Transmission Number to GCX121:
    When preparing completion notification, then move the transmission number from a9rt-transmission-number to gcx121-transmission-number.
  • Context - a completion notification needs to be sent:
    For Running Environment?:
    When the system checks the runtime environment, then if running in bpe environment use external transaction call, otherwise use tpe environment processing.
  • Context - the system is running in bpe environment:
    For Set Transaction Name to GCT1211E:
    When setting up completion notification, then set transaction name to gct1211e and configure exci parameters.
  • Context - bpe environment completion notification setup:
    For Calculate Communication Length:
    When preparing external transaction call, then compute exci-comm-ll as gct1211e-msg-lgth plus 4 and compute exci-call-data-len as length of exci-commarea-hdr plus gct1211e-msg-lgth.
  • Context - bpe environment with configured exci parameters:
    For Call External Transaction via CSIEXCI:
    When executing completion notification, then call csiexci with configured parameters including program, return code, call data length, application id, and communication area.
  • Context - an external transaction call has been executed:
    For External Call Successful?:
    When checking the call results, then if exci-rc-resp equals zero and exci-rc-resp2 equals zero and exci-rc-abcode equals space and exci-rc-msglen equals zero then call is successful, otherwise call failed.
  • Context - external transaction call completed successfully:
    For Set Success Return Code:
    When setting completion status, then move rc-sucs to cc-return-code of cccom.
  • Context - external transaction call failed:
    For Set Failure Return Code:
    When setting completion status, then if exci-rc-msgptr is not null then set address of exci-error-msg to exci-rc-msgptr, and move rc-fail to cc-return-code of cccom.
  • Context - the system is running in tpe environment:
    For Move Input to GCT1211E Message:
    When processing completion notification, then move gcx121-input to gct1211e-msg and set cc-accept-status to spaces.
  • Context - tpe environment completion notification processing:
    For Change Message Status:
    When updating message status, then call cims using cccom, chng, alt-pcb, and gct1211e.
  • Context - tpe environment with message status changed:
    For Write Message to Log:
    When logging the completion notification, then call writmsgl using cccom, alt-pcb, gct1211e-msg-code, gct1211e-message, gct1211e-msg-lgth, and gct1211e-mod-name.
  • Context - tpe environment with message logged:
    For Purge Message Queue:
    When finalizing completion notification, then call cims using cccom, purg, and alt-pcb.
👨‍💻 Technical ACs (Gherkin)
Context: EDI transmission processing has been completed
GIVEN
EDI transmission processing has been completed
Applied to: EDI Transmission Finalized
WHEN
the system needs to send completion notification
THEN
initialize GCX121 input parameters and set security byte to high values
Context: a completed EDI transmission with transmission number
GIVEN
a completed EDI transmission with transmission number
Applied to: Move Transmission Number to GCX121
WHEN
preparing completion notification
THEN
move the transmission number from A9RT-TRANSMISSION-NUMBER to GCX121-TRANSMISSION-NUMBER
Context: a completion notification needs to be sent
GIVEN
a completion notification needs to be sent
Applied to: Running Environment?
WHEN
the system checks the runtime environment
THEN
if running in BPE environment use external transaction call, otherwise use TPE environment processing
Context: the system is running in BPE environment
GIVEN
the system is running in BPE environment
Applied to: Set Transaction Name to GCT1211E
WHEN
setting up completion notification
THEN
set transaction name to GCT1211E and configure EXCI parameters
Context: BPE environment completion notification setup
GIVEN
BPE environment completion notification setup
Applied to: Calculate Communication Length
WHEN
preparing external transaction call
THEN
compute EXCI-COMM-LL as GCT1211E-MSG-LGTH plus 4 and compute EXCI-CALL-DATA-LEN as length of EXCI-COMMAREA-HDR plus GCT1211E-MSG-LGTH
Context: BPE environment with configured EXCI parameters
GIVEN
BPE environment with configured EXCI parameters
Applied to: Call External Transaction via CSIEXCI
WHEN
executing completion notification
THEN
call CSIEXCI with configured parameters including program, return code, call data length, application ID, and communication area
Context: an external transaction call has been executed
GIVEN
an external transaction call has been executed
Applied to: External Call Successful?
WHEN
checking the call results
THEN
if EXCI-RC-RESP equals zero and EXCI-RC-RESP2 equals zero and EXCI-RC-ABCODE equals space and EXCI-RC-MSGLEN equals zero then call is successful, otherwise call failed
Context: external transaction call completed successfully
GIVEN
external transaction call completed successfully
Applied to: Set Success Return Code
WHEN
setting completion status
THEN
move RC-SUCS to CC-RETURN-CODE of CCCOM
Context: external transaction call failed
GIVEN
external transaction call failed
Applied to: Set Failure Return Code
WHEN
setting completion status
THEN
if EXCI-RC-MSGPTR is not null then set address of EXCI-ERROR-MSG to EXCI-RC-MSGPTR, and move RC-FAIL to CC-RETURN-CODE of CCCOM
Context: the system is running in TPE environment
GIVEN
the system is running in TPE environment
Applied to: Move Input to GCT1211E Message
WHEN
processing completion notification
THEN
move GCX121-INPUT to GCT1211E-MSG and set CC-ACCEPT-STATUS to spaces
Context: TPE environment completion notification processing
GIVEN
TPE environment completion notification processing
Applied to: Change Message Status
WHEN
updating message status
THEN
call CIMS using CCCOM, CHNG, ALT-PCB, and GCT1211E
Context: TPE environment with message status changed
GIVEN
TPE environment with message status changed
Applied to: Write Message to Log
WHEN
logging the completion notification
THEN
call WRITMSGL using CCCOM, ALT-PCB, GCT1211E-MSG-CODE, GCT1211E-MESSAGE, GCT1211E-MSG-LGTH, and GCT1211E-MOD-NAME
Context: TPE environment with message logged
GIVEN
TPE environment with message logged
Applied to: Purge Message Queue
WHEN
finalizing completion notification
THEN
call CIMS using CCCOM, PURG, and ALT-PCB
R-GCX122A-cbl-00339 (+12) File: GCX122A.cbl Validate DC Merged 13 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate DC':
  • Context - the system needs to validate dc-p merlin user ids:
    For Get DC-P Merlin ID 1 from Admin Table GCSTBRT-AD-DC-P-MERLIN-1:
    When the administration table lookup is performed with table id 'ad' and sequence id 'adminid', then the first dc-p merlin id is retrieved from gcstbrt-ad-dc-p-merlin-1 field.
  • Context - a dc-p merlin id 1 has been retrieved from the administration table:
    For Check ID Exists in EMTZ Segment:
    When the system checks the emtz segment for user existence using the merlin id as the key, then the system determines if the user id exists based on the status code response.
  • Context - dc-p merlin id 1 exists in the emtz segment:
    For Use Original Merlin ID Set ID Found Flag:
    When the status code indicates successful user validation, then the original merlin id is stored as ws-dcp-merlin-id and the id found flag is set to true.
  • Context - dc-p merlin id 1 does not exist in the emtz segment:
    For Set Default ID 'OM01247' Set ID Not Found Flag:
    When the status code indicates user validation failure, then the default id 'om01247' is assigned to both gcstbrt-ad-dc-p-merlin-1 and ws-dcp-merlin-id, and the id not found flag is set to true.
  • Context - the second dc-p merlin id has been retrieved from the admin table:
    For Check if Second Merlin ID Exists in EMTZ Segment:
    When the system checks if the second merlin id exists in the emtz segment, then if the second merlin id is valid (status code is space), assign it to ifs merlin id, otherwise assign the first dc-p merlin id as default to ifs merlin id.
  • Context - the second dc-p merlin id has been validated successfully in the emtz segment:
    For Set IFS Merlin ID to Second Merlin ID:
    When the validation status code is space indicating success, then the system assigns the second dc-p merlin id to the ifs merlin id.
  • Context - the second dc-p merlin id validation has failed in the emtz segment:
    For Set IFS Merlin ID to Default First Merlin ID:
    When the validation status code is not space indicating failure, then the system assigns the first dc-p merlin id as the default value to the ifs merlin id.
  • Context - the system has retrieved the third dc-p merlin id from the admin table (gcstbrt-ad-dc-p-merlin-3):
    For Check if third Merlin ID exists in EMTZ segment and set default to first ID if invalid:
    When the system validates the third merlin id against the emtz user segment, then if the third merlin id exists in the system, assign it to ws-hhs-merlin-id; otherwise assign the first dc-p merlin id (gcstbrt-ad-dc-p-merlin-1) as the default value for hhs system.
  • Context - the third dc-p merlin id has been successfully validated in the emtz segment:
    For Set HHS Merlin ID to Third Merlin ID Value:
    When the validation status indicates the merlin id exists in the system (cc-status-code is space), then assign the third dc-p merlin id value to the hhs merlin id (ws-hhs-merlin-id).
  • Context - the third dc-p merlin id validation has failed in the emtz segment:
    For Set HHS Merlin ID to Default First Merlin ID:
    When the validation status indicates the merlin id does not exist in the system (cc-status-code is not space), then assign the first dc-p merlin id (gcstbrt-ad-dc-p-merlin-1) as the default value to the hhs merlin id (ws-hhs-merlin-id).
  • Context - the fourth dc-p merlin id has been retrieved from the admin table (gcstbrt-ad-dc-p-merlin-4):
    For Check if Fourth Merlin ID Exists in EMTZ Segment:
    When the system checks if this fourth merlin id exists in the emtz segment, then if the fourth merlin id is valid (status code is space), assign it to ws-ims-merlin-id, otherwise assign the first dc-p merlin id (gcstbrt-ad-dc-p-merlin-1) to ws-ims-merlin-id as default.
  • Context - the fourth dc-p merlin id validation has been performed and the status code indicates success (space):
    For Set IMS Merlin ID to Fourth ID Value:
    When the validation result shows the fourth merlin id exists in the emtz segment, then the system assigns the fourth dc-p merlin id value to the ims merlin id variable (ws-ims-merlin-id).
  • Context - the fourth dc-p merlin id validation has been performed and the status code indicates failure (not space):
    For Set IMS Merlin ID to Default First ID:
    When the validation result shows the fourth merlin id does not exist in the emtz segment, then the system assigns the first dc-p merlin id value (gcstbrt-ad-dc-p-merlin-1) to the ims merlin id variable (ws-ims-merlin-id) as a fallback default.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to validate DC-P Merlin user IDs
GIVEN
The system needs to validate DC-P Merlin user IDs
Applied to: Get DC-P Merlin ID 1 from Admin Table GCSTBRT-AD-DC-P-MERLIN-1
WHEN
The administration table lookup is performed with table ID 'AD' and sequence ID 'ADMINID'
THEN
The first DC-P Merlin ID is retrieved from GCSTBRT-AD-DC-P-MERLIN-1 field
Context: A DC-P Merlin ID 1 has been retrieved from the administration table
GIVEN
A DC-P Merlin ID 1 has been retrieved from the administration table
Applied to: Check ID Exists in EMTZ Segment
WHEN
The system checks the EMTZ segment for user existence using the Merlin ID as the key
THEN
The system determines if the user ID exists based on the status code response
Context: DC-P Merlin ID 1 exists in the EMTZ segment
GIVEN
DC-P Merlin ID 1 exists in the EMTZ segment
Applied to: Use Original Merlin ID Set ID Found Flag
WHEN
The status code indicates successful user validation
THEN
The original Merlin ID is stored as WS-DCP-MERLIN-ID and the ID found flag is set to true
Context: DC-P Merlin ID 1 does not exist in the EMTZ segment
GIVEN
DC-P Merlin ID 1 does not exist in the EMTZ segment
Applied to: Set Default ID 'OM01247' Set ID Not Found Flag
WHEN
The status code indicates user validation failure
THEN
The default ID 'OM01247' is assigned to both GCSTBRT-AD-DC-P-MERLIN-1 and WS-DCP-MERLIN-ID, and the ID not found flag is set to true
Context: The second DC-P Merlin ID has been retrieved from the admin table
GIVEN
The second DC-P Merlin ID has been retrieved from the admin table
Applied to: Check if Second Merlin ID Exists in EMTZ Segment
WHEN
The system checks if the second Merlin ID exists in the EMTZ segment
THEN
If the second Merlin ID is valid (status code is space), assign it to IFS Merlin ID, otherwise assign the first DC-P Merlin ID as default to IFS Merlin ID
Context: The second DC-P Merlin ID has been validated successfully in the EMTZ segment
GIVEN
The second DC-P Merlin ID has been validated successfully in the EMTZ segment
Applied to: Set IFS Merlin ID to Second Merlin ID
WHEN
The validation status code is space indicating success
THEN
The system assigns the second DC-P Merlin ID to the IFS Merlin ID
Context: The second DC-P Merlin ID validation has failed in the EMTZ segment
GIVEN
The second DC-P Merlin ID validation has failed in the EMTZ segment
Applied to: Set IFS Merlin ID to Default First Merlin ID
WHEN
The validation status code is not space indicating failure
THEN
The system assigns the first DC-P Merlin ID as the default value to the IFS Merlin ID
Context: The system has retrieved the third DC-P Merlin ID from the admin table (GCSTBRT-AD-DC-P-MERLIN-3)
GIVEN
The system has retrieved the third DC-P Merlin ID from the admin table (GCSTBRT-AD-DC-P-MERLIN-3)
Applied to: Check if third Merlin ID exists in EMTZ segment and set default to first ID if invalid
WHEN
The system validates the third Merlin ID against the EMTZ user segment
THEN
If the third Merlin ID exists in the system, assign it to WS-HHS-MERLIN-ID; otherwise assign the first DC-P Merlin ID (GCSTBRT-AD-DC-P-MERLIN-1) as the default value for HHS system
Context: The third DC-P Merlin ID has been successfully validated in the EMTZ segment
GIVEN
The third DC-P Merlin ID has been successfully validated in the EMTZ segment
Applied to: Set HHS Merlin ID to Third Merlin ID Value
WHEN
The validation status indicates the Merlin ID exists in the system (CC-STATUS-CODE is SPACE)
THEN
Assign the third DC-P Merlin ID value to the HHS Merlin ID (WS-HHS-MERLIN-ID)
Context: The third DC-P Merlin ID validation has failed in the EMTZ segment
GIVEN
The third DC-P Merlin ID validation has failed in the EMTZ segment
Applied to: Set HHS Merlin ID to Default First Merlin ID
WHEN
The validation status indicates the Merlin ID does not exist in the system (CC-STATUS-CODE is not SPACE)
THEN
Assign the first DC-P Merlin ID (GCSTBRT-AD-DC-P-MERLIN-1) as the default value to the HHS Merlin ID (WS-HHS-MERLIN-ID)
Context: The fourth DC-P Merlin ID has been retrieved from the admin table (GCSTBRT-AD-DC-P-MERLIN-4)
GIVEN
The fourth DC-P Merlin ID has been retrieved from the admin table (GCSTBRT-AD-DC-P-MERLIN-4)
Applied to: Check if Fourth Merlin ID Exists in EMTZ Segment
WHEN
The system checks if this fourth Merlin ID exists in the EMTZ segment
THEN
If the fourth Merlin ID is valid (status code is space), assign it to WS-IMS-MERLIN-ID, otherwise assign the first DC-P Merlin ID (GCSTBRT-AD-DC-P-MERLIN-1) to WS-IMS-MERLIN-ID as default
Context: The fourth DC-P Merlin ID validation has been performed and the status code indicates success (space)
GIVEN
The fourth DC-P Merlin ID validation has been performed and the status code indicates success (space)
Applied to: Set IMS Merlin ID to Fourth ID Value
WHEN
The validation result shows the fourth Merlin ID exists in the EMTZ segment
THEN
The system assigns the fourth DC-P Merlin ID value to the IMS Merlin ID variable (WS-IMS-MERLIN-ID)
Context: The fourth DC-P Merlin ID validation has been performed and the status code indicates failure (not space)
GIVEN
The fourth DC-P Merlin ID validation has been performed and the status code indicates failure (not space)
Applied to: Set IMS Merlin ID to Default First ID
WHEN
The validation result shows the fourth Merlin ID does not exist in the EMTZ segment
THEN
The system assigns the first DC-P Merlin ID value (GCSTBRT-AD-DC-P-MERLIN-1) to the IMS Merlin ID variable (WS-IMS-MERLIN-ID) as a fallback default
R-GCX122A-cbl-00343 (+6) File: GCX122A.cbl Retrieve Train Report by Reference Number Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Train Report by Reference Number':
  • Context - a train report retrieval operation is initiated:
    For Set Database Access Status to 'GE':
    When the system prepares to access the train report database, then the database access status must be set to 'ge' to enable exact match retrieval.
  • Context - a reference number is provided for train report lookup:
    For Move Reference Number to Search Key:
    When the system prepares the database search parameters, then the reference number must be moved to the b4-key-value field for database access.
  • Context - the database access parameters are configured with reference number and access mode:
    For Call Database Access Function Z220-GHU-B4-TRAIN:
    When the system needs to retrieve train report data, then the z220-ghu-b4-train function must be called to access the gcsb4rt database.
  • Context - a database access attempt has been made for a train report:
    For Train Report Found?:
    When the system evaluates the database access result, then if cc-status-code is spaces then train report exists, otherwise train report does not exist.
  • Context - a train report database lookup has been successful:
    For Set Train Report Found Flag:
    When the system confirms train report existence, then the sw-train-report-found flag must be set to true.
  • Context - a train report database lookup has failed:
    For Set Train Report Not Found Flag:
    When the system confirms train report does not exist, then the sw-train-report-not-found flag must be set to true.
  • Context - a train report has been successfully retrieved from the database:
    For Get Train Last Modified Terminal:
    When the system needs to determine the processing terminal, then if gcb4r-last-mod-lterm is not spaces then use gcb4r-last-mod-lterm, otherwise use gcb4r-creation-lterm as ws-lterm-process.
👨‍💻 Technical ACs (Gherkin)
Context: A train report retrieval operation is initiated
GIVEN
A train report retrieval operation is initiated
Applied to: Set Database Access Status to 'GE'
WHEN
The system prepares to access the train report database
THEN
The database access status must be set to 'GE' to enable exact match retrieval
Context: A reference number is provided for train report lookup
GIVEN
A reference number is provided for train report lookup
Applied to: Move Reference Number to Search Key
WHEN
The system prepares the database search parameters
THEN
The reference number must be moved to the B4-KEY-VALUE field for database access
Context: The database access parameters are configured with reference number and access mode
GIVEN
The database access parameters are configured with reference number and access mode
Applied to: Call Database Access Function Z220-GHU-B4-TRAIN
WHEN
The system needs to retrieve train report data
THEN
The Z220-GHU-B4-TRAIN function must be called to access the GCSB4RT database
Context: A database access attempt has been made for a train report
GIVEN
A database access attempt has been made for a train report
Applied to: Train Report Found?
WHEN
The system evaluates the database access result
THEN
If CC-STATUS-CODE is SPACES then train report exists, otherwise train report does not exist
Context: A train report database lookup has been successful
GIVEN
A train report database lookup has been successful
Applied to: Set Train Report Found Flag
WHEN
The system confirms train report existence
THEN
The SW-TRAIN-REPORT-FOUND flag must be set to TRUE
Context: A train report database lookup has failed
GIVEN
A train report database lookup has failed
Applied to: Set Train Report Not Found Flag
WHEN
The system confirms train report does not exist
THEN
The SW-TRAIN-REPORT-NOT-FOUND flag must be set to TRUE
Context: A train report has been successfully retrieved from the database
GIVEN
A train report has been successfully retrieved from the database
Applied to: Get Train Last Modified Terminal
WHEN
The system needs to determine the processing terminal
THEN
If GCB4R-LAST-MOD-LTERM is not SPACES then use GCB4R-LAST-MOD-LTERM, otherwise use GCB4R-CREATION-LTERM as WS-LTERM-PROCESS
R-GCCCCADD-cbl-00348 (+2) File: GCCCCADD.cbl Country Code Determination Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Country Code Determination':
  • Context - an origin station state code exists:
    For Search State-Country Table for Origin Station State Code:
    When the system searches the state-country lookup table for the origin station state code, then if the state code is found in the table, set the origin country code to the corresponding country entry from the table, otherwise set the origin country code to spaces.
  • Context - a destination station state code exists:
    For Search State-Country Table for Destination Station State Code:
    When the system searches the state-country lookup table for the destination station state code, then if the state code is found in the table, set the destination country code to the corresponding country entry from the table, otherwise set the destination country code to spaces.
  • Context - a notify party name exists and consignee country code has been determined:
    For Set Notify Party Country Code Same as Consignee Country Code:
    When the system processes notify party information, then set the notify party country code to the same value as the consignee country code.
👨‍💻 Technical ACs (Gherkin)
Context: An origin station state code exists
GIVEN
An origin station state code exists
Applied to: Search State-Country Table for Origin Station State Code
WHEN
The system searches the state-country lookup table for the origin station state code
THEN
If the state code is found in the table, set the origin country code to the corresponding country entry from the table, otherwise set the origin country code to spaces
Context: A destination station state code exists
GIVEN
A destination station state code exists
Applied to: Search State-Country Table for Destination Station State Code
WHEN
The system searches the state-country lookup table for the destination station state code
THEN
If the state code is found in the table, set the destination country code to the corresponding country entry from the table, otherwise set the destination country code to spaces
Context: A notify party name exists and consignee country code has been determined
GIVEN
A notify party name exists and consignee country code has been determined
Applied to: Set Notify Party Country Code Same as Consignee Country Code
WHEN
The system processes notify party information
THEN
Set the notify party country code to the same value as the consignee country code
R-GCCCBOL-cbl-00349 (+15) File: GCCCBOL.cbl Extract N10 Lading Data Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract N10 Lading Data':
  • Context - the system needs to extract n10 lading data from edi segments:
    For Set Type to 'QD' and Sequence to 1:
    When the extraction process begins, then the system sets the segment type to 'qd' and sequence number to 1 to retrieve the first quantity/description segment.
  • Context - the segment type is set to 'qd' and sequence is set to 1:
    For Get EBSBCCY Segment:
    When the system performs segment retrieval, then the system calls the segment retrieval function to get the ebsbccy segment data.
  • Context - a qd segment retrieval has been attempted:
    For Segment Found?:
    When the system checks the retrieval result, then if the segment is found, continue with quantity processing; otherwise, terminate the extraction process.
  • Context - a qd segment with quantity data is available:
    For Extract Numeric Characters from Quantity Field:
    When the system processes the quantity field cy-n10-quantity, then the system extracts numeric characters from position 7 down to position 1, building the quantity string from right to left.
  • Context - a quantity string has been extracted with potential leading spaces:
    For Replace Leading Spaces with Zeros:
    When the system formats the quantity value, then the system replaces all leading spaces in the quantity string with zeros.
  • Context - a properly formatted quantity value is available:
    For Move Quantity to Cargo Report:
    When the system updates the cargo report data, then the system moves the formatted quantity to gccc-lading-quantity field.
  • Context - a qd segment contains country code information:
    For Move Country Code to Origin Country:
    When the system processes country data, then the system moves cy-n10-country-code to gccc-orig-country field.
  • Context - a qd segment has been retrieved:
    For Description Available?:
    When the system checks for description data, then if cy-n10-description is not spaces and not low-values, proceed to store the description; otherwise, skip to second segment processing.
  • Context - a valid description exists in the first qd segment:
    For Store Description in Array:
    When the system processes the description data, then the system moves cy-n10-description to ws-desc-eb array at the current index position.
  • Context - a description has been stored in the description array:
    For Increment Description Index:
    When the system updates the array pointer, then the system increments ws-indexeb by 1 to point to the next available array position.
  • Context - the first qd segment has been processed:
    For Set Type to 'QD' and Sequence to 2:
    When the system prepares for second segment retrieval, then the system sets the segment type to 'qd' and sequence number to 2.
  • Context - the segment type is set to 'qd' and sequence is set to 2:
    For Get Second EBSBCCY Segment:
    When the system performs the second segment retrieval, then the system calls the segment retrieval function to get the second ebsbccy segment data.
  • Context - a second qd segment retrieval has been attempted:
    For Second Segment Found?:
    When the system checks the second retrieval result, then if the second segment is found, proceed with description validation; otherwise, terminate the extraction process.
  • Context - a second qd segment has been retrieved:
    For Second Description Available?:
    When the system checks for description data in the second segment, then if cy-n10-description is not spaces and not low-values, proceed to store the second description; otherwise, terminate the process.
  • Context - a valid description exists in the second qd segment:
    For Store Second Description in Array:
    When the system processes the second description data, then the system moves cy-n10-description to ws-desc-eb array at the current index position.
  • Context - the second description has been stored in the description array:
    For Increment Description Index:
    When the system finalizes the array update, then the system increments ws-indexeb by 1 to point to the next available array position.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to extract N10 lading data from EDI segments
GIVEN
The system needs to extract N10 lading data from EDI segments
Applied to: Set Type to 'QD' and Sequence to 1
WHEN
The extraction process begins
THEN
The system sets the segment type to 'QD' and sequence number to 1 to retrieve the first quantity/description segment
Context: The segment type is set to 'QD' and sequence is set to 1
GIVEN
The segment type is set to 'QD' and sequence is set to 1
Applied to: Get EBSBCCY Segment
WHEN
The system performs segment retrieval
THEN
The system calls the segment retrieval function to get the EBSBCCY segment data
Context: A QD segment retrieval has been attempted
GIVEN
A QD segment retrieval has been attempted
Applied to: Segment Found?
WHEN
The system checks the retrieval result
THEN
If the segment is found, continue with quantity processing; otherwise, terminate the extraction process
Context: A QD segment with quantity data is available
GIVEN
A QD segment with quantity data is available
Applied to: Extract Numeric Characters from Quantity Field
WHEN
The system processes the quantity field CY-N10-QUANTITY
THEN
The system extracts numeric characters from position 7 down to position 1, building the quantity string from right to left
Context: A quantity string has been extracted with potential leading spaces
GIVEN
A quantity string has been extracted with potential leading spaces
Applied to: Replace Leading Spaces with Zeros
WHEN
The system formats the quantity value
THEN
The system replaces all leading spaces in the quantity string with zeros
Context: A properly formatted quantity value is available
GIVEN
A properly formatted quantity value is available
Applied to: Move Quantity to Cargo Report
WHEN
The system updates the cargo report data
THEN
The system moves the formatted quantity to GCCC-LADING-QUANTITY field
Context: A QD segment contains country code information
GIVEN
A QD segment contains country code information
Applied to: Move Country Code to Origin Country
WHEN
The system processes country data
THEN
The system moves CY-N10-COUNTRY-CODE to GCCC-ORIG-COUNTRY field
Context: A QD segment has been retrieved
GIVEN
A QD segment has been retrieved
Applied to: Description Available?
WHEN
The system checks for description data
THEN
If CY-N10-DESCRIPTION is not spaces and not low-values, proceed to store the description; otherwise, skip to second segment processing
Context: A valid description exists in the first QD segment
GIVEN
A valid description exists in the first QD segment
Applied to: Store Description in Array
WHEN
The system processes the description data
THEN
The system moves CY-N10-DESCRIPTION to WS-DESC-EB array at the current index position
Context: A description has been stored in the description array
GIVEN
A description has been stored in the description array
Applied to: Increment Description Index
WHEN
The system updates the array pointer
THEN
The system increments WS-INDEXEB by 1 to point to the next available array position
Context: The first QD segment has been processed
GIVEN
The first QD segment has been processed
Applied to: Set Type to 'QD' and Sequence to 2
WHEN
The system prepares for second segment retrieval
THEN
The system sets the segment type to 'QD' and sequence number to 2
Context: The segment type is set to 'QD' and sequence is set to 2
GIVEN
The segment type is set to 'QD' and sequence is set to 2
Applied to: Get Second EBSBCCY Segment
WHEN
The system performs the second segment retrieval
THEN
The system calls the segment retrieval function to get the second EBSBCCY segment data
Context: A second QD segment retrieval has been attempted
GIVEN
A second QD segment retrieval has been attempted
Applied to: Second Segment Found?
WHEN
The system checks the second retrieval result
THEN
If the second segment is found, proceed with description validation; otherwise, terminate the extraction process
Context: A second QD segment has been retrieved
GIVEN
A second QD segment has been retrieved
Applied to: Second Description Available?
WHEN
The system checks for description data in the second segment
THEN
If CY-N10-DESCRIPTION is not spaces and not low-values, proceed to store the second description; otherwise, terminate the process
Context: A valid description exists in the second QD segment
GIVEN
A valid description exists in the second QD segment
Applied to: Store Second Description in Array
WHEN
The system processes the second description data
THEN
The system moves CY-N10-DESCRIPTION to WS-DESC-EB array at the current index position
Context: The second description has been stored in the description array
GIVEN
The second description has been stored in the description array
Applied to: Increment Description Index
WHEN
The system finalizes the array update
THEN
The system increments WS-INDEXEB by 1 to point to the next available array position
R-GCX122A-cbl-00350 (+12) File: GCX122A.cbl Update Train Report Status and Timestamps Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train Report Status and Timestamps':
  • Context - an acknowledgment message contains a train reference number:
    For Retrieve Train Report by Reference Number:
    When the system processes the train acknowledgment, then the system retrieves the corresponding train report from the database using the reference number.
  • Context - a train reference number is provided for acknowledgment:
    For Train Report Found?:
    When the system attempts to retrieve the train report, then the system determines if the train report exists or is not found in the database.
  • Context - a train acknowledgment is being processed:
    For Log Train Not Found Error:
    When the train report is not found in the database, then the system adds 'train report not found on customs database' message to the error log and sets train error flag.
    For Record Acknowledgment Number:
    When the system updates the train record, then the system records the acknowledgment reference number from the message into the train record.
    For Capture Current Date and Time:
    When the system needs to timestamp the acknowledgment, then the system captures the current machine date, century, and time from the system.
  • Context - a train report is found for acknowledgment processing:
    For Clear Security Error Flags:
    When the system begins updating the train report, then the system clears the security error flag in the train record.
  • Context - a train report is being acknowledged:
    For Clear Position and Port Data:
    When the train record is marked as deleted or delete-pending, then the system initializes (clears) the security position and port data fields.
  • Context - a train report exists for acknowledgment:
    For Train Deleted or Delete Pending?:
    When the system processes the acknowledgment, then the system checks if the train record is marked as deleted or delete-pending.
  • Context - a valid train report is being acknowledged:
    For Set Train Status to ACK:
    When the system processes the acknowledgment, then the system sets the train record status to ack.
  • Context - current date and time have been captured for acknowledgment:
    For Save ACK Timestamp to Train Record:
    When the system updates the train record, then the system stores the combined date-time value as the acknowledgment timestamp in the train record.
  • Context - all acknowledgment data has been prepared for a train record:
    For Update Train Report in Database:
    When the system completes acknowledgment processing, then the system updates the train record in the database with all acknowledgment information.
  • Context - a train record has been successfully acknowledged:
    For AEI Send Flag Enabled?:
    When the system determines notification requirements, then the system checks if the aei send flag is set to 'y' (yes) in the train record.
  • Context - a train acknowledgment has been processed and aei send flag is enabled:
    For Send AEI Status Message:
    When the system sends notifications, then the system creates and sends an aei message containing train id and current status.
👨‍💻 Technical ACs (Gherkin)
Context: An acknowledgment message contains a train reference number
GIVEN
An acknowledgment message contains a train reference number
Applied to: Retrieve Train Report by Reference Number
WHEN
The system processes the train acknowledgment
THEN
The system retrieves the corresponding train report from the database using the reference number
Context: A train reference number is provided for acknowledgment
GIVEN
A train reference number is provided for acknowledgment
Applied to: Train Report Found?
WHEN
The system attempts to retrieve the train report
THEN
The system determines if the train report exists or is not found in the database
Context: A train acknowledgment is being processed
GIVEN
A train acknowledgment is being processed
Applied to: Log Train Not Found Error
WHEN
The train report is not found in the database
THEN
The system adds 'TRAIN REPORT NOT FOUND ON CUSTOMS DATABASE' message to the error log and sets train error flag
Applied to: Record Acknowledgment Number
WHEN
The system updates the train record
THEN
The system records the acknowledgment reference number from the message into the train record
Applied to: Capture Current Date and Time
WHEN
The system needs to timestamp the acknowledgment
THEN
The system captures the current machine date, century, and time from the system
Context: A train report is found for acknowledgment processing
GIVEN
A train report is found for acknowledgment processing
Applied to: Clear Security Error Flags
WHEN
The system begins updating the train report
THEN
The system clears the security error flag in the train record
Context: A train report is being acknowledged
GIVEN
A train report is being acknowledged
Applied to: Clear Position and Port Data
WHEN
The train record is marked as deleted or delete-pending
THEN
The system initializes (clears) the security position and port data fields
Context: A train report exists for acknowledgment
GIVEN
A train report exists for acknowledgment
Applied to: Train Deleted or Delete Pending?
WHEN
The system processes the acknowledgment
THEN
The system checks if the train record is marked as deleted or delete-pending
Context: A valid train report is being acknowledged
GIVEN
A valid train report is being acknowledged
Applied to: Set Train Status to ACK
WHEN
The system processes the acknowledgment
THEN
The system sets the train record status to ACK
Context: Current date and time have been captured for acknowledgment
GIVEN
Current date and time have been captured for acknowledgment
Applied to: Save ACK Timestamp to Train Record
WHEN
The system updates the train record
THEN
The system stores the combined date-time value as the acknowledgment timestamp in the train record
Context: All acknowledgment data has been prepared for a train record
GIVEN
All acknowledgment data has been prepared for a train record
Applied to: Update Train Report in Database
WHEN
The system completes acknowledgment processing
THEN
The system updates the train record in the database with all acknowledgment information
Context: A train record has been successfully acknowledged
GIVEN
A train record has been successfully acknowledged
Applied to: AEI Send Flag Enabled?
WHEN
The system determines notification requirements
THEN
The system checks if the AEI send flag is set to 'Y' (Yes) in the train record
Context: A train acknowledgment has been processed and AEI send flag is enabled
GIVEN
A train acknowledgment has been processed and AEI send flag is enabled
Applied to: Send AEI Status Message
WHEN
The system sends notifications
THEN
The system creates and sends an AEI message containing train ID and current status
R-GCCCCADD-cbl-00351 File: GCCCCADD.cbl Notify Party Country Setting
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Notify Party Country Setting':
  • Context - a shipment has consignee information with a country code and notify party name field:
    For Set Notify Party Country Code = Consignee Country Code:
    When the notify party name is not blank or spaces, then the notify party country code is set to the same value as the consignee country code.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has consignee information with a country code and notify party name field
GIVEN
A shipment has consignee information with a country code and notify party name field
Applied to: Set Notify Party Country Code = Consignee Country Code
WHEN
The notify party name is not blank or spaces
THEN
The notify party country code is set to the same value as the consignee country code
R-GCCS309C-cbl-00351 (+6) File: GCCS309C.cbl Broker Reference Number Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Reference Number Processing':
  • Context - broker reference number processing is initiated:
    For Increment N9 Counter:
    When the system begins processing reference numbers for broker notifications, then the n9 counter is incremented by 1 to point to the next reference number position.
  • Context - a reference number qualifier from the manifest data array at the current n9 counter position:
    For Reference Number Qualifier Available?:
    When the qualifier is spaces, high-values, or low-values, then the system skips processing this reference number and continues to the next one.
  • Context - a valid reference number qualifier exists for broker processing:
    For Initialize N9 Segment:
    When the system needs to create an n9 reference segment, then the n9 segment structure is initialized to clear any previous data.
  • Context - an initialized n9 segment structure for broker notifications:
    For Set N9 Identifier:
    When the system prepares the segment for transmission, then the segment identifier is set to 'n9' to comply with edi standards.
  • Context - a valid reference number qualifier from the manifest data array at the current counter position:
    For Move Reference Number Qualifier to N9-01:
    When the system builds the n9 segment for broker transmission, then the reference number qualifier is moved to the n9-01 field of the segment.
  • Context - a valid reference number from the manifest data array at the current counter position:
    For Move Reference Number to N9-02:
    When the system builds the n9 segment for broker transmission, then the reference number is moved to the n9-02 field of the segment.
  • Context - a fully populated n9 segment with reference qualifier and number for broker notifications:
    For Create N9 Segment for Broker:
    When the system needs to add this segment to the transmission, then the segment is added to the transmission queue with an incremented sequence number and proper status code.
👨‍💻 Technical ACs (Gherkin)
Context: Broker reference number processing is initiated
GIVEN
Broker reference number processing is initiated
Applied to: Increment N9 Counter
WHEN
The system begins processing reference numbers for broker notifications
THEN
The N9 counter is incremented by 1 to point to the next reference number position
Context: A reference number qualifier from the manifest data array at the current N9 counter position
GIVEN
A reference number qualifier from the manifest data array at the current N9 counter position
Applied to: Reference Number Qualifier Available?
WHEN
The qualifier is spaces, high-values, or low-values
THEN
The system skips processing this reference number and continues to the next one
Context: A valid reference number qualifier exists for broker processing
GIVEN
A valid reference number qualifier exists for broker processing
Applied to: Initialize N9 Segment
WHEN
The system needs to create an N9 reference segment
THEN
The N9 segment structure is initialized to clear any previous data
Context: An initialized N9 segment structure for broker notifications
GIVEN
An initialized N9 segment structure for broker notifications
Applied to: Set N9 Identifier
WHEN
The system prepares the segment for transmission
THEN
The segment identifier is set to 'N9' to comply with EDI standards
Context: A valid reference number qualifier from the manifest data array at the current counter position
GIVEN
A valid reference number qualifier from the manifest data array at the current counter position
Applied to: Move Reference Number Qualifier to N9-01
WHEN
The system builds the N9 segment for broker transmission
THEN
The reference number qualifier is moved to the N9-01 field of the segment
Context: A valid reference number from the manifest data array at the current counter position
GIVEN
A valid reference number from the manifest data array at the current counter position
Applied to: Move Reference Number to N9-02
WHEN
The system builds the N9 segment for broker transmission
THEN
The reference number is moved to the N9-02 field of the segment
Context: A fully populated N9 segment with reference qualifier and number for broker notifications
GIVEN
A fully populated N9 segment with reference qualifier and number for broker notifications
Applied to: Create N9 Segment for Broker
WHEN
The system needs to add this segment to the transmission
THEN
The segment is added to the transmission queue with an incremented sequence number and proper status code
R-GCCCCADD-cbl-00352 (+3) File: GCCCCADD.cbl Application Type Determination Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Application Type Determination':
  • Context - an origin station state code exists:
    For Lookup Origin Country from State-Country Table:
    When the system searches the state-country table for a matching state entry, then if a match is found, the corresponding country code is assigned to the origin country field, otherwise the origin country remains empty.
  • Context - a destination station state code exists:
    For Lookup Destination Country from State-Country Table:
    When the system searches the state-country table for a matching state entry, then if a match is found, the corresponding country code is assigned to the destination country field, otherwise the destination country remains empty.
  • Context - origin and destination country codes have been determined:
    For Search Application Type Table with Country Combination:
    When the system searches the application type table using the country code combination, then if a matching combination is found, the corresponding application type and in-transit status are assigned, otherwise both fields are set to spaces.
  • Context - the in-transit status is set to ocean and the ccn key starts with '6105e':
    For Set Application Type and In-Transit Status from Table:
    When the application type and in-transit status are being finalized, then the broker name is automatically set to 'not-req' to indicate no broker is required.
👨‍💻 Technical ACs (Gherkin)
Context: An origin station state code exists
GIVEN
An origin station state code exists
Applied to: Lookup Origin Country from State-Country Table
WHEN
The system searches the state-country table for a matching state entry
THEN
If a match is found, the corresponding country code is assigned to the origin country field, otherwise the origin country remains empty
Context: A destination station state code exists
GIVEN
A destination station state code exists
Applied to: Lookup Destination Country from State-Country Table
WHEN
The system searches the state-country table for a matching state entry
THEN
If a match is found, the corresponding country code is assigned to the destination country field, otherwise the destination country remains empty
Context: Origin and destination country codes have been determined
GIVEN
Origin and destination country codes have been determined
Applied to: Search Application Type Table with Country Combination
WHEN
The system searches the application type table using the country code combination
THEN
If a matching combination is found, the corresponding application type and in-transit status are assigned, otherwise both fields are set to spaces
Context: The in-transit status is set to ocean and the CCN key starts with '6105E'
GIVEN
The in-transit status is set to ocean and the CCN key starts with '6105E'
Applied to: Set Application Type and In-Transit Status from Table
WHEN
The application type and in-transit status are being finalized
THEN
The broker name is automatically set to 'NOT-REQ' to indicate no broker is required
R-GCCCCADD-cbl-00356 (+21) File: GCCCCADD.cbl Broker Information Retrieval Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Information Retrieval':
  • Context - a shipment has shipper chop code, consignee chop code, origin station number, destination road number, and commodity stcc code:
    For Search 1: Use Shipper CHOP, Consignee CHOP, Origin Station, Destination Road, Commodity Code:
    When the system performs the primary broker search in the crossing table, then the system uses shipper chop, consignee chop, origin station, destination road formatted as 'road' + road number, and commodity code as search criteria.
  • Context - the primary broker search returned no results and shipment has consignee chop, destination road, and commodity code:
    For Search 2: Use Wildcard for Shipper CHOP and Origin Station:
    When the system performs the secondary broker search, then the system uses wildcard values for shipper chop and origin station while maintaining consignee chop, destination road, and commodity code as search criteria.
  • Context - both primary and secondary broker searches returned no results:
    For Search 3: Use Wildcard for Commodity Code:
    When the system performs the tertiary broker search, then the system uses wildcard values for shipper chop, origin station, and commodity code while maintaining consignee chop and destination road as search criteria.
    For Search 3: Use Wildcard for Commodity Code:
    When the system performs the final broker search, then the system uses wildcard values for shipper chop, origin station, and commodity code while maintaining consignee chop and destination road criteria.
  • Context - broker data has been found in the crossing table:
    For Check Override Flag:
    When the system evaluates the override flag in the broker data, then if override flag equals 'y', the system will apply the broker information regardless of existing broker status and the system determines whether to apply broker data unconditionally or check existing broker status.
  • Context - broker data has been found and override flag is not 'y':
    For Check Current Broker Status:
    When the system evaluates the current broker name, then if current broker name is spaces, 'unknown', or 'not-req', the system will apply the new broker information.
  • Context - broker data has been found and either override flag is 'y' or current broker status allows replacement:
    For Move Broker Name to Output:
    When the system processes broker information assignment, then the system moves the broker name from the crossing table to the customs cargo record.
  • Context - broker information has been successfully applied to the customs record:
    For Check Manifest-To Station Override:
    When the system evaluates the canadian manifest-to station field in the broker data, then if the canadian manifest-to station field is not spaces, the system will process the station override.
  • Context - a new manifest-to station has been specified in the broker data:
    For Validate New Manifest-To Station:
    When the system validates the station in the mc table, then the system performs a lookup using 'mc' table id and the specified station name as the sequence id.
  • Context - the manifest-to station lookup in mc table was successful:
    For Lookup Station in MC Table:
    When the system evaluates the canadian customs code for the station, then if the canadian customs code equals '00000', the system sets error flag 2 and records the station name for error reporting.
  • Context - the manifest-to station validation was successful and canadian customs code is not '00000':
    For Update Manifest-To Station Code:
    When the system updates the manifest-to station information, then the system moves the canadian customs code to manifest-to station code, station number to destination station number fields, and call letters to batch print call letters.
  • Context - the manifest-to station lookup in mc table was not successful:
    For Set Station Validation Error:
    When the system processes the lookup failure, then the system sets error flag 3 and records the station name for error reporting.
  • Context - a shipment with shipper chop, consignee chop, origin station number, destination road number, and commodity code:
    For Search 1: Use Shipper CHOP, Consignee CHOP, Origin Station, Destination Road, Commodity Code:
    When the system performs the primary broker search in the crossing table, then the system uses all five criteria (shipper chop, consignee chop, origin station, destination road with 'road' prefix, commodity code) to find matching broker data.
  • Context - the primary broker search returned no results:
    For Search 2: Use Wildcard for Shipper CHOP and Origin Station:
    When the system performs the secondary broker search, then the system uses wildcard values for shipper chop and origin station while maintaining consignee chop, destination road, and commodity code criteria.
  • Context - broker data is found and override flag equals 'y':
    For Apply Broker Data Override:
    When the system processes the broker override, then the system applies the broker name and manifest-to station information from crossing table unconditionally.
  • Context - broker data is found and override flag is not 'y':
    For Apply Broker Data:
    When the existing broker name is spaces, 'unknown', or 'not-req', then the system applies the broker name and manifest-to station information from crossing table.
  • Context - broker data is found, override flag is not 'y', and existing broker name is not empty, unknown, or not-required:
    For Keep Existing Broker:
    When the system evaluates broker application conditions, then the system retains the existing broker information without applying crossing table data.
  • Context - broker data has been applied and contains a non-empty canadian manifest-to station value:
    For Update Manifest-To Station if Provided:
    When the system processes the manifest-to station update, then the system updates the manifest-to station name, canadian customs code, station number, and call letters from the mc table lookup.
  • Context - a manifest-to station has been specified by broker data:
    For Validate Canadian Customs Code:
    When the system looks up the station in the mc table and retrieves the canadian customs code, then the system validates that the canadian customs code is not '00000' (invalid default).
  • Context - the canadian customs code for broker manifest station is valid (not '00000'):
    For Set Manifest-To Station Information:
    When the system processes the manifest station update, then the system updates manifest-to station code, destination station number, and batch print call letters.
  • Context - the canadian customs code for broker manifest station equals '00000':
    For Generate Error for Invalid Customs Code:
    When the system validates the customs code, then the system generates an error message indicating invalid manifest port canadian customs code.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has shipper CHOP code, consignee CHOP code, origin station number, destination road number, and commodity STCC code
GIVEN
A shipment has shipper CHOP code, consignee CHOP code, origin station number, destination road number, and commodity STCC code
Applied to: Search 1: Use Shipper CHOP, Consignee CHOP, Origin Station, Destination Road, Commodity Code
WHEN
The system performs the primary broker search in the crossing table
THEN
The system uses shipper CHOP, consignee CHOP, origin station, destination road formatted as 'ROAD' + road number, and commodity code as search criteria
Context: The primary broker search returned no results and shipment has consignee CHOP, destination road, and commodity code
GIVEN
The primary broker search returned no results and shipment has consignee CHOP, destination road, and commodity code
Applied to: Search 2: Use Wildcard for Shipper CHOP and Origin Station
WHEN
The system performs the secondary broker search
THEN
The system uses wildcard values for shipper CHOP and origin station while maintaining consignee CHOP, destination road, and commodity code as search criteria
Context: Both primary and secondary broker searches returned no results
GIVEN
Both primary and secondary broker searches returned no results
Applied to: Search 3: Use Wildcard for Commodity Code
WHEN
The system performs the tertiary broker search
THEN
The system uses wildcard values for shipper CHOP, origin station, and commodity code while maintaining consignee CHOP and destination road as search criteria
Applied to: Search 3: Use Wildcard for Commodity Code
WHEN
The system performs the final broker search
THEN
The system uses wildcard values for shipper CHOP, origin station, and commodity code while maintaining consignee CHOP and destination road criteria
Context: Broker data has been found in the crossing table
GIVEN
Broker data has been found in the crossing table
Applied to: Check Override Flag
WHEN
The system evaluates the override flag in the broker data
THEN
If override flag equals 'Y', the system will apply the broker information regardless of existing broker status AND The system determines whether to apply broker data unconditionally or check existing broker status
Context: Broker data has been found and override flag is not 'Y'
GIVEN
Broker data has been found and override flag is not 'Y'
Applied to: Check Current Broker Status
WHEN
The system evaluates the current broker name
THEN
If current broker name is spaces, 'UNKNOWN', or 'NOT-REQ', the system will apply the new broker information
Context: Broker data has been found and either override flag is 'Y' or current broker status allows replacement
GIVEN
Broker data has been found and either override flag is 'Y' or current broker status allows replacement
Applied to: Move Broker Name to Output
WHEN
The system processes broker information assignment
THEN
The system moves the broker name from the crossing table to the customs cargo record
Context: Broker information has been successfully applied to the customs record
GIVEN
Broker information has been successfully applied to the customs record
Applied to: Check Manifest-To Station Override
WHEN
The system evaluates the Canadian manifest-to station field in the broker data
THEN
If the Canadian manifest-to station field is not spaces, the system will process the station override
Context: A new manifest-to station has been specified in the broker data
GIVEN
A new manifest-to station has been specified in the broker data
Applied to: Validate New Manifest-To Station
WHEN
The system validates the station in the MC table
THEN
The system performs a lookup using 'MC' table ID and the specified station name as the sequence ID
Context: The manifest-to station lookup in MC table was successful
GIVEN
The manifest-to station lookup in MC table was successful
Applied to: Lookup Station in MC Table
WHEN
The system evaluates the Canadian customs code for the station
THEN
If the Canadian customs code equals '00000', the system sets error flag 2 and records the station name for error reporting
Context: The manifest-to station validation was successful and Canadian customs code is not '00000'
GIVEN
The manifest-to station validation was successful and Canadian customs code is not '00000'
Applied to: Update Manifest-To Station Code
WHEN
The system updates the manifest-to station information
THEN
The system moves the Canadian customs code to manifest-to station code, station number to destination station number fields, and call letters to batch print call letters
Context: The manifest-to station lookup in MC table was not successful
GIVEN
The manifest-to station lookup in MC table was not successful
Applied to: Set Station Validation Error
WHEN
The system processes the lookup failure
THEN
The system sets error flag 3 and records the station name for error reporting
Context: A shipment with shipper CHOP, consignee CHOP, origin station number, destination road number, and commodity code
GIVEN
A shipment with shipper CHOP, consignee CHOP, origin station number, destination road number, and commodity code
Applied to: Search 1: Use Shipper CHOP, Consignee CHOP, Origin Station, Destination Road, Commodity Code
WHEN
The system performs the primary broker search in the crossing table
THEN
The system uses all five criteria (shipper CHOP, consignee CHOP, origin station, destination road with 'ROAD' prefix, commodity code) to find matching broker data
Context: The primary broker search returned no results
GIVEN
The primary broker search returned no results
Applied to: Search 2: Use Wildcard for Shipper CHOP and Origin Station
WHEN
The system performs the secondary broker search
THEN
The system uses wildcard values for shipper CHOP and origin station while maintaining consignee CHOP, destination road, and commodity code criteria
Context: Broker data is found and override flag equals 'Y'
GIVEN
Broker data is found and override flag equals 'Y'
Applied to: Apply Broker Data Override
WHEN
The system processes the broker override
THEN
The system applies the broker name and manifest-to station information from crossing table unconditionally
Context: Broker data is found and override flag is not 'Y'
GIVEN
Broker data is found and override flag is not 'Y'
Applied to: Apply Broker Data
WHEN
The existing broker name is spaces, 'UNKNOWN', or 'NOT-REQ'
THEN
The system applies the broker name and manifest-to station information from crossing table
Context: Broker data is found, override flag is not 'Y', and existing broker name is not empty, unknown, or not-required
GIVEN
Broker data is found, override flag is not 'Y', and existing broker name is not empty, unknown, or not-required
Applied to: Keep Existing Broker
WHEN
The system evaluates broker application conditions
THEN
The system retains the existing broker information without applying crossing table data
Context: Broker data has been applied and contains a non-empty Canadian manifest-to station value
GIVEN
Broker data has been applied and contains a non-empty Canadian manifest-to station value
Applied to: Update Manifest-To Station if Provided
WHEN
The system processes the manifest-to station update
THEN
The system updates the manifest-to station name, Canadian customs code, station number, and call letters from the MC table lookup
Context: A manifest-to station has been specified by broker data
GIVEN
A manifest-to station has been specified by broker data
Applied to: Validate Canadian Customs Code
WHEN
The system looks up the station in the MC table and retrieves the Canadian customs code
THEN
The system validates that the Canadian customs code is not '00000' (invalid default)
Context: The Canadian customs code for broker manifest station is valid (not '00000')
GIVEN
The Canadian customs code for broker manifest station is valid (not '00000')
Applied to: Set Manifest-To Station Information
WHEN
The system processes the manifest station update
THEN
The system updates manifest-to station code, destination station number, and batch print call letters
Context: The Canadian customs code for broker manifest station equals '00000'
GIVEN
The Canadian customs code for broker manifest station equals '00000'
Applied to: Generate Error for Invalid Customs Code
WHEN
The system validates the customs code
THEN
The system generates an error message indicating invalid manifest port Canadian customs code
R-GCCS309C-cbl-00358 (+2) File: GCCS309C.cbl Station Code Validation Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Code Validation':
  • Context - a manifest with from-station transport code exists:
    For Access SC table with station code:
    When the system needs to validate station information, then the system accesses the sc table using the from-station code as the key.
  • Context - a station code lookup has been performed against the sc table:
    For Station code found in SC table?:
    When the system evaluates the lookup result, then if the lookup was not successful or the canadian station code is '0000', then the station is considered invalid.
  • Context - a station code lookup has failed or returned invalid data:
    For Generate station not found error message:
    When the system needs to report the validation failure, then the system generates an error message indicating the sc table entry for the station was not found.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest with from-station transport code exists
GIVEN
A manifest with from-station transport code exists
Applied to: Access SC table with station code
WHEN
The system needs to validate station information
THEN
The system accesses the SC table using the from-station code as the key
Context: A station code lookup has been performed against the SC table
GIVEN
A station code lookup has been performed against the SC table
Applied to: Station code found in SC table?
WHEN
The system evaluates the lookup result
THEN
If the lookup was not successful OR the Canadian station code is '0000', then the station is considered invalid
Context: A station code lookup has failed or returned invalid data
GIVEN
A station code lookup has failed or returned invalid data
Applied to: Generate station not found error message
WHEN
The system needs to report the validation failure
THEN
The system generates an error message indicating the SC table entry for the station was not found
R-GCCS309C-cbl-00361 (+10) File: GCCS309C.cbl Seal Number Validation Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Seal Number Validation':
  • Context - a seal number processing operation is in progress with a counter tracking processed seals:
    For Counter ≤ 20 AND seal number exists?:
    When the system evaluates whether to continue processing seal numbers, then continue processing if counter is 20 or less and current seal number is not spaces or low-values, otherwise stop processing.
  • Context - seal numbers need to be processed for transmission:
    For Initialize M7 segment:
    When a new m7 segment needs to be created, then initialize m7 segment structure and set identifier to 'm7'.
  • Context - a seal number at the current counter position exists:
    For Seal number 1 valid?:
    When the system checks if the first seal number is valid for processing, then the seal number is valid if it is not spaces and not low-values.
  • Context - the first seal number has been validated as not spaces or low-values:
    For Add seal number 1 to M7 segment:
    When the system assigns the seal number to the m7 segment, then move the seal number to m7-01-seal-number field.
  • Context - the counter has been incremented to the next seal number position:
    For Seal number 2 valid?:
    When the system checks if the second seal number is valid for processing, then the seal number is valid if it is not spaces and not low-values.
  • Context - the second seal number has been validated as not spaces or low-values:
    For Add seal number 2 to M7 segment:
    When the system assigns the seal number to the m7 segment, then move the seal number to m7-02-seal-number field.
  • Context - the counter has been incremented to the third seal number position:
    For Seal number 3 valid?:
    When the system checks if the third seal number is valid for processing, then the seal number is valid if it is not spaces and not low-values.
  • Context - the third seal number has been validated as not spaces or low-values:
    For Add seal number 3 to M7 segment:
    When the system assigns the seal number to the m7 segment, then move the seal number to m7-03-seal-number field.
  • Context - the counter has been incremented to the fourth seal number position:
    For Seal number 4 valid?:
    When the system checks if the fourth seal number is valid for processing, then the seal number is valid if it is not spaces and not low-values.
  • Context - the fourth seal number has been validated as not spaces or low-values:
    For Add seal number 4 to M7 segment:
    When the system assigns the seal number to the m7 segment, then move the seal number to m7-04-seal-number field.
  • Context - m7 segment has been populated with validated seal numbers:
    For Create M7 segment with validated seal numbers:
    When the system creates the segment for transmission, then replace underscores with spaces, increment sequence number, and create transmission department record.
👨‍💻 Technical ACs (Gherkin)
Context: A seal number processing operation is in progress with a counter tracking processed seals
GIVEN
A seal number processing operation is in progress with a counter tracking processed seals
Applied to: Counter ≤ 20 AND seal number exists?
WHEN
The system evaluates whether to continue processing seal numbers
THEN
Continue processing if counter is 20 or less AND current seal number is not spaces or low-values, otherwise stop processing
Context: Seal numbers need to be processed for transmission
GIVEN
Seal numbers need to be processed for transmission
Applied to: Initialize M7 segment
WHEN
A new M7 segment needs to be created
THEN
Initialize M7 segment structure and set identifier to 'M7'
Context: A seal number at the current counter position exists
GIVEN
A seal number at the current counter position exists
Applied to: Seal number 1 valid?
WHEN
The system checks if the first seal number is valid for processing
THEN
The seal number is valid if it is not spaces and not low-values
Context: The first seal number has been validated as not spaces or low-values
GIVEN
The first seal number has been validated as not spaces or low-values
Applied to: Add seal number 1 to M7 segment
WHEN
The system assigns the seal number to the M7 segment
THEN
Move the seal number to M7-01-SEAL-NUMBER field
Context: The counter has been incremented to the next seal number position
GIVEN
The counter has been incremented to the next seal number position
Applied to: Seal number 2 valid?
WHEN
The system checks if the second seal number is valid for processing
THEN
The seal number is valid if it is not spaces and not low-values
Context: The second seal number has been validated as not spaces or low-values
GIVEN
The second seal number has been validated as not spaces or low-values
Applied to: Add seal number 2 to M7 segment
WHEN
The system assigns the seal number to the M7 segment
THEN
Move the seal number to M7-02-SEAL-NUMBER field
Context: The counter has been incremented to the third seal number position
GIVEN
The counter has been incremented to the third seal number position
Applied to: Seal number 3 valid?
WHEN
The system checks if the third seal number is valid for processing
THEN
The seal number is valid if it is not spaces and not low-values
Context: The third seal number has been validated as not spaces or low-values
GIVEN
The third seal number has been validated as not spaces or low-values
Applied to: Add seal number 3 to M7 segment
WHEN
The system assigns the seal number to the M7 segment
THEN
Move the seal number to M7-03-SEAL-NUMBER field
Context: The counter has been incremented to the fourth seal number position
GIVEN
The counter has been incremented to the fourth seal number position
Applied to: Seal number 4 valid?
WHEN
The system checks if the fourth seal number is valid for processing
THEN
The seal number is valid if it is not spaces and not low-values
Context: The fourth seal number has been validated as not spaces or low-values
GIVEN
The fourth seal number has been validated as not spaces or low-values
Applied to: Add seal number 4 to M7 segment
WHEN
The system assigns the seal number to the M7 segment
THEN
Move the seal number to M7-04-SEAL-NUMBER field
Context: M7 segment has been populated with validated seal numbers
GIVEN
M7 segment has been populated with validated seal numbers
Applied to: Create M7 segment with validated seal numbers
WHEN
The system creates the segment for transmission
THEN
Replace underscores with spaces, increment sequence number, and create transmission department record
R-GCX122A-cbl-00363 (+5) File: GCX122A.cbl Retrieve Cargo Control Record by Reference Number Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Cargo Control Record by Reference Number':
  • Context - an input message containing a reference number in oti-03-ref-num:
    For Set Reference Number from Message:
    When the system needs to retrieve cargo control records, then the reference number is set as the key value for both ccrt-ssaq and a2rt-ssaq segments.
  • Context - a reference number has been set as the key value for a2rt-ssaq:
    For Access GCSA2RT Segment First:
    When the system performs cargo control record retrieval, then the system calls cims with ghu function to access gca2-pcb using gcsccs52 segment and a2rt-ssaq key.
  • Context - the gcsa2rt segment access has been attempted:
    For Clear GCSA2RT Data:
    When the status code indicates the gcsa2rt record was not found (cc-status-code is not spaces), then the system moves spaces to gcsccs52 to clear the segment data.
  • Context - the gcsa2rt segment processing has been completed (whether found or not found):
    For Access GCSCCRT Segment:
    When the system continues cargo control record retrieval, then the system calls cims with ghu function to access gccc-pcb using gccc-cargo-report-segment and ccrt-ssaq key.
  • Context - the gcsccrt segment access has been attempted:
    For Return Cargo Control Data:
    When the status code indicates the gcsccrt record was found (cc-status-code is spaces), then the system returns with the cargo control data available in gccc-cargo-report-segment for further processing.
    For Return Record Not Found Status:
    When the status code indicates the gcsccrt record was not found (cc-status-code is not spaces), then the system returns with a not found status, making the cargo control data unavailable for processing.
👨‍💻 Technical ACs (Gherkin)
Context: An input message containing a reference number in OTI-03-REF-NUM
GIVEN
An input message containing a reference number in OTI-03-REF-NUM
Applied to: Set Reference Number from Message
WHEN
The system needs to retrieve cargo control records
THEN
The reference number is set as the key value for both CCRT-SSAQ and A2RT-SSAQ segments
Context: A reference number has been set as the key value for A2RT-SSAQ
GIVEN
A reference number has been set as the key value for A2RT-SSAQ
Applied to: Access GCSA2RT Segment First
WHEN
The system performs cargo control record retrieval
THEN
The system calls CIMS with GHU function to access GCA2-PCB using GCSCCS52 segment and A2RT-SSAQ key
Context: The GCSA2RT segment access has been attempted
GIVEN
The GCSA2RT segment access has been attempted
Applied to: Clear GCSA2RT Data
WHEN
The status code indicates the GCSA2RT record was not found (CC-STATUS-CODE is not spaces)
THEN
The system moves spaces to GCSCCS52 to clear the segment data
Context: The GCSA2RT segment processing has been completed (whether found or not found)
GIVEN
The GCSA2RT segment processing has been completed (whether found or not found)
Applied to: Access GCSCCRT Segment
WHEN
The system continues cargo control record retrieval
THEN
The system calls CIMS with GHU function to access GCCC-PCB using GCCC-CARGO-REPORT-SEGMENT and CCRT-SSAQ key
Context: The GCSCCRT segment access has been attempted
GIVEN
The GCSCCRT segment access has been attempted
Applied to: Return Cargo Control Data
WHEN
The status code indicates the GCSCCRT record was found (CC-STATUS-CODE is spaces)
THEN
The system returns with the cargo control data available in GCCC-CARGO-REPORT-SEGMENT for further processing
Applied to: Return Record Not Found Status
WHEN
The status code indicates the GCSCCRT record was not found (CC-STATUS-CODE is not spaces)
THEN
The system returns with a not found status, making the cargo control data unavailable for processing
R-GCCCBOL-cbl-00365 (+9) File: GCCCBOL.cbl Process EBSBCCM Segments Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process EBSBCCM Segments':
  • Context - the system needs to process ebsbccm segments for lading descriptions:
    For Initialize CCM Sequence to 1:
    When the processing begins, then the ccm sequence counter is set to 1 to start with the first segment.
  • Context - a ccm sequence number is available:
    For Get First EBSBCCM Segment:
    When the system attempts to retrieve the ebsbccm segment, then the segment data is fetched using the edi bol key and ccm sequence number.
  • Context - an attempt to retrieve ebsbccm segment has been made:
    For EBSBCCM Found?:
    When the system checks the retrieval status, then processing continues if segment is found, otherwise processing ends.
  • Context - an ebsbccm segment has been retrieved:
    For Lading Description Not Empty?:
    When the lading description field is evaluated, then the description is processed only if it is not spaces or low-values.
  • Context - a valid lading description exists in the ebsbccm segment:
    For Store Lading Description in Description Array:
    When the description content is not empty, then the lading description is stored in the description array at the current index position.
  • Context - a lading description has been stored in the description array:
    For Increment Description Index:
    When the storage operation is complete, then the description array index is incremented by 1 to point to the next available position.
  • Context - an ebsbccm segment is being processed:
    For Get Additional Description Data from BOL:
    When additional description data is needed, then the system retrieves up to 7 additional description lines from related ebsbcrt segments.
  • Context - the current ebsbccm segment has been processed:
    For Increment CCM Sequence:
    When more segments need to be processed, then the ccm sequence number is incremented by 1.
  • Context - ebsbccm segments are being processed sequentially:
    For CCM Sequence > 25?:
    When the ccm sequence number is evaluated, then processing stops if the sequence exceeds 25, otherwise continues to next segment.
  • Context - the ccm sequence is within the allowed limit and more segments may exist:
    For Get Next EBSBCCM Segment:
    When the system continues processing, then the next ebsbccm segment is retrieved using the incremented sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process EBSBCCM segments for lading descriptions
GIVEN
The system needs to process EBSBCCM segments for lading descriptions
Applied to: Initialize CCM Sequence to 1
WHEN
The processing begins
THEN
The CCM sequence counter is set to 1 to start with the first segment
Context: A CCM sequence number is available
GIVEN
A CCM sequence number is available
Applied to: Get First EBSBCCM Segment
WHEN
The system attempts to retrieve the EBSBCCM segment
THEN
The segment data is fetched using the EDI BOL key and CCM sequence number
Context: An attempt to retrieve EBSBCCM segment has been made
GIVEN
An attempt to retrieve EBSBCCM segment has been made
Applied to: EBSBCCM Found?
WHEN
The system checks the retrieval status
THEN
Processing continues if segment is found, otherwise processing ends
Context: An EBSBCCM segment has been retrieved
GIVEN
An EBSBCCM segment has been retrieved
Applied to: Lading Description Not Empty?
WHEN
The lading description field is evaluated
THEN
The description is processed only if it is not spaces or low-values
Context: A valid lading description exists in the EBSBCCM segment
GIVEN
A valid lading description exists in the EBSBCCM segment
Applied to: Store Lading Description in Description Array
WHEN
The description content is not empty
THEN
The lading description is stored in the description array at the current index position
Context: A lading description has been stored in the description array
GIVEN
A lading description has been stored in the description array
Applied to: Increment Description Index
WHEN
The storage operation is complete
THEN
The description array index is incremented by 1 to point to the next available position
Context: An EBSBCCM segment is being processed
GIVEN
An EBSBCCM segment is being processed
Applied to: Get Additional Description Data from BOL
WHEN
Additional description data is needed
THEN
The system retrieves up to 7 additional description lines from related EBSBCRT segments
Context: The current EBSBCCM segment has been processed
GIVEN
The current EBSBCCM segment has been processed
Applied to: Increment CCM Sequence
WHEN
More segments need to be processed
THEN
The CCM sequence number is incremented by 1
Context: EBSBCCM segments are being processed sequentially
GIVEN
EBSBCCM segments are being processed sequentially
Applied to: CCM Sequence > 25?
WHEN
The CCM sequence number is evaluated
THEN
Processing stops if the sequence exceeds 25, otherwise continues to next segment
Context: The CCM sequence is within the allowed limit and more segments may exist
GIVEN
The CCM sequence is within the allowed limit and more segments may exist
Applied to: Get Next EBSBCCM Segment
WHEN
The system continues processing
THEN
The next EBSBCCM segment is retrieved using the incremented sequence number
R-GCCCCADD-cbl-00367 (+16) File: GCCCCADD.cbl Broker Data Validation Merged 17 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Data Validation':
  • Context - a crossing table lookup has been performed and broker data is available:
    For Move Broker Name from Crossing Table:
    When the system processes broker information from the crossing table, then the broker name from the crossing table is assigned to the customs manifest broker name field.
  • Context - broker data has been retrieved from the crossing table:
    For Canadian Manifest-To Station Available?:
    When the system checks if a canadian manifest-to station is specified in the crossing table data, then if the canadian manifest-to station field is not spaces, proceed with manifest-to station processing, otherwise skip the processing.
    For Manifest-To Station from Crossing Table Available?:
    When the system checks for manifest-to station override information, then if the canadian manifest-to field is not spaces, proceed with manifest-to station processing, otherwise skip manifest-to station updates.
  • Context - a canadian manifest-to station is specified in the crossing table:
    For Reset Error Flags:
    When the system begins processing the broker-specified manifest-to station, then all three manifest-to station error flags (error-1, error-2, error-3) are reset to off status.
  • Context - the crossing table contains a valid canadian manifest-to station specification:
    For Set Manifest-To Station Name:
    When the system processes the broker-specified manifest-to station, then the manifest-to station name is updated with the canadian manifest-to station value from the crossing table.
  • Context - a manifest-to station name has been set from broker data:
    For Lookup MC Table for Station Code:
    When the system validates the manifest-to station, then a lookup is performed in the mc table using the manifest-to station name as the search key.
  • Context - a lookup has been performed in the mc table for the manifest-to station:
    For MC Table Lookup Successful?:
    When the mc table lookup is not successful, then error flag 3 is set to on status and the station sequence id is saved for error reporting.
  • Context - the mc table lookup was successful and returned station data:
    For Validate Canadian Customs Code:
    When the system validates the canadian customs code from the mc table data, then if the canadian customs code equals '00000', it is considered invalid and error flag 2 is set to on status with the station sequence id saved for error reporting.
  • Context - the mc table lookup was successful and the canadian customs code is valid:
    For Set Station Information:
    When the system processes the valid station information, then the manifest-to station code is set to the canadian customs code, the destination station number is set to the mc station number, and the batch print call letters are set to the mc call letters.
  • Context - broker data has been successfully retrieved from the crossing table:
    For Move Broker Name from Crossing Table:
    When the system processes the broker information, then the broker name from the crossing table is assigned to the customs manifest broker name field.
  • Context - the crossing table contains manifest-to station information:
    For Reset Error Flags:
    When the system begins processing the manifest-to station override, then all three manifest-to error flags (error-1, error-2, error-3) are set to off status.
  • Context - the crossing table contains a valid manifest-to station specification:
    For Set Manifest-To Station Name:
    When the system processes the manifest-to station override, then the manifest-to station name is updated with the canadian manifest-to value from the crossing table.
  • Context - a manifest-to station name has been specified from the crossing table:
    For Lookup Manifest-To Station in MC Table:
    When the system validates the manifest-to station, then the mc table is queried using the manifest-to station name to retrieve station details.
  • Context - a manifest-to station lookup has been attempted in the mc table:
    For MC Table Lookup Successful?:
    When the mc table lookup is unsuccessful, then clear the mc table segment data and set error flag 3 to on with the station name saved for error reporting.
  • Context - station information has been successfully retrieved from the mc table:
    For Validate Canadian Customs Code:
    When the system validates the canadian customs code, then if the canadian customs code equals '00000', clear the mc table segment data and set error flag 2 to on with the station name saved for error reporting.
  • Context - valid station information exists in the mc table with a valid canadian customs code:
    For Set Station Information:
    When the system processes the station information, then the canadian customs code is assigned to the manifest-to station code, the station number is assigned to the destination station number fields, and the call letters are assigned to the batch print call letters.
  • Context - manifest-to station processing has been completed:
    For Check and Report Manifest-To Errors:
    When the system checks for any manifest-to related errors, then if error flag 1 is on, generate invalid manifest upon error message; if error flag 2 is on, generate invalid canadian customs code error message with station name; if error flag 3 is on, generate invalid manifest port mc error message with station name.
👨‍💻 Technical ACs (Gherkin)
Context: A crossing table lookup has been performed and broker data is available
GIVEN
A crossing table lookup has been performed and broker data is available
Applied to: Move Broker Name from Crossing Table
WHEN
The system processes broker information from the crossing table
THEN
The broker name from the crossing table is assigned to the customs manifest broker name field
Context: Broker data has been retrieved from the crossing table
GIVEN
Broker data has been retrieved from the crossing table
Applied to: Canadian Manifest-To Station Available?
WHEN
The system checks if a Canadian manifest-to station is specified in the crossing table data
THEN
If the Canadian manifest-to station field is not spaces, proceed with manifest-to station processing, otherwise skip the processing
Applied to: Manifest-To Station from Crossing Table Available?
WHEN
The system checks for manifest-to station override information
THEN
If the Canadian manifest-to field is not spaces, proceed with manifest-to station processing, otherwise skip manifest-to station updates
Context: A Canadian manifest-to station is specified in the crossing table
GIVEN
A Canadian manifest-to station is specified in the crossing table
Applied to: Reset Error Flags
WHEN
The system begins processing the broker-specified manifest-to station
THEN
All three manifest-to station error flags (error-1, error-2, error-3) are reset to OFF status
Context: The crossing table contains a valid Canadian manifest-to station specification
GIVEN
The crossing table contains a valid Canadian manifest-to station specification
Applied to: Set Manifest-To Station Name
WHEN
The system processes the broker-specified manifest-to station
THEN
The manifest-to station name is updated with the Canadian manifest-to station value from the crossing table
Context: A manifest-to station name has been set from broker data
GIVEN
A manifest-to station name has been set from broker data
Applied to: Lookup MC Table for Station Code
WHEN
The system validates the manifest-to station
THEN
A lookup is performed in the MC table using the manifest-to station name as the search key
Context: A lookup has been performed in the MC table for the manifest-to station
GIVEN
A lookup has been performed in the MC table for the manifest-to station
Applied to: MC Table Lookup Successful?
WHEN
The MC table lookup is not successful
THEN
Error flag 3 is set to ON status and the station sequence ID is saved for error reporting
Context: The MC table lookup was successful and returned station data
GIVEN
The MC table lookup was successful and returned station data
Applied to: Validate Canadian Customs Code
WHEN
The system validates the Canadian customs code from the MC table data
THEN
If the Canadian customs code equals '00000', it is considered invalid and error flag 2 is set to ON status with the station sequence ID saved for error reporting
Context: The MC table lookup was successful and the Canadian customs code is valid
GIVEN
The MC table lookup was successful and the Canadian customs code is valid
Applied to: Set Station Information
WHEN
The system processes the valid station information
THEN
The manifest-to station code is set to the Canadian customs code, the destination station number is set to the MC station number, and the batch print call letters are set to the MC call letters
Context: Broker data has been successfully retrieved from the crossing table
GIVEN
Broker data has been successfully retrieved from the crossing table
Applied to: Move Broker Name from Crossing Table
WHEN
The system processes the broker information
THEN
The broker name from the crossing table is assigned to the customs manifest broker name field
Context: The crossing table contains manifest-to station information
GIVEN
The crossing table contains manifest-to station information
Applied to: Reset Error Flags
WHEN
The system begins processing the manifest-to station override
THEN
All three manifest-to error flags (error-1, error-2, error-3) are set to OFF status
Context: The crossing table contains a valid manifest-to station specification
GIVEN
The crossing table contains a valid manifest-to station specification
Applied to: Set Manifest-To Station Name
WHEN
The system processes the manifest-to station override
THEN
The manifest-to station name is updated with the Canadian manifest-to value from the crossing table
Context: A manifest-to station name has been specified from the crossing table
GIVEN
A manifest-to station name has been specified from the crossing table
Applied to: Lookup Manifest-To Station in MC Table
WHEN
The system validates the manifest-to station
THEN
The MC table is queried using the manifest-to station name to retrieve station details
Context: A manifest-to station lookup has been attempted in the MC table
GIVEN
A manifest-to station lookup has been attempted in the MC table
Applied to: MC Table Lookup Successful?
WHEN
The MC table lookup is unsuccessful
THEN
Clear the MC table segment data and set error flag 3 to ON with the station name saved for error reporting
Context: Station information has been successfully retrieved from the MC table
GIVEN
Station information has been successfully retrieved from the MC table
Applied to: Validate Canadian Customs Code
WHEN
The system validates the Canadian customs code
THEN
If the Canadian customs code equals '00000', clear the MC table segment data and set error flag 2 to ON with the station name saved for error reporting
Context: Valid station information exists in the MC table with a valid Canadian customs code
GIVEN
Valid station information exists in the MC table with a valid Canadian customs code
Applied to: Set Station Information
WHEN
The system processes the station information
THEN
The Canadian customs code is assigned to the manifest-to station code, the station number is assigned to the destination station number fields, and the call letters are assigned to the batch print call letters
Context: Manifest-to station processing has been completed
GIVEN
Manifest-to station processing has been completed
Applied to: Check and Report Manifest-To Errors
WHEN
The system checks for any manifest-to related errors
THEN
If error flag 1 is ON, generate invalid manifest upon error message; if error flag 2 is ON, generate invalid Canadian customs code error message with station name; if error flag 3 is ON, generate invalid manifest port MC error message with station name
R-GCX122A-cbl-00369 (+9) File: GCX122A.cbl Update Cargo Status and Process Terminal Information Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Cargo Status and Process Terminal Information':
  • Context - a cargo acknowledgment message with reference number is received:
    For Retrieve Cargo Control Record by Reference Number:
    When the system attempts to retrieve the cargo control record using the reference number, then the system performs database lookup using the reference number as the key for both cargo control and related segments.
  • Context - a cargo acknowledgment is being processed:
    For Add Error Message: CCN Not Found:
    When the cargo control record is not found in the database, then the system adds error message 'ccn not found on customs d.b. for 824 ack' to the message text and mst entry.
  • Context - cargo control record lookup has failed:
    For Set Error Flag for DCP Interface:
    When the system needs to indicate an interface error condition, then the system sets the dcp interface error flag to true.
  • Context - a cargo control record exists and acknowledgment is being processed:
    For Update Status to ACK:
    When the current cargo status is sent, then the system updates the cargo current status to ack.
  • Context - a cargo acknowledgment is being processed and cargo record exists:
    For Update Status to ACK:
    When the system processes the acknowledgment, then the system sets the working current status to ack for processing purposes.
    For Process Arrival Notifications:
    When the cargo arrival indicator equals y, then the system performs arrival processing notifications.
  • Context - a cargo record exists and needs terminal assignment for processing:
    For Determine Processing Terminal:
    When the system evaluates terminal information, then the system uses last modify terminal if available, otherwise uses creation terminal as fallback.
  • Context - cargo record has last modify terminal information:
    For Use Last Modify Terminal:
    When the last modify terminal field is not empty, then the system assigns the last modify terminal to the processing terminal variable.
  • Context - cargo record exists but last modify terminal is not available:
    For Use Creation Terminal:
    When the last modify terminal field is empty or spaces, then the system assigns the creation terminal to the processing terminal variable.
  • Context - cargo acknowledgment processing is complete with all status and terminal updates:
    For Update Cargo Control Record:
    When the system needs to persist the changes, then the system updates the cargo control record in the database with all modifications.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo acknowledgment message with reference number is received
GIVEN
A cargo acknowledgment message with reference number is received
Applied to: Retrieve Cargo Control Record by Reference Number
WHEN
The system attempts to retrieve the cargo control record using the reference number
THEN
The system performs database lookup using the reference number as the key for both cargo control and related segments
Context: A cargo acknowledgment is being processed
GIVEN
A cargo acknowledgment is being processed
Applied to: Add Error Message: CCN Not Found
WHEN
The cargo control record is not found in the database
THEN
The system adds error message 'CCN NOT FOUND ON CUSTOMS D.B. FOR 824 ACK' to the message text and MST entry
Context: Cargo control record lookup has failed
GIVEN
Cargo control record lookup has failed
Applied to: Set Error Flag for DCP Interface
WHEN
The system needs to indicate an interface error condition
THEN
The system sets the DCP interface error flag to true
Context: A cargo control record exists and acknowledgment is being processed
GIVEN
A cargo control record exists and acknowledgment is being processed
Applied to: Update Status to ACK
WHEN
The current cargo status is SENT
THEN
The system updates the cargo current status to ACK
Context: A cargo acknowledgment is being processed and cargo record exists
GIVEN
A cargo acknowledgment is being processed and cargo record exists
Applied to: Update Status to ACK
WHEN
The system processes the acknowledgment
THEN
The system sets the working current status to ACK for processing purposes
Applied to: Process Arrival Notifications
WHEN
The cargo arrival indicator equals Y
THEN
The system performs arrival processing notifications
Context: A cargo record exists and needs terminal assignment for processing
GIVEN
A cargo record exists and needs terminal assignment for processing
Applied to: Determine Processing Terminal
WHEN
The system evaluates terminal information
THEN
The system uses last modify terminal if available, otherwise uses creation terminal as fallback
Context: Cargo record has last modify terminal information
GIVEN
Cargo record has last modify terminal information
Applied to: Use Last Modify Terminal
WHEN
The last modify terminal field is not empty
THEN
The system assigns the last modify terminal to the processing terminal variable
Context: Cargo record exists but last modify terminal is not available
GIVEN
Cargo record exists but last modify terminal is not available
Applied to: Use Creation Terminal
WHEN
The last modify terminal field is empty or spaces
THEN
The system assigns the creation terminal to the processing terminal variable
Context: Cargo acknowledgment processing is complete with all status and terminal updates
GIVEN
Cargo acknowledgment processing is complete with all status and terminal updates
Applied to: Update Cargo Control Record
WHEN
The system needs to persist the changes
THEN
The system updates the cargo control record in the database with all modifications
R-GCCS309C-cbl-00372 (+11) File: GCCS309C.cbl Database Access Module GCCCCIO2 Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Database Access Module GCCCCIO2':
  • Context - a manifest processing request is initiated with input ccn key:
    For Set CCN Key from Input:
    When the system prepares to retrieve manifest data from the database, then the ccn key from input is assigned to the database query key field.
  • Context - a database query is about to be executed:
    For Initialize GCWCCIO2 Parameters:
    When the system prepares the query parameters, then all gcwccio2 parameters are initialized to spaces to ensure clean state.
  • Context - a manifest data retrieval request is processed:
    For Set Fetch All Segments Flag:
    When the system configures the database query scope, then the fetch all segments flag is set to true to retrieve complete manifest information.
  • Context - a specific manifest needs to be retrieved from the database:
    For Set Function to GU - Get Unique:
    When the system sets the database access function, then the function is set to gu (get unique) to retrieve a single manifest record.
  • Context - a manifest lookup is performed using a specific ccn key:
    For Set Index Not Used Flag:
    When the system configures the database access method, then the index not used flag is set to true to perform direct key access.
  • Context - all database query parameters are properly configured:
    For Call GCCCCIO2 Module:
    When the system needs to retrieve manifest data from the database, then the gccccio2 module is called with all required parameters including cccom, gcwccio2, and all segment arrays.
  • Context - a database retrieval operation has been executed:
    For Error Number Present?:
    When the system checks the operation result, then if gcwccio2-error-num equals spaces, the operation is considered successful.
  • Context - database retrieval operation completed successfully with no error number:
    For Move GCSCCS53 Data from Array & Move GCSCCS55 Data from Array:
    When the system processes the retrieved segment arrays, then the first element of ws-gcsccs53-data array is moved to gcsccs53 segment and the first element of ws-gcsccs55-data array is moved to gcsccs55 segment.
  • Context - a database retrieval operation has been attempted:
    For Database Error?:
    When the system evaluates the operation outcome, then if gcwccio2-error-num is greater than spaces, a database error is detected.
  • Context - a database error has been detected during manifest retrieval:
    For Set Error Message: Unable to Locate Manifest:
    When the system prepares error information for the user, then the error message is set to 'unable to locate manifest in database'.
  • Context - a manifest not found error message has been set:
    For Call Error Handler CERR:
    When the system needs to handle the error condition, then the cerr error handler is called with cccom parameter.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest processing request is initiated with input CCN key
GIVEN
A manifest processing request is initiated with input CCN key
Applied to: Set CCN Key from Input
WHEN
The system prepares to retrieve manifest data from the database
THEN
The CCN key from input is assigned to the database query key field
Context: A database query is about to be executed
GIVEN
A database query is about to be executed
Applied to: Initialize GCWCCIO2 Parameters
WHEN
The system prepares the query parameters
THEN
All GCWCCIO2 parameters are initialized to spaces to ensure clean state
Context: A manifest data retrieval request is processed
GIVEN
A manifest data retrieval request is processed
Applied to: Set Fetch All Segments Flag
WHEN
The system configures the database query scope
THEN
The fetch all segments flag is set to true to retrieve complete manifest information
Context: A specific manifest needs to be retrieved from the database
GIVEN
A specific manifest needs to be retrieved from the database
Applied to: Set Function to GU - Get Unique
WHEN
The system sets the database access function
THEN
The function is set to GU (Get Unique) to retrieve a single manifest record
Context: A manifest lookup is performed using a specific CCN key
GIVEN
A manifest lookup is performed using a specific CCN key
Applied to: Set Index Not Used Flag
WHEN
The system configures the database access method
THEN
The index not used flag is set to true to perform direct key access
Context: All database query parameters are properly configured
GIVEN
All database query parameters are properly configured
Applied to: Call GCCCCIO2 Module
WHEN
The system needs to retrieve manifest data from the database
THEN
The GCCCCIO2 module is called with all required parameters including CCCOM, GCWCCIO2, and all segment arrays
Context: A database retrieval operation has been executed
GIVEN
A database retrieval operation has been executed
Applied to: Error Number Present?
WHEN
The system checks the operation result
THEN
If GCWCCIO2-ERROR-NUM equals spaces, the operation is considered successful
Context: Database retrieval operation completed successfully with no error number
GIVEN
Database retrieval operation completed successfully with no error number
Applied to: Move GCSCCS53 Data from Array & Move GCSCCS55 Data from Array
WHEN
The system processes the retrieved segment arrays
THEN
The first element of WS-GCSCCS53-DATA array is moved to GCSCCS53 segment AND The first element of WS-GCSCCS55-DATA array is moved to GCSCCS55 segment
Context: A database retrieval operation has been attempted
GIVEN
A database retrieval operation has been attempted
Applied to: Database Error?
WHEN
The system evaluates the operation outcome
THEN
If GCWCCIO2-ERROR-NUM is greater than spaces, a database error is detected
Context: A database error has been detected during manifest retrieval
GIVEN
A database error has been detected during manifest retrieval
Applied to: Set Error Message: Unable to Locate Manifest
WHEN
The system prepares error information for the user
THEN
The error message is set to 'UNABLE TO LOCATE MANIFEST IN DATABASE'
Context: A manifest not found error message has been set
GIVEN
A manifest not found error message has been set
Applied to: Call Error Handler CERR
WHEN
The system needs to handle the error condition
THEN
The CERR error handler is called with CCCOM parameter
R-GCCCBOL-cbl-00375 (+6) File: GCCCBOL.cbl Get Additional BOL Descriptions Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Additional BOL Descriptions':
  • Context - the system needs to retrieve additional lading descriptions from bol data:
    For Initialize EBSBCRT-AD Found Flag:
    When the additional description processing begins, then the system sets the ebsbcrt-ad found flag to true and initializes the description sequence counter to 1.
  • Context - the system is processing additional bol descriptions:
    For Description Sequence <= 10?:
    When the description sequence counter is evaluated, then processing continues if the sequence counter is less than or equal to 10, otherwise processing stops.
  • Context - the description sequence counter is within valid range:
    For Retrieve EBSBCRT-AD Segment:
    When the system attempts to retrieve an ebsbcrt-ad segment, then the system calls the data access routine to fetch the segment using current sequence number.
  • Context - the system has attempted to retrieve an ebsbcrt-ad segment:
    For EBSBCRT-AD Segment Found?:
    When the retrieval operation completes, then if the segment is found, processing continues with description extraction, otherwise the sequence counter is incremented to try the next segment.
  • Context - an ebsbcrt-ad segment has been successfully retrieved:
    For Description Index <= 7?:
    When the system processes individual description lines within the segment, then processing continues for description indexes 1 through 7, then moves to the next segment.
  • Context - the system is processing an individual description line from an ebsbcrt-ad segment:
    For Additional Lading Description Not Empty?:
    When the additional lading description content is evaluated, then if the description is not spaces, the content is moved to the description array, otherwise it is skipped.
  • Context - an additional lading description contains valid non-empty content:
    For Move Additional Description to Description Array:
    When the description content is processed, then the system moves the description content to the current position in the description array and increments the array index.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to retrieve additional lading descriptions from BOL data
GIVEN
The system needs to retrieve additional lading descriptions from BOL data
Applied to: Initialize EBSBCRT-AD Found Flag
WHEN
The additional description processing begins
THEN
The system sets the EBSBCRT-AD found flag to true and initializes the description sequence counter to 1
Context: The system is processing additional BOL descriptions
GIVEN
The system is processing additional BOL descriptions
Applied to: Description Sequence <= 10?
WHEN
The description sequence counter is evaluated
THEN
Processing continues if the sequence counter is less than or equal to 10, otherwise processing stops
Context: The description sequence counter is within valid range
GIVEN
The description sequence counter is within valid range
Applied to: Retrieve EBSBCRT-AD Segment
WHEN
The system attempts to retrieve an EBSBCRT-AD segment
THEN
The system calls the data access routine to fetch the segment using current sequence number
Context: The system has attempted to retrieve an EBSBCRT-AD segment
GIVEN
The system has attempted to retrieve an EBSBCRT-AD segment
Applied to: EBSBCRT-AD Segment Found?
WHEN
The retrieval operation completes
THEN
If the segment is found, processing continues with description extraction, otherwise the sequence counter is incremented to try the next segment
Context: An EBSBCRT-AD segment has been successfully retrieved
GIVEN
An EBSBCRT-AD segment has been successfully retrieved
Applied to: Description Index <= 7?
WHEN
The system processes individual description lines within the segment
THEN
Processing continues for description indexes 1 through 7, then moves to the next segment
Context: The system is processing an individual description line from an EBSBCRT-AD segment
GIVEN
The system is processing an individual description line from an EBSBCRT-AD segment
Applied to: Additional Lading Description Not Empty?
WHEN
The additional lading description content is evaluated
THEN
If the description is not spaces, the content is moved to the description array, otherwise it is skipped
Context: An additional lading description contains valid non-empty content
GIVEN
An additional lading description contains valid non-empty content
Applied to: Move Additional Description to Description Array
WHEN
The description content is processed
THEN
The system moves the description content to the current position in the description array and increments the array index
R-GCCCCADD-cbl-00375 (+23) File: GCCCCADD.cbl Customs 2000 Detour Processing Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customs 2000 Detour Processing':
  • Context - a shipment is being processed with action code 'rt' (return) or 'us' (transit):
    For Set Broker Name to 'NOT-REQ':
    When the system processes the broker requirements, then the broker name should be set to 'not-req' and the secondary broker name should be cleared.
    For Set Broker Name to 'NOT-REQ':
    When the system processes the broker assignment logic, then the broker name should be set to 'not-req' and the secondary broker name should be cleared.
  • Context - a shipment is being processed with action code 'rt' or 'us':
    For Clear Broker Name 2:
    When the system processes broker information, then the secondary broker name field should be set to spaces.
  • Context - a shipment has action code 'rt' (return):
    For Set In-Transit Status to Return:
    When the system configures the transit status, then the in-transit status should be set to return.
    For Set Application Type to '33':
    When the system sets the customs application type, then the application type should be set to '33'.
    For Clear Destination Station Numbers:
    When the system processes destination information, then the destination station number for index, destination station number index, and error/release status index should be cleared.
    For Set In-Transit Status to Return:
    When the in-transit status is being determined, then the in-transit status should be set to return.
    For Set Application Type to '33':
    When the customs application type is being assigned, then the application type should be set to '33'.
    For Clear Destination Station Numbers:
    When the destination information is being processed, then the destination station number for index and destination station number index should be cleared.
    For Clear Error/Release Status Index:
    When the error/release status is being processed, then the error or release status index should be cleared.
  • Context - a shipment has action code 'rt' (return) and a manifest from station name:
    For Update Origin Station Name from Port:
    When the system searches the port city state table for matching port name, then the origin station name should be updated with the port city and origin station state code should be updated with the port state.
  • Context - a shipment has action code 'us' (transit):
    For Set In-Transit Status to Transit:
    When the system configures the transit status, then the in-transit status should be set to transit and application type should be set to '33'.
    For Set In-Transit Status to Transit:
    When the in-transit status is being determined, then the in-transit status should be set to transit.
    For Set Application Type to '33':
    When the customs application type is being assigned, then the application type should be set to '33'.
  • Context - a shipment has in-transit status of transit or return and csa indicator is on:
    For Turn Off CSA Indicator:
    When the system processes csa requirements, then the csa indicator should be turned off, importer name should be cleared, business number qualifier should be cleared, and business number should be cleared.
  • Context - a shipment has in-transit status of transit or return:
    For Clear Customer Bonded Indicator:
    When the system processes bonded warehouse information, then the customer bonded indicator should be cleared and sub-location code should be cleared.
    For Clear Customer Bonded Indicator:
    When the customer bonded status is being processed, then the customer bonded indicator should be cleared.
    For Clear Sub-location Code:
    When the sub-location code is being processed, then the sub-location code should be cleared.
  • Context - a shipment does not have in-transit status of transit or return and has a sub-location error:
    For Continue Processing:
    When the system validates sub-location requirements, then an error message for invalid destination station sub-location code should be generated.
  • Context - a shipment with action code 'rt' or 'us' is being processed:
    For Clear Broker Name 2:
    When the broker information is being updated, then the secondary broker name field should be set to spaces.
  • Context - a shipment has action code 'rt' (return) and manifest from station name exists in the port city state table:
    For Update Origin Station Name from Port:
    When the origin station information is being updated, then the origin station name should be set to the corresponding port city from the lookup table.
    For Update Origin Station State from Port:
    When the origin station state information is being updated, then the origin station state code should be set to the corresponding port state from the lookup table.
  • Context - a shipment has in-transit status of transit or return and csa indicator is currently on:
    For Turn Off CSA Indicator:
    When the csa indicator is being processed, then the csa indicator should be turned off.
  • Context - a shipment has in-transit status of transit or return and csa indicator was on:
    For Clear Importer Data:
    When the importer information is being processed, then the importer name, business number qualifier, and business number should be cleared.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed with action code 'RT' (Return) or 'US' (Transit)
GIVEN
A shipment is being processed with action code 'RT' (Return) or 'US' (Transit)
Applied to: Set Broker Name to 'NOT-REQ'
WHEN
The system processes the broker requirements
THEN
The broker name should be set to 'NOT-REQ' and the secondary broker name should be cleared
Applied to: Set Broker Name to 'NOT-REQ'
WHEN
The system processes the broker assignment logic
THEN
The broker name should be set to 'NOT-REQ' and the secondary broker name should be cleared
Context: A shipment is being processed with action code 'RT' or 'US'
GIVEN
A shipment is being processed with action code 'RT' or 'US'
Applied to: Clear Broker Name 2
WHEN
The system processes broker information
THEN
The secondary broker name field should be set to spaces
Context: A shipment has action code 'RT' (Return)
GIVEN
A shipment has action code 'RT' (Return)
Applied to: Set In-Transit Status to Return
WHEN
The system configures the transit status
THEN
The in-transit status should be set to RETURN
Applied to: Set Application Type to '33'
WHEN
The system sets the customs application type
THEN
The application type should be set to '33'
Applied to: Clear Destination Station Numbers
WHEN
The system processes destination information
THEN
The destination station number for index, destination station number index, and error/release status index should be cleared
Applied to: Set In-Transit Status to Return
WHEN
The in-transit status is being determined
THEN
The in-transit status should be set to RETURN
Applied to: Set Application Type to '33'
WHEN
The customs application type is being assigned
THEN
The application type should be set to '33'
Applied to: Clear Destination Station Numbers
WHEN
The destination information is being processed
THEN
The destination station number for index and destination station number index should be cleared
Applied to: Clear Error/Release Status Index
WHEN
The error/release status is being processed
THEN
The error or release status index should be cleared
Context: A shipment has action code 'RT' (Return) and a manifest from station name
GIVEN
A shipment has action code 'RT' (Return) and a manifest from station name
Applied to: Update Origin Station Name from Port
WHEN
The system searches the port city state table for matching port name
THEN
The origin station name should be updated with the port city and origin station state code should be updated with the port state
Context: A shipment has action code 'US' (Transit)
GIVEN
A shipment has action code 'US' (Transit)
Applied to: Set In-Transit Status to Transit
WHEN
The system configures the transit status
THEN
The in-transit status should be set to TRANSIT and application type should be set to '33'
Applied to: Set In-Transit Status to Transit
WHEN
The in-transit status is being determined
THEN
The in-transit status should be set to TRANSIT
Applied to: Set Application Type to '33'
WHEN
The customs application type is being assigned
THEN
The application type should be set to '33'
Context: A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is on
GIVEN
A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is on
Applied to: Turn Off CSA Indicator
WHEN
The system processes CSA requirements
THEN
The CSA indicator should be turned off, importer name should be cleared, business number qualifier should be cleared, and business number should be cleared
Context: A shipment has in-transit status of TRANSIT or RETURN
GIVEN
A shipment has in-transit status of TRANSIT or RETURN
Applied to: Clear Customer Bonded Indicator
WHEN
The system processes bonded warehouse information
THEN
The customer bonded indicator should be cleared and sub-location code should be cleared
Applied to: Clear Customer Bonded Indicator
WHEN
The customer bonded status is being processed
THEN
The customer bonded indicator should be cleared
Applied to: Clear Sub-location Code
WHEN
The sub-location code is being processed
THEN
The sub-location code should be cleared
Context: A shipment does not have in-transit status of TRANSIT or RETURN and has a sub-location error
GIVEN
A shipment does not have in-transit status of TRANSIT or RETURN and has a sub-location error
Applied to: Continue Processing
WHEN
The system validates sub-location requirements
THEN
An error message for invalid destination station sub-location code should be generated
Context: A shipment with action code 'RT' or 'US' is being processed
GIVEN
A shipment with action code 'RT' or 'US' is being processed
Applied to: Clear Broker Name 2
WHEN
The broker information is being updated
THEN
The secondary broker name field should be set to spaces
Context: A shipment has action code 'RT' (Return) and manifest from station name exists in the port city state table
GIVEN
A shipment has action code 'RT' (Return) and manifest from station name exists in the port city state table
Applied to: Update Origin Station Name from Port
WHEN
The origin station information is being updated
THEN
The origin station name should be set to the corresponding port city from the lookup table
Applied to: Update Origin Station State from Port
WHEN
The origin station state information is being updated
THEN
The origin station state code should be set to the corresponding port state from the lookup table
Context: A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is currently on
GIVEN
A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is currently on
Applied to: Turn Off CSA Indicator
WHEN
The CSA indicator is being processed
THEN
The CSA indicator should be turned off
Context: A shipment has in-transit status of TRANSIT or RETURN and CSA indicator was on
GIVEN
A shipment has in-transit status of TRANSIT or RETURN and CSA indicator was on
Applied to: Clear Importer Data
WHEN
The importer information is being processed
THEN
The importer name, business number qualifier, and business number should be cleared
R-GCX122A-cbl-00379 (+8) File: GCX122A.cbl Retrieve Train Report from Database Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Train Report from Database':
  • Context - a train error processing request with a reference number:
    For Is Test Train Reference?:
    When the reference number equals '6105etesttrain00000000000', then the system performs special test processing and sets test train indicator.
  • Context - a train error processing request that is not a test reference:
    For Set Train Error Flag:
    When the system begins train error processing, then the train error flag is set to true.
  • Context - a valid train reference number for processing:
    For Access GCSB4RT Database:
    When the system needs to retrieve train report data, then the system accesses gcsb4rt database with ge status and the reference number as key.
  • Context - a train report lookup that returns no results and the message is a v67 warning:
    For Set Train/Cargo Not Found Message for V67:
    When the free form message starts with 'v67', then the system adds message 'train/cargo not found on customs database for v67 warning' and sets dcp interface error flag.
  • Context - a train report lookup that returns no results and the message is not a v67 warning:
    For Set Train Report Not Found Message:
    When the free form message does not start with 'v67', then the system adds message 'train report not found on customs database' and sets dcp interface error flag.
  • Context - a train report database lookup request:
    For Set Train Report Found Flag:
    When the database returns a valid train report record, then the system sets the train report found flag to true.
  • Context - a train report is found in the database and the message is a v67 warning:
    For Set Train Report Found Flag:
    When the free form message starts with 'v67', then the system sets the train type indicator to true.
  • Context - a found train report with terminal information:
    For Use Last Modified Terminal:
    When the last modified terminal field is not empty, then the system uses the last modified terminal for processing.
    For Use Creation Terminal:
    When the last modified terminal field is empty, then the system uses the creation terminal for processing.
👨‍💻 Technical ACs (Gherkin)
Context: A train error processing request with a reference number
GIVEN
A train error processing request with a reference number
Applied to: Is Test Train Reference?
WHEN
The reference number equals '6105ETESTTRAIN00000000000'
THEN
The system performs special test processing and sets test train indicator
Context: A train error processing request that is not a test reference
GIVEN
A train error processing request that is not a test reference
Applied to: Set Train Error Flag
WHEN
The system begins train error processing
THEN
The train error flag is set to true
Context: A valid train reference number for processing
GIVEN
A valid train reference number for processing
Applied to: Access GCSB4RT Database
WHEN
The system needs to retrieve train report data
THEN
The system accesses GCSB4RT database with GE status and the reference number as key
Context: A train report lookup that returns no results and the message is a V67 warning
GIVEN
A train report lookup that returns no results and the message is a V67 warning
Applied to: Set Train/Cargo Not Found Message for V67
WHEN
The free form message starts with 'V67'
THEN
The system adds message 'TRAIN/CARGO NOT FOUND ON CUSTOMS DATABASE FOR V67 WARNING' and sets DCP interface error flag
Context: A train report lookup that returns no results and the message is not a V67 warning
GIVEN
A train report lookup that returns no results and the message is not a V67 warning
Applied to: Set Train Report Not Found Message
WHEN
The free form message does not start with 'V67'
THEN
The system adds message 'TRAIN REPORT NOT FOUND ON CUSTOMS DATABASE' and sets DCP interface error flag
Context: A train report database lookup request
GIVEN
A train report database lookup request
Applied to: Set Train Report Found Flag
WHEN
The database returns a valid train report record
THEN
The system sets the train report found flag to true
Context: A train report is found in the database and the message is a V67 warning
GIVEN
A train report is found in the database and the message is a V67 warning
Applied to: Set Train Report Found Flag
WHEN
The free form message starts with 'V67'
THEN
The system sets the train type indicator to true
Context: A found train report with terminal information
GIVEN
A found train report with terminal information
Applied to: Use Last Modified Terminal
WHEN
The last modified terminal field is not empty
THEN
The system uses the last modified terminal for processing
Applied to: Use Creation Terminal
WHEN
The last modified terminal field is empty
THEN
The system uses the creation terminal for processing
R-GCCCBOL-cbl-00382 (+15) File: GCCCBOL.cbl Get MV Loaded Shipments VINs Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get MV Loaded Shipments VINs':
  • Context - the system is ready to process motor vehicle segments for vin extraction:
    For Initialize VIN Quantity to Zero:
    When vin processing begins, then the vin quantity counter is set to zero.
  • Context - the system needs to process motor vehicle segments:
    For Set Segment Type to MV Motor Vehicle:
    When segment type configuration is required, then the segment type is set to mv for motor vehicle processing.
  • Context - the system is processing motor vehicle segments from ebsbccx data source:
    For EBSBCCX MV Segment Found?:
    When a segment retrieval is attempted, then the system determines if the motor vehicle segment was found or not found.
  • Context - a motor vehicle segment is found in ebsbccx data source:
    For Extract Vehicle ID Number from Segment:
    When vin extraction is performed, then the vehicle identification number is extracted from the segment.
  • Context - a vehicle identification number has been extracted from a motor vehicle segment:
    For Format VIN with VIN Prefix:
    When vin formatting is applied, then the vin is formatted with the vin prefix to create a complete vin string.
  • Context - a vin has been formatted with the proper prefix:
    For Store VIN in Description Array:
    When vin storage is performed, then the formatted vin is stored in the description array.
  • Context - a vin has been successfully processed and stored:
    For Increment VIN Counter:
    When vin counter update is performed, then the vin quantity counter is incremented by one.
  • Context - the system has processed a motor vehicle segment:
    For More Segments Available AND Counter < Maximum?:
    When continuation evaluation is performed, then processing continues if more segments are available and the vin counter is below the maximum limit, otherwise processing stops.
    For More Segments Available AND Counter < Maximum?:
    When the system evaluates whether to continue the loop, then the loop continues if more motor vehicle segments are available and the vin counter has not exceeded the maximum allowed vins.
  • Context - the system is ready to process motor vehicle segments for vin retrieval:
    For Initialize VIN Counter to Zero:
    When the vin retrieval process begins, then the vin counter is set to zero to start counting from the beginning.
  • Context - the system needs to search for motor vehicle segments:
    For Set Search Type to 'MV' Motor Vehicle:
    When the vin retrieval process is initiated, then the search type is set to 'mv' to filter for motor vehicle records.
  • Context - the system is searching for motor vehicle segments with type 'mv':
    For MV Segment Found?:
    When a segment retrieval is attempted, then the system determines if the motor vehicle segment was found or not found.
  • Context - a motor vehicle segment has been successfully found:
    For Increment VIN Counter:
    When the system processes the segment for vin extraction, then the vin counter is incremented by one.
  • Context - a valid motor vehicle segment has been found:
    For Extract Vehicle ID Number:
    When the system processes the segment data, then the vehicle id number is extracted from the segment's vehicle id field.
  • Context - a vehicle id number has been extracted from the motor vehicle segment:
    For Format VIN String with 'VIN' Prefix:
    When the system formats the vin for storage, then the string 'vin' is concatenated with the vehicle id number to create the formatted vin string.
  • Context - a vin string has been formatted with the 'vin' prefix and vehicle id:
    For Store VIN in Description Array:
    When the system stores the vin information, then the formatted vin string is placed in the description array at the index position matching the current vin counter.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process motor vehicle segments for VIN extraction
GIVEN
The system is ready to process motor vehicle segments for VIN extraction
Applied to: Initialize VIN Quantity to Zero
WHEN
VIN processing begins
THEN
The VIN quantity counter is set to zero
Context: The system needs to process motor vehicle segments
GIVEN
The system needs to process motor vehicle segments
Applied to: Set Segment Type to MV Motor Vehicle
WHEN
Segment type configuration is required
THEN
The segment type is set to MV for motor vehicle processing
Context: The system is processing motor vehicle segments from EBSBCCX data source
GIVEN
The system is processing motor vehicle segments from EBSBCCX data source
Applied to: EBSBCCX MV Segment Found?
WHEN
A segment retrieval is attempted
THEN
The system determines if the motor vehicle segment was found or not found
Context: A motor vehicle segment is found in EBSBCCX data source
GIVEN
A motor vehicle segment is found in EBSBCCX data source
Applied to: Extract Vehicle ID Number from Segment
WHEN
VIN extraction is performed
THEN
The vehicle identification number is extracted from the segment
Context: A vehicle identification number has been extracted from a motor vehicle segment
GIVEN
A vehicle identification number has been extracted from a motor vehicle segment
Applied to: Format VIN with VIN Prefix
WHEN
VIN formatting is applied
THEN
The VIN is formatted with the VIN prefix to create a complete VIN string
Context: A VIN has been formatted with the proper prefix
GIVEN
A VIN has been formatted with the proper prefix
Applied to: Store VIN in Description Array
WHEN
VIN storage is performed
THEN
The formatted VIN is stored in the description array
Context: A VIN has been successfully processed and stored
GIVEN
A VIN has been successfully processed and stored
Applied to: Increment VIN Counter
WHEN
VIN counter update is performed
THEN
The VIN quantity counter is incremented by one
Context: The system has processed a motor vehicle segment
GIVEN
The system has processed a motor vehicle segment
Applied to: More Segments Available AND Counter < Maximum?
WHEN
Continuation evaluation is performed
THEN
Processing continues if more segments are available AND the VIN counter is below the maximum limit, otherwise processing stops
Applied to: More Segments Available AND Counter < Maximum?
WHEN
The system evaluates whether to continue the loop
THEN
The loop continues if more motor vehicle segments are available AND the VIN counter has not exceeded the maximum allowed VINs
Context: The system is ready to process motor vehicle segments for VIN retrieval
GIVEN
The system is ready to process motor vehicle segments for VIN retrieval
Applied to: Initialize VIN Counter to Zero
WHEN
The VIN retrieval process begins
THEN
The VIN counter is set to zero to start counting from the beginning
Context: The system needs to search for motor vehicle segments
GIVEN
The system needs to search for motor vehicle segments
Applied to: Set Search Type to 'MV' Motor Vehicle
WHEN
The VIN retrieval process is initiated
THEN
The search type is set to 'MV' to filter for motor vehicle records
Context: The system is searching for motor vehicle segments with type 'MV'
GIVEN
The system is searching for motor vehicle segments with type 'MV'
Applied to: MV Segment Found?
WHEN
A segment retrieval is attempted
THEN
The system determines if the motor vehicle segment was found or not found
Context: A motor vehicle segment has been successfully found
GIVEN
A motor vehicle segment has been successfully found
Applied to: Increment VIN Counter
WHEN
The system processes the segment for VIN extraction
THEN
The VIN counter is incremented by one
Context: A valid motor vehicle segment has been found
GIVEN
A valid motor vehicle segment has been found
Applied to: Extract Vehicle ID Number
WHEN
The system processes the segment data
THEN
The vehicle ID number is extracted from the segment's vehicle ID field
Context: A vehicle ID number has been extracted from the motor vehicle segment
GIVEN
A vehicle ID number has been extracted from the motor vehicle segment
Applied to: Format VIN String with 'VIN' Prefix
WHEN
The system formats the VIN for storage
THEN
The string 'VIN' is concatenated with the vehicle ID number to create the formatted VIN string
Context: A VIN string has been formatted with the 'VIN' prefix and vehicle ID
GIVEN
A VIN string has been formatted with the 'VIN' prefix and vehicle ID
Applied to: Store VIN in Description Array
WHEN
The system stores the VIN information
THEN
The formatted VIN string is placed in the description array at the index position matching the current VIN counter
R-GCCS309C-cbl-00384 (+9) File: GCCS309C.cbl AU Table Access and Automotive Flag Setting Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'AU Table Access and Automotive Flag Setting':
  • Context - a manifest record with consignee chop and commodity code fields:
    For Consignee CHOP and Commodity Code exist?:
    When the system checks for automotive release eligibility, then if both consignee chop and commodity code are not empty, proceed to au table lookup, otherwise set non-automotive flag.
  • Context - valid consignee chop and commodity code exist:
    For Access AU Table with CHOP and Commodity Code:
    When the system accesses the au table with these values as keys, then retrieve the au table entry if it exists for further automotive determination.
  • Context - an au table lookup has been performed:
    For AU Table Entry Found?:
    When the system checks the lookup result, then if no matching entry is found, set non-automotive flag, otherwise proceed with automotive evaluation.
  • Context - either consignee chop/commodity code are missing or au table entry is not found:
    For Set Non-Automotive Flag:
    When the automotive determination process encounters missing data, then set the shipment classification to non-automotive.
  • Context - a valid au table entry exists for the shipment:
    For Evaluate Country and CSA Status:
    When the system evaluates automotive eligibility criteria, then check origin country and csa indicator status according to automotive business rules.
  • Context - a shipment with an origin country code:
    For Origin Country is US, CA, or blank?:
    When the system evaluates country-based automotive eligibility, then if origin country is 'us', 'ca', or blank, proceed to csa indicator check, otherwise check mexico-specific rules.
  • Context - a shipment with origin country 'mx' and an au table entry with au type field:
    For Origin Country is MX AND AU Type 2nd char is 'C'?:
    When the system evaluates mexico-specific automotive eligibility, then if origin country is 'mx' and the second character of au type is 'c', proceed to csa indicator check, otherwise keep non-automotive flag.
  • Context - a shipment that meets country-based automotive eligibility criteria:
    For CSA Indicator is OFF?:
    When the system checks the csa indicator status, then if csa indicator is off, set automotive flag, otherwise keep non-automotive flag.
  • Context - a shipment that meets all automotive eligibility criteria (valid au entry, appropriate country, csa indicator off):
    For Set Automotive Flag:
    When the system finalizes the automotive classification, then set the shipment classification to automotive.
  • Context - a shipment that does not meet all automotive eligibility criteria:
    For Keep Non-Automotive Flag:
    When the system completes the automotive determination process, then maintain the non-automotive classification flag.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with consignee CHOP and commodity code fields
GIVEN
A manifest record with consignee CHOP and commodity code fields
Applied to: Consignee CHOP and Commodity Code exist?
WHEN
The system checks for automotive release eligibility
THEN
If both consignee CHOP and commodity code are not empty, proceed to AU table lookup, otherwise set non-automotive flag
Context: Valid consignee CHOP and commodity code exist
GIVEN
Valid consignee CHOP and commodity code exist
Applied to: Access AU Table with CHOP and Commodity Code
WHEN
The system accesses the AU table with these values as keys
THEN
Retrieve the AU table entry if it exists for further automotive determination
Context: An AU table lookup has been performed
GIVEN
An AU table lookup has been performed
Applied to: AU Table Entry Found?
WHEN
The system checks the lookup result
THEN
If no matching entry is found, set non-automotive flag, otherwise proceed with automotive evaluation
Context: Either consignee CHOP/commodity code are missing or AU table entry is not found
GIVEN
Either consignee CHOP/commodity code are missing or AU table entry is not found
Applied to: Set Non-Automotive Flag
WHEN
The automotive determination process encounters missing data
THEN
Set the shipment classification to non-automotive
Context: A valid AU table entry exists for the shipment
GIVEN
A valid AU table entry exists for the shipment
Applied to: Evaluate Country and CSA Status
WHEN
The system evaluates automotive eligibility criteria
THEN
Check origin country and CSA indicator status according to automotive business rules
Context: A shipment with an origin country code
GIVEN
A shipment with an origin country code
Applied to: Origin Country is US, CA, or blank?
WHEN
The system evaluates country-based automotive eligibility
THEN
If origin country is 'US', 'CA', or blank, proceed to CSA indicator check, otherwise check Mexico-specific rules
Context: A shipment with origin country 'MX' and an AU table entry with AU type field
GIVEN
A shipment with origin country 'MX' and an AU table entry with AU type field
Applied to: Origin Country is MX AND AU Type 2nd char is 'C'?
WHEN
The system evaluates Mexico-specific automotive eligibility
THEN
If origin country is 'MX' and the second character of AU type is 'C', proceed to CSA indicator check, otherwise keep non-automotive flag
Context: A shipment that meets country-based automotive eligibility criteria
GIVEN
A shipment that meets country-based automotive eligibility criteria
Applied to: CSA Indicator is OFF?
WHEN
The system checks the CSA indicator status
THEN
If CSA indicator is OFF, set automotive flag, otherwise keep non-automotive flag
Context: A shipment that meets all automotive eligibility criteria (valid AU entry, appropriate country, CSA indicator OFF)
GIVEN
A shipment that meets all automotive eligibility criteria (valid AU entry, appropriate country, CSA indicator OFF)
Applied to: Set Automotive Flag
WHEN
The system finalizes the automotive classification
THEN
Set the shipment classification to automotive
Context: A shipment that does not meet all automotive eligibility criteria
GIVEN
A shipment that does not meet all automotive eligibility criteria
Applied to: Keep Non-Automotive Flag
WHEN
The system completes the automotive determination process
THEN
Maintain the non-automotive classification flag
R-GCCCCADD-cbl-00385 (+12) File: GCCCCADD.cblFile: GCCCCREL.cblFile: GCCS309C.cbl In Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'In':
  • Context - an origin station state code exists:
    For Determine Origin Country Code:
    When the system searches the state-country lookup table for the origin station state code, then the corresponding country code is assigned to the origin country field.
  • Context - a destination station state code exists:
    For Determine Destination Country Code:
    When the system searches the state-country lookup table for the destination station state code, then the corresponding country code is assigned to the destination country field.
  • Context - origin and destination country codes are determined:
    For Search Application Type Table:
    When the system searches the application type table using the country code combination, then if a matching combination is found, the application type and in-transit status are set from the table values, otherwise they are set to spaces.
  • Context - a shipment action code is provided:
    For Set Broker Name to 'NOT-REQ':
    When the action code equals 'rt' (return) or 'us' (transit), then the broker name is set to 'not-req' and broker name2 is cleared.
  • Context - a shipment with action code 'rt':
    For Set In-Transit Status to RETURN:
    When the system processes the return shipment, then the in-transit status is set to return, application type is set to '33', destination station numbers are cleared, and origin station information is updated from port lookup if found.
  • Context - a shipment with action code 'us':
    For Set In-Transit Status to TRANSIT:
    When the system processes the transit shipment, then the in-transit status is set to transit and application type is set to '33'.
  • Context - a shipment with csa indicator turned on and in-transit status of either transit or return:
    For Turn OFF CSA Indicator:
    When the system processes the shipment, then the csa indicator is turned off, importer data is cleared (importer name, business number qualifier, business number), and au importer flag is set to not found.
  • Context - a shipment with in-transit status of either transit or return:
    For Clear Customer Bonded Indicator:
    When the system processes the shipment, then the customer bonded indicator is cleared and sub-location code is cleared.
  • Context - a cargo release is being canceled and the cargo has an in-transit status:
    For Update Status to 'L' Local:
    When the current in-transit status is 'z' (in-transit-zulu) or 'e' (in-transit-echo), then the in-transit status must be updated to 'l' (local) to indicate the cargo is now considered local rather than in transit.
  • Context - a manifest has in-transit status of 'l' (local):
    For Access Export Destination Table EX:
    When the system processes the manifest for customs notification, then the system accesses the export destination table using table id 'ex' and the destination station number as the key.
  • Context - a manifest has in-transit status of 't' (transit):
    For In-Transit Status = 'T'?:
    When the system processes n9 reference segments, then the system creates an n9 segment with reference qualifier 'kd' and reference number 'in-transit'.
  • Context - a manifest has in-transit status 'l' and origin country is not 'ca' and export destination table lookup was successful:
    For Status = 'L' AND Origin Country ≠ 'CA' AND Table Found?:
    When the system processes n9 reference segments, then the system creates an n9 segment with reference qualifier 'kd' and reference number 'in-transit'.
  • Context - a manifest has in-transit status 'e' (export) and origin country is not 'ca':
    For Status = 'E' AND Origin Country ≠ 'CA'?:
    When the system processes n9 reference segments, then the system creates an n9 segment with reference qualifier 'kd' and reference number 'in-transit'.
👨‍💻 Technical ACs (Gherkin)
Context: An origin station state code exists
GIVEN
An origin station state code exists
Applied to: Determine Origin Country Code
WHEN
The system searches the state-country lookup table for the origin station state code
THEN
The corresponding country code is assigned to the origin country field
Context: A destination station state code exists
GIVEN
A destination station state code exists
Applied to: Determine Destination Country Code
WHEN
The system searches the state-country lookup table for the destination station state code
THEN
The corresponding country code is assigned to the destination country field
Context: Origin and destination country codes are determined
GIVEN
Origin and destination country codes are determined
Applied to: Search Application Type Table
WHEN
The system searches the application type table using the country code combination
THEN
If a matching combination is found, the application type and in-transit status are set from the table values, otherwise they are set to spaces
Context: A shipment action code is provided
GIVEN
A shipment action code is provided
Applied to: Set Broker Name to 'NOT-REQ'
WHEN
The action code equals 'RT' (Return) or 'US' (Transit)
THEN
The broker name is set to 'NOT-REQ' and broker name2 is cleared
Context: A shipment with action code 'RT'
GIVEN
A shipment with action code 'RT'
Applied to: Set In-Transit Status to RETURN
WHEN
The system processes the return shipment
THEN
The in-transit status is set to RETURN, application type is set to '33', destination station numbers are cleared, and origin station information is updated from port lookup if found
Context: A shipment with action code 'US'
GIVEN
A shipment with action code 'US'
Applied to: Set In-Transit Status to TRANSIT
WHEN
The system processes the transit shipment
THEN
The in-transit status is set to TRANSIT and application type is set to '33'
Context: A shipment with CSA indicator turned ON and in-transit status of either TRANSIT or RETURN
GIVEN
A shipment with CSA indicator turned ON and in-transit status of either TRANSIT or RETURN
Applied to: Turn OFF CSA Indicator
WHEN
The system processes the shipment
THEN
The CSA indicator is turned OFF, importer data is cleared (importer name, business number qualifier, business number), and AU importer flag is set to not found
Context: A shipment with in-transit status of either TRANSIT or RETURN
GIVEN
A shipment with in-transit status of either TRANSIT or RETURN
Applied to: Clear Customer Bonded Indicator
WHEN
The system processes the shipment
THEN
The customer bonded indicator is cleared and sub-location code is cleared
Context: A cargo release is being canceled and the cargo has an in-transit status
GIVEN
A cargo release is being canceled and the cargo has an in-transit status
Applied to: Update Status to 'L' Local
WHEN
The current in-transit status is 'Z' (In-Transit-Zulu) or 'E' (In-Transit-Echo)
THEN
The in-transit status must be updated to 'L' (Local) to indicate the cargo is now considered local rather than in transit
Context: A manifest has in-transit status of 'L' (Local)
GIVEN
A manifest has in-transit status of 'L' (Local)
Applied to: Access Export Destination Table EX
WHEN
The system processes the manifest for customs notification
THEN
The system accesses the export destination table using table ID 'EX' and the destination station number as the key
Context: A manifest has in-transit status of 'T' (Transit)
GIVEN
A manifest has in-transit status of 'T' (Transit)
Applied to: In-Transit Status = 'T'?
WHEN
The system processes N9 reference segments
THEN
The system creates an N9 segment with reference qualifier 'KD' and reference number 'IN-TRANSIT'
Context: A manifest has in-transit status 'L' and origin country is not 'CA' and export destination table lookup was successful
GIVEN
A manifest has in-transit status 'L' and origin country is not 'CA' and export destination table lookup was successful
Applied to: Status = 'L' AND Origin Country ≠ 'CA' AND Table Found?
WHEN
The system processes N9 reference segments
THEN
The system creates an N9 segment with reference qualifier 'KD' and reference number 'IN-TRANSIT'
Context: A manifest has in-transit status 'E' (Export) and origin country is not 'CA'
GIVEN
A manifest has in-transit status 'E' (Export) and origin country is not 'CA'
Applied to: Status = 'E' AND Origin Country ≠ 'CA'?
WHEN
The system processes N9 reference segments
THEN
The system creates an N9 segment with reference qualifier 'KD' and reference number 'IN-TRANSIT'
R-GCX122A-cbl-00388 (+14) File: GCX122A.cbl Retrieve Cargo Control Record Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Cargo Control Record':
  • Context - a cargo error message is being processed:
    For Check if Test Cargo Message:
    When the reference number starts with '6105ecprstestcargo' or '6105etestcargo', then the message is flagged as test cargo and routed to special test processing.
  • Context - a test cargo message has been identified:
    For Process Special Test Check:
    When special test processing is invoked, then the system updates test timestamps in the t2 table and exits cargo error processing.
  • Context - a non-test cargo error message is being processed:
    For Set Cargo Error Processing Flag:
    When the cargo error processing begins, then the cargo error flag is set to indicate cargo-specific error handling.
  • Context - a cargo reference number is provided:
    For Access GCSCCRT Segment with Reference Number:
    When the system searches for the cargo control record, then the gcsccrt segment is accessed using the reference number as the key.
    For Access GCSA2RT Segment with Reference Number:
    When the system needs complete cargo information, then the gcsa2rt segment is accessed using the same reference number.
  • Context - a cargo control record is not found in the database:
    For Check for V67 Warning Message:
    When the free-form message starts with 'v67', then the message is identified as a v67 warning requiring train error processing.
    For Set Error Flag for DCP Interface:
    When the error is processed, then the dcp interface error flag is set to indicate interface issues.
  • Context - a v67 warning message is detected for a missing cargo record:
    For Process as Train Error Instead:
    When the system processes the v67 warning, then the message is routed to train error processing instead of cargo error processing.
  • Context - a cargo control record is not found and it's not a v67 warning:
    For Record CCN Not Found Error:
    When the system processes the missing cargo record, then an error message 'ccn not found on customs database' is recorded for user notification.
  • Context - a cargo control record is successfully found:
    For Save Current Cargo Status:
    When the cargo record is accessed, then the current status is saved for later comparison and processing decisions.
  • Context - a cargo control record is successfully located:
    For Set Cargo Report Found Flag:
    When the record retrieval is completed, then the cargo report found flag is set to enable subsequent cargo processing.
  • Context - a cargo control record has been found:
    For Determine Last Modify Terminal:
    When the system determines message routing, then the last modify terminal field is checked for availability.
  • Context - a cargo record has a last modify terminal recorded:
    For Use Last Modify Terminal:
    When terminal selection for processing is required, then the last modify terminal is selected for message routing.
  • Context - a cargo record has no last modify terminal recorded:
    For Use Creation Terminal:
    When terminal selection for processing is required, then the creation terminal is selected as the fallback for message routing.
  • Context - a terminal has been selected for processing:
    For Store Terminal for Processing:
    When the terminal selection is completed, then the selected terminal is stored in the processing context for message routing.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo error message is being processed
GIVEN
A cargo error message is being processed
Applied to: Check if Test Cargo Message
WHEN
The reference number starts with '6105ECPRSTESTCARGO' or '6105ETESTCARGO'
THEN
The message is flagged as test cargo and routed to special test processing
Context: A test cargo message has been identified
GIVEN
A test cargo message has been identified
Applied to: Process Special Test Check
WHEN
Special test processing is invoked
THEN
The system updates test timestamps in the T2 table and exits cargo error processing
Context: A non-test cargo error message is being processed
GIVEN
A non-test cargo error message is being processed
Applied to: Set Cargo Error Processing Flag
WHEN
The cargo error processing begins
THEN
The cargo error flag is set to indicate cargo-specific error handling
Context: A cargo reference number is provided
GIVEN
A cargo reference number is provided
Applied to: Access GCSCCRT Segment with Reference Number
WHEN
The system searches for the cargo control record
THEN
The GCSCCRT segment is accessed using the reference number as the key
Applied to: Access GCSA2RT Segment with Reference Number
WHEN
The system needs complete cargo information
THEN
The GCSA2RT segment is accessed using the same reference number
Context: A cargo control record is not found in the database
GIVEN
A cargo control record is not found in the database
Applied to: Check for V67 Warning Message
WHEN
The free-form message starts with 'V67'
THEN
The message is identified as a V67 warning requiring train error processing
Applied to: Set Error Flag for DCP Interface
WHEN
The error is processed
THEN
The DCP interface error flag is set to indicate interface issues
Context: A V67 warning message is detected for a missing cargo record
GIVEN
A V67 warning message is detected for a missing cargo record
Applied to: Process as Train Error Instead
WHEN
The system processes the V67 warning
THEN
The message is routed to train error processing instead of cargo error processing
Context: A cargo control record is not found and it's not a V67 warning
GIVEN
A cargo control record is not found and it's not a V67 warning
Applied to: Record CCN Not Found Error
WHEN
The system processes the missing cargo record
THEN
An error message 'CCN NOT FOUND ON CUSTOMS DATABASE' is recorded for user notification
Context: A cargo control record is successfully found
GIVEN
A cargo control record is successfully found
Applied to: Save Current Cargo Status
WHEN
The cargo record is accessed
THEN
The current status is saved for later comparison and processing decisions
Context: A cargo control record is successfully located
GIVEN
A cargo control record is successfully located
Applied to: Set Cargo Report Found Flag
WHEN
The record retrieval is completed
THEN
The cargo report found flag is set to enable subsequent cargo processing
Context: A cargo control record has been found
GIVEN
A cargo control record has been found
Applied to: Determine Last Modify Terminal
WHEN
The system determines message routing
THEN
The last modify terminal field is checked for availability
Context: A cargo record has a last modify terminal recorded
GIVEN
A cargo record has a last modify terminal recorded
Applied to: Use Last Modify Terminal
WHEN
Terminal selection for processing is required
THEN
The last modify terminal is selected for message routing
Context: A cargo record has no last modify terminal recorded
GIVEN
A cargo record has no last modify terminal recorded
Applied to: Use Creation Terminal
WHEN
Terminal selection for processing is required
THEN
The creation terminal is selected as the fallback for message routing
Context: A terminal has been selected for processing
GIVEN
A terminal has been selected for processing
Applied to: Store Terminal for Processing
WHEN
The terminal selection is completed
THEN
The selected terminal is stored in the processing context for message routing
R-GCCCBOL-cbl-00390 (+24) File: GCCCBOL.cbl Get Co Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Co':
  • Context - the system needs to process vins for co-loaded shipments:
    For Initialize VIN Counter to Zero:
    When the vin processing begins, then the vin counter is set to zero and processing flags are initialized.
  • Context - a sequence number for rf segment retrieval is available:
    For Get RF Segment from EBSBCCX:
    When the system attempts to get an rf segment from ebsbccx, then the rf segment data is retrieved and availability status is determined.
  • Context - an rf segment has been successfully retrieved from ebsbccx:
    For Has Consolidated Shipment Number?:
    When the system evaluates the consolidated shipment number field, then processing continues to v2 segments if consolidated shipment number exists, otherwise skips to next rf segment.
  • Context - a consolidated shipment exists and v2 sequence number is available:
    For Get V2 Segment from EBSBCCY:
    When the system attempts to get a v2 segment from ebsbccy, then the v2 segment data is retrieved and availability status is determined.
  • Context - a v2 segment has been successfully retrieved from ebsbccy:
    For Vehicle ID Number Not Empty?:
    When the system evaluates the vehicle identification number field, then vin processing continues if the vehicle id is not empty or spaces, otherwise moves to next v2 segment.
  • Context - a valid vehicle identification number exists in the v2 segment:
    For Increment VIN Counter:
    When the system processes the vehicle id, then the vin counter is incremented by one.
  • Context - a vin counter has been incremented for a valid vehicle:
    For VIN Counter Within Limit?:
    When the system checks the vin counter against the maximum allowed limit, then vin formatting and storage proceeds if within limit, otherwise vin is discarded.
  • Context - a valid vehicle identification number is within storage capacity limits:
    For Format VIN with Prefix:
    When the system formats the vin for storage, then the vehicle id is prefixed with 'vin' text and formatted as a complete string.
  • Context - a vin has been formatted with proper prefix:
    For Store VIN in Description Array:
    When the system stores the vin data, then the formatted vin is placed in the description array at the current vin counter position.
  • Context - a v2 segment has been processed for vehicle data:
    For More V2 Segments?:
    When the system evaluates continuation of v2 processing, then processing continues with next v2 segment if more exist and limits not exceeded, otherwise moves to next rf segment.
  • Context - an rf segment and its associated v2 segments have been processed:
    For More RF Segments?:
    When the system evaluates continuation of rf processing, then processing continues with next rf segment if more exist and limits not exceeded, otherwise ends vin processing.
  • Context - the system needs to process vins from co-loaded shipments:
    For Initialize VIN quantity to zero:
    When vin processing begins for co-loaded shipments, then vin quantity counter is set to zero and processing flags are initialized.
  • Context - rf segments exist for processing and maximum n7 reference loop limit is defined:
    For Loop through RF segments Counter ≤ Max N7 Reference Loop?:
    When system processes rf segments for co-loaded shipments, then system continues looping while counter is less than or equal to maximum n7 reference loop limit.
  • Context - rf segment sequence number is available:
    For Get EBSBCCX RF segment:
    When system attempts to retrieve ebsbccx rf segment, then system calls database routine to get rf segment data using current sequence number.
  • Context - system has attempted to retrieve an rf segment:
    For RF segment found?:
    When database operation completes, then system checks if rf segment data was found and sets appropriate processing flag.
  • Context - rf segment data has been retrieved successfully:
    For Contains consolidated shipment number?:
    When system examines the rf segment content, then system identifies if the segment contains consolidated shipment number data.
  • Context - consolidated shipment number has been identified in rf segment:
    For Initialize V2 segment counter to 1:
    When system begins v2 segment processing, then v2 segment counter is set to 1 to start sequential processing.
  • Context - v2 segments exist for processing and maximum motor vehicles limit is defined:
    For Loop through V2 segments Counter ≤ Max Motor Vehicles?:
    When system processes v2 segments for vehicle data, then system continues looping while v2 counter is less than or equal to maximum motor vehicles limit.
  • Context - v2 segment sequence number is available:
    For Get EBSBCCY V2 segment:
    When system attempts to retrieve ebsbccy v2 segment, then system calls database routine to get v2 segment data using current sequence number.
  • Context - system has attempted to retrieve a v2 segment:
    For V2 segment found?:
    When database operation completes, then system checks if v2 segment data was found and continues processing accordingly.
  • Context - v2 segment has been successfully retrieved:
    For Vehicle ID number not empty?:
    When system examines the vehicle id number field, then system verifies the vehicle id number is not empty or spaces.
  • Context - valid vehicle id number has been identified in v2 segment:
    For Increment VIN quantity:
    When system processes the vehicle identification data, then vin quantity counter is incremented by 1.
  • Context - vin quantity counter has been incremented and maximum vin descriptions limit is defined:
    For VIN quantity ≤ Max VIN descriptions?:
    When system checks vin processing capacity, then system verifies current vin quantity is less than or equal to maximum vin descriptions allowed.
  • Context - valid vehicle id number is available and vin quantity is within limits:
    For Build VIN string: 'VIN' + Vehicle ID Number:
    When system formats the vin for storage, then system creates vin string by concatenating 'vin' text with the vehicle id number.
  • Context - vin string has been formatted and description array position is available:
    For Store VIN in description array:
    When system stores the vin data, then formatted vin string is stored in the description array at the current vin quantity position.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process VINs for co-loaded shipments
GIVEN
The system needs to process VINs for co-loaded shipments
Applied to: Initialize VIN Counter to Zero
WHEN
The VIN processing begins
THEN
The VIN counter is set to zero and processing flags are initialized
Context: A sequence number for RF segment retrieval is available
GIVEN
A sequence number for RF segment retrieval is available
Applied to: Get RF Segment from EBSBCCX
WHEN
The system attempts to get an RF segment from EBSBCCX
THEN
The RF segment data is retrieved and availability status is determined
Context: An RF segment has been successfully retrieved from EBSBCCX
GIVEN
An RF segment has been successfully retrieved from EBSBCCX
Applied to: Has Consolidated Shipment Number?
WHEN
The system evaluates the consolidated shipment number field
THEN
Processing continues to V2 segments if consolidated shipment number exists, otherwise skips to next RF segment
Context: A consolidated shipment exists and V2 sequence number is available
GIVEN
A consolidated shipment exists and V2 sequence number is available
Applied to: Get V2 Segment from EBSBCCY
WHEN
The system attempts to get a V2 segment from EBSBCCY
THEN
The V2 segment data is retrieved and availability status is determined
Context: A V2 segment has been successfully retrieved from EBSBCCY
GIVEN
A V2 segment has been successfully retrieved from EBSBCCY
Applied to: Vehicle ID Number Not Empty?
WHEN
The system evaluates the vehicle identification number field
THEN
VIN processing continues if the vehicle ID is not empty or spaces, otherwise moves to next V2 segment
Context: A valid vehicle identification number exists in the V2 segment
GIVEN
A valid vehicle identification number exists in the V2 segment
Applied to: Increment VIN Counter
WHEN
The system processes the vehicle ID
THEN
The VIN counter is incremented by one
Context: A VIN counter has been incremented for a valid vehicle
GIVEN
A VIN counter has been incremented for a valid vehicle
Applied to: VIN Counter Within Limit?
WHEN
The system checks the VIN counter against the maximum allowed limit
THEN
VIN formatting and storage proceeds if within limit, otherwise VIN is discarded
Context: A valid vehicle identification number is within storage capacity limits
GIVEN
A valid vehicle identification number is within storage capacity limits
Applied to: Format VIN with Prefix
WHEN
The system formats the VIN for storage
THEN
The vehicle ID is prefixed with 'VIN' text and formatted as a complete string
Context: A VIN has been formatted with proper prefix
GIVEN
A VIN has been formatted with proper prefix
Applied to: Store VIN in Description Array
WHEN
The system stores the VIN data
THEN
The formatted VIN is placed in the description array at the current VIN counter position
Context: A V2 segment has been processed for vehicle data
GIVEN
A V2 segment has been processed for vehicle data
Applied to: More V2 Segments?
WHEN
The system evaluates continuation of V2 processing
THEN
Processing continues with next V2 segment if more exist and limits not exceeded, otherwise moves to next RF segment
Context: An RF segment and its associated V2 segments have been processed
GIVEN
An RF segment and its associated V2 segments have been processed
Applied to: More RF Segments?
WHEN
The system evaluates continuation of RF processing
THEN
Processing continues with next RF segment if more exist and limits not exceeded, otherwise ends VIN processing
Context: The system needs to process VINs from co-loaded shipments
GIVEN
The system needs to process VINs from co-loaded shipments
Applied to: Initialize VIN quantity to zero
WHEN
VIN processing begins for co-loaded shipments
THEN
VIN quantity counter is set to zero and processing flags are initialized
Context: RF segments exist for processing and maximum N7 reference loop limit is defined
GIVEN
RF segments exist for processing and maximum N7 reference loop limit is defined
Applied to: Loop through RF segments Counter ≤ Max N7 Reference Loop?
WHEN
System processes RF segments for co-loaded shipments
THEN
System continues looping while counter is less than or equal to maximum N7 reference loop limit
Context: RF segment sequence number is available
GIVEN
RF segment sequence number is available
Applied to: Get EBSBCCX RF segment
WHEN
System attempts to retrieve EBSBCCX RF segment
THEN
System calls database routine to get RF segment data using current sequence number
Context: System has attempted to retrieve an RF segment
GIVEN
System has attempted to retrieve an RF segment
Applied to: RF segment found?
WHEN
Database operation completes
THEN
System checks if RF segment data was found and sets appropriate processing flag
Context: RF segment data has been retrieved successfully
GIVEN
RF segment data has been retrieved successfully
Applied to: Contains consolidated shipment number?
WHEN
System examines the RF segment content
THEN
System identifies if the segment contains consolidated shipment number data
Context: Consolidated shipment number has been identified in RF segment
GIVEN
Consolidated shipment number has been identified in RF segment
Applied to: Initialize V2 segment counter to 1
WHEN
System begins V2 segment processing
THEN
V2 segment counter is set to 1 to start sequential processing
Context: V2 segments exist for processing and maximum motor vehicles limit is defined
GIVEN
V2 segments exist for processing and maximum motor vehicles limit is defined
Applied to: Loop through V2 segments Counter ≤ Max Motor Vehicles?
WHEN
System processes V2 segments for vehicle data
THEN
System continues looping while V2 counter is less than or equal to maximum motor vehicles limit
Context: V2 segment sequence number is available
GIVEN
V2 segment sequence number is available
Applied to: Get EBSBCCY V2 segment
WHEN
System attempts to retrieve EBSBCCY V2 segment
THEN
System calls database routine to get V2 segment data using current sequence number
Context: System has attempted to retrieve a V2 segment
GIVEN
System has attempted to retrieve a V2 segment
Applied to: V2 segment found?
WHEN
Database operation completes
THEN
System checks if V2 segment data was found and continues processing accordingly
Context: V2 segment has been successfully retrieved
GIVEN
V2 segment has been successfully retrieved
Applied to: Vehicle ID number not empty?
WHEN
System examines the vehicle ID number field
THEN
System verifies the vehicle ID number is not empty or spaces
Context: Valid vehicle ID number has been identified in V2 segment
GIVEN
Valid vehicle ID number has been identified in V2 segment
Applied to: Increment VIN quantity
WHEN
System processes the vehicle identification data
THEN
VIN quantity counter is incremented by 1
Context: VIN quantity counter has been incremented and maximum VIN descriptions limit is defined
GIVEN
VIN quantity counter has been incremented and maximum VIN descriptions limit is defined
Applied to: VIN quantity ≤ Max VIN descriptions?
WHEN
System checks VIN processing capacity
THEN
System verifies current VIN quantity is less than or equal to maximum VIN descriptions allowed
Context: Valid vehicle ID number is available and VIN quantity is within limits
GIVEN
Valid vehicle ID number is available and VIN quantity is within limits
Applied to: Build VIN string: 'VIN' + Vehicle ID Number
WHEN
System formats the VIN for storage
THEN
System creates VIN string by concatenating 'VIN' text with the vehicle ID number
Context: VIN string has been formatted and description array position is available
GIVEN
VIN string has been formatted and description array position is available
Applied to: Store VIN in description array
WHEN
System stores the VIN data
THEN
Formatted VIN string is stored in the description array at the current VIN quantity position
R-GCCCCADD-cbl-00393 (+11) File: GCCCCADD.cbl Origin Country Determination Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Origin Country Determination':
  • Context - the origin country determination process is starting:
    For Initialize Origin Country to Spaces:
    When the system begins to determine the origin country, then the origin country field should be initialized to spaces (blank).
  • Context - the system needs to lookup authorized user information for origin country determination:
    For Setup AU Table Lookup Parameters:
    When setting up the au table lookup parameters, then the lookup should be configured with 'au' as table id, consignee chop code as the key chop, and commodity code as the key commodity.
  • Context - the au table lookup parameters are configured with consignee chop and commodity code:
    For Call AU Table Lookup:
    When the system executes the au table lookup, then the system should call the table lookup function to retrieve authorized user data.
  • Context - the au table lookup has been executed:
    For AU Table Record Found?:
    When the system checks the lookup results, then if the lookup is successful, the au table data should be loaded; otherwise, the au table data should be cleared.
  • Context - the au table processing has been completed:
    For Origin Country = 'MX'?:
    When the system checks if the origin country is set to 'mx' (mexico), then if the origin country is mexico, the determination process should exit and keep the mexico origin; otherwise, continue with state-country validation.
  • Context - the origin country is not mexico and state-country validation is needed:
    For Search State-Country Table:
    When the system searches the state-country table using the origin station state code, then if the origin state code is found in the table, the origin country should be set from the corresponding table entry; otherwise, the origin country should remain spaces.
    For Search State-Country Table:
    When the state-country table is searched using the origin station state code, then if a matching state code is found in the table, the corresponding country code should be assigned to the origin country field, otherwise the origin country should remain spaces.
  • Context - the system needs to determine origin country from au table:
    For Setup AU Table Lookup Parameters:
    When setting up the au table lookup parameters, then the table id should be set to 'au', consignee chop should be used as the chop key, and commodity code should be used as the commodity key.
  • Context - au table lookup parameters are configured with table id 'au', consignee chop, and commodity code:
    For Call Table Lookup Service:
    When the table lookup service is called, then the system should attempt to retrieve the corresponding au table record.
  • Context - the au table lookup service has been executed:
    For AU Table Record Found?:
    When the lookup result is evaluated, then if the lookup is successful, the au table data should be loaded into the working segment, otherwise the au table data should be cleared to spaces.
  • Context - the origin country determination process is running:
    For Origin Country = 'MX'?:
    When the current origin country value is evaluated, then if the origin country is 'mx' (mexico), the process should exit immediately and keep the mexico designation without further state-country validation.
👨‍💻 Technical ACs (Gherkin)
Context: The origin country determination process is starting
GIVEN
The origin country determination process is starting
Applied to: Initialize Origin Country to Spaces
WHEN
The system begins to determine the origin country
THEN
The origin country field should be initialized to spaces (blank)
Context: The system needs to lookup authorized user information for origin country determination
GIVEN
The system needs to lookup authorized user information for origin country determination
Applied to: Setup AU Table Lookup Parameters
WHEN
Setting up the AU table lookup parameters
THEN
The lookup should be configured with 'AU' as table ID, consignee CHOP code as the key CHOP, and commodity code as the key commodity
Context: The AU table lookup parameters are configured with consignee CHOP and commodity code
GIVEN
The AU table lookup parameters are configured with consignee CHOP and commodity code
Applied to: Call AU Table Lookup
WHEN
The system executes the AU table lookup
THEN
The system should call the table lookup function to retrieve authorized user data
Context: The AU table lookup has been executed
GIVEN
The AU table lookup has been executed
Applied to: AU Table Record Found?
WHEN
The system checks the lookup results
THEN
If the lookup is successful, the AU table data should be loaded; otherwise, the AU table data should be cleared
Context: The AU table processing has been completed
GIVEN
The AU table processing has been completed
Applied to: Origin Country = 'MX'?
WHEN
The system checks if the origin country is set to 'MX' (Mexico)
THEN
If the origin country is Mexico, the determination process should exit and keep the Mexico origin; otherwise, continue with state-country validation
Context: The origin country is not Mexico and state-country validation is needed
GIVEN
The origin country is not Mexico and state-country validation is needed
Applied to: Search State-Country Table
WHEN
The system searches the state-country table using the origin station state code
THEN
If the origin state code is found in the table, the origin country should be set from the corresponding table entry; otherwise, the origin country should remain spaces
Applied to: Search State-Country Table
WHEN
The state-country table is searched using the origin station state code
THEN
If a matching state code is found in the table, the corresponding country code should be assigned to the origin country field, otherwise the origin country should remain spaces
Context: The system needs to determine origin country from AU table
GIVEN
The system needs to determine origin country from AU table
Applied to: Setup AU Table Lookup Parameters
WHEN
Setting up the AU table lookup parameters
THEN
The table ID should be set to 'AU', consignee CHOP should be used as the CHOP key, and commodity code should be used as the commodity key
Context: AU table lookup parameters are configured with table ID 'AU', consignee CHOP, and commodity code
GIVEN
AU table lookup parameters are configured with table ID 'AU', consignee CHOP, and commodity code
Applied to: Call Table Lookup Service
WHEN
The table lookup service is called
THEN
The system should attempt to retrieve the corresponding AU table record
Context: The AU table lookup service has been executed
GIVEN
The AU table lookup service has been executed
Applied to: AU Table Record Found?
WHEN
The lookup result is evaluated
THEN
If the lookup is successful, the AU table data should be loaded into the working segment, otherwise the AU table data should be cleared to spaces
Context: The origin country determination process is running
GIVEN
The origin country determination process is running
Applied to: Origin Country = 'MX'?
WHEN
The current origin country value is evaluated
THEN
If the origin country is 'MX' (Mexico), the process should exit immediately and keep the Mexico designation without further state-country validation
R-GCCS309C-cbl-00394 (+4) File: GCCS309C.cbl Manifest Type Determination Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Type Determination':
  • Context - a manifest is being processed for type determination:
    For Arrival Indicator = 'Y' OR Program = 'GCX148'?:
    When the arrival indicator equals 'y' or the calling program name is 'gcx148', then the manifest type code should be set to 'a' indicating an arrival manifest.
  • Context - a manifest is being processed and arrival conditions are not met:
    For Canadian Customs North Train ID exists?:
    When the canadian customs north train id field contains data (not spaces), then the manifest type code should be set to 'c' indicating a customs manifest.
  • Context - a manifest is being processed, arrival conditions are not met, and canadian customs north train id is empty:
    For Program = 'GCX146' OR 'GCX147'?:
    When the calling program name is 'gcx146' or 'gcx147', then the manifest type code should be set to 'c' indicating a customs manifest.
  • Context - a manifest is being processed, arrival conditions are not met, canadian customs north train id is empty, and the program is not a customs-specific program:
    For Set Manifest Type = 'P' - Pre-manifest:
    When none of the arrival or customs conditions are satisfied, then the manifest type code should be set to 'p' indicating a pre-manifest.
  • Context - a manifest type has been determined through the standard logic flow:
    For Destination Type = 5040?:
    When the destination type is 309-destination-5040, then the manifest type code should be cleared and set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for type determination
GIVEN
A manifest is being processed for type determination
Applied to: Arrival Indicator = 'Y' OR Program = 'GCX148'?
WHEN
The arrival indicator equals 'Y' OR the calling program name is 'GCX148'
THEN
The manifest type code should be set to 'A' indicating an Arrival manifest
Context: A manifest is being processed and arrival conditions are not met
GIVEN
A manifest is being processed and arrival conditions are not met
Applied to: Canadian Customs North Train ID exists?
WHEN
The Canadian customs north train ID field contains data (not spaces)
THEN
The manifest type code should be set to 'C' indicating a Customs manifest
Context: A manifest is being processed, arrival conditions are not met, and Canadian customs north train ID is empty
GIVEN
A manifest is being processed, arrival conditions are not met, and Canadian customs north train ID is empty
Applied to: Program = 'GCX146' OR 'GCX147'?
WHEN
The calling program name is 'GCX146' OR 'GCX147'
THEN
The manifest type code should be set to 'C' indicating a Customs manifest
Context: A manifest is being processed, arrival conditions are not met, Canadian customs north train ID is empty, and the program is not a customs-specific program
GIVEN
A manifest is being processed, arrival conditions are not met, Canadian customs north train ID is empty, and the program is not a customs-specific program
Applied to: Set Manifest Type = 'P' - Pre-manifest
WHEN
None of the arrival or customs conditions are satisfied
THEN
The manifest type code should be set to 'P' indicating a Pre-manifest
Context: A manifest type has been determined through the standard logic flow
GIVEN
A manifest type has been determined through the standard logic flow
Applied to: Destination Type = 5040?
WHEN
The destination type is 309-DESTINATION-5040
THEN
The manifest type code should be cleared and set to spaces
R-GCCCCADD-cbl-00399 (+36) File: GCCCCADD.cbl Individual Commodity Quantity Processing Merged 37 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Individual Commodity Quantity Processing':
  • Context - a waybill processing request is initiated:
    For Check for Valid EDI BOL:
    When the system checks for valid edi bol data by verifying origin road number is not zero, then the system sets edi bol availability status and extracts bol key from shipment mining data if available.
    For Check for Valid EDI BOL:
    When the system checks for valid edi bol data by verifying origin road number is not zero and retrieving shipment mining segment e1, then the system sets edi bol availability status and extracts edi bol key if data is found.
  • Context - valid edi bol data is available for processing:
    For Initialize Weight and Quantity Counters:
    When the system begins commodity quantity processing, then weight counter and quantity counter are both initialized to zero and the system sets commodity weight counter and number of units counter to zero.
  • Context - edi bol key is available and commodity sequence number is set:
    For Retrieve EBSBCCM Segment:
    When the system attempts to retrieve commodity segment ebsbccm with type 'cm', then the system returns commodity segment data if found or sets not-found status if segment does not exist.
  • Context - a commodity segment is successfully retrieved from edi bol:
    For Add Lading Quantity to Total:
    When the segment contains lading quantity data, then the lading quantity is added to the total quantity counter.
  • Context - the current commodity segment is the first segment in the sequence:
    For Retrieve Weight from EBSBCCR Segment:
    When the system processes weight data for the commodity, then weight information is retrieved from ebsbccr segment with type 'cr' and dependent key 'cr001'.
    For Get EBSBCCR Weight Segment:
    When the system processes the first commodity segment, then the system attempts to retrieve the corresponding ebsbccr weight segment using edi bol key and commodity type cr with sequence cr001.
  • Context - weight segment ebsbccr is successfully retrieved:
    For Set Weight from N7-WEIGHT Field:
    When the segment contains n7-weight field data, then the weight counter is set to the n7-weight field value.
  • Context - weight segment ebsbccr cannot be retrieved from edi bol:
    For Set Weight to Zero:
    When the system processes the first commodity segment, then the weight counter is set to zero.
  • Context - weight value has been determined for the commodity:
    For Determine Weight Unit Based on Metric Indicator:
    When the shipment root metric indicator is 'm' or 'l', then weight unit is set to kilograms, otherwise weight unit is set to pounds.
  • Context - commodity segment contains lading quantity qualifier data:
    For Set Quantity Qualifier from Lading Data:
    When the system processes the first commodity segment, then the quantity qualifier is set to the lading quantity qualifier from the edi data.
  • Context - edi processing results in both weight and quantity being zero:
    For Use Fastway SHIPCOMM Data as Fallback:
    When the system needs commodity data for the shipment, then the system retrieves commodity data from fastway shipcomm segments as fallback.
  • Context - fastway data is being used as fallback for commodity information:
    For Retrieve First SHIPCOMM Segment:
    When the system retrieves the first shipcomm segment using 'gu' function, then the first commodity segment data is returned if available.
    For Get First SHIPCOMM Segment:
    When the system retrieves the first shipcomm segment, then the system calls fwcwbio with gu function to get the first shipcomm segment and sets found status based on result.
  • Context - fastway shipcomm segment is successfully retrieved:
    For Add Units from SHIPCOMM to Total:
    When the segment contains number of units data, then the number of units is added to the total quantity counter.
  • Context - commodity data is being retrieved from fastway shipcomm:
    For Set Quantity Qualifier to PCS:
    When quantity information is processed from fastway data, then the quantity qualifier is set to 'pcs' (pieces).
  • Context - fastway shipcomm segment contains weight data:
    For Add Weight Based on Metric Indicator:
    When the shipment root metric indicator is 'm' or 'l', then metric commodity weight is added to total weight, otherwise standard commodity weight is added.
  • Context - first fastway shipcomm segment has been processed:
    For Get Next SHIPCOMM Segment:
    When the system continues processing additional commodity segments using 'gn' function, then additional commodity segments are retrieved and processed until no more segments are found.
  • Context - commodity processing has completed and total quantity is calculated:
    For Use Calculated Quantity:
    When the total quantity is greater than zero, then the final lading quantity is set to the calculated total quantity.
  • Context - commodity processing has completed:
    For Set Default Quantity to 1:
    When the total calculated quantity is zero, then the final lading quantity is set to 1 as default value.
  • Context - weight processing has completed and total weight is calculated:
    For Use Calculated Weight:
    When the calculated weight is greater than zero, then the final weight is set to the calculated total weight.
  • Context - weight processing has completed:
    For Set Default Weight to 1:
    When the calculated total weight is zero, then the final weight is set to '00000001' as default value.
  • Context - commodity quantity processing is complete:
    For Set Default Qualifier to PCS:
    When the quantity qualifier is empty or not specified, then the quantity qualifier is set to 'pcs' (pieces) as default.
  • Context - edi bol data is available and commodity sequence counter is set:
    For Get EBSBCCM Commodity Segment:
    When the system attempts to retrieve ebsbccm commodity segment using edi bol key and sequence number, then the system returns commodity segment data if found or sets not found status if invalid edi bol or segment does not exist.
  • Context - a commodity segment is successfully retrieved from edi bol data:
    For Add Lading Quantity to Total:
    When the system processes the commodity segment, then the system adds the lading quantity from the segment to the total number of units counter.
  • Context - ebsbccr weight segment is successfully retrieved for the first commodity:
    For Extract Total Weight:
    When the system processes the weight segment, then the system extracts the n7 weight value and assigns it to the commodity weight counter.
  • Context - ebsbccr weight segment is not found for the first commodity:
    For Set Weight to Zero:
    When the system attempts to process weight information, then the system sets the commodity weight counter to zero.
  • Context - weight information has been processed for a commodity:
    For Determine Weight Unit from Metric Indicator:
    When the system determines the appropriate weight unit, then the system sets weight unit to kilograms if metric indicator is m or l, otherwise sets weight unit to pounds.
  • Context - a commodity segment is being processed from edi data:
    For Set Quantity Qualifier from Lading Data:
    When the system extracts quantity information, then the system assigns the lading quantity qualifier from the commodity segment to the customs quantity qualifier.
  • Context - edi commodity processing results in both weight and quantity being zero:
    For Use Fastway SHIPCOMM Data as Fallback:
    When the system needs commodity data for customs processing, then the system initiates fastway shipcomm data retrieval as fallback source.
  • Context - a shipcomm segment is successfully retrieved:
    For Add SHIPCOMM Quantities and Weights:
    When the system processes the shipcomm data, then the system adds number of units to quantity counter and adds appropriate weight (metric or standard) to weight counter based on metric indicator.
  • Context - shipcomm data is being used for commodity information:
    For Set Default Quantity Qualifier to PCS:
    When the system processes quantity information from shipcomm, then the system sets the quantity qualifier to pcs (pieces).
  • Context - the first shipcomm segment has been processed successfully:
    For Get Next SHIPCOMM Segments:
    When the system continues processing additional shipcomm segments, then the system calls fwcwbio with gn function to get next shipcomm segments until no more segments are found.
  • Context - all commodity data processing is complete:
    For Use Calculated Quantity:
    When the system validates the final calculated quantity, then the system uses the calculated quantity if greater than zero, otherwise sets quantity to 1 as default.
    For Use Calculated Weight:
    When the system validates the final calculated weight, then the system uses the calculated weight if greater than zero, otherwise sets weight to 00000001 as default.
  • Context - final quantity and weight processing is complete:
    For Ensure Quantity Qualifier is Set:
    When the system validates the quantity qualifier, then the system sets quantity qualifier to pcs if it is empty or spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing request is initiated
GIVEN
A waybill processing request is initiated
Applied to: Check for Valid EDI BOL
WHEN
The system checks for valid EDI BOL data by verifying origin road number is not zero
THEN
The system sets EDI BOL availability status and extracts BOL key from shipment mining data if available
Applied to: Check for Valid EDI BOL
WHEN
The system checks for valid EDI BOL data by verifying origin road number is not zero and retrieving shipment mining segment E1
THEN
The system sets EDI BOL availability status and extracts EDI BOL key if data is found
Context: Valid EDI BOL data is available for processing
GIVEN
Valid EDI BOL data is available for processing
Applied to: Initialize Weight and Quantity Counters
WHEN
The system begins commodity quantity processing
THEN
Weight counter and quantity counter are both initialized to zero AND The system sets commodity weight counter and number of units counter to zero
Context: EDI BOL key is available and commodity sequence number is set
GIVEN
EDI BOL key is available and commodity sequence number is set
Applied to: Retrieve EBSBCCM Segment
WHEN
The system attempts to retrieve commodity segment EBSBCCM with type 'CM'
THEN
The system returns commodity segment data if found or sets not-found status if segment does not exist
Context: A commodity segment is successfully retrieved from EDI BOL
GIVEN
A commodity segment is successfully retrieved from EDI BOL
Applied to: Add Lading Quantity to Total
WHEN
The segment contains lading quantity data
THEN
The lading quantity is added to the total quantity counter
Context: The current commodity segment is the first segment in the sequence
GIVEN
The current commodity segment is the first segment in the sequence
Applied to: Retrieve Weight from EBSBCCR Segment
WHEN
The system processes weight data for the commodity
THEN
Weight information is retrieved from EBSBCCR segment with type 'CR' and dependent key 'CR001'
Applied to: Get EBSBCCR Weight Segment
WHEN
The system processes the first commodity segment
THEN
The system attempts to retrieve the corresponding EBSBCCR weight segment using EDI BOL key and commodity type CR with sequence CR001
Context: Weight segment EBSBCCR is successfully retrieved
GIVEN
Weight segment EBSBCCR is successfully retrieved
Applied to: Set Weight from N7-WEIGHT Field
WHEN
The segment contains N7-WEIGHT field data
THEN
The weight counter is set to the N7-WEIGHT field value
Context: Weight segment EBSBCCR cannot be retrieved from EDI BOL
GIVEN
Weight segment EBSBCCR cannot be retrieved from EDI BOL
Applied to: Set Weight to Zero
WHEN
The system processes the first commodity segment
THEN
The weight counter is set to zero
Context: Weight value has been determined for the commodity
GIVEN
Weight value has been determined for the commodity
Applied to: Determine Weight Unit Based on Metric Indicator
WHEN
The shipment root metric indicator is 'M' or 'L'
THEN
Weight unit is set to kilograms, otherwise weight unit is set to pounds
Context: Commodity segment contains lading quantity qualifier data
GIVEN
Commodity segment contains lading quantity qualifier data
Applied to: Set Quantity Qualifier from Lading Data
WHEN
The system processes the first commodity segment
THEN
The quantity qualifier is set to the lading quantity qualifier from the EDI data
Context: EDI processing results in both weight and quantity being zero
GIVEN
EDI processing results in both weight and quantity being zero
Applied to: Use Fastway SHIPCOMM Data as Fallback
WHEN
The system needs commodity data for the shipment
THEN
The system retrieves commodity data from Fastway SHIPCOMM segments as fallback
Context: Fastway data is being used as fallback for commodity information
GIVEN
Fastway data is being used as fallback for commodity information
Applied to: Retrieve First SHIPCOMM Segment
WHEN
The system retrieves the first SHIPCOMM segment using 'GU' function
THEN
The first commodity segment data is returned if available
Applied to: Get First SHIPCOMM Segment
WHEN
The system retrieves the first SHIPCOMM segment
THEN
The system calls FWCWBIO with GU function to get the first SHIPCOMM segment and sets found status based on result
Context: Fastway SHIPCOMM segment is successfully retrieved
GIVEN
Fastway SHIPCOMM segment is successfully retrieved
Applied to: Add Units from SHIPCOMM to Total
WHEN
The segment contains number of units data
THEN
The number of units is added to the total quantity counter
Context: Commodity data is being retrieved from Fastway SHIPCOMM
GIVEN
Commodity data is being retrieved from Fastway SHIPCOMM
Applied to: Set Quantity Qualifier to PCS
WHEN
Quantity information is processed from Fastway data
THEN
The quantity qualifier is set to 'PCS' (pieces)
Context: Fastway SHIPCOMM segment contains weight data
GIVEN
Fastway SHIPCOMM segment contains weight data
Applied to: Add Weight Based on Metric Indicator
WHEN
The shipment root metric indicator is 'M' or 'L'
THEN
Metric commodity weight is added to total weight, otherwise standard commodity weight is added
Context: First Fastway SHIPCOMM segment has been processed
GIVEN
First Fastway SHIPCOMM segment has been processed
Applied to: Get Next SHIPCOMM Segment
WHEN
The system continues processing additional commodity segments using 'GN' function
THEN
Additional commodity segments are retrieved and processed until no more segments are found
Context: Commodity processing has completed and total quantity is calculated
GIVEN
Commodity processing has completed and total quantity is calculated
Applied to: Use Calculated Quantity
WHEN
The total quantity is greater than zero
THEN
The final lading quantity is set to the calculated total quantity
Context: Commodity processing has completed
GIVEN
Commodity processing has completed
Applied to: Set Default Quantity to 1
WHEN
The total calculated quantity is zero
THEN
The final lading quantity is set to 1 as default value
Context: Weight processing has completed and total weight is calculated
GIVEN
Weight processing has completed and total weight is calculated
Applied to: Use Calculated Weight
WHEN
The calculated weight is greater than zero
THEN
The final weight is set to the calculated total weight
Context: Weight processing has completed
GIVEN
Weight processing has completed
Applied to: Set Default Weight to 1
WHEN
The calculated total weight is zero
THEN
The final weight is set to '00000001' as default value
Context: Commodity quantity processing is complete
GIVEN
Commodity quantity processing is complete
Applied to: Set Default Qualifier to PCS
WHEN
The quantity qualifier is empty or not specified
THEN
The quantity qualifier is set to 'PCS' (pieces) as default
Context: EDI BOL data is available and commodity sequence counter is set
GIVEN
EDI BOL data is available and commodity sequence counter is set
Applied to: Get EBSBCCM Commodity Segment
WHEN
The system attempts to retrieve EBSBCCM commodity segment using EDI BOL key and sequence number
THEN
The system returns commodity segment data if found or sets not found status if invalid EDI BOL or segment does not exist
Context: A commodity segment is successfully retrieved from EDI BOL data
GIVEN
A commodity segment is successfully retrieved from EDI BOL data
Applied to: Add Lading Quantity to Total
WHEN
The system processes the commodity segment
THEN
The system adds the lading quantity from the segment to the total number of units counter
Context: EBSBCCR weight segment is successfully retrieved for the first commodity
GIVEN
EBSBCCR weight segment is successfully retrieved for the first commodity
Applied to: Extract Total Weight
WHEN
The system processes the weight segment
THEN
The system extracts the N7 weight value and assigns it to the commodity weight counter
Context: EBSBCCR weight segment is not found for the first commodity
GIVEN
EBSBCCR weight segment is not found for the first commodity
Applied to: Set Weight to Zero
WHEN
The system attempts to process weight information
THEN
The system sets the commodity weight counter to zero
Context: Weight information has been processed for a commodity
GIVEN
Weight information has been processed for a commodity
Applied to: Determine Weight Unit from Metric Indicator
WHEN
The system determines the appropriate weight unit
THEN
The system sets weight unit to kilograms if metric indicator is M or L, otherwise sets weight unit to pounds
Context: A commodity segment is being processed from EDI data
GIVEN
A commodity segment is being processed from EDI data
Applied to: Set Quantity Qualifier from Lading Data
WHEN
The system extracts quantity information
THEN
The system assigns the lading quantity qualifier from the commodity segment to the customs quantity qualifier
Context: EDI commodity processing results in both weight and quantity being zero
GIVEN
EDI commodity processing results in both weight and quantity being zero
Applied to: Use Fastway SHIPCOMM Data as Fallback
WHEN
The system needs commodity data for customs processing
THEN
The system initiates Fastway SHIPCOMM data retrieval as fallback source
Context: A SHIPCOMM segment is successfully retrieved
GIVEN
A SHIPCOMM segment is successfully retrieved
Applied to: Add SHIPCOMM Quantities and Weights
WHEN
The system processes the SHIPCOMM data
THEN
The system adds number of units to quantity counter and adds appropriate weight (metric or standard) to weight counter based on metric indicator
Context: SHIPCOMM data is being used for commodity information
GIVEN
SHIPCOMM data is being used for commodity information
Applied to: Set Default Quantity Qualifier to PCS
WHEN
The system processes quantity information from SHIPCOMM
THEN
The system sets the quantity qualifier to PCS (pieces)
Context: The first SHIPCOMM segment has been processed successfully
GIVEN
The first SHIPCOMM segment has been processed successfully
Applied to: Get Next SHIPCOMM Segments
WHEN
The system continues processing additional SHIPCOMM segments
THEN
The system calls FWCWBIO with GN function to get next SHIPCOMM segments until no more segments are found
Context: All commodity data processing is complete
GIVEN
All commodity data processing is complete
Applied to: Use Calculated Quantity
WHEN
The system validates the final calculated quantity
THEN
The system uses the calculated quantity if greater than zero, otherwise sets quantity to 1 as default
Applied to: Use Calculated Weight
WHEN
The system validates the final calculated weight
THEN
The system uses the calculated weight if greater than zero, otherwise sets weight to 00000001 as default
Context: Final quantity and weight processing is complete
GIVEN
Final quantity and weight processing is complete
Applied to: Ensure Quantity Qualifier is Set
WHEN
The system validates the quantity qualifier
THEN
The system sets quantity qualifier to PCS if it is empty or spaces
R-GCCCBOL-cbl-00401 (+18) File: GCCCBOL.cbl Check BOL for CSA Merged 19 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check BOL for CSA':
  • Context - an edi bol key exists for the shipment:
    For Get N1 Importer Segment from BOL:
    When the system searches for n1 importer segment data, then the system retrieves the first n1 importer segment from the edi bol data source.
    For Get N1 Importer Segment from BOL:
    When the system searches for n1 importer segment data in the edi bol, then the system retrieves the importer segment if it exists or sets not found status.
  • Context - the system has attempted to retrieve n1 importer segment data:
    For N1 Segment Found?:
    When the retrieval operation completes, then the system checks if a valid n1 segment was found and continues csa processing only if found, otherwise skips csa validation.
  • Context - an n1 importer segment has been retrieved from edi bol:
    For Entity ID = 'IM' AND Name Not Empty?:
    When the system validates the segment data, then the system verifies that the entity id code equals 'im' and the name field is not empty, proceeding with qualifier validation only if both conditions are met.
  • Context - a valid n1 importer segment with entity id 'im' and non-empty name exists:
    For ID Code Qualifier = 'M5'?:
    When the system checks the id code qualifier, then if the qualifier equals 'm5', the system sets the csa indicator on and copies all importer data to the cargo report.
  • Context - a valid n1 importer segment exists with entity id 'im', non-empty name, and qualifier is not 'm5':
    For ID Code Qualifier = 'BN'?:
    When the system checks if the id code qualifier equals 'bn', then if the qualifier equals 'bn', the system copies importer data to cargo report without setting csa indicator.
  • Context - a valid n1 importer segment exists with entity id 'im', non-empty name, and qualifier is neither 'm5' nor 'bn':
    For ID Code Qualifier = 'AI'?:
    When the system checks if the id code qualifier equals 'ai', then if the qualifier equals 'ai', the system copies importer data to cargo report without setting csa indicator.
  • Context - a valid n1 importer segment with entity id 'im', non-empty name, and id code qualifier 'm5' exists:
    For Set CSA Indicator ON:
    When the system processes the m5 qualified importer, then the system sets the csa indicator to on status to enable canada-us trade processing.
  • Context - a valid n1 importer segment with m5 qualifier has been processed and csa indicator is set on:
    For Copy Importer Data to Cargo Report:
    When the system copies importer data, then the system copies the importer name to gccc-importer, id code qualifier to gccc-business-nbr-qual, and id code to gccc-business-nbr fields.
  • Context - a valid n1 importer segment with bn or ai qualifier exists:
    For Copy Importer Data Only:
    When the system processes the non-m5 qualified importer, then the system copies the importer name to gccc-importer, id code qualifier to gccc-business-nbr-qual, and id code to gccc-business-nbr fields without setting csa indicator.
  • Context - the system has attempted to retrieve n1 importer segment from edi bol:
    For N1 Importer Segment Found?:
    When the system evaluates the retrieval status, then processing continues if segment is found, otherwise csa processing is skipped.
  • Context - an n1 segment has been retrieved from the edi bol:
    For Check Entity ID Code = 'IM':
    When the system checks the entity id code in the n1 segment, then processing continues only if the entity id code equals 'im' indicating an importer.
  • Context - an n1 segment exists with entity id code 'im':
    For Entity ID = 'IM' AND Name Not Empty?:
    When the system validates the entity name and id code are not empty, then processing continues if both name and id code contain valid data, otherwise csa processing ends.
  • Context - a valid importer n1 segment with entity id 'im', valid name and id code:
    For ID Code Qualifier = 'M5'?:
    When the system checks if the id code qualifier equals 'm5', then csa indicator is set on if qualifier is m5, otherwise check for other qualifiers.
  • Context - an importer n1 segment with m5 qualifier has been validated:
    For Set CSA Indicator ON:
    When the system processes the m5 qualified importer, then the csa indicator is set to on to enable canada-us trade processing.
  • Context - a valid importer n1 segment with m5 qualifier:
    For Copy BOL N1 Importer Data:
    When the system copies importer data from the n1 segment, then importer name is copied to gccc-importer, id code qualifier to gccc-business-nbr-qual, and id code to gccc-business-nbr.
  • Context - a valid importer n1 segment without m5 qualifier:
    For ID Code Qualifier = 'BN'?:
    When the system checks if the id code qualifier equals 'bn', then importer data is copied if qualifier is bn, otherwise check for ai qualifier.
  • Context - a valid importer n1 segment without m5 or bn qualifier:
    For ID Code Qualifier = 'AI'?:
    When the system checks if the id code qualifier equals 'ai', then importer data is copied if qualifier is ai, otherwise csa processing ends.
  • Context - a valid importer n1 segment with bn or ai qualifier:
    For Copy BOL N1 Importer Data Only:
    When the system copies importer data from the n1 segment, then importer name, id code qualifier, and id code are copied to cargo fields but csa indicator remains off.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Get N1 Importer Segment from BOL
WHEN
The system searches for N1 importer segment data
THEN
The system retrieves the first N1 importer segment from the EDI BOL data source
Applied to: Get N1 Importer Segment from BOL
WHEN
The system searches for N1 importer segment data in the EDI BOL
THEN
The system retrieves the importer segment if it exists or sets not found status
Context: The system has attempted to retrieve N1 importer segment data
GIVEN
The system has attempted to retrieve N1 importer segment data
Applied to: N1 Segment Found?
WHEN
The retrieval operation completes
THEN
The system checks if a valid N1 segment was found and continues CSA processing only if found, otherwise skips CSA validation
Context: An N1 importer segment has been retrieved from EDI BOL
GIVEN
An N1 importer segment has been retrieved from EDI BOL
Applied to: Entity ID = 'IM' AND Name Not Empty?
WHEN
The system validates the segment data
THEN
The system verifies that the entity ID code equals 'IM' AND the name field is not empty, proceeding with qualifier validation only if both conditions are met
Context: A valid N1 importer segment with entity ID 'IM' and non-empty name exists
GIVEN
A valid N1 importer segment with entity ID 'IM' and non-empty name exists
Applied to: ID Code Qualifier = 'M5'?
WHEN
The system checks the ID code qualifier
THEN
If the qualifier equals 'M5', the system sets the CSA indicator ON and copies all importer data to the cargo report
Context: A valid N1 importer segment exists with entity ID 'IM', non-empty name, and qualifier is not 'M5'
GIVEN
A valid N1 importer segment exists with entity ID 'IM', non-empty name, and qualifier is not 'M5'
Applied to: ID Code Qualifier = 'BN'?
WHEN
The system checks if the ID code qualifier equals 'BN'
THEN
If the qualifier equals 'BN', the system copies importer data to cargo report without setting CSA indicator
Context: A valid N1 importer segment exists with entity ID 'IM', non-empty name, and qualifier is neither 'M5' nor 'BN'
GIVEN
A valid N1 importer segment exists with entity ID 'IM', non-empty name, and qualifier is neither 'M5' nor 'BN'
Applied to: ID Code Qualifier = 'AI'?
WHEN
The system checks if the ID code qualifier equals 'AI'
THEN
If the qualifier equals 'AI', the system copies importer data to cargo report without setting CSA indicator
Context: A valid N1 importer segment with entity ID 'IM', non-empty name, and ID code qualifier 'M5' exists
GIVEN
A valid N1 importer segment with entity ID 'IM', non-empty name, and ID code qualifier 'M5' exists
Applied to: Set CSA Indicator ON
WHEN
The system processes the M5 qualified importer
THEN
The system sets the CSA indicator to ON status to enable Canada-US trade processing
Context: A valid N1 importer segment with M5 qualifier has been processed and CSA indicator is set ON
GIVEN
A valid N1 importer segment with M5 qualifier has been processed and CSA indicator is set ON
Applied to: Copy Importer Data to Cargo Report
WHEN
The system copies importer data
THEN
The system copies the importer name to GCCC-IMPORTER, ID code qualifier to GCCC-BUSINESS-NBR-QUAL, and ID code to GCCC-BUSINESS-NBR fields
Context: A valid N1 importer segment with BN or AI qualifier exists
GIVEN
A valid N1 importer segment with BN or AI qualifier exists
Applied to: Copy Importer Data Only
WHEN
The system processes the non-M5 qualified importer
THEN
The system copies the importer name to GCCC-IMPORTER, ID code qualifier to GCCC-BUSINESS-NBR-QUAL, and ID code to GCCC-BUSINESS-NBR fields without setting CSA indicator
Context: The system has attempted to retrieve N1 importer segment from EDI BOL
GIVEN
The system has attempted to retrieve N1 importer segment from EDI BOL
Applied to: N1 Importer Segment Found?
WHEN
The system evaluates the retrieval status
THEN
Processing continues if segment is found, otherwise CSA processing is skipped
Context: An N1 segment has been retrieved from the EDI BOL
GIVEN
An N1 segment has been retrieved from the EDI BOL
Applied to: Check Entity ID Code = 'IM'
WHEN
The system checks the entity ID code in the N1 segment
THEN
Processing continues only if the entity ID code equals 'IM' indicating an importer
Context: An N1 segment exists with entity ID code 'IM'
GIVEN
An N1 segment exists with entity ID code 'IM'
Applied to: Entity ID = 'IM' AND Name Not Empty?
WHEN
The system validates the entity name and ID code are not empty
THEN
Processing continues if both name and ID code contain valid data, otherwise CSA processing ends
Context: A valid importer N1 segment with entity ID 'IM', valid name and ID code
GIVEN
A valid importer N1 segment with entity ID 'IM', valid name and ID code
Applied to: ID Code Qualifier = 'M5'?
WHEN
The system checks if the ID code qualifier equals 'M5'
THEN
CSA indicator is set ON if qualifier is M5, otherwise check for other qualifiers
Context: An importer N1 segment with M5 qualifier has been validated
GIVEN
An importer N1 segment with M5 qualifier has been validated
Applied to: Set CSA Indicator ON
WHEN
The system processes the M5 qualified importer
THEN
The CSA indicator is set to ON to enable Canada-US trade processing
Context: A valid importer N1 segment with M5 qualifier
GIVEN
A valid importer N1 segment with M5 qualifier
Applied to: Copy BOL N1 Importer Data
WHEN
The system copies importer data from the N1 segment
THEN
Importer name is copied to GCCC-IMPORTER, ID code qualifier to GCCC-BUSINESS-NBR-QUAL, and ID code to GCCC-BUSINESS-NBR
Context: A valid importer N1 segment without M5 qualifier
GIVEN
A valid importer N1 segment without M5 qualifier
Applied to: ID Code Qualifier = 'BN'?
WHEN
The system checks if the ID code qualifier equals 'BN'
THEN
Importer data is copied if qualifier is BN, otherwise check for AI qualifier
Context: A valid importer N1 segment without M5 or BN qualifier
GIVEN
A valid importer N1 segment without M5 or BN qualifier
Applied to: ID Code Qualifier = 'AI'?
WHEN
The system checks if the ID code qualifier equals 'AI'
THEN
Importer data is copied if qualifier is AI, otherwise CSA processing ends
Context: A valid importer N1 segment with BN or AI qualifier
GIVEN
A valid importer N1 segment with BN or AI qualifier
Applied to: Copy BOL N1 Importer Data Only
WHEN
The system copies importer data from the N1 segment
THEN
Importer name, ID code qualifier, and ID code are copied to cargo fields but CSA indicator remains OFF
R-GCCS309C-cbl-00403 (+19) File: GCCS309C.cbl Entity Record Processing Loop Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity Record Processing Loop':
  • Context - entity processing is about to begin:
    For Initialize Loop Counter WS-SUB-REC = 1:
    When the system starts processing entity records, then the loop counter ws-sub-rec is set to 1 to start from the first entity record.
  • Context - entity records are being processed in a loop:
    For Loop Counter <= Max Entities AND Entity Data Not Empty?:
    When the system checks if more entities need processing, then continue processing if ws-sub-rec is less than or equal to gcsccs99-s55-max-seq and the entity data at current position is not spaces or low-values.
  • Context - a valid entity record exists at the current loop position:
    For Get Next Entity Record from GCSCCS55:
    When the system retrieves entity data for processing, then move the entity data from ws-gcsccs55-data array at current ws-sub-rec position to gcsccs55 working structure.
  • Context - an entity record is being processed:
    For Destination Type Check:
    When the system needs to validate entity information, then check if 309-destination flag is set to determine validation path - 4040 validation for 309-destination or 5040 validation for other destinations.
  • Context - the destination type is 309-destination:
    For Set Entity Code for 4040 Validation:
    When entity validation is required, then move gccs-n101-entity-id-cde to ws-4040-n1-code for validation.
  • Context - entity code has been set for 4040 validation:
    For Valid 4040 Entity Code?:
    When the system validates the entity code, then check if ws-valid-4040-n1 condition is true to determine if entity code is valid for 4040 destination.
  • Context - the destination type is not 309-destination:
    For Set Entity Code for 5040 Validation:
    When entity validation is required, then move gccs-n101-entity-id-cde to ws-4040-n1-code for 5040 validation processing.
  • Context - entity is being processed for 5040 destination:
    For Perform Consignee-Importer Address Check:
    When address validation is required, then perform n20625-check-cn-importer procedure to validate consignee-importer specific address requirements.
  • Context - entity code has been prepared for 5040 validation:
    For Valid 5040 Entity Code?:
    When the system validates the entity code, then check if ws-valid-5040-n1 condition is true to determine if entity code is valid for 5040 destination.
  • Context - entity has valid 5040 entity code:
    For Complete Address Available?:
    When address completeness is evaluated, then check that city name and country code are not spaces, and for us/ca countries, postal code and state/province code are not spaces.
  • Context - address validation is being performed:
    For City Name Present?:
    When city name is checked, then verify that gccs-n401-city-name is not equal to spaces.
    For Country Code Present?:
    When country code is checked, then verify that gccs-n404-country-cde is not equal to spaces.
  • Context - address has valid city name and country code:
    For Postal Code Present for US/CA?:
    When postal code validation is performed, then if gccs-n404-country-cde equals 'us' or 'ca', then gccs-n403-postal-cde must not equal spaces.
  • Context - address has valid postal code for us/ca or is non-us/ca country:
    For State/Province Code Present for US/CA?:
    When state/province code validation is performed, then if gccs-n404-country-cde equals 'us' or 'ca', then gccs-n402-state-prov-cde must not equal spaces.
  • Context - entity record has passed all validation checks:
    For Process N1-N3-N4-PER Segments:
    When entity processing is executed, then perform n2063-each-n1-n3-n4-per procedure to create n1, n3, n4, and per edi segments for the entity.
  • Context - entity record fails validation checks:
    For Clear Entity Record - Invalid Address:
    When invalid entity data is detected, then initialize gcsccs55 to clear the invalid entity record data.
  • Context - current entity record processing is complete:
    For Increment Loop Counter:
    When moving to next entity record, then increment ws-sub-rec by 1 to advance to the next entity position.
  • Context - all manifest entities have been processed:
    For Add Railway Entity - Canadian Pacific:
    When standard railway entity needs to be added, then create n1 segment with entity id 'rr' and name 'canadian pacific railway'.
  • Context - railway n1 segment has been created:
    For Create Railway N3 Address Segment:
    When railway address information is added, then create n3 segment with address '7550 ogdendale rd s.e.'.
  • Context - railway n3 address segment has been created:
    For Create Railway N4 Location Segment:
    When railway location information is added, then create n4 segment with city 'calgary', country 'ca', postal code 't2c 4x9', and state/province 'ab' in position 02 for 309-destination or position 07 for other destinations.
👨‍💻 Technical ACs (Gherkin)
Context: Entity processing is about to begin
GIVEN
Entity processing is about to begin
Applied to: Initialize Loop Counter WS-SUB-REC = 1
WHEN
The system starts processing entity records
THEN
The loop counter WS-SUB-REC is set to 1 to start from the first entity record
Context: Entity records are being processed in a loop
GIVEN
Entity records are being processed in a loop
Applied to: Loop Counter <= Max Entities AND Entity Data Not Empty?
WHEN
The system checks if more entities need processing
THEN
Continue processing if WS-SUB-REC is less than or equal to GCSCCS99-S55-MAX-SEQ AND the entity data at current position is not SPACES or LOW-VALUES
Context: A valid entity record exists at the current loop position
GIVEN
A valid entity record exists at the current loop position
Applied to: Get Next Entity Record from GCSCCS55
WHEN
The system retrieves entity data for processing
THEN
Move the entity data from WS-GCSCCS55-DATA array at current WS-SUB-REC position to GCSCCS55 working structure
Context: An entity record is being processed
GIVEN
An entity record is being processed
Applied to: Destination Type Check
WHEN
The system needs to validate entity information
THEN
Check if 309-DESTINATION flag is set to determine validation path - 4040 validation for 309-DESTINATION or 5040 validation for other destinations
Context: The destination type is 309-DESTINATION
GIVEN
The destination type is 309-DESTINATION
Applied to: Set Entity Code for 4040 Validation
WHEN
Entity validation is required
THEN
Move GCCS-N101-ENTITY-ID-CDE to WS-4040-N1-CODE for validation
Context: Entity code has been set for 4040 validation
GIVEN
Entity code has been set for 4040 validation
Applied to: Valid 4040 Entity Code?
WHEN
The system validates the entity code
THEN
Check if WS-VALID-4040-N1 condition is true to determine if entity code is valid for 4040 destination
Context: The destination type is not 309-DESTINATION
GIVEN
The destination type is not 309-DESTINATION
Applied to: Set Entity Code for 5040 Validation
WHEN
Entity validation is required
THEN
Move GCCS-N101-ENTITY-ID-CDE to WS-4040-N1-CODE for 5040 validation processing
Context: Entity is being processed for 5040 destination
GIVEN
Entity is being processed for 5040 destination
Applied to: Perform Consignee-Importer Address Check
WHEN
Address validation is required
THEN
Perform N20625-CHECK-CN-IMPORTER procedure to validate consignee-importer specific address requirements
Context: Entity code has been prepared for 5040 validation
GIVEN
Entity code has been prepared for 5040 validation
Applied to: Valid 5040 Entity Code?
WHEN
The system validates the entity code
THEN
Check if WS-VALID-5040-N1 condition is true to determine if entity code is valid for 5040 destination
Context: Entity has valid 5040 entity code
GIVEN
Entity has valid 5040 entity code
Applied to: Complete Address Available?
WHEN
Address completeness is evaluated
THEN
Check that city name AND country code are not SPACES, AND for US/CA countries, postal code AND state/province code are not SPACES
Context: Address validation is being performed
GIVEN
Address validation is being performed
Applied to: City Name Present?
WHEN
City name is checked
THEN
Verify that GCCS-N401-CITY-NAME is not equal to SPACES
Applied to: Country Code Present?
WHEN
Country code is checked
THEN
Verify that GCCS-N404-COUNTRY-CDE is not equal to SPACES
Context: Address has valid city name and country code
GIVEN
Address has valid city name and country code
Applied to: Postal Code Present for US/CA?
WHEN
Postal code validation is performed
THEN
If GCCS-N404-COUNTRY-CDE equals 'US' OR 'CA', then GCCS-N403-POSTAL-CDE must not equal SPACES
Context: Address has valid postal code for US/CA or is non-US/CA country
GIVEN
Address has valid postal code for US/CA or is non-US/CA country
Applied to: State/Province Code Present for US/CA?
WHEN
State/province code validation is performed
THEN
If GCCS-N404-COUNTRY-CDE equals 'US' OR 'CA', then GCCS-N402-STATE-PROV-CDE must not equal SPACES
Context: Entity record has passed all validation checks
GIVEN
Entity record has passed all validation checks
Applied to: Process N1-N3-N4-PER Segments
WHEN
Entity processing is executed
THEN
Perform N2063-EACH-N1-N3-N4-PER procedure to create N1, N3, N4, and PER EDI segments for the entity
Context: Entity record fails validation checks
GIVEN
Entity record fails validation checks
Applied to: Clear Entity Record - Invalid Address
WHEN
Invalid entity data is detected
THEN
Initialize GCSCCS55 to clear the invalid entity record data
Context: Current entity record processing is complete
GIVEN
Current entity record processing is complete
Applied to: Increment Loop Counter
WHEN
Moving to next entity record
THEN
Increment WS-SUB-REC by 1 to advance to the next entity position
Context: All manifest entities have been processed
GIVEN
All manifest entities have been processed
Applied to: Add Railway Entity - Canadian Pacific
WHEN
Standard railway entity needs to be added
THEN
Create N1 segment with entity ID 'RR' and name 'CANADIAN PACIFIC RAILWAY'
Context: Railway N1 segment has been created
GIVEN
Railway N1 segment has been created
Applied to: Create Railway N3 Address Segment
WHEN
Railway address information is added
THEN
Create N3 segment with address '7550 OGDENDALE RD S.E.'
Context: Railway N3 address segment has been created
GIVEN
Railway N3 address segment has been created
Applied to: Create Railway N4 Location Segment
WHEN
Railway location information is added
THEN
Create N4 segment with city 'CALGARY', country 'CA', postal code 'T2C 4X9', and state/province 'AB' in position 02 for 309-DESTINATION or position 07 for other destinations
R-GCX122A-cbl-00403 (+8) File: GCX122A.cbl Call Message Table Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Message Table Lookup':
  • Context - a message processing request is initiated:
    For Message Number Available?:
    When the system checks for availability of a predefined message number in gcw122-msg-num, then if predefined message number exists and is not spaces, use it for key construction, otherwise extract first 3 characters from free-form message text.
  • Context - a predefined message number exists in gcw122-msg-num and is not spaces:
    For Build Key with Predefined Message Number:
    When the system builds the table lookup key, then concatenate 'b' prefix with the predefined message number to form the sequence id for table lookup.
  • Context - no predefined message number exists or gcw122-msg-num contains spaces:
    For Build Key with Error Code from Message:
    When the system builds the table lookup key, then extract first 3 characters from ted-02-free-form-msg and concatenate with 'b' prefix to form the sequence id for table lookup.
  • Context - a message table lookup operation is required:
    For Set Table ID to 'MS':
    When the system prepares table access parameters, then set table identifier to 'ms' to access the message text table.
  • Context - table lookup parameters are prepared with table id 'ms' and constructed sequence id:
    For Call Table Lookup Service:
    When the system needs to retrieve standardized message text, then call gcctbio service with gu function code to perform table segment retrieval.
  • Context - table lookup service has been invoked for message text retrieval:
    For Message Text Found?:
    When the system evaluates the lookup operation result, then if gcctbio-return-flag equals 0, message text was found successfully, otherwise message text was not found.
  • Context - message text was successfully retrieved from the message table (gcctbio-return-flag equals 0):
    For Set Message Found Flag:
    When the system processes the lookup result, then set sw-gcstbrt-ms-found flag to true, move retrieved table segment to gcstbrt-ms-segment, and store english text in ws-gcstbrt-ms-eng-text.
  • Context - message text was found and message found flag is set to true:
    For Store Retrieved Message Text:
    When the system stores the retrieved message text, then extract english text from gcstbrt-ms-eng-text and make it available for message processing operations.
  • Context - message text lookup operation failed (gcctbio-return-flag not equal to 0):
    For Set Message Not Found Flag:
    When the system processes the failed lookup result, then set sw-gcstbrt-ms-not-found flag to true to indicate message text was not available in the table.
👨‍💻 Technical ACs (Gherkin)
Context: A message processing request is initiated
GIVEN
A message processing request is initiated
Applied to: Message Number Available?
WHEN
The system checks for availability of a predefined message number in GCW122-MSG-NUM
THEN
If predefined message number exists and is not spaces, use it for key construction, otherwise extract first 3 characters from free-form message text
Context: A predefined message number exists in GCW122-MSG-NUM and is not spaces
GIVEN
A predefined message number exists in GCW122-MSG-NUM and is not spaces
Applied to: Build Key with Predefined Message Number
WHEN
The system builds the table lookup key
THEN
Concatenate 'B' prefix with the predefined message number to form the sequence ID for table lookup
Context: No predefined message number exists or GCW122-MSG-NUM contains spaces
GIVEN
No predefined message number exists or GCW122-MSG-NUM contains spaces
Applied to: Build Key with Error Code from Message
WHEN
The system builds the table lookup key
THEN
Extract first 3 characters from TED-02-FREE-FORM-MSG and concatenate with 'B' prefix to form the sequence ID for table lookup
Context: A message table lookup operation is required
GIVEN
A message table lookup operation is required
Applied to: Set Table ID to 'MS'
WHEN
The system prepares table access parameters
THEN
Set table identifier to 'MS' to access the message text table
Context: Table lookup parameters are prepared with table ID 'MS' and constructed sequence ID
GIVEN
Table lookup parameters are prepared with table ID 'MS' and constructed sequence ID
Applied to: Call Table Lookup Service
WHEN
The system needs to retrieve standardized message text
THEN
Call GCCTBIO service with GU function code to perform table segment retrieval
Context: Table lookup service has been invoked for message text retrieval
GIVEN
Table lookup service has been invoked for message text retrieval
Applied to: Message Text Found?
WHEN
The system evaluates the lookup operation result
THEN
If GCCTBIO-RETURN-FLAG equals 0, message text was found successfully, otherwise message text was not found
Context: Message text was successfully retrieved from the message table (GCCTBIO-RETURN-FLAG equals 0)
GIVEN
Message text was successfully retrieved from the message table (GCCTBIO-RETURN-FLAG equals 0)
Applied to: Set Message Found Flag
WHEN
The system processes the lookup result
THEN
Set SW-GCSTBRT-MS-FOUND flag to true, move retrieved table segment to GCSTBRT-MS-SEGMENT, and store English text in WS-GCSTBRT-MS-ENG-TEXT
Context: Message text was found and message found flag is set to true
GIVEN
Message text was found and message found flag is set to true
Applied to: Store Retrieved Message Text
WHEN
The system stores the retrieved message text
THEN
Extract English text from GCSTBRT-MS-ENG-TEXT and make it available for message processing operations
Context: Message text lookup operation failed (GCCTBIO-RETURN-FLAG not equal to 0)
GIVEN
Message text lookup operation failed (GCCTBIO-RETURN-FLAG not equal to 0)
Applied to: Set Message Not Found Flag
WHEN
The system processes the failed lookup result
THEN
Set SW-GCSTBRT-MS-NOT-FOUND flag to true to indicate message text was not available in the table
R-GCCCBOL-cbl-00410 (+17) File: GCCCBOL.cbl Check Fastway for CSA Merged 18 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Check Fastway for CSA':
  • Context - the system needs to search fastway data for csa importer information:
    For Initialize N101 Search Flag:
    When the csa fastway search process begins, then the n101 search flag is set to not found and data start index is set to 1.
  • Context - shipmine data contains multiple data lines with various segment types:
    For Search SHIPMINE for N1-01 IM Segment:
    When the system searches through data lines from the current start index to position 5, then the system identifies any data line that begins with ' n1-01 im' and sets the n101 found flag.
  • Context - the current shipmine segment has been searched and n1-01 im was not found:
    For Move to Next SHIPMINE Segment:
    When the system needs to continue searching in subsequent segments, then the shipmine segment number is incremented by 1, the next shipmine segment is retrieved, and the data start index is reset to 1.
  • Context - an n1-01 im segment has been found in the current data position:
    For Extract N1-02 Importer Name:
    When the system checks the next data line for n1-02 importer name information, then if the next data line contains ' n1-02', the importer name is extracted from positions 8-28 of that line and stored as the csa importer name.
  • Context - the importer name has been extracted from n1-02 segment:
    For Check Next Data Line for N1-03:
    When the system examines the next data line for n1-03 qualifier information, then if the data line contains ' n1-03 m5', ' n1-03 bn', or ' n1-03 ai', the corresponding qualifier (m5, bn, or ai) is stored as the business number qualifier.
  • Context - a valid business number qualifier has been found in the n1-03 segment:
    For Check Next Data Line for N1-04:
    When the system checks the next data line for n1-04 business number information, then if the data line contains ' n1-04', the business number is extracted from positions 8-17 of that line and stored as the business number.
  • Context - a business number has been successfully extracted from the n1-04 segment:
    For Set CSA Indicator ON:
    When the business number qualifier is 'm5', then the csa indicator is set to on to enable csa-specific processing.
  • Context - valid importer name and business number have been extracted from shipmine data:
    For Store Importer Name and Business Number:
    When the n1-04 business number segment has been processed, then the importer name is stored in the importer field and the business number is stored in the business number field for subsequent csa processing.
  • Context - the system is searching through shipmine segments for csa importer information:
    For More SHIPMINE Segments?:
    When the current data index exceeds position 5 in the current segment, then the system attempts to retrieve the next shipmine segment and continues processing if available, or terminates the search if no more segments exist.
  • Context - csa processing is required for fastway shipment data:
    For Initialize N101 Search Flag:
    When the system begins searching for csa importer information, then the n101 search flag is set to not found and data start index is initialized to 1.
  • Context - shipmine data is available for processing:
    For Search SHIPMINE for N101 Importer Segment:
    When searching for importer segments with data line containing ' n1-01 im', then the n101 found flag is set to true when the segment is located.
  • Context - the system is searching for csa importer data in shipmine:
    For Exit - No CSA Data:
    When shipmine data is not found or exhausted, then the csa search process exits without setting csa indicators.
  • Context - current shipmine segment data index is greater than 5:
    For Move to Next SHIPMINE Segment:
    When more data processing is required, then increment shipmine segment number and reset data index to 1 if next segment is found.
  • Context - a data line contains ' n1-02' segment identifier:
    For Extract Importer Name:
    When processing csa importer information, then extract characters 8-28 from the data line as the csa importer name.
  • Context - a data line contains ' n1-03' segment with qualifier m5, bn, or ai:
    For Set Business Number Qualifier M5/BN/AI:
    When processing business number qualifier information, then set the business number qualifier to m5, bn, or ai respectively based on the segment data.
  • Context - a data line contains ' n1-04' segment identifier:
    For Extract Business Number:
    When processing business number information, then extract characters 8-17 as business number and copy importer name to csa importer field.
  • Context - business number qualifier is set to m5:
    For Set CSA Indicator ON:
    When processing n1-04 business number segment, then set the csa indicator to on to enable csa processing.
  • Context - n1-04 segment is not found in the current data processing:
    For Clear Business Number Qualifier:
    When business number extraction fails, then clear the business number qualifier field to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to search Fastway data for CSA importer information
GIVEN
The system needs to search Fastway data for CSA importer information
Applied to: Initialize N101 Search Flag
WHEN
The CSA Fastway search process begins
THEN
The N101 search flag is set to not found and data start index is set to 1
Context: SHIPMINE data contains multiple data lines with various segment types
GIVEN
SHIPMINE data contains multiple data lines with various segment types
Applied to: Search SHIPMINE for N1-01 IM Segment
WHEN
The system searches through data lines from the current start index to position 5
THEN
The system identifies any data line that begins with ' N1-01 IM' and sets the N101 found flag
Context: The current SHIPMINE segment has been searched and N1-01 IM was not found
GIVEN
The current SHIPMINE segment has been searched and N1-01 IM was not found
Applied to: Move to Next SHIPMINE Segment
WHEN
The system needs to continue searching in subsequent segments
THEN
The shipmine segment number is incremented by 1, the next SHIPMINE segment is retrieved, and the data start index is reset to 1
Context: An N1-01 IM segment has been found in the current data position
GIVEN
An N1-01 IM segment has been found in the current data position
Applied to: Extract N1-02 Importer Name
WHEN
The system checks the next data line for N1-02 importer name information
THEN
If the next data line contains ' N1-02', the importer name is extracted from positions 8-28 of that line and stored as the CSA importer name
Context: The importer name has been extracted from N1-02 segment
GIVEN
The importer name has been extracted from N1-02 segment
Applied to: Check Next Data Line for N1-03
WHEN
The system examines the next data line for N1-03 qualifier information
THEN
If the data line contains ' N1-03 M5', ' N1-03 BN', or ' N1-03 AI', the corresponding qualifier (M5, BN, or AI) is stored as the business number qualifier
Context: A valid business number qualifier has been found in the N1-03 segment
GIVEN
A valid business number qualifier has been found in the N1-03 segment
Applied to: Check Next Data Line for N1-04
WHEN
The system checks the next data line for N1-04 business number information
THEN
If the data line contains ' N1-04', the business number is extracted from positions 8-17 of that line and stored as the business number
Context: A business number has been successfully extracted from the N1-04 segment
GIVEN
A business number has been successfully extracted from the N1-04 segment
Applied to: Set CSA Indicator ON
WHEN
The business number qualifier is 'M5'
THEN
The CSA indicator is set to ON to enable CSA-specific processing
Context: Valid importer name and business number have been extracted from SHIPMINE data
GIVEN
Valid importer name and business number have been extracted from SHIPMINE data
Applied to: Store Importer Name and Business Number
WHEN
The N1-04 business number segment has been processed
THEN
The importer name is stored in the importer field and the business number is stored in the business number field for subsequent CSA processing
Context: The system is searching through SHIPMINE segments for CSA importer information
GIVEN
The system is searching through SHIPMINE segments for CSA importer information
Applied to: More SHIPMINE Segments?
WHEN
The current data index exceeds position 5 in the current segment
THEN
The system attempts to retrieve the next SHIPMINE segment and continues processing if available, or terminates the search if no more segments exist
Context: CSA processing is required for Fastway shipment data
GIVEN
CSA processing is required for Fastway shipment data
Applied to: Initialize N101 Search Flag
WHEN
the system begins searching for CSA importer information
THEN
the N101 search flag is set to not found and data start index is initialized to 1
Context: SHIPMINE data is available for processing
GIVEN
SHIPMINE data is available for processing
Applied to: Search SHIPMINE for N101 Importer Segment
WHEN
searching for importer segments with data line containing ' N1-01 IM'
THEN
the N101 found flag is set to true when the segment is located
Context: the system is searching for CSA importer data in SHIPMINE
GIVEN
the system is searching for CSA importer data in SHIPMINE
Applied to: Exit - No CSA Data
WHEN
SHIPMINE data is not found or exhausted
THEN
the CSA search process exits without setting CSA indicators
Context: current SHIPMINE segment data index is greater than 5
GIVEN
current SHIPMINE segment data index is greater than 5
Applied to: Move to Next SHIPMINE Segment
WHEN
more data processing is required
THEN
increment SHIPMINE segment number and reset data index to 1 if next segment is found
Context: a data line contains ' N1-02' segment identifier
GIVEN
a data line contains ' N1-02' segment identifier
Applied to: Extract Importer Name
WHEN
processing CSA importer information
THEN
extract characters 8-28 from the data line as the CSA importer name
Context: a data line contains ' N1-03' segment with qualifier M5, BN, or AI
GIVEN
a data line contains ' N1-03' segment with qualifier M5, BN, or AI
Applied to: Set Business Number Qualifier M5/BN/AI
WHEN
processing business number qualifier information
THEN
set the business number qualifier to M5, BN, or AI respectively based on the segment data
Context: a data line contains ' N1-04' segment identifier
GIVEN
a data line contains ' N1-04' segment identifier
Applied to: Extract Business Number
WHEN
processing business number information
THEN
extract characters 8-17 as business number and copy importer name to CSA importer field
Context: business number qualifier is set to M5
GIVEN
business number qualifier is set to M5
Applied to: Set CSA Indicator ON
WHEN
processing N1-04 business number segment
THEN
set the CSA indicator to ON to enable CSA processing
Context: N1-04 segment is not found in the current data processing
GIVEN
N1-04 segment is not found in the current data processing
Applied to: Clear Business Number Qualifier
WHEN
business number extraction fails
THEN
clear the business number qualifier field to spaces
R-GCX122A-cbl-00412 (+7) File: GCX122A.cbl Update Train Record Status Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Train Record Status':
  • Context - a train error message is being processed:
    For Error Type = 'X' Info Only?:
    When the error type is 'x' indicating informational message only, then the system sets status to warning for warning items or info for other items and exits without database updates.
  • Context - a train error message requires status update:
    For Train Report Found in Database?:
    When the system checks for train record existence in the database, then processing continues only if the train record is found, otherwise the update process is skipped.
  • Context - a train record exists in the database:
    For Train Deleted or Delete Pending?:
    When the train record is marked as deleted or delete pending, then the system skips the status update process for this record.
  • Context - a train record requires error status update and is not deleted:
    For Set Resend Flag to 'Y':
    When the system processes the error update, then the resend flag is set to 'y', train key is copied to error train field, and position date is copied to error date field.
  • Context - a train record is being updated with an error message:
    For Error Type = 'R' Reject?:
    When the error type is 'r' indicating a rejection, then the system sets reject status flag, train status to reject, and current status to 'reject'.
    For Set ERROR Status:
    When the error type is not 'r', then the system sets error status flag, train status to error, and current status to 'error'.
  • Context - a train record status update is being performed:
    For Save Train Root Segment:
    When the system needs to update the database record, then the current train root segment is saved, the record is retrieved from database, the saved segment is restored, and the record is replaced in the database.
  • Context - a train record status has been successfully updated:
    For AEI Send Flag = 'Y'?:
    When the aei send flag is set to 'y' for the train record, then the system sends an aei status message containing train id and current status.
👨‍💻 Technical ACs (Gherkin)
Context: A train error message is being processed
GIVEN
A train error message is being processed
Applied to: Error Type = 'X' Info Only?
WHEN
The error type is 'X' indicating informational message only
THEN
The system sets status to WARNING for warning items or INFO for other items and exits without database updates
Context: A train error message requires status update
GIVEN
A train error message requires status update
Applied to: Train Report Found in Database?
WHEN
The system checks for train record existence in the database
THEN
Processing continues only if the train record is found, otherwise the update process is skipped
Context: A train record exists in the database
GIVEN
A train record exists in the database
Applied to: Train Deleted or Delete Pending?
WHEN
The train record is marked as deleted or delete pending
THEN
The system skips the status update process for this record
Context: A train record requires error status update and is not deleted
GIVEN
A train record requires error status update and is not deleted
Applied to: Set Resend Flag to 'Y'
WHEN
The system processes the error update
THEN
The resend flag is set to 'Y', train key is copied to error train field, and position date is copied to error date field
Context: A train record is being updated with an error message
GIVEN
A train record is being updated with an error message
Applied to: Error Type = 'R' Reject?
WHEN
The error type is 'R' indicating a rejection
THEN
The system sets reject status flag, train status to REJECT, and current status to 'REJECT'
Applied to: Set ERROR Status
WHEN
The error type is not 'R'
THEN
The system sets error status flag, train status to ERROR, and current status to 'ERROR'
Context: A train record status update is being performed
GIVEN
A train record status update is being performed
Applied to: Save Train Root Segment
WHEN
The system needs to update the database record
THEN
The current train root segment is saved, the record is retrieved from database, the saved segment is restored, and the record is replaced in the database
Context: A train record status has been successfully updated
GIVEN
A train record status has been successfully updated
Applied to: AEI Send Flag = 'Y'?
WHEN
The AEI send flag is set to 'Y' for the train record
THEN
The system sends an AEI status message containing train ID and current status
R-GCCCBOL-cbl-00419 (+6) File: GCCCBOL.cbl Parse Broker Name Using Standard Formats Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parse Broker Name Using Standard Formats':
  • Context - a broker name string is provided for parsing:
    For Check if starts with 'CUSTOMS BROKER ':
    When the string starts with 'customs broker ' (15 characters including space), then extract the broker name from position 16 to 43 (28 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with 'customs broker ':
    For Check if starts with 'CUSTOMS BROKER: ':
    When the string starts with 'customs broker: ' (16 characters including colon and space), then extract the broker name from position 17 to 43 (27 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with 'customs broker ' or 'customs broker: ':
    For Check if starts with 'BROKER ':
    When the string starts with 'broker ' (7 characters including space), then extract the broker name from position 8 to 43 (36 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with 'customs broker ', 'customs broker: ', or 'broker ':
    For Check if starts with 'BROKER: ':
    When the string starts with 'broker: ' (8 characters including colon and space), then extract the broker name from position 9 to 43 (35 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with 'customs broker ', 'customs broker: ', 'broker ', or 'broker: ':
    For Check if starts with 'CB ' or 'XQ ':
    When the string starts with 'cb ' or 'xq ' (3 characters including space), then extract the broker name from position 4 to 44 (41 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with 'customs broker ', 'customs broker: ', 'broker ', 'broker: ', 'cb ', or 'xq ':
    For Check if starts with 'CB: ' or 'XQ: ':
    When the string starts with 'cb: ' or 'xq: ' (4 characters including colon and space), then extract the broker name from position 5 to 44 (40 characters) and store it as the parsed broker name.
  • Context - a broker name string is provided for parsing and it does not start with any standard prefixes:
    For Use entire string as broker name:
    When the string does not start with 'customs broker ', 'customs broker: ', 'broker ', 'broker: ', 'cb ', 'xq ', 'cb: ', or 'xq: ', then use the entire string as the parsed broker name without any modification.
👨‍💻 Technical ACs (Gherkin)
Context: A broker name string is provided for parsing
GIVEN
A broker name string is provided for parsing
Applied to: Check if starts with 'CUSTOMS BROKER '
WHEN
The string starts with 'CUSTOMS BROKER ' (15 characters including space)
THEN
Extract the broker name from position 16 to 43 (28 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER '
GIVEN
A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER '
Applied to: Check if starts with 'CUSTOMS BROKER: '
WHEN
The string starts with 'CUSTOMS BROKER: ' (16 characters including colon and space)
THEN
Extract the broker name from position 17 to 43 (27 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ' or 'CUSTOMS BROKER: '
GIVEN
A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ' or 'CUSTOMS BROKER: '
Applied to: Check if starts with 'BROKER '
WHEN
The string starts with 'BROKER ' (7 characters including space)
THEN
Extract the broker name from position 8 to 43 (36 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', or 'BROKER '
GIVEN
A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', or 'BROKER '
Applied to: Check if starts with 'BROKER: '
WHEN
The string starts with 'BROKER: ' (8 characters including colon and space)
THEN
Extract the broker name from position 9 to 43 (35 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', or 'BROKER: '
GIVEN
A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', or 'BROKER: '
Applied to: Check if starts with 'CB ' or 'XQ '
WHEN
The string starts with 'CB ' or 'XQ ' (3 characters including space)
THEN
Extract the broker name from position 4 to 44 (41 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', or 'XQ '
GIVEN
A broker name string is provided for parsing and it does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', or 'XQ '
Applied to: Check if starts with 'CB: ' or 'XQ: '
WHEN
The string starts with 'CB: ' or 'XQ: ' (4 characters including colon and space)
THEN
Extract the broker name from position 5 to 44 (40 characters) and store it as the parsed broker name
Context: A broker name string is provided for parsing and it does not start with any standard prefixes
GIVEN
A broker name string is provided for parsing and it does not start with any standard prefixes
Applied to: Use entire string as broker name
WHEN
The string does not start with 'CUSTOMS BROKER ', 'CUSTOMS BROKER: ', 'BROKER ', 'BROKER: ', 'CB ', 'XQ ', 'CB: ', or 'XQ: '
THEN
Use the entire string as the parsed broker name without any modification
R-GCCCCADD-cbl-00419 (+25) File: GCCCCADD.cbl Total Weight Processing Merged 26 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Total Weight Processing':
  • Context - a waybill processing request with origin road number:
    For Check for Valid EDI BOL:
    When the system checks for valid edi bol data by looking up shipmin segment with type 'e' and sequence '1', then if edi bol data is found, extract the edi bol key for further processing, otherwise mark as invalid edi bol.
  • Context - valid edi bol data is available:
    For Initialize Weight Counters:
    When starting weight processing for commodity segments, then initialize commodity weight counter to zero and number of units counter to zero.
  • Context - edi bol key and commodity sequence number:
    For Get EBSBCCM Segment:
    When attempting to retrieve ebsbccm segment with type 'cm' for the current sequence, then if segment is found, mark as found for processing, otherwise mark as not found.
  • Context - a valid commodity segment with lading quantity:
    For Add Lading Quantity to Total:
    When processing the commodity segment for weight calculation, then add the l0-lading-qty value to the total number of units counter.
  • Context - the first commodity segment in the sequence:
    For Get EBSBCCR Weight Segment:
    When processing weight data for the commodity, then retrieve ebsbccr segment with type 'cr' and dependent key 'cr001' to get weight information.
  • Context - a valid ebsbccr weight segment:
    For Extract Total Weight from N7-WEIGHT:
    When processing weight data from the segment, then move the n7-weight value to the commodity weight counter.
  • Context - no valid ebsbccr weight segment found:
    For Set Weight to Zero:
    When processing weight data for the first commodity segment, then set the commodity weight counter to zero.
  • Context - weight data from commodity segment:
    For Check Metric Indicator:
    When setting weight unit for the shipment, then if metric indicator is 'm' or 'l', set weight unit to kg, otherwise set to lb.
  • Context - a valid commodity segment with quantity qualifier:
    For Set Quantity Qualifier from Segment:
    When processing the first commodity segment, then move the l0-lading-qty-qual to the lading quantity qualifier field.
  • Context - no valid edi bol data or zero weight and quantity from edi processing:
    For Use Fastway SHIPCOMM Data:
    When attempting to get weight and quantity information, then retrieve weight and quantity from shipcomm segments using 'gu' and 'gn' functions, set quantity qualifier to 'pcs', and use metric or standard weight based on metric indicator.
  • Context - calculated weight from edi or fastway data:
    For Validate Final Weight:
    When finalizing weight for customs manifest, then if weight is greater than zero, use the calculated weight, otherwise set default weight to '00000001'.
  • Context - calculated quantity from edi or fastway data:
    For Validate Quantity:
    When finalizing quantity for customs manifest, then if quantity is greater than zero, use the calculated quantity, otherwise set default quantity to 1.
  • Context - processed weight and quantity data:
    For Validate Quantity:
    When quantity qualifier field is empty or spaces, then set the lading quantity qualifier to 'pcs' as default.
  • Context - a waybill processing request is initiated:
    For Check for Valid EDI BOL:
    When the system checks for edi bol availability by verifying origin road number is not zero, then the system should set edi bol validity flag and extract bol key from shipment mining data if available.
  • Context - valid edi bol data is available for processing:
    For Initialize Weight Counters:
    When the system begins weight extraction process, then the system should initialize commodity weight counter and number of units counter to zero.
  • Context - edi bol key is available and sequence counter is set:
    For Get EBSBCCM Segment:
    When the system attempts to retrieve ebsbccm commodity segment using edi bol key and cm type with sequence number, then the system should return commodity segment data if found or set not-found flag if segment does not exist.
  • Context - a commodity segment is successfully retrieved from edi bol:
    For Add Lading Quantity to Total:
    When the system processes the commodity segment data, then the system should add the lading quantity from l0-lading-qty field to the total units counter.
  • Context - the first commodity segment is being processed:
    For Get EBSBCCR Weight Segment:
    When the system needs to extract weight information, then the system should retrieve ebsbccr weight segment using edi bol key with cr type and cr001 dependent key.
    For Set Quantity Qualifier from Segment:
    When the system extracts quantity information, then the system should assign the lading quantity qualifier from l0-lading-qty-qual field to the customs record.
  • Context - ebsbccr weight segment is successfully retrieved:
    For Extract Total Weight from N7-WEIGHT:
    When the system processes the weight segment data, then the system should extract the weight value from n7-weight field and assign it to commodity weight counter.
  • Context - ebsbccr weight segment retrieval fails:
    For Set Weight to Zero:
    When the system cannot find weight data for the commodity segment, then the system should set the commodity weight counter to zero.
  • Context - weight data has been extracted from the first commodity segment:
    For Determine Weight Unit from Metric Indicator:
    When the system checks the metric indicator from shipment root data, then the system should set weight unit to kg if metric indicator is m or l, otherwise set weight unit to lb.
  • Context - edi bol processing results in zero weight and zero quantity:
    For Use Fastway SHIPCOMM Data as Fallback:
    When the system needs weight and quantity data for customs processing, then the system should retrieve weight and quantity from fastway shipcomm segments and set quantity qualifier to pcs.
  • Context - weight processing is complete from either edi bol or fastway data:
    For Validate Final Weight Value:
    When the system validates the final calculated weight, then the system should use the calculated weight if greater than zero, otherwise set default weight to 1.
  • Context - final quantity calculation results in zero units:
    For Set Default Weight to 1:
    When the system validates quantity for customs processing, then the system should set quantity to 1 and assign the formatted value to lading quantity field.
  • Context - weight and quantity processing is complete:
    For Validate Final Weight Value:
    When the lading quantity qualifier field is empty, then the system should set the lading quantity qualifier to pcs as default value.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing request with origin road number
GIVEN
A waybill processing request with origin road number
Applied to: Check for Valid EDI BOL
WHEN
The system checks for valid EDI BOL data by looking up SHIPMIN segment with type 'E' and sequence '1'
THEN
If EDI BOL data is found, extract the EDI BOL key for further processing, otherwise mark as invalid EDI BOL
Context: Valid EDI BOL data is available
GIVEN
Valid EDI BOL data is available
Applied to: Initialize Weight Counters
WHEN
Starting weight processing for commodity segments
THEN
Initialize commodity weight counter to zero and number of units counter to zero
Context: EDI BOL key and commodity sequence number
GIVEN
EDI BOL key and commodity sequence number
Applied to: Get EBSBCCM Segment
WHEN
Attempting to retrieve EBSBCCM segment with type 'CM' for the current sequence
THEN
If segment is found, mark as found for processing, otherwise mark as not found
Context: A valid commodity segment with lading quantity
GIVEN
A valid commodity segment with lading quantity
Applied to: Add Lading Quantity to Total
WHEN
Processing the commodity segment for weight calculation
THEN
Add the L0-LADING-QTY value to the total number of units counter
Context: The first commodity segment in the sequence
GIVEN
The first commodity segment in the sequence
Applied to: Get EBSBCCR Weight Segment
WHEN
Processing weight data for the commodity
THEN
Retrieve EBSBCCR segment with type 'CR' and dependent key 'CR001' to get weight information
Context: A valid EBSBCCR weight segment
GIVEN
A valid EBSBCCR weight segment
Applied to: Extract Total Weight from N7-WEIGHT
WHEN
Processing weight data from the segment
THEN
Move the N7-WEIGHT value to the commodity weight counter
Context: No valid EBSBCCR weight segment found
GIVEN
No valid EBSBCCR weight segment found
Applied to: Set Weight to Zero
WHEN
Processing weight data for the first commodity segment
THEN
Set the commodity weight counter to zero
Context: Weight data from commodity segment
GIVEN
Weight data from commodity segment
Applied to: Check Metric Indicator
WHEN
Setting weight unit for the shipment
THEN
If metric indicator is 'M' or 'L', set weight unit to KG, otherwise set to LB
Context: A valid commodity segment with quantity qualifier
GIVEN
A valid commodity segment with quantity qualifier
Applied to: Set Quantity Qualifier from Segment
WHEN
Processing the first commodity segment
THEN
Move the L0-LADING-QTY-QUAL to the lading quantity qualifier field
Context: No valid EDI BOL data or zero weight and quantity from EDI processing
GIVEN
No valid EDI BOL data or zero weight and quantity from EDI processing
Applied to: Use Fastway SHIPCOMM Data
WHEN
Attempting to get weight and quantity information
THEN
Retrieve weight and quantity from SHIPCOMM segments using 'GU' and 'GN' functions, set quantity qualifier to 'PCS', and use metric or standard weight based on metric indicator
Context: Calculated weight from EDI or Fastway data
GIVEN
Calculated weight from EDI or Fastway data
Applied to: Validate Final Weight
WHEN
Finalizing weight for customs manifest
THEN
If weight is greater than zero, use the calculated weight, otherwise set default weight to '00000001'
Context: Calculated quantity from EDI or Fastway data
GIVEN
Calculated quantity from EDI or Fastway data
Applied to: Validate Quantity
WHEN
Finalizing quantity for customs manifest
THEN
If quantity is greater than zero, use the calculated quantity, otherwise set default quantity to 1
Context: Processed weight and quantity data
GIVEN
Processed weight and quantity data
Applied to: Validate Quantity
WHEN
Quantity qualifier field is empty or spaces
THEN
Set the lading quantity qualifier to 'PCS' as default
Context: A waybill processing request is initiated
GIVEN
A waybill processing request is initiated
Applied to: Check for Valid EDI BOL
WHEN
The system checks for EDI BOL availability by verifying origin road number is not zero
THEN
The system should set EDI BOL validity flag and extract BOL key from shipment mining data if available
Context: Valid EDI BOL data is available for processing
GIVEN
Valid EDI BOL data is available for processing
Applied to: Initialize Weight Counters
WHEN
The system begins weight extraction process
THEN
The system should initialize commodity weight counter and number of units counter to zero
Context: EDI BOL key is available and sequence counter is set
GIVEN
EDI BOL key is available and sequence counter is set
Applied to: Get EBSBCCM Segment
WHEN
The system attempts to retrieve EBSBCCM commodity segment using EDI BOL key and CM type with sequence number
THEN
The system should return commodity segment data if found or set not-found flag if segment does not exist
Context: A commodity segment is successfully retrieved from EDI BOL
GIVEN
A commodity segment is successfully retrieved from EDI BOL
Applied to: Add Lading Quantity to Total
WHEN
The system processes the commodity segment data
THEN
The system should add the lading quantity from L0-LADING-QTY field to the total units counter
Context: The first commodity segment is being processed
GIVEN
The first commodity segment is being processed
Applied to: Get EBSBCCR Weight Segment
WHEN
The system needs to extract weight information
THEN
The system should retrieve EBSBCCR weight segment using EDI BOL key with CR type and CR001 dependent key
Applied to: Set Quantity Qualifier from Segment
WHEN
The system extracts quantity information
THEN
The system should assign the lading quantity qualifier from L0-LADING-QTY-QUAL field to the customs record
Context: EBSBCCR weight segment is successfully retrieved
GIVEN
EBSBCCR weight segment is successfully retrieved
Applied to: Extract Total Weight from N7-WEIGHT
WHEN
The system processes the weight segment data
THEN
The system should extract the weight value from N7-WEIGHT field and assign it to commodity weight counter
Context: EBSBCCR weight segment retrieval fails
GIVEN
EBSBCCR weight segment retrieval fails
Applied to: Set Weight to Zero
WHEN
The system cannot find weight data for the commodity segment
THEN
The system should set the commodity weight counter to zero
Context: Weight data has been extracted from the first commodity segment
GIVEN
Weight data has been extracted from the first commodity segment
Applied to: Determine Weight Unit from Metric Indicator
WHEN
The system checks the metric indicator from shipment root data
THEN
The system should set weight unit to KG if metric indicator is M or L, otherwise set weight unit to LB
Context: EDI BOL processing results in zero weight and zero quantity
GIVEN
EDI BOL processing results in zero weight and zero quantity
Applied to: Use Fastway SHIPCOMM Data as Fallback
WHEN
The system needs weight and quantity data for customs processing
THEN
The system should retrieve weight and quantity from Fastway SHIPCOMM segments and set quantity qualifier to PCS
Context: Weight processing is complete from either EDI BOL or Fastway data
GIVEN
Weight processing is complete from either EDI BOL or Fastway data
Applied to: Validate Final Weight Value
WHEN
The system validates the final calculated weight
THEN
The system should use the calculated weight if greater than zero, otherwise set default weight to 1
Context: Final quantity calculation results in zero units
GIVEN
Final quantity calculation results in zero units
Applied to: Set Default Weight to 1
WHEN
The system validates quantity for customs processing
THEN
The system should set quantity to 1 and assign the formatted value to lading quantity field
Context: Weight and quantity processing is complete
GIVEN
Weight and quantity processing is complete
Applied to: Validate Final Weight Value
WHEN
The lading quantity qualifier field is empty
THEN
The system should set the lading quantity qualifier to PCS as default value
R-GCX122A-cbl-00420 (+4) File: GCX122A.cbl Update Cargo Record Status Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Cargo Record Status':
  • Context - a cargo error message is being processed with error type information available from the message table:
    For Is Error Type 'X' Info?:
    When the error type from the message table is 'x' (informational), then the system should set the current status to 'warning' for warning items or 'info' for other items and exit without updating the cargo database record.
  • Context - a cargo error message is being processed and the error type is not informational ('x'):
    For Set Error/Release Status Index to 'E':
    When the cargo report is found in the system, then the system should set the error or release status index to 'e' to indicate error processing mode.
  • Context - a cargo error message is being processed and the cargo report exists in the system:
    For Is Error Type 'R' Reject?:
    When the error type from the message table is 'r' (reject), then the system should set the error status to 'r', set the current status to 'reject', and update the cargo record in the database.
    For Set Current Status to ERROR:
    When the error type from the message table is not 'r' (not a reject) and not 'x' (not informational), then the system should set the error status to 'e', set the current status to 'error', and update the cargo record in the database.
  • Context - a cargo error message has been processed and the appropriate error status has been determined:
    For Update Cargo Record in GCSCCRT:
    When the cargo record status needs to be persisted, then the system should update the cargo record in the gcsccrt database with the new error status and current status.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo error message is being processed with error type information available from the message table
GIVEN
A cargo error message is being processed with error type information available from the message table
Applied to: Is Error Type 'X' Info?
WHEN
The error type from the message table is 'X' (informational)
THEN
The system should set the current status to 'WARNING' for warning items or 'INFO' for other items and exit without updating the cargo database record
Context: A cargo error message is being processed and the error type is not informational ('X')
GIVEN
A cargo error message is being processed and the error type is not informational ('X')
Applied to: Set Error/Release Status Index to 'E'
WHEN
The cargo report is found in the system
THEN
The system should set the error or release status index to 'E' to indicate error processing mode
Context: A cargo error message is being processed and the cargo report exists in the system
GIVEN
A cargo error message is being processed and the cargo report exists in the system
Applied to: Is Error Type 'R' Reject?
WHEN
The error type from the message table is 'R' (reject)
THEN
The system should set the error status to 'R', set the current status to 'REJECT', and update the cargo record in the database
Applied to: Set Current Status to ERROR
WHEN
The error type from the message table is not 'R' (not a reject) and not 'X' (not informational)
THEN
The system should set the error status to 'E', set the current status to 'ERROR', and update the cargo record in the database
Context: A cargo error message has been processed and the appropriate error status has been determined
GIVEN
A cargo error message has been processed and the appropriate error status has been determined
Applied to: Update Cargo Record in GCSCCRT
WHEN
The cargo record status needs to be persisted
THEN
The system should update the cargo record in the GCSCCRT database with the new error status and current status
R-GCCS309C-cbl-00423 (+8) File: GCCS309C.cbl Port Function Code Assignment Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Port Function Code Assignment':
  • Context - a manifest is being processed for port function code assignment:
    For Set Port Function Code 'O' for Origin:
    When the destination type is 309-destination, then the port function code should be set to 'o' for origin.
    For Set Port Function Code 'J' for Junction:
    When the destination type is not 309-destination, then the port function code should be set to 'j' for junction and the origin station state code should be added to province/state code field.
  • Context - the first r4 segment for origin port has been created:
    For Set Port Function Code '3' for Customs District:
    When processing the second r4 segment for customs district, then the port function code should be set to '3' and location qualifier should be set to 'cd'.
  • Context - processing the third r4 segment for destination port:
    For Use From-Station Trans Code:
    When the csa indicator is on, then the location identifier should use the manifest from-station transaction code.
    For Use To-Station Trans Code:
    When the csa indicator is off, then the location identifier should use the manifest to-station transaction code.
    For Add Terminal Name if Not 309-Destination:
    When the destination type is not 309-destination, then the sub-location code should be added to the terminal name field.
  • Context - the second r4 segment for customs district has been created:
    For Set Port Function Code '4' for Destination:
    When processing the third r4 segment for destination port, then the port function code should be set to '4' and location qualifier should be set to 'cd'.
  • Context - processing the fourth r4 segment for final destination:
    For Set Port Function Code 'E' for Export:
    When the destination type is 309-destination, then the port function code should be set to 'e' for export.
    For Set Port Function Code 'R' for Rail:
    When the destination type is not 309-destination, then the port function code should be set to 'r' for rail and the destination station state code should be added to province/state code field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed for port function code assignment
GIVEN
A manifest is being processed for port function code assignment
Applied to: Set Port Function Code 'O' for Origin
WHEN
The destination type is 309-destination
THEN
The port function code should be set to 'O' for origin
Applied to: Set Port Function Code 'J' for Junction
WHEN
The destination type is not 309-destination
THEN
The port function code should be set to 'J' for junction and the origin station state code should be added to province/state code field
Context: The first R4 segment for origin port has been created
GIVEN
The first R4 segment for origin port has been created
Applied to: Set Port Function Code '3' for Customs District
WHEN
Processing the second R4 segment for customs district
THEN
The port function code should be set to '3' and location qualifier should be set to 'CD'
Context: Processing the third R4 segment for destination port
GIVEN
Processing the third R4 segment for destination port
Applied to: Use From-Station Trans Code
WHEN
The CSA indicator is on
THEN
The location identifier should use the manifest from-station transaction code
Applied to: Use To-Station Trans Code
WHEN
The CSA indicator is off
THEN
The location identifier should use the manifest to-station transaction code
Applied to: Add Terminal Name if Not 309-Destination
WHEN
The destination type is not 309-destination
THEN
The sub-location code should be added to the terminal name field
Context: The second R4 segment for customs district has been created
GIVEN
The second R4 segment for customs district has been created
Applied to: Set Port Function Code '4' for Destination
WHEN
Processing the third R4 segment for destination port
THEN
The port function code should be set to '4' and location qualifier should be set to 'CD'
Context: Processing the fourth R4 segment for final destination
GIVEN
Processing the fourth R4 segment for final destination
Applied to: Set Port Function Code 'E' for Export
WHEN
The destination type is 309-destination
THEN
The port function code should be set to 'E' for export
Applied to: Set Port Function Code 'R' for Rail
WHEN
The destination type is not 309-destination
THEN
The port function code should be set to 'R' for rail and the destination station state code should be added to province/state code field
R-GCX122A-cbl-00425 (+6) File: GCX122A.cbl Get Port Code and Email Users Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Port Code and Email Users':
  • Context - a train report exists with port of release information:
    For Extract Port Code from Train Report:
    When the system needs to send aei notifications, then the port code from the train report's port of release field is extracted and used as the lookup key.
  • Context - the system needs to lookup email recipients for a port code:
    For Set Record Type to CUSEMAIL:
    When preparing the database query parameters, then the record type is set to 'cusemail' to indicate email user lookup.
  • Context - a port code and record type of cusemail are specified:
    For Call Database to Get Email Users:
    When the database lookup service is called, then the system attempts to retrieve email user information for the port code.
  • Context - a database lookup for email recipients has been performed:
    For Email Users Found?:
    When the system evaluates the lookup results, then if the return code indicates success, use retrieved recipients; otherwise use default recipient.
  • Context - the database lookup successfully returned email recipients:
    For Use Retrieved Email Recipients:
    When building the recipient list for aei notifications, then the system iterates through up to 10 returned email addresses and adds non-blank entries to the recipient list.
  • Context - the database lookup for email recipients failed or returned no results:
    For Use Default Merlin ID as Recipient:
    When building the recipient list for aei notifications, then the system uses the default merlin id as both the sender and the first recipient.
  • Context - email recipients have been determined (either from database or default):
    For Prepare Email User List for AEI Message:
    When preparing to send aei notification, then the system sets the default merlin id as sender, configures recipient list, clears copy and keyword fields, sets message width to 080, and initializes return status.
👨‍💻 Technical ACs (Gherkin)
Context: A train report exists with port of release information
GIVEN
A train report exists with port of release information
Applied to: Extract Port Code from Train Report
WHEN
The system needs to send AEI notifications
THEN
The port code from the train report's port of release field is extracted and used as the lookup key
Context: The system needs to lookup email recipients for a port code
GIVEN
The system needs to lookup email recipients for a port code
Applied to: Set Record Type to CUSEMAIL
WHEN
Preparing the database query parameters
THEN
The record type is set to 'CUSEMAIL' to indicate email user lookup
Context: A port code and record type of CUSEMAIL are specified
GIVEN
A port code and record type of CUSEMAIL are specified
Applied to: Call Database to Get Email Users
WHEN
The database lookup service is called
THEN
The system attempts to retrieve email user information for the port code
Context: A database lookup for email recipients has been performed
GIVEN
A database lookup for email recipients has been performed
Applied to: Email Users Found?
WHEN
The system evaluates the lookup results
THEN
If the return code indicates success, use retrieved recipients; otherwise use default recipient
Context: The database lookup successfully returned email recipients
GIVEN
The database lookup successfully returned email recipients
Applied to: Use Retrieved Email Recipients
WHEN
Building the recipient list for AEI notifications
THEN
The system iterates through up to 10 returned email addresses and adds non-blank entries to the recipient list
Context: The database lookup for email recipients failed or returned no results
GIVEN
The database lookup for email recipients failed or returned no results
Applied to: Use Default Merlin ID as Recipient
WHEN
Building the recipient list for AEI notifications
THEN
The system uses the default Merlin ID as both the sender and the first recipient
Context: Email recipients have been determined (either from database or default)
GIVEN
Email recipients have been determined (either from database or default)
Applied to: Prepare Email User List for AEI Message
WHEN
Preparing to send AEI notification
THEN
The system sets the default Merlin ID as sender, configures recipient list, clears copy and keyword fields, sets message width to 080, and initializes return status
R-GCCCBOL-cbl-00426 (+4) File: GCCCBOL.cbl Get Payment Method from EBSBCBC Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Payment Method from EBSBCBC':
  • Context - a shipment requires payment method information:
    For Call 8430-GET-EBSBCBC to retrieve BOL data:
    When the system calls the bol data retrieval service, then the ebsbcbc segment data is retrieved from the bol system.
  • Context - bol data retrieval has been attempted:
    For EBSBCBC segment found?:
    When the system checks if ebsbcbc segment was found, then processing continues only if the bol segment exists, otherwise payment method processing is skipped.
  • Context - ebsbcbc bol segment is available:
    For Payment method field not empty?:
    When the system checks the b2-shipment-meth-pay field, then payment method is processed only if the field is not empty or spaces.
  • Context - ebsbcbc segment exists and payment method field contains valid data:
    For Extract B2-SHIPMENT-METH-PAY from BOL:
    When the system processes the payment method extraction, then the b2-shipment-meth-pay value is extracted from the bol segment.
  • Context - payment method has been successfully extracted from bol data:
    For Store payment method in GCCC-BX03-SHIP-METH-PAY:
    When the system stores the payment method, then the extracted value is moved to gccc-bx03-ship-meth-pay field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires payment method information
GIVEN
A shipment requires payment method information
Applied to: Call 8430-GET-EBSBCBC to retrieve BOL data
WHEN
The system calls the BOL data retrieval service
THEN
The EBSBCBC segment data is retrieved from the BOL system
Context: BOL data retrieval has been attempted
GIVEN
BOL data retrieval has been attempted
Applied to: EBSBCBC segment found?
WHEN
The system checks if EBSBCBC segment was found
THEN
Processing continues only if the BOL segment exists, otherwise payment method processing is skipped
Context: EBSBCBC BOL segment is available
GIVEN
EBSBCBC BOL segment is available
Applied to: Payment method field not empty?
WHEN
The system checks the B2-SHIPMENT-METH-PAY field
THEN
Payment method is processed only if the field is not empty or spaces
Context: EBSBCBC segment exists and payment method field contains valid data
GIVEN
EBSBCBC segment exists and payment method field contains valid data
Applied to: Extract B2-SHIPMENT-METH-PAY from BOL
WHEN
The system processes the payment method extraction
THEN
The B2-SHIPMENT-METH-PAY value is extracted from the BOL segment
Context: Payment method has been successfully extracted from BOL data
GIVEN
Payment method has been successfully extracted from BOL data
Applied to: Store payment method in GCCC-BX03-SHIP-METH-PAY
WHEN
The system stores the payment method
THEN
The extracted value is moved to GCCC-BX03-SHIP-METH-PAY field
R-GCCCBOL-cbl-00431 (+2) File: GCCCBOL.cbl Initialize EBSBCCY Search Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize EBSBCCY Search':
  • Context - a cargo reference data search is being initiated for ebsbccy segments:
    For Set EBSBCCY Indicator to Spaces:
    When the system prepares to search for cargo reference information, then the ebsbccy indicator should be set to spaces and the ebsbccy segment data should be cleared.
  • Context - the system is preparing to search for cargo reference data in ebsbccy segments:
    For Set Type-3 to 'CR':
    When the search parameters are being configured, then the type-3 parameter should be set to 'cr' to identify cargo reference segment types.
  • Context - the system is preparing to process multiple cargo reference segments sequentially:
    For Initialize Sequence Counter to 0:
    When the sequence management is being initialized, then the sequence counter (ws-seq) should be set to 0 to start from the beginning.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo reference data search is being initiated for EBSBCCY segments
GIVEN
A cargo reference data search is being initiated for EBSBCCY segments
Applied to: Set EBSBCCY Indicator to Spaces
WHEN
The system prepares to search for cargo reference information
THEN
The EBSBCCY indicator should be set to spaces and the EBSBCCY segment data should be cleared
Context: The system is preparing to search for cargo reference data in EBSBCCY segments
GIVEN
The system is preparing to search for cargo reference data in EBSBCCY segments
Applied to: Set Type-3 to 'CR'
WHEN
The search parameters are being configured
THEN
The Type-3 parameter should be set to 'CR' to identify cargo reference segment types
Context: The system is preparing to process multiple cargo reference segments sequentially
GIVEN
The system is preparing to process multiple cargo reference segments sequentially
Applied to: Initialize Sequence Counter to 0
WHEN
The sequence management is being initialized
THEN
The sequence counter (WS-SEQ) should be set to 0 to start from the beginning
R-GCCCCADD-cbl-00432 (+16) File: GCCCCADD.cbl Fastway Data Fallback Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fastway Data Fallback':
  • Context - a waybill processing request is initiated:
    For Check EDI BOL Data Availability:
    When the system checks for edi bol data availability by verifying if origin road number is not zero, then the system sets the edi bol validity flag and retrieves the edi bol key if data is available.
    For Check EDI BOL Data Availability:
    When the system needs to retrieve weight and quantity information, then the system should first check if edi bol data is available by validating the origin road number and retrieving the edi bol key.
  • Context - edi bol data is available and weight/quantity processing is required:
    For EDI BOL Weight/Quantity Found?:
    When the system retrieves edi bol commodity records and finds valid weight and quantity data, then the system uses edi bol weight, quantity, and quantity qualifier data for manifest creation.
  • Context - edi bol weight and quantity data is not available or weight and quantity are both zero:
    For Initialize Fastway Data Retrieval:
    When the system needs to obtain weight and quantity information, then the system initializes fastway shipcomm data retrieval and sets the get function to 'gu' for first record.
  • Context - fastway data retrieval is initialized and shipcomm records need to be processed:
    For Get First SHIPCOMM Record:
    When the system calls fwcwbio to get the first shipcomm record, then the system extracts number of units, sets quantity qualifier to 'pcs', and determines weight unit based on metric indicator.
  • Context - shipcomm record is found and weight data needs to be processed:
    For Determine Weight Unit Based on Metric Indicator:
    When the system checks the metric indicator in shiproot and the indicator is 'm' or 'l', then the system sets weight unit to kilograms and uses metric commodity weight, otherwise sets weight unit to pounds and uses standard commodity weight.
  • Context - first shipcomm record has been processed and additional records may exist:
    For Get Next SHIPCOMM Record:
    When the system sets get function to 'gn' and retrieves subsequent shipcomm records, then the system accumulates number of units and weight from each additional record until no more records are found.
  • Context - weight and quantity processing is complete and final weight validation is performed:
    For Set Default Weight to 1:
    When the calculated weight is zero or negative, then the system sets the weight to '00000001' as the default minimum weight.
  • Context - weight and quantity processing is complete and final quantity validation is performed:
    For Set Default Quantity to 1:
    When the calculated quantity is zero or negative, then the system sets the quantity to 1 as the default minimum quantity.
  • Context - weight and quantity processing is using fastway shipcomm data:
    For Set Default Quantity Qualifier to 'PCS':
    When the quantity qualifier is spaces or not specified, then the system sets the quantity qualifier to 'pcs' (pieces) as the default unit of measure.
  • Context - edi bol data availability has been checked:
    For EDI BOL Weight/Quantity Found?:
    When weight and quantity data is found in edi bol records, then the system should use edi bol commodity and weight data for processing.
  • Context - edi bol weight and quantity data is not available or equals zero:
    For Initialize Fastway Data Retrieval:
    When the system needs to obtain commodity weight and quantity information, then the system should initialize fastway shipcomm data retrieval and set the get function to 'gu' for first record retrieval.
  • Context - fastway data retrieval has been initialized:
    For Get First SHIPCOMM Record:
    When the first shipcomm record is successfully retrieved, then the system should extract number of units, set quantity qualifier to 'pcs', and determine weight based on metric indicator (metric weight for 'm' or 'l', standard weight otherwise).
  • Context - the first shipcomm record has been processed:
    For Get Next SHIPCOMM Record:
    When additional shipcomm records are found using 'gn' function, then the system should accumulate number of units, set quantity qualifier to 'pcs', and add weight values based on metric indicator.
  • Context - weight and quantity processing has been completed:
    For Set Default Weight to 1:
    When the final weight value is zero or not positive, then the system should set the weight to '00000001' as default value.
  • Context - weight processing has been completed:
    For Set Default Quantity to 1:
    When the final quantity value is zero or not positive, then the system should set the quantity to 1 and convert it to display format.
  • Context - all weight and quantity processing has been completed:
    For Complete Weight/Quantity Processing:
    When the quantity qualifier field is blank or spaces, then the system should set the quantity qualifier to 'pcs' as default value.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing request is initiated
GIVEN
A waybill processing request is initiated
Applied to: Check EDI BOL Data Availability
WHEN
The system checks for EDI BOL data availability by verifying if origin road number is not zero
THEN
The system sets the EDI BOL validity flag and retrieves the EDI BOL key if data is available
Applied to: Check EDI BOL Data Availability
WHEN
The system needs to retrieve weight and quantity information
THEN
The system should first check if EDI BOL data is available by validating the origin road number and retrieving the EDI BOL key
Context: EDI BOL data is available and weight/quantity processing is required
GIVEN
EDI BOL data is available and weight/quantity processing is required
Applied to: EDI BOL Weight/Quantity Found?
WHEN
The system retrieves EDI BOL commodity records and finds valid weight and quantity data
THEN
The system uses EDI BOL weight, quantity, and quantity qualifier data for manifest creation
Context: EDI BOL weight and quantity data is not available or weight and quantity are both zero
GIVEN
EDI BOL weight and quantity data is not available or weight and quantity are both zero
Applied to: Initialize Fastway Data Retrieval
WHEN
The system needs to obtain weight and quantity information
THEN
The system initializes Fastway SHIPCOMM data retrieval and sets the get function to 'GU' for first record
Context: Fastway data retrieval is initialized and SHIPCOMM records need to be processed
GIVEN
Fastway data retrieval is initialized and SHIPCOMM records need to be processed
Applied to: Get First SHIPCOMM Record
WHEN
The system calls FWCWBIO to get the first SHIPCOMM record
THEN
The system extracts number of units, sets quantity qualifier to 'PCS', and determines weight unit based on metric indicator
Context: SHIPCOMM record is found and weight data needs to be processed
GIVEN
SHIPCOMM record is found and weight data needs to be processed
Applied to: Determine Weight Unit Based on Metric Indicator
WHEN
The system checks the metric indicator in SHIPROOT and the indicator is 'M' or 'L'
THEN
The system sets weight unit to kilograms and uses metric commodity weight, otherwise sets weight unit to pounds and uses standard commodity weight
Context: First SHIPCOMM record has been processed and additional records may exist
GIVEN
First SHIPCOMM record has been processed and additional records may exist
Applied to: Get Next SHIPCOMM Record
WHEN
The system sets get function to 'GN' and retrieves subsequent SHIPCOMM records
THEN
The system accumulates number of units and weight from each additional record until no more records are found
Context: Weight and quantity processing is complete and final weight validation is performed
GIVEN
Weight and quantity processing is complete and final weight validation is performed
Applied to: Set Default Weight to 1
WHEN
The calculated weight is zero or negative
THEN
The system sets the weight to '00000001' as the default minimum weight
Context: Weight and quantity processing is complete and final quantity validation is performed
GIVEN
Weight and quantity processing is complete and final quantity validation is performed
Applied to: Set Default Quantity to 1
WHEN
The calculated quantity is zero or negative
THEN
The system sets the quantity to 1 as the default minimum quantity
Context: Weight and quantity processing is using Fastway SHIPCOMM data
GIVEN
Weight and quantity processing is using Fastway SHIPCOMM data
Applied to: Set Default Quantity Qualifier to 'PCS'
WHEN
The quantity qualifier is spaces or not specified
THEN
The system sets the quantity qualifier to 'PCS' (pieces) as the default unit of measure
Context: EDI BOL data availability has been checked
GIVEN
EDI BOL data availability has been checked
Applied to: EDI BOL Weight/Quantity Found?
WHEN
Weight and quantity data is found in EDI BOL records
THEN
The system should use EDI BOL commodity and weight data for processing
Context: EDI BOL weight and quantity data is not available or equals zero
GIVEN
EDI BOL weight and quantity data is not available or equals zero
Applied to: Initialize Fastway Data Retrieval
WHEN
The system needs to obtain commodity weight and quantity information
THEN
The system should initialize Fastway SHIPCOMM data retrieval and set the get function to 'GU' for first record retrieval
Context: Fastway data retrieval has been initialized
GIVEN
Fastway data retrieval has been initialized
Applied to: Get First SHIPCOMM Record
WHEN
The first SHIPCOMM record is successfully retrieved
THEN
The system should extract number of units, set quantity qualifier to 'PCS', and determine weight based on metric indicator (metric weight for 'M' or 'L', standard weight otherwise)
Context: The first SHIPCOMM record has been processed
GIVEN
The first SHIPCOMM record has been processed
Applied to: Get Next SHIPCOMM Record
WHEN
Additional SHIPCOMM records are found using 'GN' function
THEN
The system should accumulate number of units, set quantity qualifier to 'PCS', and add weight values based on metric indicator
Context: Weight and quantity processing has been completed
GIVEN
Weight and quantity processing has been completed
Applied to: Set Default Weight to 1
WHEN
The final weight value is zero or not positive
THEN
The system should set the weight to '00000001' as default value
Context: Weight processing has been completed
GIVEN
Weight processing has been completed
Applied to: Set Default Quantity to 1
WHEN
The final quantity value is zero or not positive
THEN
The system should set the quantity to 1 and convert it to display format
Context: All weight and quantity processing has been completed
GIVEN
All weight and quantity processing has been completed
Applied to: Complete Weight/Quantity Processing
WHEN
The quantity qualifier field is blank or spaces
THEN
The system should set the quantity qualifier to 'PCS' as default value
R-GCCS309C-cbl-00432 (+10) File: GCCS309C.cbl Follower Car Retrieval and Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Follower Car Retrieval and Processing':
  • Context - a manifest contains idler shipment indicator and customs notification is required:
    For Initialize End-of-Followers Flag:
    When the system begins processing follower cars, then the end-of-followers flag is cleared and ccn key is set for database retrieval.
  • Context - idler car processing has been initiated:
    For Set CCN Key for Database Query:
    When the system prepares to query the database for follower cars, then the ccn key is set to the main manifest ccn and database function is set to get unique.
  • Context - database query parameters are configured for idler car retrieval:
    For Retrieve Next Idler Car from Database:
    When the system executes the database call to get the next idler car, then the next idler car record is retrieved or end-of-data condition is detected.
  • Context - a database call has been made to retrieve the next idler car:
    For End of Followers Reached?:
    When the database status code is not spaces (indicating no more records), then the end-of-followers flag is set to 'y' and processing terminates.
  • Context - an idler car record has been successfully retrieved from the database:
    For Is Follower Manifested?:
    When the system checks the follower manifest indicator, then if gccc-follower-mfst is true, the car is processed for edi segments, otherwise it is skipped.
  • Context - a follower car is confirmed as manifested:
    For Create VID Equipment Segment for Follower Car:
    When the system processes the follower car for edi transmission, then a vid segment is created with the follower car's equipment information including car initial, number, and load status.
  • Context - a vid segment has been created for a follower car:
    For Destination Type Check:
    When the system checks if the destination is 309-destination type, then if 309-destination, additional n10 and hazmat segments are processed; otherwise only basic vid segment is created.
  • Context - a follower car is being processed and destination type is 309-destination:
    For Create N10 Description Segment for Follower:
    When the system creates commodity description segments, then an n10 segment is generated with quantity set to zero for follower cars and commodity description details.
  • Context - an n10 segment has been created for a follower car:
    For Follower Has Hazardous Material?:
    When the system checks for hazardous material indicators, then if un number is not spaces, not 'na', and commodity danger description exists, hazmat segments are created.
  • Context - a follower car contains valid hazardous material information:
    For Create H1-H2 Hazardous Material Segments for Follower:
    When the system processes hazardous material data, then h1 segment is created with un number and hazmat description, followed by h2 segments for additional hazmat details.
  • Context - current idler car processing is complete or the car was not manifested:
    For Set Database Function to GN - Get Next:
    When the system prepares to retrieve the next idler car, then database function is set to gn (get next) to continue sequential processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest contains idler shipment indicator and customs notification is required
GIVEN
A manifest contains idler shipment indicator and customs notification is required
Applied to: Initialize End-of-Followers Flag
WHEN
The system begins processing follower cars
THEN
The end-of-followers flag is cleared and CCN key is set for database retrieval
Context: Idler car processing has been initiated
GIVEN
Idler car processing has been initiated
Applied to: Set CCN Key for Database Query
WHEN
The system prepares to query the database for follower cars
THEN
The CCN key is set to the main manifest CCN and database function is set to Get Unique
Context: Database query parameters are configured for idler car retrieval
GIVEN
Database query parameters are configured for idler car retrieval
Applied to: Retrieve Next Idler Car from Database
WHEN
The system executes the database call to get the next idler car
THEN
The next idler car record is retrieved or end-of-data condition is detected
Context: A database call has been made to retrieve the next idler car
GIVEN
A database call has been made to retrieve the next idler car
Applied to: End of Followers Reached?
WHEN
The database status code is not spaces (indicating no more records)
THEN
The end-of-followers flag is set to 'Y' and processing terminates
Context: An idler car record has been successfully retrieved from the database
GIVEN
An idler car record has been successfully retrieved from the database
Applied to: Is Follower Manifested?
WHEN
The system checks the follower manifest indicator
THEN
If GCCC-FOLLOWER-MFST is true, the car is processed for EDI segments, otherwise it is skipped
Context: A follower car is confirmed as manifested
GIVEN
A follower car is confirmed as manifested
Applied to: Create VID Equipment Segment for Follower Car
WHEN
The system processes the follower car for EDI transmission
THEN
A VID segment is created with the follower car's equipment information including car initial, number, and load status
Context: A VID segment has been created for a follower car
GIVEN
A VID segment has been created for a follower car
Applied to: Destination Type Check
WHEN
The system checks if the destination is 309-DESTINATION type
THEN
If 309-DESTINATION, additional N10 and hazmat segments are processed; otherwise only basic VID segment is created
Context: A follower car is being processed and destination type is 309-DESTINATION
GIVEN
A follower car is being processed and destination type is 309-DESTINATION
Applied to: Create N10 Description Segment for Follower
WHEN
The system creates commodity description segments
THEN
An N10 segment is generated with quantity set to zero for follower cars and commodity description details
Context: An N10 segment has been created for a follower car
GIVEN
An N10 segment has been created for a follower car
Applied to: Follower Has Hazardous Material?
WHEN
The system checks for hazardous material indicators
THEN
If UN number is not spaces, not 'NA', and commodity danger description exists, hazmat segments are created
Context: A follower car contains valid hazardous material information
GIVEN
A follower car contains valid hazardous material information
Applied to: Create H1-H2 Hazardous Material Segments for Follower
WHEN
The system processes hazardous material data
THEN
H1 segment is created with UN number and hazmat description, followed by H2 segments for additional hazmat details
Context: Current idler car processing is complete or the car was not manifested
GIVEN
Current idler car processing is complete or the car was not manifested
Applied to: Set Database Function to GN - Get Next
WHEN
The system prepares to retrieve the next idler car
THEN
Database function is set to GN (Get Next) to continue sequential processing
R-GCX122A-cbl-00432 (+7) File: GCX122A.cbl Get Supervisor Merlin ID from Terminal Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get Supervisor Merlin ID from Terminal':
  • Context - a processing terminal identifier (lterm) exists:
    For Access LT Table with LTERM:
    When the system needs to retrieve supervisor configuration, then the system accesses the lt table using the lterm as the key to retrieve terminal configuration data.
  • Context - a request to access lt table with a specific lterm:
    For LT Table Entry Found?:
    When the table lookup is performed, then if the return flag equals 0, the terminal configuration exists, otherwise it does not exist.
  • Context - a valid lt table entry exists for the lterm:
    For Retrieve LT Segment Data:
    When the table segment is successfully retrieved, then the system moves the table segment data to the lt segment structure for processing.
  • Context - terminal configuration data has been retrieved from lt table:
    For Check for Alternate Terminal:
    When the system processes the terminal configuration, then the system checks if the lt-alternate field contains a non-space value.
  • Context - an alternate terminal is specified in the lt-alternate field:
    For Update LTERM to Alternate:
    When the alternate terminal field is not spaces, then the system updates the processing lterm to the alternate terminal value and updates the mst call letters accordingly.
  • Context - a supervisor merlin id is retrieved from terminal configuration:
    For Validate Supervisor Merlin ID:
    When the system validates the supervisor id, then the system performs a lookup using the supervisor merlin id as the key to verify its existence.
  • Context - the supervisor merlin id validation returns a successful status:
    For Set Valid Supervisor ID:
    When the status code is spaces (indicating success), then the system assigns the supervisor merlin id to the user merlin field for message routing.
  • Context - the supervisor merlin id validation fails:
    For Add Invalid ID Error Message:
    When the status code is not spaces (indicating failure), then the system adds an error message 'supervisor merlin userid invalid' with the invalid id and clears the user merlin field.
👨‍💻 Technical ACs (Gherkin)
Context: A processing terminal identifier (LTERM) exists
GIVEN
A processing terminal identifier (LTERM) exists
Applied to: Access LT Table with LTERM
WHEN
The system needs to retrieve supervisor configuration
THEN
The system accesses the LT table using the LTERM as the key to retrieve terminal configuration data
Context: A request to access LT table with a specific LTERM
GIVEN
A request to access LT table with a specific LTERM
Applied to: LT Table Entry Found?
WHEN
The table lookup is performed
THEN
If the return flag equals 0, the terminal configuration exists, otherwise it does not exist
Context: A valid LT table entry exists for the LTERM
GIVEN
A valid LT table entry exists for the LTERM
Applied to: Retrieve LT Segment Data
WHEN
The table segment is successfully retrieved
THEN
The system moves the table segment data to the LT segment structure for processing
Context: Terminal configuration data has been retrieved from LT table
GIVEN
Terminal configuration data has been retrieved from LT table
Applied to: Check for Alternate Terminal
WHEN
The system processes the terminal configuration
THEN
The system checks if the LT-ALTERNATE field contains a non-space value
Context: An alternate terminal is specified in the LT-ALTERNATE field
GIVEN
An alternate terminal is specified in the LT-ALTERNATE field
Applied to: Update LTERM to Alternate
WHEN
The alternate terminal field is not spaces
THEN
The system updates the processing LTERM to the alternate terminal value and updates the MST call letters accordingly
Context: A supervisor Merlin ID is retrieved from terminal configuration
GIVEN
A supervisor Merlin ID is retrieved from terminal configuration
Applied to: Validate Supervisor Merlin ID
WHEN
The system validates the supervisor ID
THEN
The system performs a lookup using the supervisor Merlin ID as the key to verify its existence
Context: The supervisor Merlin ID validation returns a successful status
GIVEN
The supervisor Merlin ID validation returns a successful status
Applied to: Set Valid Supervisor ID
WHEN
The status code is spaces (indicating success)
THEN
The system assigns the supervisor Merlin ID to the user Merlin field for message routing
Context: The supervisor Merlin ID validation fails
GIVEN
The supervisor Merlin ID validation fails
Applied to: Add Invalid ID Error Message
WHEN
The status code is not spaces (indicating failure)
THEN
The system adds an error message 'SUPERVISOR MERLIN USERID INVALID' with the invalid ID and clears the user Merlin field
R-GCCCBOL-cbl-00434 (+4) File: GCCCBOL.cbl Extract Numeric Characters from Quantity Field Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Numeric Characters from Quantity Field':
  • Context - a quantity field cy-n10-quantity with 7 character positions that may contain mixed alphanumeric data:
    For Extract Numeric Characters from Quantity Field - Process quantity field character by character to build numeric string with right-to-left positioning:
    When the system processes the quantity field for multi-bill shipment data extraction, then the system should iterate through positions 7 down to 1, extract only numeric characters, place them in corresponding positions in a work field, replace leading spaces with zeros, and move the final cleaned quantity to the output field gccc-lading-quantity.
  • Context - a quantity extraction process is starting:
    For Set Index to Position 7:
    When the system begins to process the quantity field, then the system should set the index ws-index to position 7 and initialize the quantity work field ws-quantity to spaces.
  • Context - a character at a specific position in the cy-n10-quantity field:
    For Is Character at Current Position Numeric?:
    When the system evaluates the character during quantity processing, then the system should check if the character at ws-data-idx position is numeric and only process numeric characters for inclusion in the final quantity.
  • Context - a numeric character found at the current position in cy-n10-quantity:
    For Move Character to Work Field at Index Position:
    When the character passes numeric validation, then the system should move the numeric character to the ws-quantity work field at the current ws-index position and decrement the index by 1.
  • Context - a work field ws-quantity containing extracted numeric characters with potential leading spaces:
    For Replace Leading Spaces with Zeros:
    When all character positions have been processed, then the system should inspect ws-quantity and replace all leading spaces with zeros to create a properly formatted numeric value.
👨‍💻 Technical ACs (Gherkin)
Context: A quantity field CY-N10-QUANTITY with 7 character positions that may contain mixed alphanumeric data
GIVEN
A quantity field CY-N10-QUANTITY with 7 character positions that may contain mixed alphanumeric data
Applied to: Extract Numeric Characters from Quantity Field - Process quantity field character by character to build numeric string with right-to-left positioning
WHEN
The system processes the quantity field for multi-bill shipment data extraction
THEN
The system should iterate through positions 7 down to 1, extract only numeric characters, place them in corresponding positions in a work field, replace leading spaces with zeros, and move the final cleaned quantity to the output field GCCC-LADING-QUANTITY
Context: A quantity extraction process is starting
GIVEN
A quantity extraction process is starting
Applied to: Set Index to Position 7
WHEN
The system begins to process the quantity field
THEN
The system should set the index WS-INDEX to position 7 and initialize the quantity work field WS-QUANTITY to spaces
Context: A character at a specific position in the CY-N10-QUANTITY field
GIVEN
A character at a specific position in the CY-N10-QUANTITY field
Applied to: Is Character at Current Position Numeric?
WHEN
The system evaluates the character during quantity processing
THEN
The system should check if the character at WS-DATA-IDX position is numeric and only process numeric characters for inclusion in the final quantity
Context: A numeric character found at the current position in CY-N10-QUANTITY
GIVEN
A numeric character found at the current position in CY-N10-QUANTITY
Applied to: Move Character to Work Field at Index Position
WHEN
The character passes numeric validation
THEN
The system should move the numeric character to the WS-QUANTITY work field at the current WS-INDEX position and decrement the index by 1
Context: A work field WS-QUANTITY containing extracted numeric characters with potential leading spaces
GIVEN
A work field WS-QUANTITY containing extracted numeric characters with potential leading spaces
Applied to: Replace Leading Spaces with Zeros
WHEN
All character positions have been processed
THEN
The system should inspect WS-QUANTITY and replace all leading spaces with zeros to create a properly formatted numeric value
R-GCCCBOL-cbl-00439 (+4) File: GCCCBOL.cbl Format VIN with Prefix Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Format VIN with Prefix':
  • Context - a vehicle identification number field from motor vehicle segment:
    For VIN Number Available?:
    When the system evaluates the vin field content, then processing continues if vin is not equal to spaces or low-values, otherwise vin processing is skipped.
  • Context - a motor vehicle segment with vehicle identification data:
    For Get Vehicle ID Number:
    When the system processes the mv segment, then the vehicle id number is extracted from the vc-vehicle-id-no field.
  • Context - a valid vehicle identification number:
    For Create VIN String:
    When the system formats the vin for storage, then a string is created by concatenating 'vin' text followed by the vehicle identification number.
  • Context - a successfully formatted vin string:
    For Store Formatted VIN:
    When the vin is stored in the description array, then the vin quantity counter is incremented by 1.
  • Context - a vin counter and maximum vin capacity limit:
    For Store Formatted VIN:
    When the system attempts to store a vin, then the vin is stored only if the current vin quantity is less than or equal to the maximum allowed vins.
👨‍💻 Technical ACs (Gherkin)
Context: A vehicle identification number field from motor vehicle segment
GIVEN
A vehicle identification number field from motor vehicle segment
Applied to: VIN Number Available?
WHEN
The system evaluates the VIN field content
THEN
Processing continues if VIN is not equal to spaces or low-values, otherwise VIN processing is skipped
Context: A motor vehicle segment with vehicle identification data
GIVEN
A motor vehicle segment with vehicle identification data
Applied to: Get Vehicle ID Number
WHEN
The system processes the MV segment
THEN
The vehicle ID number is extracted from the VC-VEHICLE-ID-NO field
Context: A valid vehicle identification number
GIVEN
A valid vehicle identification number
Applied to: Create VIN String
WHEN
The system formats the VIN for storage
THEN
A string is created by concatenating 'VIN' text followed by the vehicle identification number
Context: A successfully formatted VIN string
GIVEN
A successfully formatted VIN string
Applied to: Store Formatted VIN
WHEN
The VIN is stored in the description array
THEN
The VIN quantity counter is incremented by 1
Context: A VIN counter and maximum VIN capacity limit
GIVEN
A VIN counter and maximum VIN capacity limit
Applied to: Store Formatted VIN
WHEN
The system attempts to store a VIN
THEN
The VIN is stored only if the current VIN quantity is less than or equal to the maximum allowed VINs
R-GCX122A-cbl-00440 (+6) File: GCX122A.cbl Initialize Arrival Transaction Input Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Initialize Arrival Transaction Input':
  • Context - a cargo arrival processing request is initiated:
    For Initialize GCX148 Input Structure:
    When the system begins arrival transaction initialization, then the gcx148 input structure is initialized to clear any previous data.
  • Context - an arrival transaction is being prepared:
    For Set Security Byte to High-Value:
    When security parameters are being configured, then the security byte is set to high-value to indicate maximum security clearance required.
  • Context - a cargo record with a valid cargo control number exists:
    For Move Cargo Control Number to Transaction:
    When an arrival transaction is being prepared for the cargo, then the cargo control number from the cargo record is assigned to the arrival transaction.
  • Context - an arrival transaction is being prepared for cargo:
    For Set Transaction Type to CA-CARGO:
    When the transaction type needs to be specified, then the transaction type is set to ca-cargo to indicate this is a cargo-related arrival.
  • Context - a cargo arrival transaction is being prepared:
    For Set Action Code to 'CAA':
    When the action code needs to be specified, then the action code is set to 'caa' to indicate cargo arrival processing.
  • Context - a cargo record contains manifest transaction code information:
    For Move Port Code from Manifest Transaction Code:
    When an arrival transaction is being prepared, then the port code from the manifest transaction code is extracted and assigned to the arrival transaction.
  • Context - all arrival transaction parameters have been configured:
    For Prepare GCT1481E Message Structure:
    When the system prepares to communicate the arrival information, then the gcx148 input data is formatted into the gct1481e message structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo arrival processing request is initiated
GIVEN
A cargo arrival processing request is initiated
Applied to: Initialize GCX148 Input Structure
WHEN
The system begins arrival transaction initialization
THEN
The GCX148 input structure is initialized to clear any previous data
Context: An arrival transaction is being prepared
GIVEN
An arrival transaction is being prepared
Applied to: Set Security Byte to High-Value
WHEN
Security parameters are being configured
THEN
The security byte is set to high-value to indicate maximum security clearance required
Context: A cargo record with a valid cargo control number exists
GIVEN
A cargo record with a valid cargo control number exists
Applied to: Move Cargo Control Number to Transaction
WHEN
An arrival transaction is being prepared for the cargo
THEN
The cargo control number from the cargo record is assigned to the arrival transaction
Context: An arrival transaction is being prepared for cargo
GIVEN
An arrival transaction is being prepared for cargo
Applied to: Set Transaction Type to CA-CARGO
WHEN
The transaction type needs to be specified
THEN
The transaction type is set to CA-CARGO to indicate this is a cargo-related arrival
Context: A cargo arrival transaction is being prepared
GIVEN
A cargo arrival transaction is being prepared
Applied to: Set Action Code to 'CAA'
WHEN
The action code needs to be specified
THEN
The action code is set to 'CAA' to indicate cargo arrival processing
Context: A cargo record contains manifest transaction code information
GIVEN
A cargo record contains manifest transaction code information
Applied to: Move Port Code from Manifest Transaction Code
WHEN
An arrival transaction is being prepared
THEN
The port code from the manifest transaction code is extracted and assigned to the arrival transaction
Context: All arrival transaction parameters have been configured
GIVEN
All arrival transaction parameters have been configured
Applied to: Prepare GCT1481E Message Structure
WHEN
The system prepares to communicate the arrival information
THEN
The GCX148 input data is formatted into the GCT1481E message structure
R-GCCCCADD-cbl-00441 (+3) File: GCCCCADD.cbl Weight Unit Setting Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Weight Unit Setting':
  • Context - a shipment record exists with a metric indicator field:
    For Weight Unit Setting - Set weight units (KG/LB) based on metric indicator:
    When the system processes weight unit determination and the metric indicator is 'm' (metric) or 'l' (liters), then the weight unit is set to kg (kilograms).
    For Weight Unit Setting - Set weight units (KG/LB) based on metric indicator:
    When the system processes weight unit determination and the metric indicator is not 'm' (metric) or 'l' (liters), then the weight unit is set to lb (pounds).
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record exists with a metric indicator field
GIVEN
A shipment record exists with a metric indicator field
Applied to: Weight Unit Setting - Set weight units (KG/LB) based on metric indicator
WHEN
The system processes weight unit determination AND the metric indicator is 'M' (metric) or 'L' (liters)
THEN
The weight unit is set to KG (kilograms)
Applied to: Weight Unit Setting - Set weight units (KG/LB) based on metric indicator
WHEN
The system processes weight unit determination AND the metric indicator is not 'M' (metric) or 'L' (liters)
THEN
The weight unit is set to LB (pounds)
R-GCCCCADD-cbl-00443 (+6) File: GCCCCADD.cbl Quantity Qualifier Validation Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Quantity Qualifier Validation':
  • Context - a cargo manifest is being processed:
    For Quantity Qualifier Empty?:
    When the quantity qualifier field is empty or contains only spaces, then the system generates a required field error message for quantity qualifier.
  • Context - a cargo manifest has a non-empty quantity qualifier:
    For Lookup Quantity Qualifier in MU Table:
    When the system looks up the quantity qualifier in the mu (measurement units) table, then the system retrieves the corresponding measurement unit record if it exists.
  • Context - a quantity qualifier has been looked up in the mu table:
    For Found in MU Table?:
    When the quantity qualifier is not found in the measurement units reference table, then the system generates a 'not found on mu table' error message.
    For Validation Successful:
    When the quantity qualifier is found in the measurement units reference table, then the system considers the quantity qualifier validation successful and continues processing.
  • Context - a shipment record is being processed for customs manifest creation:
    For Quantity Qualifier Empty?:
    When the quantity qualifier field is empty or contains only spaces, then the system generates a required field error message and adds it to the error collection.
  • Context - a shipment record has a populated quantity qualifier field:
    For Lookup Quantity Qualifier in MU Table:
    When the system looks up the quantity qualifier in the mu (measurement units) reference table, then the system retrieves the corresponding measurement unit record if the qualifier exists in the table.
  • Context - a shipment record has a quantity qualifier that does not exist in the mu reference table:
    For Generate Not Found Error:
    When the lookup operation fails to find a matching record, then the system generates a 'not found on mu table' error message and adds it to the error collection.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed
GIVEN
A cargo manifest is being processed
Applied to: Quantity Qualifier Empty?
WHEN
The quantity qualifier field is empty or contains only spaces
THEN
The system generates a required field error message for quantity qualifier
Context: A cargo manifest has a non-empty quantity qualifier
GIVEN
A cargo manifest has a non-empty quantity qualifier
Applied to: Lookup Quantity Qualifier in MU Table
WHEN
The system looks up the quantity qualifier in the MU (Measurement Units) table
THEN
The system retrieves the corresponding measurement unit record if it exists
Context: A quantity qualifier has been looked up in the MU table
GIVEN
A quantity qualifier has been looked up in the MU table
Applied to: Found in MU Table?
WHEN
The quantity qualifier is not found in the measurement units reference table
THEN
The system generates a 'not found on MU table' error message
Applied to: Validation Successful
WHEN
The quantity qualifier is found in the measurement units reference table
THEN
The system considers the quantity qualifier validation successful and continues processing
Context: A shipment record is being processed for customs manifest creation
GIVEN
A shipment record is being processed for customs manifest creation
Applied to: Quantity Qualifier Empty?
WHEN
The quantity qualifier field is empty or contains only spaces
THEN
The system generates a required field error message and adds it to the error collection
Context: A shipment record has a populated quantity qualifier field
GIVEN
A shipment record has a populated quantity qualifier field
Applied to: Lookup Quantity Qualifier in MU Table
WHEN
The system looks up the quantity qualifier in the MU (Measurement Units) reference table
THEN
The system retrieves the corresponding measurement unit record if the qualifier exists in the table
Context: A shipment record has a quantity qualifier that does not exist in the MU reference table
GIVEN
A shipment record has a quantity qualifier that does not exist in the MU reference table
Applied to: Generate Not Found Error
WHEN
The lookup operation fails to find a matching record
THEN
The system generates a 'not found on MU table' error message and adds it to the error collection
R-GCCS309C-cbl-00443 (+7) File: GCCS309C.cbl Multi Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multi':
  • Context - a manifest with consignee chop and commodity code information:
    For Access AU Table for Automotive Check:
    When both consignee chop and commodity code are not empty, then the system should lookup the au table using chop and commodity code as search criteria.
  • Context - an au table record is successfully found and origin country and csa indicator are available:
    For Set Automotive Release Flag Based on Country and CSA Status:
    When origin country is us, ca, or blank, or origin country is mx with au type second character as c, and csa indicator is off, then the system should set the automotive flag to true, otherwise set to non-automotive.
  • Context - a manifest processing request:
    For Set Non-Automotive Flag:
    When either consignee chop or commodity code is empty, or au table record is not found, then the system should set the non-automotive flag to true.
  • Context - a manifest with from-station transportation code:
    For Access SC Table for Station Codes:
    When processing station information lookup, then the system should query sc table using the from-station code as search criteria.
  • Context - an sc table lookup request:
    For Retrieve Station Name and State Code:
    When sc table record is found and canadian station code is not 0000, then the system should retrieve and store the station segment information.
    For Generate Station Code Error Message:
    When sc table record is not found or canadian station code equals 0000, then the system should generate an error message indicating sc table entry not found for the station.
  • Context - a manifest with in-transit status information:
    For Access EX Table for Export Destination:
    When in-transit status equals 'l' (local), then the system should initiate ex table lookup using destination station number.
  • Context - an ex table lookup for destination station:
    For Set Export Destination Flag:
    When ex table record is successfully found, then the system should set the export destination flag for subsequent processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest with consignee CHOP and commodity code information
GIVEN
A manifest with consignee CHOP and commodity code information
Applied to: Access AU Table for Automotive Check
WHEN
Both consignee CHOP and commodity code are not empty
THEN
The system should lookup the AU table using CHOP and commodity code as search criteria
Context: An AU table record is successfully found and origin country and CSA indicator are available
GIVEN
An AU table record is successfully found and origin country and CSA indicator are available
Applied to: Set Automotive Release Flag Based on Country and CSA Status
WHEN
Origin country is US, CA, or blank, OR origin country is MX with AU type second character as C, AND CSA indicator is OFF
THEN
The system should set the automotive flag to TRUE, otherwise set to non-automotive
Context: A manifest processing request
GIVEN
A manifest processing request
Applied to: Set Non-Automotive Flag
WHEN
Either consignee CHOP or commodity code is empty, OR AU table record is not found
THEN
The system should set the non-automotive flag to TRUE
Context: A manifest with from-station transportation code
GIVEN
A manifest with from-station transportation code
Applied to: Access SC Table for Station Codes
WHEN
Processing station information lookup
THEN
The system should query SC table using the from-station code as search criteria
Context: An SC table lookup request
GIVEN
An SC table lookup request
Applied to: Retrieve Station Name and State Code
WHEN
SC table record is found and Canadian station code is not 0000
THEN
The system should retrieve and store the station segment information
Applied to: Generate Station Code Error Message
WHEN
SC table record is not found OR Canadian station code equals 0000
THEN
The system should generate an error message indicating SC table entry not found for the station
Context: A manifest with in-transit status information
GIVEN
A manifest with in-transit status information
Applied to: Access EX Table for Export Destination
WHEN
In-transit status equals 'L' (Local)
THEN
The system should initiate EX table lookup using destination station number
Context: An EX table lookup for destination station
GIVEN
An EX table lookup for destination station
Applied to: Set Export Destination Flag
WHEN
EX table record is successfully found
THEN
The system should set the export destination flag for subsequent processing
R-GCCCBOL-cbl-00444 (+10) File: GCCCBOL.cbl Search SHIPMINE for N1 Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search SHIPMINE for N1':
  • Context - the system needs to search for n1-01 im importer segments in shipmine data:
    For Set N1-01 Not Found Flag:
    When the search process begins, then the system sets the n1-01 found flag to false (not found) to initialize the search state.
  • Context - the system has a defined starting position for data search:
    For Initialize Data Index from Start Position:
    When beginning to search through shipmine data lines, then the system sets the data index to the specified starting position to begin sequential search.
  • Context - the system is searching through shipmine data lines with a current data index position:
    For Data Index <= 5?:
    When checking if more data lines exist in the current segment, then the system validates that the data index is less than or equal to 5 to stay within segment boundaries.
  • Context - the system is examining a shipmine data line at the current index position:
    For Data Line Contains 'N1-01 IM'?:
    When checking the data line content for importer segment identification, then the system determines if the data line contains the exact pattern 'n1-01 im' starting at position 1 through 9.
  • Context - the system has identified a data line containing the n1-01 im pattern:
    For Set N1-01 Found Flag:
    When the importer segment is successfully located, then the system sets the n1-01 found flag to true to indicate successful discovery.
  • Context - the current data line does not contain the n1-01 im pattern and the search continues:
    For Increment Data Index:
    When moving to examine the next data line in the current segment, then the system increments the data index by 1 to advance to the next sequential data line.
  • Context - the system has completed searching the current segment or reached segment boundary:
    For N1-01 Found?:
    When determining next action based on search results, then the system checks if the n1-01 found flag is true to decide whether to continue searching or proceed with processing.
  • Context - the n1-01 im pattern was not found in the current shipmine segment:
    For Move to Next SHIPMINE Segment:
    When continuing the search in additional segments, then the system increments the shipmine segment number by 1 to access the next available segment.
  • Context - the system needs to access the next shipmine segment for continued searching:
    For Get Next SHIPMINE Data:
    When retrieving data from the next segment number, then the system performs a database call to get shipmine data using the incremented segment number.
  • Context - the system has attempted to retrieve the next shipmine segment:
    For SHIPMINE Data Found?:
    When checking if the segment retrieval was successful, then the system validates that the shipmine data was found (status code is spaces) to determine if more data is available for searching.
  • Context - a new shipmine segment has been successfully retrieved:
    For Reset Data Index to 1:
    When starting to search through the new segment's data lines, then the system resets the data index to 1 to begin searching from the first data line of the new segment.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to search for N1-01 IM importer segments in SHIPMINE data
GIVEN
The system needs to search for N1-01 IM importer segments in SHIPMINE data
Applied to: Set N1-01 Not Found Flag
WHEN
The search process begins
THEN
The system sets the N1-01 found flag to false (not found) to initialize the search state
Context: The system has a defined starting position for data search
GIVEN
The system has a defined starting position for data search
Applied to: Initialize Data Index from Start Position
WHEN
Beginning to search through SHIPMINE data lines
THEN
The system sets the data index to the specified starting position to begin sequential search
Context: The system is searching through SHIPMINE data lines with a current data index position
GIVEN
The system is searching through SHIPMINE data lines with a current data index position
Applied to: Data Index <= 5?
WHEN
Checking if more data lines exist in the current segment
THEN
The system validates that the data index is less than or equal to 5 to stay within segment boundaries
Context: The system is examining a SHIPMINE data line at the current index position
GIVEN
The system is examining a SHIPMINE data line at the current index position
Applied to: Data Line Contains 'N1-01 IM'?
WHEN
Checking the data line content for importer segment identification
THEN
The system determines if the data line contains the exact pattern 'N1-01 IM' starting at position 1 through 9
Context: The system has identified a data line containing the N1-01 IM pattern
GIVEN
The system has identified a data line containing the N1-01 IM pattern
Applied to: Set N1-01 Found Flag
WHEN
The importer segment is successfully located
THEN
The system sets the N1-01 found flag to true to indicate successful discovery
Context: The current data line does not contain the N1-01 IM pattern and the search continues
GIVEN
The current data line does not contain the N1-01 IM pattern and the search continues
Applied to: Increment Data Index
WHEN
Moving to examine the next data line in the current segment
THEN
The system increments the data index by 1 to advance to the next sequential data line
Context: The system has completed searching the current segment or reached segment boundary
GIVEN
The system has completed searching the current segment or reached segment boundary
Applied to: N1-01 Found?
WHEN
Determining next action based on search results
THEN
The system checks if the N1-01 found flag is true to decide whether to continue searching or proceed with processing
Context: The N1-01 IM pattern was not found in the current SHIPMINE segment
GIVEN
The N1-01 IM pattern was not found in the current SHIPMINE segment
Applied to: Move to Next SHIPMINE Segment
WHEN
Continuing the search in additional segments
THEN
The system increments the SHIPMINE segment number by 1 to access the next available segment
Context: The system needs to access the next SHIPMINE segment for continued searching
GIVEN
The system needs to access the next SHIPMINE segment for continued searching
Applied to: Get Next SHIPMINE Data
WHEN
Retrieving data from the next segment number
THEN
The system performs a database call to get SHIPMINE data using the incremented segment number
Context: The system has attempted to retrieve the next SHIPMINE segment
GIVEN
The system has attempted to retrieve the next SHIPMINE segment
Applied to: SHIPMINE Data Found?
WHEN
Checking if the segment retrieval was successful
THEN
The system validates that the SHIPMINE data was found (status code is spaces) to determine if more data is available for searching
Context: A new SHIPMINE segment has been successfully retrieved
GIVEN
A new SHIPMINE segment has been successfully retrieved
Applied to: Reset Data Index to 1
WHEN
Starting to search through the new segment's data lines
THEN
The system resets the data index to 1 to begin searching from the first data line of the new segment
R-GCCCCADD-cbl-00447 (+40) File: GCCCCADD.cbl Shipper Record Building Merged 41 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Shipper Record Building':
  • Context - a customs manifest creation process is initiated:
    For Initialize Shipper Record Structure:
    When the system begins building shipper record information, then a new shipper record structure is initialized with empty values.
  • Context - a shipper record structure has been initialized:
    For Set Record Type as '55' and Sequence '0001':
    When the system sets up the record identification, then the record type is set to '55' and sequence number is set to '0001' for shipper identification.
  • Context - a shipper record needs to be populated with data:
    For Check EDI BOL HN Segment Available?:
    When the system checks for availability of edi bol hn segment data, then if edi bol hn segment is found, use edi data source, otherwise use fastway shipper data.
  • Context - edi bol hn segment data is available:
    For Extract Shipper Name from EDI BOL:
    When the system processes shipper name information, then the shipper name is extracted from f1-consignor-name field in the edi bol data.
    For Extract Shipper CHOP Code from EDI BOL:
    When the system processes shipper identification codes, then the shipper chop code is extracted from f1-shpr-chop field in the edi bol data.
  • Context - shipper information is being processed from any data source:
    For Set Entity ID as 'SH' - Shipper:
    When the system sets the entity type identifier, then the entity id is set to 'sh' to identify this record as a shipper entity.
  • Context - shipper record is being populated from edi bol data source:
    For Check EDI BOL HA Address Segment?:
    When the system needs to populate address information, then if edi bol ha address segment is available, use edi address data, otherwise use fastway address data.
  • Context - edi bol ha address segment is available:
    For Extract Address from EDI BOL HA Segment:
    When the system processes shipper address information, then address line 1 is extracted from f2-addl-name-addr-1 and address line 2 from f2-addl-name-addr-2.
    For Extract Address from EDI BOL HA Segment:
    When the system processes edi address data, then address line 1 is extracted to n301 field and address line 2 to n302 field.
  • Context - edi bol ha address segment is not available:
    For Use Fastway Shipper Address Data:
    When the system needs shipper address information, then address information is extracted from fastway shpr-addr fields and address line 1 is extracted from fastway shipper address field 1, and if blank, 'na' is used as default.
  • Context - shipper address information is being processed:
    For Check EDI BOL HC City/State Segment?:
    When the system needs city, state, and postal code information, then if edi bol hc city/state segment is available, use edi data, otherwise parse fastway address data.
  • Context - edi bol hc city/state segment is available:
    For Extract City/State/Postal from EDI BOL HC:
    When the system processes shipper location information, then city name is extracted from f4-city-name, state code from f4-state-prov-code, postal code from f4-postal-code, and country code from f4-country-code.
    For Extract City/State/Postal from EDI BOL HC:
    When the system processes edi city/state data, then city name is extracted to n401 field, state code to n402 field, postal code to n403 field, and country code to n404 field.
  • Context - edi bol hc segment is not available and fastway address data exists:
    For Parse Fastway Address for City/State/Postal:
    When the system needs to extract location components, then the system parses shpr-addr field to extract city name, state/province code, and postal code components.
    For Parse Fastway Address for City/State/Postal:
    When the system parses fastway address field 2, then city name, state code, and postal code are extracted and assigned to respective n4 segment fields.
  • Context - a state or province code has been extracted from shipper address data:
    For Determine Country Code from State Lookup:
    When the system needs to determine the corresponding country code, then the system searches the tb-state-country table using the state code to find the matching country code.
  • Context - shipper record is being populated with contact information:
    For Check EDI BOL GP Contact Segment?:
    When the system checks for available contact data sources, then if edi bol gp contact segment is available, extract contact information, otherwise proceed without contact details.
  • Context - edi bol gp contact segment is available:
    For Extract Contact Information from EDI BOL:
    When the system processes shipper contact information, then contact function code is extracted from per-contact-func-code, contact name from per-name, communication number qualifier from per-commun-no-qual, and communication number from per-commun-number.
    For Extract Contact Information from EDI BOL:
    When the system processes edi contact data, then contact function code is extracted to per01 field, contact name to per02 field, communication qualifier to per03 field, and communication number to per04 field.
  • Context - edi bol hn segment is not available:
    For Use Fastway Shipper Data:
    When the system needs to populate shipper information, then the system uses fastway shiproot data as the primary source for shipper information.
  • Context - fastway data is being used as the shipper information source:
    For Extract Shipper Name from Fastway:
    When the system processes shipper name information, then the shipper name is extracted from shpr-nm field in the shiproot data.
    For Extract Shipper CHOP from Fastway:
    When the system processes shipper identification codes, then the shipper chop code is extracted from shpr-chop field in the shiproot data.
    For Use Fastway Address Data:
    When the system processes shipper address information, then address line 1 is extracted from shpr-addr(1), and if empty, 'na' is used as default.
  • Context - fastway data is being used for shipper location information:
    For Parse Fastway City/State Information:
    When the system processes city and state information, then the system parses shpr-addr(2) to extract city name, state/province code, and postal code, then determines country code through state lookup.
  • Context - shipper record has been populated with data from either edi bol or fastway sources:
    For Validate Shipper Record Data:
    When the system performs data validation, then all required shipper fields are validated for completeness and format compliance according to customs requirements.
  • Context - shipper record has been validated and completed:
    For Store Shipper Record in Array Position 1:
    When the system stores the record for customs processing, then the shipper record is stored in ws-gcsccs55-data array at position 1.
  • Context - a new shipper record needs to be created for customs manifest:
    For Initialize Shipper Record Structure:
    When the system begins building shipper information, then the record is initialized with ccn key, record type '55', and sequence '0001'.
  • Context - a shipper record structure is being initialized:
    For Set Record Type as '55' and Sequence '0001':
    When the system sets record identification parameters, then record type is set to '55' and sequence number is set to '0001'.
  • Context - a shipper record is being built for customs manifest:
    For Check EDI BOL HN Segment Available?:
    When the system checks for edi bol hn segment availability, then if edi bol hn segment is found, use edi data; otherwise use fastway data as fallback.
  • Context - edi bol hn segment is available with shipper information:
    For Extract Shipper Name from EDI BOL:
    When the system processes edi shipper data, then shipper name is extracted to n102 field, chop code to sc301 field, and entity id is set to 'sh'.
  • Context - shipper identity has been extracted from edi bol:
    For Check EDI BOL HA Address Segment?:
    When the system checks for edi bol ha address segment, then if ha segment is found, extract address from edi; otherwise use fastway address data.
  • Context - shipper address information has been processed:
    For Check EDI BOL HC City/State Segment?:
    When the system checks for edi bol hc city/state segment, then if hc segment is found, extract city/state from edi; otherwise parse fastway address data.
  • Context - state or province code has been extracted from address information:
    For Determine Country Code from State Lookup:
    When the system performs state-country table lookup, then corresponding country code is retrieved and assigned to n404 field, or remains blank if not found.
  • Context - shipper geographic information has been processed:
    For Check EDI BOL GP Contact Segment?:
    When the system checks for edi bol gp contact segment, then if gp segment is found, extract contact information; otherwise proceed to validation.
  • Context - edi bol hn segment is not found or not available:
    For Use Fastway Shipper Data as Fallback:
    When the system needs to build shipper record, then shipper information is extracted from fastway shipment root data including name, chop code, and address.
  • Context - edi bol data is not available and fastway data is being used:
    For Extract Shipper Name from Fastway:
    When the system processes fastway shipper information, then shipper chop is extracted to sc301 field, entity id is set to 'sh', and shipper name is extracted to n102 field.
  • Context - fastway data is being used for shipper information:
    For Use Fastway Address Information:
    When the system processes fastway address data, then if shipper address field 1 is blank, 'na' is used; otherwise the address value is extracted to n301 field, and n302 field is set to spaces.
  • Context - fastway address data is being processed for geographic information:
    For Parse Fastway City/State Information:
    When the system parses shipper address field 2, then city name is extracted to n401 field, state code to n402 field, postal code to n403 field, and country code is determined via state lookup.
  • Context - shipper record data has been extracted from either edi or fastway sources:
    For Validate Shipper Record Data:
    When the system validates shipper record completeness, then all required fields are checked for presence and validity according to customs manifest requirements.
  • Context - shipper record has been built and validated successfully:
    For Store Shipper Record in Array Position 1:
    When the system stores the shipper record, then the complete shipper record is stored in array position 1 of the customs manifest record collection.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest creation process is initiated
GIVEN
A customs manifest creation process is initiated
Applied to: Initialize Shipper Record Structure
WHEN
The system begins building shipper record information
THEN
A new shipper record structure is initialized with empty values
Context: A shipper record structure has been initialized
GIVEN
A shipper record structure has been initialized
Applied to: Set Record Type as '55' and Sequence '0001'
WHEN
The system sets up the record identification
THEN
The record type is set to '55' and sequence number is set to '0001' for shipper identification
Context: A shipper record needs to be populated with data
GIVEN
A shipper record needs to be populated with data
Applied to: Check EDI BOL HN Segment Available?
WHEN
The system checks for availability of EDI BOL HN segment data
THEN
If EDI BOL HN segment is found, use EDI data source, otherwise use Fastway shipper data
Context: EDI BOL HN segment data is available
GIVEN
EDI BOL HN segment data is available
Applied to: Extract Shipper Name from EDI BOL
WHEN
The system processes shipper name information
THEN
The shipper name is extracted from F1-CONSIGNOR-NAME field in the EDI BOL data
Applied to: Extract Shipper CHOP Code from EDI BOL
WHEN
The system processes shipper identification codes
THEN
The shipper CHOP code is extracted from F1-SHPR-CHOP field in the EDI BOL data
Context: Shipper information is being processed from any data source
GIVEN
Shipper information is being processed from any data source
Applied to: Set Entity ID as 'SH' - Shipper
WHEN
The system sets the entity type identifier
THEN
The entity ID is set to 'SH' to identify this record as a shipper entity
Context: Shipper record is being populated from EDI BOL data source
GIVEN
Shipper record is being populated from EDI BOL data source
Applied to: Check EDI BOL HA Address Segment?
WHEN
The system needs to populate address information
THEN
If EDI BOL HA address segment is available, use EDI address data, otherwise use Fastway address data
Context: EDI BOL HA address segment is available
GIVEN
EDI BOL HA address segment is available
Applied to: Extract Address from EDI BOL HA Segment
WHEN
The system processes shipper address information
THEN
Address line 1 is extracted from F2-ADDL-NAME-ADDR-1 and address line 2 from F2-ADDL-NAME-ADDR-2
Applied to: Extract Address from EDI BOL HA Segment
WHEN
The system processes EDI address data
THEN
Address line 1 is extracted to N301 field and address line 2 to N302 field
Context: EDI BOL HA address segment is not available
GIVEN
EDI BOL HA address segment is not available
Applied to: Use Fastway Shipper Address Data
WHEN
The system needs shipper address information
THEN
Address information is extracted from Fastway SHPR-ADDR fields AND Address line 1 is extracted from Fastway shipper address field 1, and if blank, 'NA' is used as default
Context: Shipper address information is being processed
GIVEN
Shipper address information is being processed
Applied to: Check EDI BOL HC City/State Segment?
WHEN
The system needs city, state, and postal code information
THEN
If EDI BOL HC city/state segment is available, use EDI data, otherwise parse Fastway address data
Context: EDI BOL HC city/state segment is available
GIVEN
EDI BOL HC city/state segment is available
Applied to: Extract City/State/Postal from EDI BOL HC
WHEN
The system processes shipper location information
THEN
City name is extracted from F4-CITY-NAME, state code from F4-STATE-PROV-CODE, postal code from F4-POSTAL-CODE, and country code from F4-COUNTRY-CODE
Applied to: Extract City/State/Postal from EDI BOL HC
WHEN
The system processes EDI city/state data
THEN
City name is extracted to N401 field, state code to N402 field, postal code to N403 field, and country code to N404 field
Context: EDI BOL HC segment is not available and Fastway address data exists
GIVEN
EDI BOL HC segment is not available and Fastway address data exists
Applied to: Parse Fastway Address for City/State/Postal
WHEN
The system needs to extract location components
THEN
The system parses SHPR-ADDR field to extract city name, state/province code, and postal code components
Applied to: Parse Fastway Address for City/State/Postal
WHEN
The system parses Fastway address field 2
THEN
City name, state code, and postal code are extracted and assigned to respective N4 segment fields
Context: A state or province code has been extracted from shipper address data
GIVEN
A state or province code has been extracted from shipper address data
Applied to: Determine Country Code from State Lookup
WHEN
The system needs to determine the corresponding country code
THEN
The system searches the TB-STATE-COUNTRY table using the state code to find the matching country code
Context: Shipper record is being populated with contact information
GIVEN
Shipper record is being populated with contact information
Applied to: Check EDI BOL GP Contact Segment?
WHEN
The system checks for available contact data sources
THEN
If EDI BOL GP contact segment is available, extract contact information, otherwise proceed without contact details
Context: EDI BOL GP contact segment is available
GIVEN
EDI BOL GP contact segment is available
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes shipper contact information
THEN
Contact function code is extracted from PER-CONTACT-FUNC-CODE, contact name from PER-NAME, communication number qualifier from PER-COMMUN-NO-QUAL, and communication number from PER-COMMUN-NUMBER
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes EDI contact data
THEN
Contact function code is extracted to PER01 field, contact name to PER02 field, communication qualifier to PER03 field, and communication number to PER04 field
Context: EDI BOL HN segment is not available
GIVEN
EDI BOL HN segment is not available
Applied to: Use Fastway Shipper Data
WHEN
The system needs to populate shipper information
THEN
The system uses Fastway SHIPROOT data as the primary source for shipper information
Context: Fastway data is being used as the shipper information source
GIVEN
Fastway data is being used as the shipper information source
Applied to: Extract Shipper Name from Fastway
WHEN
The system processes shipper name information
THEN
The shipper name is extracted from SHPR-NM field in the SHIPROOT data
Applied to: Extract Shipper CHOP from Fastway
WHEN
The system processes shipper identification codes
THEN
The shipper CHOP code is extracted from SHPR-CHOP field in the SHIPROOT data
Applied to: Use Fastway Address Data
WHEN
The system processes shipper address information
THEN
Address line 1 is extracted from SHPR-ADDR(1), and if empty, 'NA' is used as default
Context: Fastway data is being used for shipper location information
GIVEN
Fastway data is being used for shipper location information
Applied to: Parse Fastway City/State Information
WHEN
The system processes city and state information
THEN
The system parses SHPR-ADDR(2) to extract city name, state/province code, and postal code, then determines country code through state lookup
Context: Shipper record has been populated with data from either EDI BOL or Fastway sources
GIVEN
Shipper record has been populated with data from either EDI BOL or Fastway sources
Applied to: Validate Shipper Record Data
WHEN
The system performs data validation
THEN
All required shipper fields are validated for completeness and format compliance according to customs requirements
Context: Shipper record has been validated and completed
GIVEN
Shipper record has been validated and completed
Applied to: Store Shipper Record in Array Position 1
WHEN
The system stores the record for customs processing
THEN
The shipper record is stored in WS-GCSCCS55-DATA array at position 1
Context: A new shipper record needs to be created for customs manifest
GIVEN
A new shipper record needs to be created for customs manifest
Applied to: Initialize Shipper Record Structure
WHEN
The system begins building shipper information
THEN
The record is initialized with CCN key, record type '55', and sequence '0001'
Context: A shipper record structure is being initialized
GIVEN
A shipper record structure is being initialized
Applied to: Set Record Type as '55' and Sequence '0001'
WHEN
The system sets record identification parameters
THEN
Record type is set to '55' and sequence number is set to '0001'
Context: A shipper record is being built for customs manifest
GIVEN
A shipper record is being built for customs manifest
Applied to: Check EDI BOL HN Segment Available?
WHEN
The system checks for EDI BOL HN segment availability
THEN
If EDI BOL HN segment is found, use EDI data; otherwise use Fastway data as fallback
Context: EDI BOL HN segment is available with shipper information
GIVEN
EDI BOL HN segment is available with shipper information
Applied to: Extract Shipper Name from EDI BOL
WHEN
The system processes EDI shipper data
THEN
Shipper name is extracted to N102 field, CHOP code to SC301 field, and entity ID is set to 'SH'
Context: Shipper identity has been extracted from EDI BOL
GIVEN
Shipper identity has been extracted from EDI BOL
Applied to: Check EDI BOL HA Address Segment?
WHEN
The system checks for EDI BOL HA address segment
THEN
If HA segment is found, extract address from EDI; otherwise use Fastway address data
Context: Shipper address information has been processed
GIVEN
Shipper address information has been processed
Applied to: Check EDI BOL HC City/State Segment?
WHEN
The system checks for EDI BOL HC city/state segment
THEN
If HC segment is found, extract city/state from EDI; otherwise parse Fastway address data
Context: State or province code has been extracted from address information
GIVEN
State or province code has been extracted from address information
Applied to: Determine Country Code from State Lookup
WHEN
The system performs state-country table lookup
THEN
Corresponding country code is retrieved and assigned to N404 field, or remains blank if not found
Context: Shipper geographic information has been processed
GIVEN
Shipper geographic information has been processed
Applied to: Check EDI BOL GP Contact Segment?
WHEN
The system checks for EDI BOL GP contact segment
THEN
If GP segment is found, extract contact information; otherwise proceed to validation
Context: EDI BOL HN segment is not found or not available
GIVEN
EDI BOL HN segment is not found or not available
Applied to: Use Fastway Shipper Data as Fallback
WHEN
The system needs to build shipper record
THEN
Shipper information is extracted from Fastway shipment root data including name, CHOP code, and address
Context: EDI BOL data is not available and Fastway data is being used
GIVEN
EDI BOL data is not available and Fastway data is being used
Applied to: Extract Shipper Name from Fastway
WHEN
The system processes Fastway shipper information
THEN
Shipper CHOP is extracted to SC301 field, entity ID is set to 'SH', and shipper name is extracted to N102 field
Context: Fastway data is being used for shipper information
GIVEN
Fastway data is being used for shipper information
Applied to: Use Fastway Address Information
WHEN
The system processes Fastway address data
THEN
If shipper address field 1 is blank, 'NA' is used; otherwise the address value is extracted to N301 field, and N302 field is set to spaces
Context: Fastway address data is being processed for geographic information
GIVEN
Fastway address data is being processed for geographic information
Applied to: Parse Fastway City/State Information
WHEN
The system parses shipper address field 2
THEN
City name is extracted to N401 field, state code to N402 field, postal code to N403 field, and country code is determined via state lookup
Context: Shipper record data has been extracted from either EDI or Fastway sources
GIVEN
Shipper record data has been extracted from either EDI or Fastway sources
Applied to: Validate Shipper Record Data
WHEN
The system validates shipper record completeness
THEN
All required fields are checked for presence and validity according to customs manifest requirements
Context: Shipper record has been built and validated successfully
GIVEN
Shipper record has been built and validated successfully
Applied to: Store Shipper Record in Array Position 1
WHEN
The system stores the shipper record
THEN
The complete shipper record is stored in array position 1 of the customs manifest record collection
R-GCX122A-cbl-00447 (+2) File: GCX122A.cbl Retrieve Iron Highway Configuration Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Iron Highway Configuration':
  • Context - a cargo record exists with an origin station number and the system needs iron highway configuration data:
    For Retrieve Iron Highway Configuration - Access IH table using origin station number to get Iron Highway system configuration:
    When the system accesses the ih table using the origin station number as the key, then the iron highway configuration is retrieved if found, otherwise the configuration remains unavailable.
  • Context - the system needs to retrieve iron highway configuration data:
    For Set Function Code to GU - Get Unique:
    When setting up table access parameters, then function code is set to gu for unique record retrieval, table id is set to 'ih', and origin station number is used as the search key.
  • Context - a table lookup has been performed for iron highway configuration:
    For Configuration Found?:
    When the system checks the return status from the table access, then if return flag equals '0' then configuration is available, otherwise configuration is not available.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with an origin station number and the system needs Iron Highway configuration data
GIVEN
A cargo record exists with an origin station number and the system needs Iron Highway configuration data
Applied to: Retrieve Iron Highway Configuration - Access IH table using origin station number to get Iron Highway system configuration
WHEN
The system accesses the IH table using the origin station number as the key
THEN
The Iron Highway configuration is retrieved if found, otherwise the configuration remains unavailable
Context: The system needs to retrieve Iron Highway configuration data
GIVEN
The system needs to retrieve Iron Highway configuration data
Applied to: Set Function Code to GU - Get Unique
WHEN
Setting up table access parameters
THEN
Function code is set to GU for unique record retrieval, table ID is set to 'IH', and origin station number is used as the search key
Context: A table lookup has been performed for Iron Highway configuration
GIVEN
A table lookup has been performed for Iron Highway configuration
Applied to: Configuration Found?
WHEN
The system checks the return status from the table access
THEN
If return flag equals '0' then configuration is available, otherwise configuration is not available
R-GCX122A-cbl-00450 (+11) File: GCX122A.cbl Prepare Iron Highway Transaction Data Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Iron Highway Transaction Data':
  • Context - a cargo record exists with an origin station number:
    For Get Iron Highway Configuration Table:
    When the system needs to prepare iron highway transaction data, then the system looks up the iron highway configuration table using the cargo origin station number as the key.
  • Context - a lookup has been performed on the iron highway configuration table:
    For Configuration Found?:
    When the system checks the lookup result, then if configuration is found (return flag equals '0'), proceed with data mapping, otherwise skip iron highway processing.
  • Context - iron highway configuration has been successfully retrieved:
    For Set Record Type from Configuration:
    When the system prepares the iron highway transaction data structure, then the record type code from the configuration is assigned to the iron highway record type field.
  • Context - a cargo record has a current status value:
    For Map Current Cargo Status:
    When the system prepares iron highway transaction data, then the cargo current status is mapped to the iron highway ccn status field.
  • Context - a cargo record contains an equipment id for indexing:
    For Map Equipment ID for Index:
    When the system prepares iron highway transaction data, then the equipment id for index is mapped to the iron highway car id field.
  • Context - a cargo record has a waybill key for indexing:
    For Map Waybill Key First 15 Characters:
    When the system prepares iron highway transaction data, then the first 15 characters of the waybill key are mapped to the iron highway waybill field.
  • Context - a cargo record has a ccn key identifier:
    For Map Cargo Control Number:
    When the system prepares iron highway transaction data, then the ccn key is mapped to the iron highway ccn field.
  • Context - the system is preparing to process cargo reference numbers:
    For Initialize Reference Counter:
    When iron highway data mapping begins, then the reference number counter is set to zero.
  • Context - cargo record contains multiple reference numbers:
    For Loop Through Reference Numbers:
    When the system processes iron highway data, then the system loops through reference numbers incrementing the counter from 1 to 10.
  • Context - a cargo reference number entry is being processed:
    For Reference Qualifier = 'CN'?:
    When the system checks the reference number qualifier, then if the qualifier equals 'cn', the reference number is identified as a shipment id candidate.
  • Context - a reference number has been identified with 'cn' qualifier:
    For Map Reference Number to Shipment ID:
    When the system maps the reference data, then the reference number value is assigned to the iron highway shipment id field.
  • Context - iron highway transaction data has been completely mapped:
    For Call Iron Highway Interface:
    When all required fields have been populated, then the system calls the gccih program with the iron highway data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with an origin station number
GIVEN
A cargo record exists with an origin station number
Applied to: Get Iron Highway Configuration Table
WHEN
The system needs to prepare Iron Highway transaction data
THEN
The system looks up the Iron Highway configuration table using the cargo origin station number as the key
Context: A lookup has been performed on the Iron Highway configuration table
GIVEN
A lookup has been performed on the Iron Highway configuration table
Applied to: Configuration Found?
WHEN
The system checks the lookup result
THEN
If configuration is found (return flag equals '0'), proceed with data mapping, otherwise skip Iron Highway processing
Context: Iron Highway configuration has been successfully retrieved
GIVEN
Iron Highway configuration has been successfully retrieved
Applied to: Set Record Type from Configuration
WHEN
The system prepares the Iron Highway transaction data structure
THEN
The record type code from the configuration is assigned to the Iron Highway record type field
Context: A cargo record has a current status value
GIVEN
A cargo record has a current status value
Applied to: Map Current Cargo Status
WHEN
The system prepares Iron Highway transaction data
THEN
The cargo current status is mapped to the Iron Highway CCN status field
Context: A cargo record contains an equipment ID for indexing
GIVEN
A cargo record contains an equipment ID for indexing
Applied to: Map Equipment ID for Index
WHEN
The system prepares Iron Highway transaction data
THEN
The equipment ID for index is mapped to the Iron Highway car ID field
Context: A cargo record has a waybill key for indexing
GIVEN
A cargo record has a waybill key for indexing
Applied to: Map Waybill Key First 15 Characters
WHEN
The system prepares Iron Highway transaction data
THEN
The first 15 characters of the waybill key are mapped to the Iron Highway waybill field
Context: A cargo record has a CCN key identifier
GIVEN
A cargo record has a CCN key identifier
Applied to: Map Cargo Control Number
WHEN
The system prepares Iron Highway transaction data
THEN
The CCN key is mapped to the Iron Highway CCN field
Context: The system is preparing to process cargo reference numbers
GIVEN
The system is preparing to process cargo reference numbers
Applied to: Initialize Reference Counter
WHEN
Iron Highway data mapping begins
THEN
The reference number counter is set to zero
Context: Cargo record contains multiple reference numbers
GIVEN
Cargo record contains multiple reference numbers
Applied to: Loop Through Reference Numbers
WHEN
The system processes Iron Highway data
THEN
The system loops through reference numbers incrementing the counter from 1 to 10
Context: A cargo reference number entry is being processed
GIVEN
A cargo reference number entry is being processed
Applied to: Reference Qualifier = 'CN'?
WHEN
The system checks the reference number qualifier
THEN
If the qualifier equals 'CN', the reference number is identified as a shipment ID candidate
Context: A reference number has been identified with 'CN' qualifier
GIVEN
A reference number has been identified with 'CN' qualifier
Applied to: Map Reference Number to Shipment ID
WHEN
The system maps the reference data
THEN
The reference number value is assigned to the Iron Highway shipment ID field
Context: Iron Highway transaction data has been completely mapped
GIVEN
Iron Highway transaction data has been completely mapped
Applied to: Call Iron Highway Interface
WHEN
All required fields have been populated
THEN
The system calls the GCCIH program with the Iron Highway data structure
R-GCCS309C-cbl-00451 (+13) File: GCCS309C.cbl Consignee Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Consignee':
  • Context - a cargo data array gcsccs55 with multiple entity records exists:
    For Get Next Entity Record from GCSCCS55:
    When the system iterates through entity records using ws-sub-rec counter from 1 to maximum sequence gcsccs99-s55-max-seq, then each non-empty entity record is retrieved and processed sequentially.
  • Context - an entity record from the cargo data array is being evaluated:
    For Entity Record Empty?:
    When the entity record data equals spaces or low-values, then the record is considered empty and processing for that record is skipped.
  • Context - a valid entity record needs to be processed:
    For Destination Type Check:
    When the system checks the destination flag 309-destination, then if 309-destination is true, apply 4040 validation rules, otherwise apply 5040 validation rules.
  • Context - the destination type is 4040 and an entity record contains an entity id code:
    For Check Entity Code for 4040 Validity:
    When the entity id code gccs-n101-entity-id-cde is checked against ws-valid-4040-n1 validation table, then the entity is marked as valid if the code exists in the 4040 validation table.
  • Context - the destination type is 5040 and an entity record contains an entity id code:
    For Check Entity Code for 5040 Validity:
    When the entity id code gccs-n101-entity-id-cde is checked against ws-valid-5040-n1 validation table, then the entity is marked as valid if the code exists in the 5040 validation table.
  • Context - a valid 5040 entity record with address information:
    For Address Complete?:
    When the system checks city name, country code, postal code, and state/province code fields, then address is complete if city name and country code are present, and for us/ca countries, postal code and state/province code are also present.
  • Context - an entity record requires consignee-importer address validation:
    For Perform Consignee-Importer Check:
    When the system calls n20625-check-cn-importer procedure, then address mapping and validation logic is applied to ensure complete address information.
  • Context - an entity record has passed validation checks:
    For Process Entity Segments:
    When the entity contains valid data and meets destination requirements, then the system calls n2063-each-n1-n3-n4-per to create transmission segments.
  • Context - an entity record fails validation checks:
    For Skip Invalid Entity:
    When the entity code is not valid for the destination type or address is incomplete, then the system initializes gcsccs55 to clear the record and continues to the next entity.
  • Context - a cargo data array gcsccs55 exists with multiple entity records:
    For Read Entity Record from GCSCCS55:
    When the system processes entity records sequentially, then each non-empty record is loaded into gcsccs55 structure for further processing and empty or low-value records terminate the loop.
  • Context - an entity record is being processed from gcsccs55:
    For Is Entity Code 'CN' - Consignee?:
    When the entity identification code is 'cn', then the entity is identified as a consignee and its address data is stored for potential use in importer address mapping.
    For Is Entity Code 'IM' - Importer?:
    When the entity identification code is 'im', then the entity is identified as an importer and proceeds to address completeness validation.
  • Context - an importer entity record is being processed:
    For Is Importer Address Complete?:
    When the system validates address completeness by checking city name is not spaces and country code is not spaces and for us or ca countries postal code is not spaces and state/province code is not spaces, then if all required fields are present the original importer address is used, otherwise consignee address is copied to replace incomplete importer address.
  • Context - address validation and potential mapping has been completed for an entity:
    For Continue with Address Processing:
    When the system has determined the final address to use, then the entity record proceeds to the address processing workflow with either the original or mapped address data.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo data array GCSCCS55 with multiple entity records exists
GIVEN
A cargo data array GCSCCS55 with multiple entity records exists
Applied to: Get Next Entity Record from GCSCCS55
WHEN
The system iterates through entity records using WS-SUB-REC counter from 1 to maximum sequence GCSCCS99-S55-MAX-SEQ
THEN
Each non-empty entity record is retrieved and processed sequentially
Context: An entity record from the cargo data array is being evaluated
GIVEN
An entity record from the cargo data array is being evaluated
Applied to: Entity Record Empty?
WHEN
The entity record data equals SPACES or LOW-VALUES
THEN
The record is considered empty and processing for that record is skipped
Context: A valid entity record needs to be processed
GIVEN
A valid entity record needs to be processed
Applied to: Destination Type Check
WHEN
The system checks the destination flag 309-DESTINATION
THEN
If 309-DESTINATION is true, apply 4040 validation rules, otherwise apply 5040 validation rules
Context: The destination type is 4040 and an entity record contains an entity ID code
GIVEN
The destination type is 4040 and an entity record contains an entity ID code
Applied to: Check Entity Code for 4040 Validity
WHEN
The entity ID code GCCS-N101-ENTITY-ID-CDE is checked against WS-VALID-4040-N1 validation table
THEN
The entity is marked as valid if the code exists in the 4040 validation table
Context: The destination type is 5040 and an entity record contains an entity ID code
GIVEN
The destination type is 5040 and an entity record contains an entity ID code
Applied to: Check Entity Code for 5040 Validity
WHEN
The entity ID code GCCS-N101-ENTITY-ID-CDE is checked against WS-VALID-5040-N1 validation table
THEN
The entity is marked as valid if the code exists in the 5040 validation table
Context: A valid 5040 entity record with address information
GIVEN
A valid 5040 entity record with address information
Applied to: Address Complete?
WHEN
The system checks city name, country code, postal code, and state/province code fields
THEN
Address is complete if city name and country code are present, and for US/CA countries, postal code and state/province code are also present
Context: An entity record requires consignee-importer address validation
GIVEN
An entity record requires consignee-importer address validation
Applied to: Perform Consignee-Importer Check
WHEN
The system calls N20625-CHECK-CN-IMPORTER procedure
THEN
Address mapping and validation logic is applied to ensure complete address information
Context: An entity record has passed validation checks
GIVEN
An entity record has passed validation checks
Applied to: Process Entity Segments
WHEN
The entity contains valid data and meets destination requirements
THEN
The system calls N2063-EACH-N1-N3-N4-PER to create transmission segments
Context: An entity record fails validation checks
GIVEN
An entity record fails validation checks
Applied to: Skip Invalid Entity
WHEN
The entity code is not valid for the destination type or address is incomplete
THEN
The system initializes GCSCCS55 to clear the record and continues to the next entity
Context: A cargo data array GCSCCS55 exists with multiple entity records
GIVEN
A cargo data array GCSCCS55 exists with multiple entity records
Applied to: Read Entity Record from GCSCCS55
WHEN
The system processes entity records sequentially
THEN
Each non-empty record is loaded into GCSCCS55 structure for further processing and empty or low-value records terminate the loop
Context: An entity record is being processed from GCSCCS55
GIVEN
An entity record is being processed from GCSCCS55
Applied to: Is Entity Code 'CN' - Consignee?
WHEN
The entity identification code is 'CN'
THEN
The entity is identified as a consignee and its address data is stored for potential use in importer address mapping
Applied to: Is Entity Code 'IM' - Importer?
WHEN
The entity identification code is 'IM'
THEN
The entity is identified as an importer and proceeds to address completeness validation
Context: An importer entity record is being processed
GIVEN
An importer entity record is being processed
Applied to: Is Importer Address Complete?
WHEN
The system validates address completeness by checking city name is not spaces AND country code is not spaces AND for US or CA countries postal code is not spaces AND state/province code is not spaces
THEN
If all required fields are present the original importer address is used, otherwise consignee address is copied to replace incomplete importer address
Context: Address validation and potential mapping has been completed for an entity
GIVEN
Address validation and potential mapping has been completed for an entity
Applied to: Continue with Address Processing
WHEN
The system has determined the final address to use
THEN
The entity record proceeds to the address processing workflow with either the original or mapped address data
R-GCCS309C-cbl-00460 (+9) File: GCCS309C.cbl Complete Address Validation Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Complete Address Validation':
  • Context - an entity with identification code exists in the manifest data:
    For Check 4040 N1 Code Validity:
    When the destination type is 4040, then the system validates the entity code against the 4040 n1 code validity table.
    For Check 5040 N1 Code Validity:
    When the destination type is 5040, then the system validates the entity code against the 5040 n1 code validity table.
  • Context - an entity identification code has been checked against the appropriate validation table:
    For Valid N1 Code?:
    When the code validation is performed, then the system either accepts the code as valid or rejects it as invalid.
  • Context - an entity address record with city name field:
    For City Name Present?:
    When the address validation is performed, then the system checks if the city name field contains a non-empty value.
  • Context - an entity address record with country code field:
    For Country Code Present?:
    When the address validation is performed, then the system checks if the country code field contains a non-empty value.
  • Context - an entity address with a country code:
    For Country is US or CA?:
    When the country code is either 'us' or 'ca', then the system applies stricter validation rules requiring postal code and state/province code.
  • Context - an entity address in the united states or canada:
    For Postal Code Present?:
    When the postal code validation is performed, then the system requires a non-empty postal code value.
    For State/Province Code Present?:
    When the state/province code validation is performed, then the system requires a non-empty state or province code value.
  • Context - an entity address that has passed all required validations:
    For Accept Complete Address:
    When all validation checks are successful, then the system processes the entity address data for transmission.
  • Context - an entity address that fails one or more validation checks:
    For Reject Incomplete Address:
    When any required field is missing or invalid, then the system initializes the address data to empty values and excludes it from processing.
👨‍💻 Technical ACs (Gherkin)
Context: An entity with identification code exists in the manifest data
GIVEN
An entity with identification code exists in the manifest data
Applied to: Check 4040 N1 Code Validity
WHEN
The destination type is 4040
THEN
The system validates the entity code against the 4040 N1 code validity table
Applied to: Check 5040 N1 Code Validity
WHEN
The destination type is 5040
THEN
The system validates the entity code against the 5040 N1 code validity table
Context: An entity identification code has been checked against the appropriate validation table
GIVEN
An entity identification code has been checked against the appropriate validation table
Applied to: Valid N1 Code?
WHEN
The code validation is performed
THEN
The system either accepts the code as valid or rejects it as invalid
Context: An entity address record with city name field
GIVEN
An entity address record with city name field
Applied to: City Name Present?
WHEN
The address validation is performed
THEN
The system checks if the city name field contains a non-empty value
Context: An entity address record with country code field
GIVEN
An entity address record with country code field
Applied to: Country Code Present?
WHEN
The address validation is performed
THEN
The system checks if the country code field contains a non-empty value
Context: An entity address with a country code
GIVEN
An entity address with a country code
Applied to: Country is US or CA?
WHEN
The country code is either 'US' or 'CA'
THEN
The system applies stricter validation rules requiring postal code and state/province code
Context: An entity address in the United States or Canada
GIVEN
An entity address in the United States or Canada
Applied to: Postal Code Present?
WHEN
The postal code validation is performed
THEN
The system requires a non-empty postal code value
Applied to: State/Province Code Present?
WHEN
The state/province code validation is performed
THEN
The system requires a non-empty state or province code value
Context: An entity address that has passed all required validations
GIVEN
An entity address that has passed all required validations
Applied to: Accept Complete Address
WHEN
All validation checks are successful
THEN
The system processes the entity address data for transmission
Context: An entity address that fails one or more validation checks
GIVEN
An entity address that fails one or more validation checks
Applied to: Reject Incomplete Address
WHEN
Any required field is missing or invalid
THEN
The system initializes the address data to empty values and excludes it from processing
R-GCCCCADD-cbl-00469 (+28) File: GCCCCADD.cbl Consignee Record Building Merged 29 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Consignee Record Building':
  • Context - a consignee record needs to be created:
    For Initialize Consignee Record Structure:
    When the system begins consignee record building process, then the system initializes the consignee record structure, sets record type to '55', and assigns sequence number '0002'.
  • Context - an edi bol key exists for the shipment:
    For Search for EDI BOL Consignee Data CN Segment:
    When the system searches for consignee name data in edi bol cn segment type '01', then the system sets the consignee data found flag based on whether the cn segment exists.
    For Search for EDI BOL Consignee Data:
    When the system searches for consignee data in edi bol, then the system retrieves consignee segment 'cn' with sequence '01' from edi bol data.
  • Context - edi bol cn segment data is found for the shipment:
    For Extract Consignee Name and CHOP from EDI:
    When the system processes the consignee name information, then the system sets entity id to 'cn', extracts shipper name to consignee name field, and sets the consignee chop code.
  • Context - edi bol consignee name data has been found:
    For Search for EDI Address Data CA Segment:
    When the system searches for address data in edi bol ca segment for consignee type, then the system sets the address data found flag based on whether the ca segment exists.
  • Context - edi bol ca segment address data is found:
    For Extract Address from EDI BOL:
    When the system processes the address information, then the system extracts address line 1 and 2, and if address line 1 is blank, sets it to 'na'.
  • Context - edi bol ca segment address data is not found:
    For Use Fastway Address Data:
    When the system needs address information for the consignee, then the system uses consignee address from fastway data and if blank, sets address line 1 to 'na' and clears address line 2.
  • Context - address information has been processed for the consignee:
    For Search for EDI City/State Data CC Segment:
    When the system searches for city/state data in edi bol cc segment for consignee type, then the system sets the city/state data found flag based on whether the cc segment exists.
  • Context - edi bol cc segment city/state data is found:
    For Extract City/State/Postal/Country from EDI:
    When the system processes the geographic information, then the system extracts city name, state/province code, postal code, and country code from the edi data.
  • Context - edi bol cc segment city/state data is not found:
    For Use Fastway City/State Data:
    When the system needs geographic information for the consignee, then the system parses fastway consignee address data to extract city, state/province, postal code, and determines country from state lookup table.
  • Context - geographic information has been processed for the consignee:
    For Search for EDI Contact Data GP Segment:
    When the system searches for contact data in edi bol gp segment for consignee type, then the system sets the contact data found flag based on whether the gp segment exists.
  • Context - edi bol gp segment contact data is found:
    For Extract Contact Information from EDI:
    When the system processes the contact information, then the system extracts contact function code, contact name, communication number qualifier, and communication number from the edi data.
  • Context - edi bol cn segment consignee data is not found:
    For Use Fastway Consignee Data:
    When the system needs consignee information, then the system uses consignee chop code, sets entity id to 'cn', and extracts consignee name from fastway shipment data.
  • Context - all consignee data has been extracted from available sources:
    For Validate Consignee Record Data:
    When the system validates the consignee record, then the system performs n1 segment validation including entity id, name, address, city/state/postal/country, and contact information validation.
  • Context - the consignee record has been validated successfully:
    For Store Consignee Record in Array Position 2:
    When the system completes consignee record building, then the system stores the consignee record in array position 2 of the record 55 data structure.
  • Context - a consignee record needs to be built:
    For Initialize Consignee Record Structure:
    When the system starts consignee record building process, then the system initializes the consignee record structure, sets record type to '55', and assigns sequence number '0002' for consignee data.
  • Context - edi bol consignee segment is found:
    For Extract Consignee Name from EDI BOL:
    When the system processes the consignee segment data, then the system sets entity id to 'cn', extracts shipper name as consignee name, and extracts consignee chop code.
  • Context - edi bol consignee data exists:
    For Search for EDI BOL Address Data:
    When the system searches for address information, then the system retrieves address segment 'ca' with sequence '01' for the consignee.
    For Search for EDI BOL City/State Data:
    When the system searches for city/state information, then the system retrieves city/state segment 'cc' with sequence '01' for the consignee.
    For Search for EDI BOL Contact Data:
    When the system searches for contact information, then the system retrieves contact segment 'gp' with sequence '01' for the consignee.
  • Context - edi bol address segment is found:
    For Extract Address from EDI BOL:
    When the system processes the address segment, then the system extracts additional name/address line 1 and additional name/address line 2 from the edi bol data.
  • Context - edi bol address segment is not found:
    For Use Fastway Address Data:
    When the system needs address information for consignee, then the system uses consignee address from fastway shipment root data element 3.
  • Context - edi bol city/state segment is found:
    For Extract City/State/Postal from EDI BOL:
    When the system processes the city/state segment, then the system extracts city name, state/province code, postal code, and country code from the edi bol data.
  • Context - edi bol city/state segment is not found:
    For Use Fastway City/State Data:
    When the system needs geographic information for consignee, then the system parses city name, state/province code, postal code, and determines country code from fastway consignee data element 4.
  • Context - edi bol contact segment is found:
    For Extract Contact Information from EDI BOL:
    When the system processes the contact segment, then the system extracts contact function code, contact name, communication number qualifier, and communication number from the edi bol data.
  • Context - edi bol consignee segment is not found:
    For Use Fastway Consignee Data:
    When the system needs consignee information, then the system sets entity id to 'cn', uses consignee chop code, and extracts consignee name from fastway shipment root data element 1.
  • Context - consignee address information is missing or incomplete:
    For Set Default Address if Missing:
    When the system validates address data, then the system sets address line 1 to 'na' if missing and sets address line 2 to 'na' if missing or contains only one character followed by spaces.
  • Context - consignee record data has been populated:
    For Validate Consignee Record Data:
    When the system validates the consignee record, then the system validates entity id, name, address, city/state/postal, and contact information according to customs requirements.
  • Context - consignee record has been validated and completed:
    For Store Consignee Record in Array Position 2:
    When the system stores the consignee record, then the system places the consignee record in array position 2 of the customs record structure.
👨‍💻 Technical ACs (Gherkin)
Context: A consignee record needs to be created
GIVEN
A consignee record needs to be created
Applied to: Initialize Consignee Record Structure
WHEN
The system begins consignee record building process
THEN
The system initializes the consignee record structure, sets record type to '55', and assigns sequence number '0002'
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Search for EDI BOL Consignee Data CN Segment
WHEN
The system searches for consignee name data in EDI BOL CN segment type '01'
THEN
The system sets the consignee data found flag based on whether the CN segment exists
Applied to: Search for EDI BOL Consignee Data
WHEN
The system searches for consignee data in EDI BOL
THEN
The system retrieves consignee segment 'CN' with sequence '01' from EDI BOL data
Context: EDI BOL CN segment data is found for the shipment
GIVEN
EDI BOL CN segment data is found for the shipment
Applied to: Extract Consignee Name and CHOP from EDI
WHEN
The system processes the consignee name information
THEN
The system sets entity ID to 'CN', extracts shipper name to consignee name field, and sets the consignee CHOP code
Context: EDI BOL consignee name data has been found
GIVEN
EDI BOL consignee name data has been found
Applied to: Search for EDI Address Data CA Segment
WHEN
The system searches for address data in EDI BOL CA segment for consignee type
THEN
The system sets the address data found flag based on whether the CA segment exists
Context: EDI BOL CA segment address data is found
GIVEN
EDI BOL CA segment address data is found
Applied to: Extract Address from EDI BOL
WHEN
The system processes the address information
THEN
The system extracts address line 1 and 2, and if address line 1 is blank, sets it to 'NA'
Context: EDI BOL CA segment address data is not found
GIVEN
EDI BOL CA segment address data is not found
Applied to: Use Fastway Address Data
WHEN
The system needs address information for the consignee
THEN
The system uses consignee address from Fastway data and if blank, sets address line 1 to 'NA' and clears address line 2
Context: Address information has been processed for the consignee
GIVEN
Address information has been processed for the consignee
Applied to: Search for EDI City/State Data CC Segment
WHEN
The system searches for city/state data in EDI BOL CC segment for consignee type
THEN
The system sets the city/state data found flag based on whether the CC segment exists
Context: EDI BOL CC segment city/state data is found
GIVEN
EDI BOL CC segment city/state data is found
Applied to: Extract City/State/Postal/Country from EDI
WHEN
The system processes the geographic information
THEN
The system extracts city name, state/province code, postal code, and country code from the EDI data
Context: EDI BOL CC segment city/state data is not found
GIVEN
EDI BOL CC segment city/state data is not found
Applied to: Use Fastway City/State Data
WHEN
The system needs geographic information for the consignee
THEN
The system parses Fastway consignee address data to extract city, state/province, postal code, and determines country from state lookup table
Context: Geographic information has been processed for the consignee
GIVEN
Geographic information has been processed for the consignee
Applied to: Search for EDI Contact Data GP Segment
WHEN
The system searches for contact data in EDI BOL GP segment for consignee type
THEN
The system sets the contact data found flag based on whether the GP segment exists
Context: EDI BOL GP segment contact data is found
GIVEN
EDI BOL GP segment contact data is found
Applied to: Extract Contact Information from EDI
WHEN
The system processes the contact information
THEN
The system extracts contact function code, contact name, communication number qualifier, and communication number from the EDI data
Context: EDI BOL CN segment consignee data is not found
GIVEN
EDI BOL CN segment consignee data is not found
Applied to: Use Fastway Consignee Data
WHEN
The system needs consignee information
THEN
The system uses consignee CHOP code, sets entity ID to 'CN', and extracts consignee name from Fastway shipment data
Context: All consignee data has been extracted from available sources
GIVEN
All consignee data has been extracted from available sources
Applied to: Validate Consignee Record Data
WHEN
The system validates the consignee record
THEN
The system performs N1 segment validation including entity ID, name, address, city/state/postal/country, and contact information validation
Context: The consignee record has been validated successfully
GIVEN
The consignee record has been validated successfully
Applied to: Store Consignee Record in Array Position 2
WHEN
The system completes consignee record building
THEN
The system stores the consignee record in array position 2 of the record 55 data structure
Context: A consignee record needs to be built
GIVEN
A consignee record needs to be built
Applied to: Initialize Consignee Record Structure
WHEN
The system starts consignee record building process
THEN
The system initializes the consignee record structure, sets record type to '55', and assigns sequence number '0002' for consignee data
Context: EDI BOL consignee segment is found
GIVEN
EDI BOL consignee segment is found
Applied to: Extract Consignee Name from EDI BOL
WHEN
The system processes the consignee segment data
THEN
The system sets entity ID to 'CN', extracts shipper name as consignee name, and extracts consignee CHOP code
Context: EDI BOL consignee data exists
GIVEN
EDI BOL consignee data exists
Applied to: Search for EDI BOL Address Data
WHEN
The system searches for address information
THEN
The system retrieves address segment 'CA' with sequence '01' for the consignee
Applied to: Search for EDI BOL City/State Data
WHEN
The system searches for city/state information
THEN
The system retrieves city/state segment 'CC' with sequence '01' for the consignee
Applied to: Search for EDI BOL Contact Data
WHEN
The system searches for contact information
THEN
The system retrieves contact segment 'GP' with sequence '01' for the consignee
Context: EDI BOL address segment is found
GIVEN
EDI BOL address segment is found
Applied to: Extract Address from EDI BOL
WHEN
The system processes the address segment
THEN
The system extracts additional name/address line 1 and additional name/address line 2 from the EDI BOL data
Context: EDI BOL address segment is not found
GIVEN
EDI BOL address segment is not found
Applied to: Use Fastway Address Data
WHEN
The system needs address information for consignee
THEN
The system uses consignee address from Fastway shipment root data element 3
Context: EDI BOL city/state segment is found
GIVEN
EDI BOL city/state segment is found
Applied to: Extract City/State/Postal from EDI BOL
WHEN
The system processes the city/state segment
THEN
The system extracts city name, state/province code, postal code, and country code from the EDI BOL data
Context: EDI BOL city/state segment is not found
GIVEN
EDI BOL city/state segment is not found
Applied to: Use Fastway City/State Data
WHEN
The system needs geographic information for consignee
THEN
The system parses city name, state/province code, postal code, and determines country code from Fastway consignee data element 4
Context: EDI BOL contact segment is found
GIVEN
EDI BOL contact segment is found
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes the contact segment
THEN
The system extracts contact function code, contact name, communication number qualifier, and communication number from the EDI BOL data
Context: EDI BOL consignee segment is not found
GIVEN
EDI BOL consignee segment is not found
Applied to: Use Fastway Consignee Data
WHEN
The system needs consignee information
THEN
The system sets entity ID to 'CN', uses consignee CHOP code, and extracts consignee name from Fastway shipment root data element 1
Context: Consignee address information is missing or incomplete
GIVEN
Consignee address information is missing or incomplete
Applied to: Set Default Address if Missing
WHEN
The system validates address data
THEN
The system sets address line 1 to 'NA' if missing and sets address line 2 to 'NA' if missing or contains only one character followed by spaces
Context: Consignee record data has been populated
GIVEN
Consignee record data has been populated
Applied to: Validate Consignee Record Data
WHEN
The system validates the consignee record
THEN
The system validates entity ID, name, address, city/state/postal, and contact information according to customs requirements
Context: Consignee record has been validated and completed
GIVEN
Consignee record has been validated and completed
Applied to: Store Consignee Record in Array Position 2
WHEN
The system stores the consignee record
THEN
The system places the consignee record in array position 2 of the customs record structure
R-GCCS309C-cbl-00470 File: GCCS309C.cbl CSA Indicator Processing
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Indicator Processing':
  • Context - a manifest record with csa indicator status and both from-station and to-station transaction codes available:
    For CSA Indicator Processing:
    When the system processes r4 port function code 4 segment for destination border crossing, then if csa indicator is on, use the from-station transaction code as the location identifier, otherwise use the to-station transaction code as the location identifier.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest record with CSA indicator status and both from-station and to-station transaction codes available
GIVEN
A manifest record with CSA indicator status and both from-station and to-station transaction codes available
Applied to: CSA Indicator Processing
WHEN
The system processes R4 port function code 4 segment for destination border crossing
THEN
If CSA indicator is ON, use the from-station transaction code as the location identifier, otherwise use the to-station transaction code as the location identifier
R-GCCS309C-cbl-00471 (+11) File: GCCS309C.cbl Follower Car Database Iteration Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Follower Car Database Iteration':
  • Context - a manifest contains idler shipment cars that need to be processed:
    For Initialize End-of-Followers Flag to Spaces:
    When the system begins follower car iteration processing, then the end-of-followers flag is set to spaces to indicate processing has not completed.
  • Context - a manifest ccn key exists for the current shipment:
    For Set CCN Key for Database Search:
    When the system needs to search for associated follower cars, then the ccn key is set as the database search parameter for follower car retrieval.
  • Context - the system is ready to begin follower car database access:
    For Set Database Function to GU - Get Unique:
    When starting the follower car retrieval process, then the database function is set to gu (get unique) to retrieve the first matching record.
  • Context - database search parameters and function are properly set:
    For Call Database Access Function:
    When the system executes the database access call, then the database operation is performed to retrieve follower car data.
  • Context - a database access operation has been executed for follower cars:
    For Database Status OK?:
    When the database operation fails or reaches end of file, then the end-of-followers flag is set to 'y' to terminate processing.
  • Context - the first follower car record has been successfully retrieved:
    For Change Function to GN - Get Next:
    When the system needs to continue processing additional follower cars, then the database function is changed to gn (get next) for sequential record retrieval.
  • Context - the system is in the middle of follower car processing:
    For End of Followers?:
    When checking if more follower cars need to be processed, then processing terminates if the end-of-followers flag indicates completion, otherwise continues.
  • Context - a follower car record has been retrieved from the database:
    For Is Follower Manifest Car?:
    When the system evaluates if the car should be included in manifest processing, then the car is processed for manifest segments if it qualifies as a follower manifest car, otherwise it is skipped.
  • Context - a follower car qualifies for manifest processing:
    For Process VID Segment for Follower:
    When the system processes vehicle information for the follower car, then a vid segment is generated containing the follower car's equipment details.
  • Context - a follower car has been processed for vehicle information:
    For Process N10 Description for Follower:
    When the system processes description and quantity information for the follower car, then an n10 segment is generated containing the follower car's cargo description and quantity details.
  • Context - a follower car has been processed for basic manifest information:
    For Hazardous Material Present?:
    When the system checks for hazardous material indicators, then hazmat processing is performed if un number exists and is not 'na', and commodity danger description is present, otherwise hazmat processing is skipped.
  • Context - a follower car contains hazardous materials:
    For Process H1-H2 Hazmat for Follower:
    When the system processes hazardous material information for the follower car, then h1 and h2 segments are generated containing the follower car's hazardous material classification and description.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest contains idler shipment cars that need to be processed
GIVEN
A manifest contains idler shipment cars that need to be processed
Applied to: Initialize End-of-Followers Flag to Spaces
WHEN
The system begins follower car iteration processing
THEN
The end-of-followers flag is set to spaces to indicate processing has not completed
Context: A manifest CCN key exists for the current shipment
GIVEN
A manifest CCN key exists for the current shipment
Applied to: Set CCN Key for Database Search
WHEN
The system needs to search for associated follower cars
THEN
The CCN key is set as the database search parameter for follower car retrieval
Context: The system is ready to begin follower car database access
GIVEN
The system is ready to begin follower car database access
Applied to: Set Database Function to GU - Get Unique
WHEN
Starting the follower car retrieval process
THEN
The database function is set to GU (Get Unique) to retrieve the first matching record
Context: Database search parameters and function are properly set
GIVEN
Database search parameters and function are properly set
Applied to: Call Database Access Function
WHEN
The system executes the database access call
THEN
The database operation is performed to retrieve follower car data
Context: A database access operation has been executed for follower cars
GIVEN
A database access operation has been executed for follower cars
Applied to: Database Status OK?
WHEN
The database operation fails or reaches end of file
THEN
The end-of-followers flag is set to 'Y' to terminate processing
Context: The first follower car record has been successfully retrieved
GIVEN
The first follower car record has been successfully retrieved
Applied to: Change Function to GN - Get Next
WHEN
The system needs to continue processing additional follower cars
THEN
The database function is changed to GN (Get Next) for sequential record retrieval
Context: The system is in the middle of follower car processing
GIVEN
The system is in the middle of follower car processing
Applied to: End of Followers?
WHEN
Checking if more follower cars need to be processed
THEN
Processing terminates if the end-of-followers flag indicates completion, otherwise continues
Context: A follower car record has been retrieved from the database
GIVEN
A follower car record has been retrieved from the database
Applied to: Is Follower Manifest Car?
WHEN
The system evaluates if the car should be included in manifest processing
THEN
The car is processed for manifest segments if it qualifies as a follower manifest car, otherwise it is skipped
Context: A follower car qualifies for manifest processing
GIVEN
A follower car qualifies for manifest processing
Applied to: Process VID Segment for Follower
WHEN
The system processes vehicle information for the follower car
THEN
A VID segment is generated containing the follower car's equipment details
Context: A follower car has been processed for vehicle information
GIVEN
A follower car has been processed for vehicle information
Applied to: Process N10 Description for Follower
WHEN
The system processes description and quantity information for the follower car
THEN
An N10 segment is generated containing the follower car's cargo description and quantity details
Context: A follower car has been processed for basic manifest information
GIVEN
A follower car has been processed for basic manifest information
Applied to: Hazardous Material Present?
WHEN
The system checks for hazardous material indicators
THEN
Hazmat processing is performed if UN number exists and is not 'NA', and commodity danger description is present, otherwise hazmat processing is skipped
Context: A follower car contains hazardous materials
GIVEN
A follower car contains hazardous materials
Applied to: Process H1-H2 Hazmat for Follower
WHEN
The system processes hazardous material information for the follower car
THEN
H1 and H2 segments are generated containing the follower car's hazardous material classification and description
R-GCX122A-cbl-00471 (+11) File: GCX122A.cbl Send AEI Status Message Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send AEI Status Message':
  • Context - a train record requires aei status notification and has a port code:
    For Retrieve Email Recipients by Port Code:
    When the system looks up email recipients using the port code from the train's position port, then the system retrieves the customer email list for that port code.
  • Context - the system has attempted to retrieve email recipients by port code:
    For Recipients Found?:
    When the email lookup returns a success status, then the system uses the retrieved email recipient list for aei notification.
  • Context - email recipients were successfully retrieved from the customer email table:
    For Use Retrieved Email List:
    When the system prepares the aei notification, then the system populates up to 10 email recipient addresses from the retrieved list and sets default merlin id as sender.
  • Context - email recipient lookup failed or returned no results:
    For Use Default Merlin ID:
    When the system prepares the aei notification, then the system sets default merlin id as both sender and first recipient.
  • Context - a train record requires aei status notification with valid train id and status:
    For Format Status Message with Train ID and Status:
    When the system formats the aei message, then the system creates a subject line containing 'train: ' followed by the canadian customs train id, ' status: ' followed by the current train status.
  • Context - aei message is formatted with recipients, sender, and status information:
    For Send AEI Message to Recipients:
    When the system sends the aei notification, then the system calls the email messaging service with formatted message details and item width of 080.
  • Context - the system has attempted to send the primary aei notification:
    For Send Successful?:
    When the email messaging service returns a status, then the system checks if the return status flag indicates successful delivery.
  • Context - the primary aei notification was sent successfully:
    For AEI Message Sent Successfully:
    When the system completes aei processing, then the system purges the message queue and continues normal processing.
  • Context - the primary aei notification send failed:
    For Send to Default Recipients OM01247 and AEI9999:
    When the system attempts fallback notification, then the system clears recipient list and sends notification to om01247 as first recipient and aei9999 as second recipient.
  • Context - the system has attempted to send aei notification to fallback recipients:
    For Fallback Send Successful?:
    When the email messaging service returns a status for the fallback attempt, then the system checks if the return status flag indicates successful delivery.
  • Context - both primary and fallback aei notification sends have failed:
    For Log Send Failure Error:
    When the system handles the send failure, then the system logs error message 'send to file of om01247 failed' and calls error handling routine.
  • Context - a database error occurred during email recipient lookup:
    For Complete AEI Processing:
    When the system completes aei processing, then the system sends database error notification to support team with sql error code details.
👨‍💻 Technical ACs (Gherkin)
Context: A train record requires AEI status notification and has a port code
GIVEN
A train record requires AEI status notification and has a port code
Applied to: Retrieve Email Recipients by Port Code
WHEN
The system looks up email recipients using the port code from the train's position port
THEN
The system retrieves the customer email list for that port code
Context: The system has attempted to retrieve email recipients by port code
GIVEN
The system has attempted to retrieve email recipients by port code
Applied to: Recipients Found?
WHEN
The email lookup returns a success status
THEN
The system uses the retrieved email recipient list for AEI notification
Context: Email recipients were successfully retrieved from the customer email table
GIVEN
Email recipients were successfully retrieved from the customer email table
Applied to: Use Retrieved Email List
WHEN
The system prepares the AEI notification
THEN
The system populates up to 10 email recipient addresses from the retrieved list and sets default Merlin ID as sender
Context: Email recipient lookup failed or returned no results
GIVEN
Email recipient lookup failed or returned no results
Applied to: Use Default Merlin ID
WHEN
The system prepares the AEI notification
THEN
The system sets default Merlin ID as both sender and first recipient
Context: A train record requires AEI status notification with valid train ID and status
GIVEN
A train record requires AEI status notification with valid train ID and status
Applied to: Format Status Message with Train ID and Status
WHEN
The system formats the AEI message
THEN
The system creates a subject line containing 'TRAIN: ' followed by the Canadian customs train ID, ' STATUS: ' followed by the current train status
Context: AEI message is formatted with recipients, sender, and status information
GIVEN
AEI message is formatted with recipients, sender, and status information
Applied to: Send AEI Message to Recipients
WHEN
The system sends the AEI notification
THEN
The system calls the email messaging service with formatted message details and item width of 080
Context: The system has attempted to send the primary AEI notification
GIVEN
The system has attempted to send the primary AEI notification
Applied to: Send Successful?
WHEN
The email messaging service returns a status
THEN
The system checks if the return status flag indicates successful delivery
Context: The primary AEI notification was sent successfully
GIVEN
The primary AEI notification was sent successfully
Applied to: AEI Message Sent Successfully
WHEN
The system completes AEI processing
THEN
The system purges the message queue and continues normal processing
Context: The primary AEI notification send failed
GIVEN
The primary AEI notification send failed
Applied to: Send to Default Recipients OM01247 and AEI9999
WHEN
The system attempts fallback notification
THEN
The system clears recipient list and sends notification to OM01247 as first recipient and AEI9999 as second recipient
Context: The system has attempted to send AEI notification to fallback recipients
GIVEN
The system has attempted to send AEI notification to fallback recipients
Applied to: Fallback Send Successful?
WHEN
The email messaging service returns a status for the fallback attempt
THEN
The system checks if the return status flag indicates successful delivery
Context: Both primary and fallback AEI notification sends have failed
GIVEN
Both primary and fallback AEI notification sends have failed
Applied to: Log Send Failure Error
WHEN
The system handles the send failure
THEN
The system logs error message 'SEND TO FILE OF OM01247 FAILED' and calls error handling routine
Context: A database error occurred during email recipient lookup
GIVEN
A database error occurred during email recipient lookup
Applied to: Complete AEI Processing
WHEN
The system completes AEI processing
THEN
The system sends database error notification to support team with SQL error code details
R-GCCCCADD-cbl-00483 (+24) File: GCCCCADD.cbl N1 Entity Segment Building Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1 Entity Segment Building':
  • Context - an edi bol contains stuffer entity data with type pn:
    For Build SF Stuffer Entity Segment:
    When the system processes the stuffer entity segment, then the system creates an sf entity record with name, address, city, state, postal code, country, and contact information from the edi data.
  • Context - an edi bol contains ultimate consignee entity data with type un:
    For Build UC Ultimate Consignee Segment:
    When the system processes the ultimate consignee entity segment, then the system creates a uc entity record with name, address, city, state, postal code, country, and contact information from the edi data, defaulting address to 'na' if not provided.
  • Context - an edi bol contains beneficial owner entity data with type bn and organization id bn:
    For Build BN Beneficial Owner Segment:
    When the system processes the beneficial owner entity segment, then the system creates a bn entity record with name, consignee chop code, address, city, state, postal code, and country information from the edi data.
  • Context - an edi bol contains transportation data with organization id c1:
    For Build C1 Carrier Entity Segment:
    When the system processes the carrier entity segment from edi, then the system creates a c1 entity record with organization id, name, address, city, state, postal code, country, and contact information from the edi transportation data.
  • Context - no edi transportation data exists for c1 organization id and the consignee data code in fastway shipment data equals 'c':
    For Build C1 Carrier Entity Segment:
    When the system processes the carrier entity segment from fastway, then the system creates a c1 entity record using consignee data from fastway shipment with name, address, city, state, postal code, and country information.
  • Context - an edi bol contains transportation data with organization id n1:
    For Build N1 Notify Party Segment:
    When the system processes the notify party entity segment, then the system creates an n1 entity record with organization id, name, address, city, state, postal code, country, and contact information from the edi transportation data.
  • Context - an edi bol contains mcoa segment data with organization id of pf or ss:
    For Build PF/SS Entity Segments from MCOA:
    When the system processes the mcoa entity segment, then the system creates a pf or ss entity record with organization id, name, id code qualifier, id code, address, city, state, postal code, and country information from the mcoa data, defaulting address to 'na' if not provided.
  • Context - an edi bol contains transportation data with organization ids 11, mc, oo, or fw:
    For Build Additional Entity Segments:
    When the system processes each additional entity segment type, then the system creates entity records for each found organization type with organization id, name, address, city, state, postal code, country, and contact information from the edi transportation data.
  • Context - an edi bol contains named entity data with type nn and the entity id code is valid according to predefined entity id values:
    For Build NN Entity Segments:
    When the system processes the named entity segment, then the system creates an nn entity record with entity id code, name, consignee chop code, address, city, state, postal code, and country information from the edi data.
  • Context - an n1 entity segment is being processed:
    For Validate All N1 Segments:
    When the address information is validated, then the system sets address line 1 to 'na' if it is spaces or low-values, and ensures all address components are properly populated.
  • Context - a validated n1 entity segment exists and the sequence index is within the maximum allowed range:
    For Store N1 Segments in Database:
    When the system stores the entity segment, then the system assigns the ccn key, record type 55, current sequence number, and stores the segment data in the database array.
  • Context - edi bol data is available for processing:
    For Build SF Stuffer Entity Segment:
    When sf entity data is found in edi bol segments with entity type 'pn', then extract sf entity name, address, city, state, postal code, country code and contact information to create sf segment with entity id 'sf'.
    For Build UC Ultimate Consignee Segment:
    When uc entity data is found in edi bol segments with entity type 'un', then extract uc entity name, address, city, state, postal code, country code and contact information to create uc segment with entity id 'uc', defaulting address to 'na' if not provided.
  • Context - edi bol data is available for processing and organization id is set to 'bn':
    For Build BN Beneficial Owner Segment:
    When bn entity data is found in edi bol segments with entity type 'bn', then extract bn entity name from u1-name field, address from bt segments, city/state/postal/country from by segments to create bn segment with entity id 'bn', defaulting address to 'na' if not provided.
  • Context - edi bol data is available for processing and organization id is set to 'c1':
    For Build C1 Carrier Entity Segment:
    When c1 entity data is found in edi bol transportation segments or consignee data code in fastway equals 'c', then extract c1 entity information from edi tn/t2/ta/t3 segments or from fastway consignee data to create c1 segment with entity id 'c1', including name, address, city, state, postal code, country and contact information.
  • Context - edi bol data is available for processing and organization id is set to 'n1':
    For Build N1 Notify Party Segment:
    When n1 entity data is found in edi bol transportation segments, then extract n1 entity information from edi tn/t2/ta/t3 segments to create n1 segment with entity id 'n1', including name, address, city, state, postal code, country and contact information.
  • Context - edi bol mcoa segments are available for processing:
    For Build PF/SS Entity Segments from MCOA:
    When mcoa segment is found with organization id equal to 'pf' or 'ss', then extract entity name, id code qualifier, id code from f5 fields and address information from on/oc segments to create pf or ss segment, defaulting address to 'na' if not provided.
  • Context - edi bol transportation segments are available for processing:
    For Build Additional Entity Segments:
    When transportation segment is found with organization id matching '11', 'mc', 'oo', or 'fw', then extract entity information from tn/t2/ta/t3 segments to create corresponding entity segment with matching organization id, including name, address, city, state, postal code, country and contact information.
  • Context - edi bol data is available and nn sequence number is being processed:
    For Build NN Entity Segments:
    When nn entity data is found in edi bol segments and entity id code is valid according to predefined entity id values, then extract nn entity name, address from gc segments, city/state/postal/country from ga segments to create nn segment with validated entity id, or reset variables if entity not found or invalid.
  • Context - entity segment is being built with address information:
    For Set Default Address Values:
    When address line 1 is spaces or not provided, then set address line 1 to 'na' as default value to maintain data integrity.
  • Context - entity segment contains state or province code information:
    For Assign Country Codes:
    When state/province code is provided in entity address data, then search state-country reference table to find matching country code and assign it to entity country field, leaving blank if no match found.
  • Context - entity segment is for shipper (sequence 0001) or consignee (sequence 0002):
    For Validate All N1 Segments:
    When entity name, address, city, state, postal code or country information is missing, then generate appropriate error messages for missing required fields including entity id, name, address line 1, city, state/province, postal code and country code.
  • Context - entity segment sequence number is greater than 2 (not shipper or consignee):
    For Validate All N1 Segments:
    When entity id code is provided but not in valid entity id list or is shipper, consignee, or customs broker type, then generate error message for invalid entity id value.
  • Context - entity segment contains address and contact information:
    For Validate All N1 Segments:
    When city name has less than 2 characters or postal code has less than 3 characters or contact qualifier is provided without contact number or contact number is provided without qualifier, then generate appropriate error messages for minimum length requirements and incomplete contact information.
  • Context - entity segment contains country code for canada, usa, or mexico:
    For Validate All N1 Segments:
    When state/province code is missing or state/province code is invalid for the specified country, then generate error message for missing or invalid state/province code, or auto-assign country code when state/province is provided but country is missing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL contains stuffer entity data with type PN
GIVEN
An EDI BOL contains stuffer entity data with type PN
Applied to: Build SF Stuffer Entity Segment
WHEN
The system processes the stuffer entity segment
THEN
The system creates an SF entity record with name, address, city, state, postal code, country, and contact information from the EDI data
Context: An EDI BOL contains ultimate consignee entity data with type UN
GIVEN
An EDI BOL contains ultimate consignee entity data with type UN
Applied to: Build UC Ultimate Consignee Segment
WHEN
The system processes the ultimate consignee entity segment
THEN
The system creates a UC entity record with name, address, city, state, postal code, country, and contact information from the EDI data, defaulting address to 'NA' if not provided
Context: An EDI BOL contains beneficial owner entity data with type BN and organization ID BN
GIVEN
An EDI BOL contains beneficial owner entity data with type BN and organization ID BN
Applied to: Build BN Beneficial Owner Segment
WHEN
The system processes the beneficial owner entity segment
THEN
The system creates a BN entity record with name, consignee chop code, address, city, state, postal code, and country information from the EDI data
Context: An EDI BOL contains transportation data with organization ID C1
GIVEN
An EDI BOL contains transportation data with organization ID C1
Applied to: Build C1 Carrier Entity Segment
WHEN
The system processes the carrier entity segment from EDI
THEN
The system creates a C1 entity record with organization ID, name, address, city, state, postal code, country, and contact information from the EDI transportation data
Context: No EDI transportation data exists for C1 organization ID AND the consignee data code in Fastway shipment data equals 'C'
GIVEN
No EDI transportation data exists for C1 organization ID AND the consignee data code in Fastway shipment data equals 'C'
Applied to: Build C1 Carrier Entity Segment
WHEN
The system processes the carrier entity segment from Fastway
THEN
The system creates a C1 entity record using consignee data from Fastway shipment with name, address, city, state, postal code, and country information
Context: An EDI BOL contains transportation data with organization ID N1
GIVEN
An EDI BOL contains transportation data with organization ID N1
Applied to: Build N1 Notify Party Segment
WHEN
The system processes the notify party entity segment
THEN
The system creates an N1 entity record with organization ID, name, address, city, state, postal code, country, and contact information from the EDI transportation data
Context: An EDI BOL contains MCOA segment data with organization ID of PF or SS
GIVEN
An EDI BOL contains MCOA segment data with organization ID of PF or SS
Applied to: Build PF/SS Entity Segments from MCOA
WHEN
The system processes the MCOA entity segment
THEN
The system creates a PF or SS entity record with organization ID, name, ID code qualifier, ID code, address, city, state, postal code, and country information from the MCOA data, defaulting address to 'NA' if not provided
Context: An EDI BOL contains transportation data with organization IDs 11, MC, OO, or FW
GIVEN
An EDI BOL contains transportation data with organization IDs 11, MC, OO, or FW
Applied to: Build Additional Entity Segments
WHEN
The system processes each additional entity segment type
THEN
The system creates entity records for each found organization type with organization ID, name, address, city, state, postal code, country, and contact information from the EDI transportation data
Context: An EDI BOL contains named entity data with type NN AND the entity ID code is valid according to predefined entity ID values
GIVEN
An EDI BOL contains named entity data with type NN AND the entity ID code is valid according to predefined entity ID values
Applied to: Build NN Entity Segments
WHEN
The system processes the named entity segment
THEN
The system creates an NN entity record with entity ID code, name, consignee chop code, address, city, state, postal code, and country information from the EDI data
Context: An N1 entity segment is being processed
GIVEN
An N1 entity segment is being processed
Applied to: Validate All N1 Segments
WHEN
The address information is validated
THEN
The system sets address line 1 to 'NA' if it is spaces or low-values, and ensures all address components are properly populated
Context: A validated N1 entity segment exists AND the sequence index is within the maximum allowed range
GIVEN
A validated N1 entity segment exists AND the sequence index is within the maximum allowed range
Applied to: Store N1 Segments in Database
WHEN
The system stores the entity segment
THEN
The system assigns the CCN key, record type 55, current sequence number, and stores the segment data in the database array
Context: EDI BOL data is available for processing
GIVEN
EDI BOL data is available for processing
Applied to: Build SF Stuffer Entity Segment
WHEN
SF entity data is found in EDI BOL segments with entity type 'PN'
THEN
Extract SF entity name, address, city, state, postal code, country code and contact information to create SF segment with entity ID 'SF'
Applied to: Build UC Ultimate Consignee Segment
WHEN
UC entity data is found in EDI BOL segments with entity type 'UN'
THEN
Extract UC entity name, address, city, state, postal code, country code and contact information to create UC segment with entity ID 'UC', defaulting address to 'NA' if not provided
Context: EDI BOL data is available for processing and organization ID is set to 'BN'
GIVEN
EDI BOL data is available for processing and organization ID is set to 'BN'
Applied to: Build BN Beneficial Owner Segment
WHEN
BN entity data is found in EDI BOL segments with entity type 'BN'
THEN
Extract BN entity name from U1-NAME field, address from BT segments, city/state/postal/country from BY segments to create BN segment with entity ID 'BN', defaulting address to 'NA' if not provided
Context: EDI BOL data is available for processing and organization ID is set to 'C1'
GIVEN
EDI BOL data is available for processing and organization ID is set to 'C1'
Applied to: Build C1 Carrier Entity Segment
WHEN
C1 entity data is found in EDI BOL transportation segments OR consignee data code in Fastway equals 'C'
THEN
Extract C1 entity information from EDI TN/T2/TA/T3 segments OR from Fastway consignee data to create C1 segment with entity ID 'C1', including name, address, city, state, postal code, country and contact information
Context: EDI BOL data is available for processing and organization ID is set to 'N1'
GIVEN
EDI BOL data is available for processing and organization ID is set to 'N1'
Applied to: Build N1 Notify Party Segment
WHEN
N1 entity data is found in EDI BOL transportation segments
THEN
Extract N1 entity information from EDI TN/T2/TA/T3 segments to create N1 segment with entity ID 'N1', including name, address, city, state, postal code, country and contact information
Context: EDI BOL MCOA segments are available for processing
GIVEN
EDI BOL MCOA segments are available for processing
Applied to: Build PF/SS Entity Segments from MCOA
WHEN
MCOA segment is found with organization ID equal to 'PF' or 'SS'
THEN
Extract entity name, ID code qualifier, ID code from F5 fields and address information from ON/OC segments to create PF or SS segment, defaulting address to 'NA' if not provided
Context: EDI BOL transportation segments are available for processing
GIVEN
EDI BOL transportation segments are available for processing
Applied to: Build Additional Entity Segments
WHEN
Transportation segment is found with organization ID matching '11', 'MC', 'OO', or 'FW'
THEN
Extract entity information from TN/T2/TA/T3 segments to create corresponding entity segment with matching organization ID, including name, address, city, state, postal code, country and contact information
Context: EDI BOL data is available and NN sequence number is being processed
GIVEN
EDI BOL data is available and NN sequence number is being processed
Applied to: Build NN Entity Segments
WHEN
NN entity data is found in EDI BOL segments AND entity ID code is valid according to predefined entity ID values
THEN
Extract NN entity name, address from GC segments, city/state/postal/country from GA segments to create NN segment with validated entity ID, OR reset variables if entity not found or invalid
Context: Entity segment is being built with address information
GIVEN
Entity segment is being built with address information
Applied to: Set Default Address Values
WHEN
Address line 1 is spaces or not provided
THEN
Set address line 1 to 'NA' as default value to maintain data integrity
Context: Entity segment contains state or province code information
GIVEN
Entity segment contains state or province code information
Applied to: Assign Country Codes
WHEN
State/province code is provided in entity address data
THEN
Search state-country reference table to find matching country code and assign it to entity country field, leaving blank if no match found
Context: Entity segment is for shipper (sequence 0001) or consignee (sequence 0002)
GIVEN
Entity segment is for shipper (sequence 0001) or consignee (sequence 0002)
Applied to: Validate All N1 Segments
WHEN
Entity name, address, city, state, postal code or country information is missing
THEN
Generate appropriate error messages for missing required fields including entity ID, name, address line 1, city, state/province, postal code and country code
Context: Entity segment sequence number is greater than 2 (not shipper or consignee)
GIVEN
Entity segment sequence number is greater than 2 (not shipper or consignee)
Applied to: Validate All N1 Segments
WHEN
Entity ID code is provided but not in valid entity ID list OR is shipper, consignee, or customs broker type
THEN
Generate error message for invalid entity ID value
Context: Entity segment contains address and contact information
GIVEN
Entity segment contains address and contact information
Applied to: Validate All N1 Segments
WHEN
City name has less than 2 characters OR postal code has less than 3 characters OR contact qualifier is provided without contact number OR contact number is provided without qualifier
THEN
Generate appropriate error messages for minimum length requirements and incomplete contact information
Context: Entity segment contains country code for Canada, USA, or Mexico
GIVEN
Entity segment contains country code for Canada, USA, or Mexico
Applied to: Validate All N1 Segments
WHEN
State/province code is missing OR state/province code is invalid for the specified country
THEN
Generate error message for missing or invalid state/province code, OR auto-assign country code when state/province is provided but country is missing
R-GCCS309C-cbl-00483 (+9) File: GCCS309C.cbl Automotive Release Determination Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Automotive Release Determination':
  • Context - a manifest with consignee chop and commodity code fields:
    For Consignee CHOP and Commodity Code exist?:
    When the system checks for automotive release eligibility, then the system should verify both consignee chop and commodity code are not spaces before accessing the au table.
  • Context - valid consignee chop and commodity code exist:
    For Access AU Table with CHOP and Commodity Code:
    When the system needs to determine automotive classification, then the system should access the au table using 'au' as table id, consignee chop as key chop, and commodity code as key commodity.
  • Context - an au table lookup has been performed:
    For AU Table Entry Found?:
    When the system evaluates the lookup result, then the system should check if the return flag indicates successful retrieval of au table data.
  • Context - either consignee chop or commodity code is missing, or au table entry is not found:
    For Set Non-Automotive Flag:
    When the system determines automotive classification, then the system should set the automotive flag to non-automotive as the default classification.
  • Context - a valid au table entry exists for the consignee and commodity combination:
    For Evaluate Country and CSA Criteria:
    When the system determines final automotive classification, then the system should evaluate origin country codes and csa indicator status according to automotive release business rules.
  • Context - a shipment with an origin country code:
    For Origin Country is US, CA, or blank?:
    When the system evaluates automotive eligibility based on origin country, then the system should consider shipments from us, ca, or blank origin country as potentially eligible for automotive classification.
  • Context - a shipment originating from mexico with au table data:
    For Origin Country is MX AND AU Type Code 2nd position is 'C'?:
    When the system evaluates automotive eligibility for mexican origin, then the system should check if origin country is mx and the second position of au type code is 'c' to determine eligibility.
  • Context - a shipment that meets country origin criteria for automotive classification:
    For CSA Indicator is OFF?:
    When the system performs final automotive eligibility validation, then the system should verify that the csa indicator is off before setting automotive classification.
  • Context - a shipment that meets all automotive eligibility criteria including country origin and csa indicator status:
    For Set Automotive Flag:
    When the system finalizes automotive classification, then the system should set the automotive flag to true indicating the shipment qualifies for automotive processing.
  • Context - a shipment that does not meet all automotive eligibility criteria:
    For Keep Non-Automotive Flag:
    When the system finalizes automotive classification, then the system should retain the non-automotive flag indicating the shipment does not qualify for automotive processing.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest with consignee CHOP and commodity code fields
GIVEN
A manifest with consignee CHOP and commodity code fields
Applied to: Consignee CHOP and Commodity Code exist?
WHEN
The system checks for automotive release eligibility
THEN
The system should verify both consignee CHOP and commodity code are not spaces before accessing the AU table
Context: Valid consignee CHOP and commodity code exist
GIVEN
Valid consignee CHOP and commodity code exist
Applied to: Access AU Table with CHOP and Commodity Code
WHEN
The system needs to determine automotive classification
THEN
The system should access the AU table using 'AU' as table ID, consignee CHOP as key CHOP, and commodity code as key commodity
Context: An AU table lookup has been performed
GIVEN
An AU table lookup has been performed
Applied to: AU Table Entry Found?
WHEN
The system evaluates the lookup result
THEN
The system should check if the return flag indicates successful retrieval of AU table data
Context: Either consignee CHOP or commodity code is missing, or AU table entry is not found
GIVEN
Either consignee CHOP or commodity code is missing, or AU table entry is not found
Applied to: Set Non-Automotive Flag
WHEN
The system determines automotive classification
THEN
The system should set the automotive flag to non-automotive as the default classification
Context: A valid AU table entry exists for the consignee and commodity combination
GIVEN
A valid AU table entry exists for the consignee and commodity combination
Applied to: Evaluate Country and CSA Criteria
WHEN
The system determines final automotive classification
THEN
The system should evaluate origin country codes and CSA indicator status according to automotive release business rules
Context: A shipment with an origin country code
GIVEN
A shipment with an origin country code
Applied to: Origin Country is US, CA, or blank?
WHEN
The system evaluates automotive eligibility based on origin country
THEN
The system should consider shipments from US, CA, or blank origin country as potentially eligible for automotive classification
Context: A shipment originating from Mexico with AU table data
GIVEN
A shipment originating from Mexico with AU table data
Applied to: Origin Country is MX AND AU Type Code 2nd position is 'C'?
WHEN
The system evaluates automotive eligibility for Mexican origin
THEN
The system should check if origin country is MX and the second position of AU type code is 'C' to determine eligibility
Context: A shipment that meets country origin criteria for automotive classification
GIVEN
A shipment that meets country origin criteria for automotive classification
Applied to: CSA Indicator is OFF?
WHEN
The system performs final automotive eligibility validation
THEN
The system should verify that the CSA indicator is OFF before setting automotive classification
Context: A shipment that meets all automotive eligibility criteria including country origin and CSA indicator status
GIVEN
A shipment that meets all automotive eligibility criteria including country origin and CSA indicator status
Applied to: Set Automotive Flag
WHEN
The system finalizes automotive classification
THEN
The system should set the automotive flag to TRUE indicating the shipment qualifies for automotive processing
Context: A shipment that does not meet all automotive eligibility criteria
GIVEN
A shipment that does not meet all automotive eligibility criteria
Applied to: Keep Non-Automotive Flag
WHEN
The system finalizes automotive classification
THEN
The system should retain the non-automotive flag indicating the shipment does not qualify for automotive processing
R-GCX122A-cbl-00483 (+6) File: GCX122A.cbl Handle Test Train Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Test Train Processing':
  • Context - a train error message is received with a reference number:
    For Reference Number = '6105ETESTTRAIN00000000000'?:
    When the reference number equals '6105etesttrain00000000000', then the system sets the test train indicator and initiates test processing workflow.
  • Context - the train reference number matches the test train pattern '6105etesttrain00000000000':
    For Set Test Train Indicator:
    When the system confirms this is test data, then the system sets test-train indicator to true and calls special test table processing.
  • Context - the system needs to update test train acknowledgment timestamps:
    For T2 Table Found?:
    When the t2 test table lookup is performed, then if the table is not found, the system reports a configuration error and stops processing.
  • Context - a test train acknowledgment is being processed and the t2 table is accessible:
    For Record Current Date in T2-358-ACK & Record Current Century in T2-358-ACK & Record Current Time in T2-358-ACK:
    When the system updates the test acknowledgment timestamp, then the current machine date is stored in positions 3-6 of the t2-358-ack field and the current machine century is stored in positions 1-2 of the t2-358-ack field and the first 4 digits of the current machine time are stored in positions 9-12 of the t2-358-ack field.
  • Context - the test train acknowledgment timestamps have been updated in memory:
    For Save Updated Test Table:
    When the system completes the timestamp recording, then the updated t2 table segment is written back to the database using replace operation.
👨‍💻 Technical ACs (Gherkin)
Context: A train error message is received with a reference number
GIVEN
A train error message is received with a reference number
Applied to: Reference Number = '6105ETESTTRAIN00000000000'?
WHEN
The reference number equals '6105ETESTTRAIN00000000000'
THEN
The system sets the test train indicator and initiates test processing workflow
Context: The train reference number matches the test train pattern '6105ETESTTRAIN00000000000'
GIVEN
The train reference number matches the test train pattern '6105ETESTTRAIN00000000000'
Applied to: Set Test Train Indicator
WHEN
The system confirms this is test data
THEN
The system sets TEST-TRAIN indicator to true and calls special test table processing
Context: The system needs to update test train acknowledgment timestamps
GIVEN
The system needs to update test train acknowledgment timestamps
Applied to: T2 Table Found?
WHEN
The T2 test table lookup is performed
THEN
If the table is not found, the system reports a configuration error and stops processing
Context: A test train acknowledgment is being processed and the T2 table is accessible
GIVEN
A test train acknowledgment is being processed and the T2 table is accessible
Applied to: Record Current Date in T2-358-ACK & Record Current Century in T2-358-ACK & Record Current Time in T2-358-ACK
WHEN
The system updates the test acknowledgment timestamp
THEN
The current machine date is stored in positions 3-6 of the T2-358-ACK field AND The current machine century is stored in positions 1-2 of the T2-358-ACK field AND The first 4 digits of the current machine time are stored in positions 9-12 of the T2-358-ACK field
Context: The test train acknowledgment timestamps have been updated in memory
GIVEN
The test train acknowledgment timestamps have been updated in memory
Applied to: Save Updated Test Table
WHEN
The system completes the timestamp recording
THEN
The updated T2 table segment is written back to the database using replace operation
R-GCX122A-cbl-00490 (+6) File: GCX122A.cbl Handle Test Cargo Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Test Cargo Processing':
  • Context - a cargo error message is received with a reference number:
    For Check Reference Number:
    When the reference number starts with '6105ecprstestcargo' or starts with '6105etestcargo', then the system should identify this as test cargo data and set the test cargo flag.
  • Context - a cargo reference number matches test cargo patterns:
    For Set Test Cargo Flag:
    When the reference starts with '6105ecprstestcargo' or '6105etestcargo', then the system should set the test-cargo flag to true and perform special test processing.
  • Context - test cargo processing is required:
    For Retrieve T2 Test Table:
    When the system needs to update test acknowledgment data, then the system should retrieve the t2 table segment from the gcstbrt table with table id 't2'.
  • Context - the system attempts to retrieve the t2 test table:
    For T2 Table Found?:
    When the t2 table retrieval operation is performed, then if the table is not found (return flag not equal to '0'), log an error message 't2 check table entry not found'.
  • Context - test cargo processing is active and t2 table is available:
    For Update Test Acknowledgment Timestamp:
    When a cargo test acknowledgment needs to be recorded, then the system should update t2-309-ack field with current machine date (positions 3-8), current century (positions 1-2), and current time first 4 digits (positions 9-12).
  • Context - the t2 table has been updated with test acknowledgment timestamp:
    For Save Updated T2 Table:
    When the timestamp update is complete, then the system should save the updated t2 table segment back to the database using repl function.
  • Context - a cargo error message is received:
    For Continue Normal Cargo Error Processing:
    When the reference number does not match test cargo patterns, then the system should continue with normal cargo error processing workflow.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo error message is received with a reference number
GIVEN
A cargo error message is received with a reference number
Applied to: Check Reference Number
WHEN
The reference number starts with '6105ECPRSTESTCARGO' or starts with '6105ETESTCARGO'
THEN
The system should identify this as test cargo data and set the test cargo flag
Context: A cargo reference number matches test cargo patterns
GIVEN
A cargo reference number matches test cargo patterns
Applied to: Set Test Cargo Flag
WHEN
The reference starts with '6105ECPRSTESTCARGO' or '6105ETESTCARGO'
THEN
The system should set the TEST-CARGO flag to true and perform special test processing
Context: Test cargo processing is required
GIVEN
Test cargo processing is required
Applied to: Retrieve T2 Test Table
WHEN
The system needs to update test acknowledgment data
THEN
The system should retrieve the T2 table segment from the GCSTBRT table with table ID 'T2'
Context: The system attempts to retrieve the T2 test table
GIVEN
The system attempts to retrieve the T2 test table
Applied to: T2 Table Found?
WHEN
The T2 table retrieval operation is performed
THEN
If the table is not found (return flag not equal to '0'), log an error message 'T2 CHECK TABLE ENTRY NOT FOUND'
Context: Test cargo processing is active and T2 table is available
GIVEN
Test cargo processing is active and T2 table is available
Applied to: Update Test Acknowledgment Timestamp
WHEN
A cargo test acknowledgment needs to be recorded
THEN
The system should update T2-309-ACK field with current machine date (positions 3-8), current century (positions 1-2), and current time first 4 digits (positions 9-12)
Context: The T2 table has been updated with test acknowledgment timestamp
GIVEN
The T2 table has been updated with test acknowledgment timestamp
Applied to: Save Updated T2 Table
WHEN
The timestamp update is complete
THEN
The system should save the updated T2 table segment back to the database using REPL function
Context: A cargo error message is received
GIVEN
A cargo error message is received
Applied to: Continue Normal Cargo Error Processing
WHEN
The reference number does not match test cargo patterns
THEN
The system should continue with normal cargo error processing workflow
R-GCCS309C-cbl-00493 (+6) File: GCCS309C.cbl Evaluate Country and CSA Criteria Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Evaluate Country and CSA Criteria':
  • Context - a shipment with origin country, csa indicator status, and automotive type information available:
    For Evaluate Country and CSA Criteria:
    When the system evaluates automotive classification criteria where origin country is us, ca, or blank, or origin country is mx with automotive type second character as 'c', and csa indicator is off, then the shipment is classified as automotive, otherwise it remains non-automotive.
  • Context - a shipment with an origin country code:
    For Origin Country is US, CA, or blank?:
    When the origin country is 'us', 'ca', or blank spaces, then the shipment meets the primary automotive country qualification criteria.
    For Origin Country is MX?:
    When the origin country is 'mx', then the shipment requires automotive type code validation for automotive qualification.
  • Context - a mexico origin shipment with automotive type code information:
    For AU Type second character is 'C'?:
    When the second character of the automotive type code is 'c', then the mexico shipment meets the automotive type qualification criteria.
  • Context - a shipment that meets country and type qualifications with csa indicator information:
    For CSA Indicator is OFF?:
    When the csa indicator is off, then the shipment meets all criteria for automotive classification.
  • Context - a shipment that meets all automotive qualification criteria:
    For Set AUTOMOTIVE flag to TRUE:
    When country, type, and csa validations are successful, then the shipment is flagged as automotive for processing.
  • Context - a shipment that does not meet automotive qualification criteria:
    For Keep NON-AUTOMOTIVE flag:
    When any of the country, type, or csa validations fail, then the shipment remains classified as non-automotive.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with origin country, CSA indicator status, and automotive type information available
GIVEN
A shipment with origin country, CSA indicator status, and automotive type information available
Applied to: Evaluate Country and CSA Criteria
WHEN
The system evaluates automotive classification criteria where origin country is US, CA, or blank, OR origin country is MX with automotive type second character as 'C', AND CSA indicator is OFF
THEN
The shipment is classified as AUTOMOTIVE, otherwise it remains NON-AUTOMOTIVE
Context: A shipment with an origin country code
GIVEN
A shipment with an origin country code
Applied to: Origin Country is US, CA, or blank?
WHEN
The origin country is 'US', 'CA', or blank spaces
THEN
The shipment meets the primary automotive country qualification criteria
Applied to: Origin Country is MX?
WHEN
The origin country is 'MX'
THEN
The shipment requires automotive type code validation for automotive qualification
Context: A Mexico origin shipment with automotive type code information
GIVEN
A Mexico origin shipment with automotive type code information
Applied to: AU Type second character is 'C'?
WHEN
The second character of the automotive type code is 'C'
THEN
The Mexico shipment meets the automotive type qualification criteria
Context: A shipment that meets country and type qualifications with CSA indicator information
GIVEN
A shipment that meets country and type qualifications with CSA indicator information
Applied to: CSA Indicator is OFF?
WHEN
The CSA indicator is OFF
THEN
The shipment meets all criteria for automotive classification
Context: A shipment that meets all automotive qualification criteria
GIVEN
A shipment that meets all automotive qualification criteria
Applied to: Set AUTOMOTIVE flag to TRUE
WHEN
Country, type, and CSA validations are successful
THEN
The shipment is flagged as AUTOMOTIVE for processing
Context: A shipment that does not meet automotive qualification criteria
GIVEN
A shipment that does not meet automotive qualification criteria
Applied to: Keep NON-AUTOMOTIVE flag
WHEN
Any of the country, type, or CSA validations fail
THEN
The shipment remains classified as NON-AUTOMOTIVE
R-GCCCCADD-cbl-00494 (+19) File: GCCCCADD.cbl Contact Information Processing Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Contact Information Processing':
  • Context - contact information processing is starting for an entity:
    For Initialize Contact Fields:
    When the system begins contact information processing, then all contact function code, person name, communication qualifier, and communication number fields are cleared.
    For Initialize Contact Fields:
    When the system begins contact data processing, then all contact function code, person name, communication qualifier, and communication number fields are cleared.
  • Context - an edi bol contains per segment data for an entity:
    For Retrieve PER Segment from EDI BOL:
    When the system processes contact information for that entity, then contact function code, person name, communication number qualifier, and communication number are extracted from the per segment.
  • Context - contact information contains a communication number qualifier:
    For Validate Communication Qualifier:
    When the system validates the communication qualifier, then the qualifier must be spaces, 'fx' for fax, or 'te' for telephone, otherwise generate validation error.
    For Communication Number Missing?:
    When the system validates communication requirements, then a communication number must be provided, otherwise generate a communication number required error.
  • Context - contact information contains a person name:
    For Validate Communication Number Required:
    When the system validates contact completeness, then communication number qualifier must be present, otherwise generate required field error.
    For Communication Number Missing? & Contact Name or Qualifier Present?:
    When the system validates communication requirements, then a communication number must be provided, otherwise generate a communication number required error and a communication number qualifier must be provided, otherwise generate a qualifier required error.
  • Context - contact information contains a communication number:
    For Validate Communication Number Required:
    When the system validates contact completeness, then communication number qualifier must be present, otherwise generate required field error.
    For Contact Name or Qualifier Present?:
    When the system validates communication requirements, then a communication number qualifier must be provided, otherwise generate a qualifier required error.
  • Context - contact information contains communication number qualifier or person name:
    For Validate Communication Number Required:
    When the system validates contact completeness, then communication number must be present, otherwise generate required field error.
  • Context - contact information has been validated successfully:
    For Set Contact Information in Record & Store Contact Information in Record:
    When the system processes the contact data, then contact function code, person name, communication qualifier, and communication number are stored in the entity record and the contact function code, person name, communication qualifier, and communication number are stored in the customs record.
  • Context - an entity record is being processed for contact information:
    For EDI BOL PER Segment Available?:
    When the system checks for edi bol per segment data, then the system identifies whether contact information exists in the edi source or should use default processing.
  • Context - edi bol per segment data is available:
    For Extract Contact Function Code & Extract Contact Person Name & Extract Communication Number Qualifier & Extract Communication Number:
    When the system processes contact information, then the contact function code is extracted and stored in the contact function code field and the contact person name is extracted and stored in the person name field and the communication number qualifier is extracted and stored in the communication qualifier field and the communication number is extracted and stored in the communication number field.
  • Context - a communication number qualifier has been extracted from contact data:
    For Communication Qualifier Valid?:
    When the system validates the qualifier value, then the qualifier must be spaces, 'fx' for fax, or 'te' for telephone, otherwise generate an invalid qualifier error.
  • Context - no edi bol per segment data is available for an entity:
    For Clear Contact Fields if No Data:
    When the system processes contact information, then all contact fields are cleared or set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: Contact information processing is starting for an entity
GIVEN
Contact information processing is starting for an entity
Applied to: Initialize Contact Fields
WHEN
The system begins contact information processing
THEN
All contact function code, person name, communication qualifier, and communication number fields are cleared
Applied to: Initialize Contact Fields
WHEN
The system begins contact data processing
THEN
All contact function code, person name, communication qualifier, and communication number fields are cleared
Context: An EDI BOL contains PER segment data for an entity
GIVEN
An EDI BOL contains PER segment data for an entity
Applied to: Retrieve PER Segment from EDI BOL
WHEN
The system processes contact information for that entity
THEN
Contact function code, person name, communication number qualifier, and communication number are extracted from the PER segment
Context: Contact information contains a communication number qualifier
GIVEN
Contact information contains a communication number qualifier
Applied to: Validate Communication Qualifier
WHEN
The system validates the communication qualifier
THEN
The qualifier must be spaces, 'FX' for fax, or 'TE' for telephone, otherwise generate validation error
Applied to: Communication Number Missing?
WHEN
The system validates communication requirements
THEN
A communication number must be provided, otherwise generate a communication number required error
Context: Contact information contains a person name
GIVEN
Contact information contains a person name
Applied to: Validate Communication Number Required
WHEN
The system validates contact completeness
THEN
Communication number qualifier must be present, otherwise generate required field error
Applied to: Communication Number Missing? & Contact Name or Qualifier Present?
WHEN
The system validates communication requirements
THEN
A communication number must be provided, otherwise generate a communication number required error AND A communication number qualifier must be provided, otherwise generate a qualifier required error
Context: Contact information contains a communication number
GIVEN
Contact information contains a communication number
Applied to: Validate Communication Number Required
WHEN
The system validates contact completeness
THEN
Communication number qualifier must be present, otherwise generate required field error
Applied to: Contact Name or Qualifier Present?
WHEN
The system validates communication requirements
THEN
A communication number qualifier must be provided, otherwise generate a qualifier required error
Context: Contact information contains communication number qualifier or person name
GIVEN
Contact information contains communication number qualifier or person name
Applied to: Validate Communication Number Required
WHEN
The system validates contact completeness
THEN
Communication number must be present, otherwise generate required field error
Context: Contact information has been validated successfully
GIVEN
Contact information has been validated successfully
Applied to: Set Contact Information in Record & Store Contact Information in Record
WHEN
The system processes the contact data
THEN
Contact function code, person name, communication qualifier, and communication number are stored in the entity record AND The contact function code, person name, communication qualifier, and communication number are stored in the customs record
Context: An entity record is being processed for contact information
GIVEN
An entity record is being processed for contact information
Applied to: EDI BOL PER Segment Available?
WHEN
The system checks for EDI BOL PER segment data
THEN
The system identifies whether contact information exists in the EDI source or should use default processing
Context: EDI BOL PER segment data is available
GIVEN
EDI BOL PER segment data is available
Applied to: Extract Contact Function Code & Extract Contact Person Name & Extract Communication Number Qualifier & Extract Communication Number
WHEN
The system processes contact information
THEN
The contact function code is extracted and stored in the contact function code field AND The contact person name is extracted and stored in the person name field AND The communication number qualifier is extracted and stored in the communication qualifier field AND The communication number is extracted and stored in the communication number field
Context: A communication number qualifier has been extracted from contact data
GIVEN
A communication number qualifier has been extracted from contact data
Applied to: Communication Qualifier Valid?
WHEN
The system validates the qualifier value
THEN
The qualifier must be spaces, 'FX' for fax, or 'TE' for telephone, otherwise generate an invalid qualifier error
Context: No EDI BOL PER segment data is available for an entity
GIVEN
No EDI BOL PER segment data is available for an entity
Applied to: Clear Contact Fields if No Data
WHEN
The system processes contact information
THEN
All contact fields are cleared or set to spaces
R-GCX122A-cbl-00497 (+10) File: GCX122A.cbl Send AEI Message with Recipients Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send AEI Message with Recipients':
  • Context - an aei message needs to be sent for train status notification:
    For Initialize AEI Work Table:
    When the system begins the aei message process, then the aei work table structure is initialized to prepare for email recipient lookup.
  • Context - a train status notification needs to be sent and the aei work table is initialized:
    For Call Database to Get Email Recipients:
    When the system calls the database with the port code from train position data, then the system attempts to retrieve corresponding email recipients for that port.
  • Context - the database call to retrieve email recipients returns successfully:
    For Use Retrieved Email Recipients:
    When the return code indicates success, then the system populates the recipient list with up to 10 email addresses from the database result and sets the default merlin id as sender.
  • Context - the database call to retrieve email recipients fails or returns no results:
    For Use Default Merlin ID Recipients:
    When the return code indicates failure or no recipients found, then the system sets the default merlin id as both sender and first recipient in the recipient list.
  • Context - email recipients have been determined and train status information is available:
    For Set Message Subject and Format:
    When the system prepares the aei message content, then the message subject is formatted as 'train: [train_id] status: [current_status]' and message formatting parameters are set.
  • Context - the aei message is formatted with subject, recipients, and content:
    For Call Email Send Service:
    When the system calls the email send service, then the email service processes the send request and returns a status indicating success or failure.
  • Context - the email send service is called with the aei message:
    For Message Sent Successfully:
    When the email send service returns a successful status, then the aei message process completes successfully and no further action is required.
  • Context - the primary email send operation fails:
    For Send to Backup Recipients OM01247 and AEI9999:
    When the email send service returns a failure status, then the system clears the recipient list and sets 'om01247' as first recipient and 'aei9999' as second recipient, then attempts to send the message again.
  • Context - the backup email send service is called after primary send failure:
    For Process Complete:
    When the backup email send service returns a successful status, then the aei message process completes successfully using the backup recipients.
  • Context - both primary and backup email send operations fail:
    For Log Send Failure Error:
    When the backup email send service also returns a failure status, then the system logs the error message 'send to file of om01247 failed' and calls the error handling routine.
  • Context - the database call returns a db2 error condition:
    For Process Complete:
    When the return code indicates a db2 error, then the system performs db2 abend processing to handle the database error condition.
👨‍💻 Technical ACs (Gherkin)
Context: An AEI message needs to be sent for train status notification
GIVEN
An AEI message needs to be sent for train status notification
Applied to: Initialize AEI Work Table
WHEN
The system begins the AEI message process
THEN
The AEI work table structure is initialized to prepare for email recipient lookup
Context: A train status notification needs to be sent and the AEI work table is initialized
GIVEN
A train status notification needs to be sent and the AEI work table is initialized
Applied to: Call Database to Get Email Recipients
WHEN
The system calls the database with the port code from train position data
THEN
The system attempts to retrieve corresponding email recipients for that port
Context: The database call to retrieve email recipients returns successfully
GIVEN
The database call to retrieve email recipients returns successfully
Applied to: Use Retrieved Email Recipients
WHEN
The return code indicates success
THEN
The system populates the recipient list with up to 10 email addresses from the database result and sets the default Merlin ID as sender
Context: The database call to retrieve email recipients fails or returns no results
GIVEN
The database call to retrieve email recipients fails or returns no results
Applied to: Use Default Merlin ID Recipients
WHEN
The return code indicates failure or no recipients found
THEN
The system sets the default Merlin ID as both sender and first recipient in the recipient list
Context: Email recipients have been determined and train status information is available
GIVEN
Email recipients have been determined and train status information is available
Applied to: Set Message Subject and Format
WHEN
The system prepares the AEI message content
THEN
The message subject is formatted as 'TRAIN: [train_id] STATUS: [current_status]' and message formatting parameters are set
Context: The AEI message is formatted with subject, recipients, and content
GIVEN
The AEI message is formatted with subject, recipients, and content
Applied to: Call Email Send Service
WHEN
The system calls the email send service
THEN
The email service processes the send request and returns a status indicating success or failure
Context: The email send service is called with the AEI message
GIVEN
The email send service is called with the AEI message
Applied to: Message Sent Successfully
WHEN
The email send service returns a successful status
THEN
The AEI message process completes successfully and no further action is required
Context: The primary email send operation fails
GIVEN
The primary email send operation fails
Applied to: Send to Backup Recipients OM01247 and AEI9999
WHEN
The email send service returns a failure status
THEN
The system clears the recipient list and sets 'OM01247' as first recipient and 'AEI9999' as second recipient, then attempts to send the message again
Context: The backup email send service is called after primary send failure
GIVEN
The backup email send service is called after primary send failure
Applied to: Process Complete
WHEN
The backup email send service returns a successful status
THEN
The AEI message process completes successfully using the backup recipients
Context: Both primary and backup email send operations fail
GIVEN
Both primary and backup email send operations fail
Applied to: Log Send Failure Error
WHEN
The backup email send service also returns a failure status
THEN
The system logs the error message 'SEND TO FILE OF OM01247 FAILED' and calls the error handling routine
Context: The database call returns a DB2 error condition
GIVEN
The database call returns a DB2 error condition
Applied to: Process Complete
WHEN
The return code indicates a DB2 error
THEN
The system performs DB2 abend processing to handle the database error condition
R-GCCCCADD-cbl-00501 (+32) File: GCCCCADD.cbl Stuffer Entity Processing Merged 33 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Stuffer Entity Processing':
  • Context - an edi bill of lading key exists for processing:
    For Search for EDI BOL Stuffer Segment PN:
    When the system searches for stuffer segment type 'pn' with sequence '01', then the system retrieves stuffer name and contact information if the segment exists.
  • Context - a search for stuffer segment 'pn' has been performed:
    For Stuffer Segment Found?:
    When the system evaluates the search results, then processing continues with stuffer data extraction if segment is found, otherwise stuffer processing is skipped.
  • Context - stuffer segment 'pn' exists in edi bill of lading:
    For Extract Stuffer Name from EDI BOL:
    When the system processes the stuffer name data, then the stuffer name is extracted and assigned to the entity name field.
  • Context - stuffer entity information is being processed:
    For Set Entity ID as 'SF':
    When the system creates the entity record, then the entity id is set to 'sf' to identify this as a stuffer entity.
  • Context - stuffer entity 'pn' segment exists and entity id is set to 'sf':
    For Search for Stuffer Address Segment PA:
    When the system searches for address segment type 'pa' with sequence '01', then the system retrieves stuffer address information if the address segment exists.
  • Context - a search for stuffer address segment 'pa' has been performed:
    For Address Segment Found?:
    When the system evaluates the address search results, then address extraction continues if segment is found, otherwise default address is applied.
  • Context - stuffer address segment 'pa' exists in edi bill of lading:
    For Extract Address Lines from EDI BOL:
    When the system processes the address data, then address line 1 and address line 2 are extracted from the edi segment.
  • Context - stuffer address segment 'pa' does not exist in edi bill of lading:
    For Set Default Address as 'NA':
    When the system processes address requirements, then address line 1 is set to 'na' as the default value.
  • Context - stuffer address processing is complete:
    For Search for Stuffer City/State Segment PC:
    When the system searches for city/state segment type 'pc' with sequence '01', then the system retrieves stuffer geographic information if the segment exists.
  • Context - a search for stuffer city/state segment 'pc' has been performed:
    For City/State Segment Found?:
    When the system evaluates the geographic search results, then geographic data extraction continues if segment is found, otherwise contact processing begins.
  • Context - stuffer city/state segment 'pc' exists in edi bill of lading:
    For Extract City, State, Postal, Country from EDI BOL:
    When the system processes the geographic data, then city name, state/province code, postal code and country code are extracted from the edi segment.
  • Context - stuffer geographic information processing is complete:
    For Search for Stuffer Contact Segment GP:
    When the system searches for contact segment type 'gp' with sequence '01', then the system retrieves stuffer contact information if the segment exists.
  • Context - a search for stuffer contact segment 'gp' has been performed:
    For Contact Segment Found?:
    When the system evaluates the contact search results, then contact data extraction continues if segment is found, otherwise validation processing begins.
  • Context - stuffer contact segment 'gp' exists in edi bill of lading:
    For Extract Contact Information from EDI BOL:
    When the system processes the contact data, then contact function code, person name, communication number qualifier and communication number are extracted from the edi segment.
  • Context - all available stuffer information has been extracted from edi segments:
    For Validate Stuffer Entity Data:
    When the system validates the stuffer entity data, then required field validations are performed and missing address defaults to 'na' if not provided.
  • Context - stuffer entity data has been validated and is complete:
    For Insert Stuffer Record into Customs Database:
    When the system processes the database insertion, then the stuffer record is inserted into the customs database with sequence number between 0003 and 0025.
  • Context - the system needs to process stuffer entity information:
    For Initialize SF Segment:
    When stuffer entity processing begins, then a new stuffer segment structure is initialized with empty values.
  • Context - an edi bol key exists for the shipment:
    For Retrieve EDI BOL Stuffer Data EBSNRSC-PN:
    When the system searches for stuffer data with entity type 'pn' and sequence '01', then the system retrieves stuffer name data if available or sets not found status.
  • Context - the system has attempted to retrieve stuffer name data from edi bol:
    For Stuffer Data Found?:
    When stuffer name data is successfully found, then the system continues with stuffer entity processing.
    For Stuffer Data Found?:
    When no stuffer name data is found, then the system skips stuffer entity processing and continues to next entity type.
  • Context - stuffer name data has been successfully retrieved:
    For Set Entity ID to 'SF':
    When the system processes the stuffer entity information, then the entity id field is set to 'sf' to identify this as a stuffer entity.
  • Context - stuffer name data exists in the edi bol segment:
    For Extract Stuffer Name from U1-NAME:
    When the system processes the stuffer entity information, then the stuffer name is extracted from u1-name field and assigned to the entity name field.
  • Context - a stuffer entity record is being created:
    For Clear ID Code Qualifier and ID Code:
    When the system sets up the stuffer entity fields, then the id code qualifier and id code fields are set to spaces.
  • Context - stuffer entity processing is in progress and edi bol key exists:
    For Retrieve Stuffer Address EBSNRSA-PA:
    When the system searches for stuffer address data with type 'pa' for the stuffer entity, then the system retrieves address information if available or sets not found status.
    For Retrieve City/State/Postal EBSNRSA-PC:
    When the system searches for stuffer location data with type 'pc' for the stuffer entity, then the system retrieves city, state, postal, and country information if available.
    For Retrieve Contact Information EBSNRSA-GP:
    When the system searches for stuffer contact data with type 'gp' for the stuffer entity, then the system retrieves contact information if available.
  • Context - stuffer address data has been successfully retrieved from edi bol:
    For Extract Address Lines from U2 fields:
    When the system processes the address information, then address line 1 and address line 2 are extracted from u2-addl-name-addr-1 and u2-addl-name-addr-2 fields.
  • Context - no stuffer address data is found in edi bol:
    For Set Default 'NA' for Address:
    When the system processes stuffer address information, then address line 1 is set to 'na' and address line 2 is set to spaces.
  • Context - stuffer city/state data has been successfully retrieved from edi bol:
    For Extract City, State, Postal, Country from U4 fields:
    When the system processes the location information, then city name, state/province code, postal code, and country code are extracted from u4 fields.
  • Context - stuffer contact data has been successfully retrieved from edi bol:
    For Extract Contact Function, Name, Communication Details:
    When the system processes the contact information, then contact function code, contact name, communication number qualifier, and communication number are extracted from the contact segment.
  • Context - stuffer address information has been processed:
    For Validate Address Field Set 'NA' if Empty:
    When address line 1 is empty or contains only spaces, then address line 1 is set to 'na' to meet customs documentation requirements.
  • Context - stuffer entity data has been populated from edi sources:
    For Validate N1 Segment Data:
    When the system validates the complete stuffer entity segment, then all required fields are validated and error messages are generated for any missing or invalid data.
  • Context - stuffer entity data has been validated successfully:
    For Insert SF Entity Record into Customs Database:
    When the system saves the stuffer entity information, then the stuffer entity record is inserted into the customs database with entity type 'sf' and assigned sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI Bill of Lading key exists for processing
GIVEN
An EDI Bill of Lading key exists for processing
Applied to: Search for EDI BOL Stuffer Segment PN
WHEN
The system searches for stuffer segment type 'PN' with sequence '01'
THEN
The system retrieves stuffer name and contact information if the segment exists
Context: A search for stuffer segment 'PN' has been performed
GIVEN
A search for stuffer segment 'PN' has been performed
Applied to: Stuffer Segment Found?
WHEN
The system evaluates the search results
THEN
Processing continues with stuffer data extraction if segment is found, otherwise stuffer processing is skipped
Context: Stuffer segment 'PN' exists in EDI Bill of Lading
GIVEN
Stuffer segment 'PN' exists in EDI Bill of Lading
Applied to: Extract Stuffer Name from EDI BOL
WHEN
The system processes the stuffer name data
THEN
The stuffer name is extracted and assigned to the entity name field
Context: Stuffer entity information is being processed
GIVEN
Stuffer entity information is being processed
Applied to: Set Entity ID as 'SF'
WHEN
The system creates the entity record
THEN
The entity ID is set to 'SF' to identify this as a stuffer entity
Context: Stuffer entity 'PN' segment exists and entity ID is set to 'SF'
GIVEN
Stuffer entity 'PN' segment exists and entity ID is set to 'SF'
Applied to: Search for Stuffer Address Segment PA
WHEN
The system searches for address segment type 'PA' with sequence '01'
THEN
The system retrieves stuffer address information if the address segment exists
Context: A search for stuffer address segment 'PA' has been performed
GIVEN
A search for stuffer address segment 'PA' has been performed
Applied to: Address Segment Found?
WHEN
The system evaluates the address search results
THEN
Address extraction continues if segment is found, otherwise default address is applied
Context: Stuffer address segment 'PA' exists in EDI Bill of Lading
GIVEN
Stuffer address segment 'PA' exists in EDI Bill of Lading
Applied to: Extract Address Lines from EDI BOL
WHEN
The system processes the address data
THEN
Address line 1 and address line 2 are extracted from the EDI segment
Context: Stuffer address segment 'PA' does not exist in EDI Bill of Lading
GIVEN
Stuffer address segment 'PA' does not exist in EDI Bill of Lading
Applied to: Set Default Address as 'NA'
WHEN
The system processes address requirements
THEN
Address line 1 is set to 'NA' as the default value
Context: Stuffer address processing is complete
GIVEN
Stuffer address processing is complete
Applied to: Search for Stuffer City/State Segment PC
WHEN
The system searches for city/state segment type 'PC' with sequence '01'
THEN
The system retrieves stuffer geographic information if the segment exists
Context: A search for stuffer city/state segment 'PC' has been performed
GIVEN
A search for stuffer city/state segment 'PC' has been performed
Applied to: City/State Segment Found?
WHEN
The system evaluates the geographic search results
THEN
Geographic data extraction continues if segment is found, otherwise contact processing begins
Context: Stuffer city/state segment 'PC' exists in EDI Bill of Lading
GIVEN
Stuffer city/state segment 'PC' exists in EDI Bill of Lading
Applied to: Extract City, State, Postal, Country from EDI BOL
WHEN
The system processes the geographic data
THEN
City name, state/province code, postal code and country code are extracted from the EDI segment
Context: Stuffer geographic information processing is complete
GIVEN
Stuffer geographic information processing is complete
Applied to: Search for Stuffer Contact Segment GP
WHEN
The system searches for contact segment type 'GP' with sequence '01'
THEN
The system retrieves stuffer contact information if the segment exists
Context: A search for stuffer contact segment 'GP' has been performed
GIVEN
A search for stuffer contact segment 'GP' has been performed
Applied to: Contact Segment Found?
WHEN
The system evaluates the contact search results
THEN
Contact data extraction continues if segment is found, otherwise validation processing begins
Context: Stuffer contact segment 'GP' exists in EDI Bill of Lading
GIVEN
Stuffer contact segment 'GP' exists in EDI Bill of Lading
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes the contact data
THEN
Contact function code, person name, communication number qualifier and communication number are extracted from the EDI segment
Context: All available stuffer information has been extracted from EDI segments
GIVEN
All available stuffer information has been extracted from EDI segments
Applied to: Validate Stuffer Entity Data
WHEN
The system validates the stuffer entity data
THEN
Required field validations are performed and missing address defaults to 'NA' if not provided
Context: Stuffer entity data has been validated and is complete
GIVEN
Stuffer entity data has been validated and is complete
Applied to: Insert Stuffer Record into Customs Database
WHEN
The system processes the database insertion
THEN
The stuffer record is inserted into the customs database with sequence number between 0003 and 0025
Context: The system needs to process stuffer entity information
GIVEN
The system needs to process stuffer entity information
Applied to: Initialize SF Segment
WHEN
Stuffer entity processing begins
THEN
A new stuffer segment structure is initialized with empty values
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Retrieve EDI BOL Stuffer Data EBSNRSC-PN
WHEN
The system searches for stuffer data with entity type 'PN' and sequence '01'
THEN
The system retrieves stuffer name data if available or sets not found status
Context: The system has attempted to retrieve stuffer name data from EDI BOL
GIVEN
The system has attempted to retrieve stuffer name data from EDI BOL
Applied to: Stuffer Data Found?
WHEN
Stuffer name data is successfully found
THEN
The system continues with stuffer entity processing
Applied to: Stuffer Data Found?
WHEN
No stuffer name data is found
THEN
The system skips stuffer entity processing and continues to next entity type
Context: Stuffer name data has been successfully retrieved
GIVEN
Stuffer name data has been successfully retrieved
Applied to: Set Entity ID to 'SF'
WHEN
The system processes the stuffer entity information
THEN
The entity ID field is set to 'SF' to identify this as a stuffer entity
Context: Stuffer name data exists in the EDI BOL segment
GIVEN
Stuffer name data exists in the EDI BOL segment
Applied to: Extract Stuffer Name from U1-NAME
WHEN
The system processes the stuffer entity information
THEN
The stuffer name is extracted from U1-NAME field and assigned to the entity name field
Context: A stuffer entity record is being created
GIVEN
A stuffer entity record is being created
Applied to: Clear ID Code Qualifier and ID Code
WHEN
The system sets up the stuffer entity fields
THEN
The ID code qualifier and ID code fields are set to spaces
Context: Stuffer entity processing is in progress and EDI BOL key exists
GIVEN
Stuffer entity processing is in progress and EDI BOL key exists
Applied to: Retrieve Stuffer Address EBSNRSA-PA
WHEN
The system searches for stuffer address data with type 'PA' for the stuffer entity
THEN
The system retrieves address information if available or sets not found status
Applied to: Retrieve City/State/Postal EBSNRSA-PC
WHEN
The system searches for stuffer location data with type 'PC' for the stuffer entity
THEN
The system retrieves city, state, postal, and country information if available
Applied to: Retrieve Contact Information EBSNRSA-GP
WHEN
The system searches for stuffer contact data with type 'GP' for the stuffer entity
THEN
The system retrieves contact information if available
Context: Stuffer address data has been successfully retrieved from EDI BOL
GIVEN
Stuffer address data has been successfully retrieved from EDI BOL
Applied to: Extract Address Lines from U2 fields
WHEN
The system processes the address information
THEN
Address line 1 and address line 2 are extracted from U2-ADDL-NAME-ADDR-1 and U2-ADDL-NAME-ADDR-2 fields
Context: No stuffer address data is found in EDI BOL
GIVEN
No stuffer address data is found in EDI BOL
Applied to: Set Default 'NA' for Address
WHEN
The system processes stuffer address information
THEN
Address line 1 is set to 'NA' and address line 2 is set to spaces
Context: Stuffer city/state data has been successfully retrieved from EDI BOL
GIVEN
Stuffer city/state data has been successfully retrieved from EDI BOL
Applied to: Extract City, State, Postal, Country from U4 fields
WHEN
The system processes the location information
THEN
City name, state/province code, postal code, and country code are extracted from U4 fields
Context: Stuffer contact data has been successfully retrieved from EDI BOL
GIVEN
Stuffer contact data has been successfully retrieved from EDI BOL
Applied to: Extract Contact Function, Name, Communication Details
WHEN
The system processes the contact information
THEN
Contact function code, contact name, communication number qualifier, and communication number are extracted from the contact segment
Context: Stuffer address information has been processed
GIVEN
Stuffer address information has been processed
Applied to: Validate Address Field Set 'NA' if Empty
WHEN
Address line 1 is empty or contains only spaces
THEN
Address line 1 is set to 'NA' to meet customs documentation requirements
Context: Stuffer entity data has been populated from EDI sources
GIVEN
Stuffer entity data has been populated from EDI sources
Applied to: Validate N1 Segment Data
WHEN
The system validates the complete stuffer entity segment
THEN
All required fields are validated and error messages are generated for any missing or invalid data
Context: Stuffer entity data has been validated successfully
GIVEN
Stuffer entity data has been validated successfully
Applied to: Insert SF Entity Record into Customs Database
WHEN
The system saves the stuffer entity information
THEN
The stuffer entity record is inserted into the customs database with entity type 'SF' and assigned sequence number
R-GCX122A-cbl-00508 (+9) File: GCX122A.cbl Send Arrival Transaction Message Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Send Arrival Transaction Message':
  • Context - a cargo arrival transaction needs to be processed:
    For Initialize Arrival Message Structure:
    When the arrival processing begins, then the arrival message structure is initialized to clear any previous data.
  • Context - an arrival message structure has been initialized:
    For Set Security Parameters:
    When security parameters need to be set, then the security byte is set to high-value to indicate secure transmission.
  • Context - a cargo record exists with a valid cargo control number:
    For Extract Cargo Control Number:
    When an arrival message is being prepared, then the cargo control number is extracted and assigned to the message train or us ccn field.
  • Context - an arrival message is being prepared for cargo:
    For Set Message Type to Cargo Arrival:
    When the message type needs to be specified, then the message type is set to cargo arrival indicator.
  • Context - a cargo arrival message is being prepared:
    For Set Action Code to 'CAA':
    When the action code needs to be specified, then the action code is set to 'caa' to indicate cargo arrival action.
  • Context - a cargo record contains manifest transaction code information:
    For Extract Port Code from Manifest:
    When port information is needed for the arrival message, then the port code is extracted from the manifest transaction code and assigned to the message port code field.
  • Context - all arrival message components have been populated:
    For Prepare Message for Transmission:
    When the message needs to be prepared for transmission, then the complete message input is formatted and prepared for the messaging system.
  • Context - an arrival message has been prepared for transmission:
    For Send Message to Transaction Queue:
    When the message needs to be sent to the processing queue, then the message is transmitted using the cims interface with chng function to the alternate pcb.
  • Context - an arrival message has been sent to the transaction queue:
    For Write Message to Log:
    When logging is required for audit purposes, then the message is written to the system log using writmsgl with message code, content, length and module name.
  • Context - an arrival message has been logged to the system:
    For Complete Message Transmission:
    When the transmission process needs to be completed, then the message is purged from the processing queue using cims with purg function to the alternate pcb.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo arrival transaction needs to be processed
GIVEN
A cargo arrival transaction needs to be processed
Applied to: Initialize Arrival Message Structure
WHEN
The arrival processing begins
THEN
The arrival message structure is initialized to clear any previous data
Context: An arrival message structure has been initialized
GIVEN
An arrival message structure has been initialized
Applied to: Set Security Parameters
WHEN
Security parameters need to be set
THEN
The security byte is set to high-value to indicate secure transmission
Context: A cargo record exists with a valid cargo control number
GIVEN
A cargo record exists with a valid cargo control number
Applied to: Extract Cargo Control Number
WHEN
An arrival message is being prepared
THEN
The cargo control number is extracted and assigned to the message train or US CCN field
Context: An arrival message is being prepared for cargo
GIVEN
An arrival message is being prepared for cargo
Applied to: Set Message Type to Cargo Arrival
WHEN
The message type needs to be specified
THEN
The message type is set to cargo arrival indicator
Context: A cargo arrival message is being prepared
GIVEN
A cargo arrival message is being prepared
Applied to: Set Action Code to 'CAA'
WHEN
The action code needs to be specified
THEN
The action code is set to 'CAA' to indicate cargo arrival action
Context: A cargo record contains manifest transaction code information
GIVEN
A cargo record contains manifest transaction code information
Applied to: Extract Port Code from Manifest
WHEN
Port information is needed for the arrival message
THEN
The port code is extracted from the manifest transaction code and assigned to the message port code field
Context: All arrival message components have been populated
GIVEN
All arrival message components have been populated
Applied to: Prepare Message for Transmission
WHEN
The message needs to be prepared for transmission
THEN
The complete message input is formatted and prepared for the messaging system
Context: An arrival message has been prepared for transmission
GIVEN
An arrival message has been prepared for transmission
Applied to: Send Message to Transaction Queue
WHEN
The message needs to be sent to the processing queue
THEN
The message is transmitted using the CIMS interface with CHNG function to the alternate PCB
Context: An arrival message has been sent to the transaction queue
GIVEN
An arrival message has been sent to the transaction queue
Applied to: Write Message to Log
WHEN
Logging is required for audit purposes
THEN
The message is written to the system log using WRITMSGL with message code, content, length and module name
Context: An arrival message has been logged to the system
GIVEN
An arrival message has been logged to the system
Applied to: Complete Message Transmission
WHEN
The transmission process needs to be completed
THEN
The message is purged from the processing queue using CIMS with PURG function to the alternate PCB
R-GCCCCADD-cbl-00517 (+26) File: GCCCCADD.cbl Ultimate Consignee Processing Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Ultimate Consignee Processing':
  • Context - ultimate consignee processing is starting:
    For Initialize UC Segment Record:
    When the system begins building uc segment data, then a new gcsccs55 segment record is initialized with empty values.
  • Context - an edi bill of lading key exists for record 55 processing:
    For Search for EDI BOL UN Segment:
    When the system searches for un segment type with sequence '01', then the system retrieves the ultimate consignee entity data if the segment exists.
  • Context - edi bol un segment is successfully retrieved:
    For Extract UC Entity Data from EDI:
    When the system processes the ultimate consignee data, then entity id is set to 'uc', entity name is extracted from u1-name field, and id code qualifiers are cleared.
  • Context - ultimate consignee un segment has been processed:
    For Search for UA Address Segment:
    When the system searches for corresponding ua address segment with un type and sequence '01', then the system retrieves address data if the ua segment exists.
  • Context - edi bol ua address segment is successfully retrieved:
    For Extract Address Lines from EDI:
    When the system processes the address information, then address line 1 is set from u2-addl-name-addr-1 and address line 2 is set from u2-addl-name-addr-2.
  • Context - edi bol ua address segment is not found:
    For Set Default Address 'NA':
    When the system processes ultimate consignee address requirements, then address line 2 is cleared and address line 1 is set to 'na' as default.
  • Context - ultimate consignee address processing is complete:
    For Search for UC City/State Segment:
    When the system searches for corresponding uc location segment with un type and sequence '01', then the system retrieves location data if the uc segment exists.
    For Validate Address Requirements:
    When the system validates address line 1 is empty, then address line 1 is set to 'na' to meet minimum requirements.
  • Context - edi bol uc location segment is successfully retrieved:
    For Extract City/State/Postal/Country from EDI:
    When the system processes the location information, then city name is set from u4-city-name, state/province code from u4-state-prov-code, postal code from u4-postal-code, and country code from u4-country-code.
  • Context - edi bol uc location segment is not found:
    For Clear City/State/Postal/Country Fields:
    When the system processes ultimate consignee location requirements, then all location fields (city name, state/province code, postal code, country code) are cleared.
  • Context - ultimate consignee location processing is complete:
    For Search for GP Contact Segment:
    When the system searches for corresponding gp contact segment with un type and sequence '01', then the system retrieves contact data if the gp segment exists.
  • Context - edi bol gp contact segment is successfully retrieved:
    For Extract Contact Information:
    When the system processes the contact information, then contact function code is set from per-contact-func-code, contact name from per-name, communication number qualifier from per-commun-no-qual, and communication number from per-commun-number.
  • Context - ultimate consignee segment data is populated:
    For Validate UC Segment Data:
    When the system performs n1 segment validation, then all required fields are validated according to customs requirements and error messages are generated for missing mandatory data.
  • Context - ultimate consignee segment data is validated and complete:
    For Insert UC Record into Database:
    When the system stores the uc record, then the ultimate consignee record is inserted into the customs database with sequence numbers 0003-0025.
  • Context - an ultimate consignee segment is being processed:
    For Set Entity ID to 'UC':
    When the system processes the un segment data, then the entity id code is set to 'uc' to identify this as an ultimate consignee record.
  • Context - ultimate consignee edi data is available:
    For Extract Ultimate Consignee Name:
    When the system processes the un segment, then the ultimate consignee name is extracted and assigned to the entity name field.
  • Context - ultimate consignee address information is being processed:
    For Address Data Available?:
    When the system checks for ua address segment availability, then if ua address segment is found, extract address lines, otherwise set default address to 'na'.
  • Context - ua address segment data is available for ultimate consignee:
    For Extract Address Lines 1 & 2:
    When the system processes the address information, then address line 1 and address line 2 are extracted from the ua segment data.
  • Context - no ua address segment is available for ultimate consignee:
    For Set Default Address to 'NA':
    When the system processes address information, then address line 1 is set to 'na' and address line 2 is set to spaces.
  • Context - ultimate consignee geographic information is being processed:
    For City/State Data Available?:
    When the system checks for uc city/state segment availability, then if uc segment is found, extract city, state, postal and country codes, otherwise clear all geographic fields.
  • Context - uc city/state segment data is available for ultimate consignee:
    For Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code:
    When the system processes the geographic information, then city name, state/province code, postal code, and country code are extracted from the uc segment.
  • Context - no uc city/state segment is available for ultimate consignee:
    For Clear City/State/Postal Fields:
    When the system processes geographic information, then city name, state/province code, postal code, and country code fields are set to spaces.
  • Context - ultimate consignee contact information is being processed:
    For Contact Data Available?:
    When the system checks for gp contact segment availability, then if gp segment is found, extract contact function code, name, communication qualifier and number, otherwise proceed to validation.
  • Context - gp contact segment data is available for ultimate consignee:
    For Extract Contact Function Code, Extract Contact Name, Extract Communication Qualifier, Extract Communication Number:
    When the system processes the contact information, then contact function code, contact name, communication number qualifier, and communication number are extracted from the gp segment.
  • Context - ultimate consignee address information has been processed:
    For Validate Address Requirements:
    When the system validates address requirements, then if address line 1 is spaces, it is set to 'na' to meet minimum address requirements.
  • Context - ultimate consignee entity data has been assembled:
    For Validate Entity Segment Data:
    When the system validates the entity segment, then all required fields are validated according to entity segment validation rules including entity id, name, address, and contact information requirements.
  • Context - ultimate consignee entity data has been validated successfully:
    For Insert Ultimate Consignee Record:
    When the system processes the record insertion, then the ultimate consignee record is inserted into the customs database with sequence number between 0003 and 0025.
👨‍💻 Technical ACs (Gherkin)
Context: Ultimate Consignee processing is starting
GIVEN
Ultimate Consignee processing is starting
Applied to: Initialize UC Segment Record
WHEN
The system begins building UC segment data
THEN
A new GCSCCS55 segment record is initialized with empty values
Context: An EDI Bill of Lading key exists for record 55 processing
GIVEN
An EDI Bill of Lading key exists for record 55 processing
Applied to: Search for EDI BOL UN Segment
WHEN
The system searches for UN segment type with sequence '01'
THEN
The system retrieves the Ultimate Consignee entity data if the segment exists
Context: EDI BOL UN segment is successfully retrieved
GIVEN
EDI BOL UN segment is successfully retrieved
Applied to: Extract UC Entity Data from EDI
WHEN
The system processes the Ultimate Consignee data
THEN
Entity ID is set to 'UC', entity name is extracted from U1-NAME field, and ID code qualifiers are cleared
Context: Ultimate Consignee UN segment has been processed
GIVEN
Ultimate Consignee UN segment has been processed
Applied to: Search for UA Address Segment
WHEN
The system searches for corresponding UA address segment with UN type and sequence '01'
THEN
The system retrieves address data if the UA segment exists
Context: EDI BOL UA address segment is successfully retrieved
GIVEN
EDI BOL UA address segment is successfully retrieved
Applied to: Extract Address Lines from EDI
WHEN
The system processes the address information
THEN
Address line 1 is set from U2-ADDL-NAME-ADDR-1 and address line 2 is set from U2-ADDL-NAME-ADDR-2
Context: EDI BOL UA address segment is not found
GIVEN
EDI BOL UA address segment is not found
Applied to: Set Default Address 'NA'
WHEN
The system processes Ultimate Consignee address requirements
THEN
Address line 2 is cleared and address line 1 is set to 'NA' as default
Context: Ultimate Consignee address processing is complete
GIVEN
Ultimate Consignee address processing is complete
Applied to: Search for UC City/State Segment
WHEN
The system searches for corresponding UC location segment with UN type and sequence '01'
THEN
The system retrieves location data if the UC segment exists
Applied to: Validate Address Requirements
WHEN
The system validates address line 1 is empty
THEN
Address line 1 is set to 'NA' to meet minimum requirements
Context: EDI BOL UC location segment is successfully retrieved
GIVEN
EDI BOL UC location segment is successfully retrieved
Applied to: Extract City/State/Postal/Country from EDI
WHEN
The system processes the location information
THEN
City name is set from U4-CITY-NAME, state/province code from U4-STATE-PROV-CODE, postal code from U4-POSTAL-CODE, and country code from U4-COUNTRY-CODE
Context: EDI BOL UC location segment is not found
GIVEN
EDI BOL UC location segment is not found
Applied to: Clear City/State/Postal/Country Fields
WHEN
The system processes Ultimate Consignee location requirements
THEN
All location fields (city name, state/province code, postal code, country code) are cleared
Context: Ultimate Consignee location processing is complete
GIVEN
Ultimate Consignee location processing is complete
Applied to: Search for GP Contact Segment
WHEN
The system searches for corresponding GP contact segment with UN type and sequence '01'
THEN
The system retrieves contact data if the GP segment exists
Context: EDI BOL GP contact segment is successfully retrieved
GIVEN
EDI BOL GP contact segment is successfully retrieved
Applied to: Extract Contact Information
WHEN
The system processes the contact information
THEN
Contact function code is set from PER-CONTACT-FUNC-CODE, contact name from PER-NAME, communication number qualifier from PER-COMMUN-NO-QUAL, and communication number from PER-COMMUN-NUMBER
Context: Ultimate Consignee segment data is populated
GIVEN
Ultimate Consignee segment data is populated
Applied to: Validate UC Segment Data
WHEN
The system performs N1 segment validation
THEN
All required fields are validated according to customs requirements and error messages are generated for missing mandatory data
Context: Ultimate Consignee segment data is validated and complete
GIVEN
Ultimate Consignee segment data is validated and complete
Applied to: Insert UC Record into Database
WHEN
The system stores the UC record
THEN
The Ultimate Consignee record is inserted into the customs database with sequence numbers 0003-0025
Context: An Ultimate Consignee segment is being processed
GIVEN
An Ultimate Consignee segment is being processed
Applied to: Set Entity ID to 'UC'
WHEN
The system processes the UN segment data
THEN
The entity ID code is set to 'UC' to identify this as an Ultimate Consignee record
Context: Ultimate Consignee EDI data is available
GIVEN
Ultimate Consignee EDI data is available
Applied to: Extract Ultimate Consignee Name
WHEN
The system processes the UN segment
THEN
The ultimate consignee name is extracted and assigned to the entity name field
Context: Ultimate Consignee address information is being processed
GIVEN
Ultimate Consignee address information is being processed
Applied to: Address Data Available?
WHEN
The system checks for UA address segment availability
THEN
If UA address segment is found, extract address lines, otherwise set default address to 'NA'
Context: UA address segment data is available for Ultimate Consignee
GIVEN
UA address segment data is available for Ultimate Consignee
Applied to: Extract Address Lines 1 & 2
WHEN
The system processes the address information
THEN
Address line 1 and address line 2 are extracted from the UA segment data
Context: No UA address segment is available for Ultimate Consignee
GIVEN
No UA address segment is available for Ultimate Consignee
Applied to: Set Default Address to 'NA'
WHEN
The system processes address information
THEN
Address line 1 is set to 'NA' and address line 2 is set to spaces
Context: Ultimate Consignee geographic information is being processed
GIVEN
Ultimate Consignee geographic information is being processed
Applied to: City/State Data Available?
WHEN
The system checks for UC city/state segment availability
THEN
If UC segment is found, extract city, state, postal and country codes, otherwise clear all geographic fields
Context: UC city/state segment data is available for Ultimate Consignee
GIVEN
UC city/state segment data is available for Ultimate Consignee
Applied to: Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code
WHEN
The system processes the geographic information
THEN
City name, state/province code, postal code, and country code are extracted from the UC segment
Context: No UC city/state segment is available for Ultimate Consignee
GIVEN
No UC city/state segment is available for Ultimate Consignee
Applied to: Clear City/State/Postal Fields
WHEN
The system processes geographic information
THEN
City name, state/province code, postal code, and country code fields are set to spaces
Context: Ultimate Consignee contact information is being processed
GIVEN
Ultimate Consignee contact information is being processed
Applied to: Contact Data Available?
WHEN
The system checks for GP contact segment availability
THEN
If GP segment is found, extract contact function code, name, communication qualifier and number, otherwise proceed to validation
Context: GP contact segment data is available for Ultimate Consignee
GIVEN
GP contact segment data is available for Ultimate Consignee
Applied to: Extract Contact Function Code, Extract Contact Name, Extract Communication Qualifier, Extract Communication Number
WHEN
The system processes the contact information
THEN
Contact function code, contact name, communication number qualifier, and communication number are extracted from the GP segment
Context: Ultimate Consignee address information has been processed
GIVEN
Ultimate Consignee address information has been processed
Applied to: Validate Address Requirements
WHEN
The system validates address requirements
THEN
If address line 1 is spaces, it is set to 'NA' to meet minimum address requirements
Context: Ultimate Consignee entity data has been assembled
GIVEN
Ultimate Consignee entity data has been assembled
Applied to: Validate Entity Segment Data
WHEN
The system validates the entity segment
THEN
All required fields are validated according to entity segment validation rules including entity ID, name, address, and contact information requirements
Context: Ultimate Consignee entity data has been validated successfully
GIVEN
Ultimate Consignee entity data has been validated successfully
Applied to: Insert Ultimate Consignee Record
WHEN
The system processes the record insertion
THEN
The Ultimate Consignee record is inserted into the customs database with sequence number between 0003 and 0025
R-GCX122A-cbl-00518 (+9) File: GCX122A.cbl Call Iron Highway Interface Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Call Iron Highway Interface':
  • Context - a cargo record has been processed and may have a status change:
    For Check if Cargo Status Changed:
    When the system compares the saved status with the current cargo status, then if the statuses are different, iron highway processing continues, otherwise it exits.
  • Context - cargo status has changed and iron highway processing is required:
    For Retrieve Iron Highway Configuration:
    When the system looks up iron highway configuration using the cargo origin station number as the key, then the system retrieves the ih table configuration data for further processing.
  • Context - a lookup for iron highway configuration has been performed:
    For IH Config Found?:
    When the system checks the return flag from the table lookup, then if return flag equals '0', configuration is found and processing continues, otherwise iron highway processing exits.
  • Context - iron highway configuration is available and cargo processing is active:
    For Set Record Type for Cargo:
    When the system prepares transaction data for iron highway interface, then the record type is set to cargo type using the gcx105 cargo indicator.
  • Context - iron highway transaction data is being prepared:
    For Map Current Status to IH Format:
    When the system processes the current cargo status, then the current cargo status is mapped to the iron highway ccn status field.
    For Map Equipment ID to Car ID:
    When the system processes cargo equipment information, then the cargo equipment id for index is mapped to the iron highway car id field.
    For Map Waybill Information:
    When the system processes cargo waybill information, then the first 15 characters of the cargo waybill key for index are mapped to the iron highway waybill field.
    For Map Cargo Control Number:
    When the system processes cargo control information, then the cargo ccn key is mapped to the iron highway ccn field.
  • Context - iron highway transaction data is being prepared with cargo reference numbers:
    For Extract Shipment ID from Reference Numbers:
    When the system processes up to 10 reference number entries looking for cn qualifier, then when a reference number qualifier equals 'cn', the corresponding reference number is mapped to the iron highway shipment id.
  • Context - all iron highway transaction data has been prepared and mapped:
    For Call GCCIH Interface:
    When the system is ready to send the transaction to iron highway, then the gccih program is called with the prepared iron highway transaction data.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record has been processed and may have a status change
GIVEN
A cargo record has been processed and may have a status change
Applied to: Check if Cargo Status Changed
WHEN
The system compares the saved status with the current cargo status
THEN
If the statuses are different, Iron Highway processing continues, otherwise it exits
Context: Cargo status has changed and Iron Highway processing is required
GIVEN
Cargo status has changed and Iron Highway processing is required
Applied to: Retrieve Iron Highway Configuration
WHEN
The system looks up Iron Highway configuration using the cargo origin station number as the key
THEN
The system retrieves the IH table configuration data for further processing
Context: A lookup for Iron Highway configuration has been performed
GIVEN
A lookup for Iron Highway configuration has been performed
Applied to: IH Config Found?
WHEN
The system checks the return flag from the table lookup
THEN
If return flag equals '0', configuration is found and processing continues, otherwise Iron Highway processing exits
Context: Iron Highway configuration is available and cargo processing is active
GIVEN
Iron Highway configuration is available and cargo processing is active
Applied to: Set Record Type for Cargo
WHEN
The system prepares transaction data for Iron Highway interface
THEN
The record type is set to cargo type using the GCX105 cargo indicator
Context: Iron Highway transaction data is being prepared
GIVEN
Iron Highway transaction data is being prepared
Applied to: Map Current Status to IH Format
WHEN
The system processes the current cargo status
THEN
The current cargo status is mapped to the Iron Highway CCN status field
Applied to: Map Equipment ID to Car ID
WHEN
The system processes cargo equipment information
THEN
The cargo equipment ID for index is mapped to the Iron Highway car ID field
Applied to: Map Waybill Information
WHEN
The system processes cargo waybill information
THEN
The first 15 characters of the cargo waybill key for index are mapped to the Iron Highway waybill field
Applied to: Map Cargo Control Number
WHEN
The system processes cargo control information
THEN
The cargo CCN key is mapped to the Iron Highway CCN field
Context: Iron Highway transaction data is being prepared with cargo reference numbers
GIVEN
Iron Highway transaction data is being prepared with cargo reference numbers
Applied to: Extract Shipment ID from Reference Numbers
WHEN
The system processes up to 10 reference number entries looking for CN qualifier
THEN
When a reference number qualifier equals 'CN', the corresponding reference number is mapped to the Iron Highway shipment ID
Context: All Iron Highway transaction data has been prepared and mapped
GIVEN
All Iron Highway transaction data has been prepared and mapped
Applied to: Call GCCIH Interface
WHEN
The system is ready to send the transaction to Iron Highway
THEN
The GCCIH program is called with the prepared Iron Highway transaction data
R-GCX122A-cbl-00528 (+8) File: GCX122A.cbl Retrieve Email Recipients by Port Code Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Email Recipients by Port Code':
  • Context - a train record exists with port information:
    For Extract Port Code from Train Record:
    When the system needs to send aei notification messages, then the port code is extracted from the train record's port of release field and used as the lookup key.
  • Context - the system needs to query for email recipients:
    For Set Record Type to CUSEMAIL:
    When preparing to query the database for email distribution list, then the record type is set to 'cusemail' to identify the correct table/record type.
  • Context - a port code is available and record type is set to cusemail:
    For Query Database for Email Recipients:
    When the system executes the database query, then the system calls the database service to retrieve email recipients for the specified port code.
  • Context - a database query for email recipients has been executed:
    For Query Successful?:
    When the system checks the return code from the database query, then if return code equals success constant, query is considered successful, otherwise it failed.
  • Context - the database query was successful and returned email recipients:
    For Loop Through Retrieved Email List:
    When the system processes the retrieved email list, then the system loops through email recipients from position 1 to 10 or until a blank entry is found.
  • Context - the system is processing email recipients from the database query result:
    For More Email Recipients?:
    When the system checks the current email recipient entry, then if the email user id is not blank and the counter is 10 or less, there are more recipients to process.
  • Context - a valid email recipient exists in the query results:
    For Add Email Recipient to Distribution List:
    When the system processes the email recipient, then the email user id is moved to the corresponding position in the message distribution list.
  • Context - the database query for email recipients failed:
    For Use Default Merlin ID as Recipient:
    When the system needs to set up email distribution, then the default merlin id is used as the first recipient in the distribution list.
  • Context - the system is preparing to send aei notification messages:
    For Set Default Merlin ID as Sender:
    When setting up the message sender information, then the default merlin id is assigned as the from-user-code for the message.
👨‍💻 Technical ACs (Gherkin)
Context: A train record exists with port information
GIVEN
A train record exists with port information
Applied to: Extract Port Code from Train Record
WHEN
The system needs to send AEI notification messages
THEN
The port code is extracted from the train record's port of release field and used as the lookup key
Context: The system needs to query for email recipients
GIVEN
The system needs to query for email recipients
Applied to: Set Record Type to CUSEMAIL
WHEN
Preparing to query the database for email distribution list
THEN
The record type is set to 'CUSEMAIL' to identify the correct table/record type
Context: A port code is available and record type is set to CUSEMAIL
GIVEN
A port code is available and record type is set to CUSEMAIL
Applied to: Query Database for Email Recipients
WHEN
The system executes the database query
THEN
The system calls the database service to retrieve email recipients for the specified port code
Context: A database query for email recipients has been executed
GIVEN
A database query for email recipients has been executed
Applied to: Query Successful?
WHEN
The system checks the return code from the database query
THEN
If return code equals success constant, query is considered successful, otherwise it failed
Context: The database query was successful and returned email recipients
GIVEN
The database query was successful and returned email recipients
Applied to: Loop Through Retrieved Email List
WHEN
The system processes the retrieved email list
THEN
The system loops through email recipients from position 1 to 10 or until a blank entry is found
Context: The system is processing email recipients from the database query result
GIVEN
The system is processing email recipients from the database query result
Applied to: More Email Recipients?
WHEN
The system checks the current email recipient entry
THEN
If the email user ID is not blank and the counter is 10 or less, there are more recipients to process
Context: A valid email recipient exists in the query results
GIVEN
A valid email recipient exists in the query results
Applied to: Add Email Recipient to Distribution List
WHEN
The system processes the email recipient
THEN
The email user ID is moved to the corresponding position in the message distribution list
Context: The database query for email recipients failed
GIVEN
The database query for email recipients failed
Applied to: Use Default Merlin ID as Recipient
WHEN
The system needs to set up email distribution
THEN
The default Merlin ID is used as the first recipient in the distribution list
Context: The system is preparing to send AEI notification messages
GIVEN
The system is preparing to send AEI notification messages
Applied to: Set Default Merlin ID as Sender
WHEN
Setting up the message sender information
THEN
The default Merlin ID is assigned as the from-user-code for the message
R-GCCCCADD-cbl-00531 (+40) File: GCCCCADD.cbl Beneficial Owner Processing Merged 41 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Beneficial Owner Processing':
  • Context - the system is processing beneficial owner information:
    For Initialize BN Segment Record:
    When starting beneficial owner segment creation, then a new beneficial owner segment record is initialized with empty values.
  • Context - the system needs to search for beneficial owner transportation data:
    For Set BN Entity ID for Search:
    When preparing to search transportation segments, then the entity id is set to 'bn' for beneficial owner identification.
  • Context - the entity id is set to 'bn' for beneficial owner:
    For Search Transportation Segments for BN:
    When searching transportation segments database, then the system retrieves transportation segments matching the beneficial owner entity id.
  • Context - a search for beneficial owner transportation segments has been performed:
    For BN Transportation Segment Found?:
    When evaluating the search results, then the system determines whether beneficial owner transportation segment data exists or processing should be skipped.
  • Context - beneficial owner transportation segment exists:
    For Search for BN Entity in EDI BOL:
    When searching edi bol entity segments for beneficial owner data, then the system retrieves beneficial owner entity information from edi bol segments.
  • Context - a search for beneficial owner entity in edi bol has been performed:
    For BN Entity Found in EDI BOL?:
    When evaluating the edi bol search results, then the system determines whether to proceed with beneficial owner processing or skip it based on entity existence.
    For BN Entity Found in EDI BOL?:
    When checking if beneficial owner entity data exists, then if beneficial owner entity is found, proceed to extract entity details; otherwise, end beneficial owner processing.
  • Context - beneficial owner entity is found in edi bol:
    For Set BN Entity ID Code:
    When processing beneficial owner entity information, then the entity id code 'bn' is assigned to the customs segment.
  • Context - beneficial owner entity data is available in edi bol:
    For Extract Beneficial Owner Name:
    When processing beneficial owner information, then the beneficial owner name is extracted and assigned to the customs segment.
  • Context - beneficial owner entity information is being processed:
    For Set Consignee CHOP Code:
    When setting up beneficial owner segment data, then the consignee chop code is assigned to the beneficial owner customs segment.
  • Context - beneficial owner entity processing is in progress:
    For Search for BN Address Segment:
    When searching for beneficial owner address information, then the system retrieves address segments matching the beneficial owner entity.
  • Context - a search for beneficial owner address has been performed:
    For BN Address Found?:
    When evaluating address search results, then the system determines whether to use found address data or set default address values.
    For BN Address Found?:
    When checking if address data exists for beneficial owner, then if address is found, extract address lines; otherwise, set default address to 'na'.
  • Context - beneficial owner address segment is found in edi:
    For Extract Address Information:
    When processing address information, then address line 1 and address line 2 are extracted and assigned to the customs segment.
  • Context - beneficial owner address segment is not found in edi:
    For Set Default 'NA' Address:
    When processing address information, then address line 1 is set to 'na' as default value.
  • Context - beneficial owner address processing is in progress:
    For Search for BN City/State Segment:
    When searching for city and state information, then the system retrieves city/state segments matching the beneficial owner entity.
  • Context - a search for beneficial owner city/state has been performed:
    For BN City/State Found?:
    When evaluating city/state search results, then the system determines whether to use found city/state data or clear the city/state information.
    For BN City/State Found?:
    When checking if city/state data exists for beneficial owner, then if city/state is found, extract location details; otherwise, clear city/state information.
  • Context - beneficial owner city/state segment is found in edi:
    For Extract City, State, Postal, Country:
    When processing city and state information, then city name, state/province code, postal code, and country code are extracted and assigned to the customs segment.
  • Context - beneficial owner city/state segment is not found in edi:
    For Clear City/State Information:
    When processing city and state information, then city, state, postal code, and country fields are cleared in the customs segment.
  • Context - beneficial owner segment processing is continuing:
    For Clear Contact Information:
    When setting up contact information, then all contact function code, name, communication qualifier, and communication number fields are cleared.
  • Context - beneficial owner segment data has been populated:
    For Validate BN Segment Data:
    When validating the segment before database insertion, then the beneficial owner segment data is validated according to customs data requirements.
  • Context - beneficial owner segment data has been validated successfully:
    For Insert BN Record into Customs Database:
    When inserting the record into the customs database, then the beneficial owner segment record is inserted into the customs database with sequence number between 0003 and 0025.
    For Insert BN Record into Customs Database:
    When storing the beneficial owner information, then the beneficial owner record is inserted into the customs database with sequence numbers 0003-0025.
  • Context - beneficial owner transportation segment or entity data is not found:
    For Skip BN Processing:
    When determining processing path, then beneficial owner processing is skipped and the system continues to the next processing step.
  • Context - the system needs to process beneficial owner information:
    For Initialize BN Segment Record:
    When starting beneficial owner segment processing, then a new beneficial owner segment record is initialized with empty values.
  • Context - a beneficial owner segment is being processed:
    For Set Organization ID to 'BN':
    When setting up the organization identifier for transportation segment search, then the organization id is set to 'bn' (beneficial owner).
  • Context - the organization id is set to 'bn':
    For Search for Transportation Segment with BN ID:
    When searching for transportation segment data, then the system retrieves transportation segment information for beneficial owner entity.
  • Context - a search for beneficial owner transportation segment has been performed:
    For Transportation Segment Found?:
    When checking if transportation segment data exists, then if transportation segment is found, proceed to search for bn entity; otherwise, end beneficial owner processing.
  • Context - a transportation segment exists for beneficial owner:
    For Search for BN Entity in EDI BOL:
    When searching for beneficial owner entity in edi bol data, then the system retrieves beneficial owner entity information from edi bol.
  • Context - beneficial owner entity exists in edi bol:
    For Extract BN Entity Name:
    When processing beneficial owner entity information, then the beneficial owner entity name is extracted and stored in the segment record.
  • Context - beneficial owner entity name has been extracted:
    For Set Entity ID to 'BN':
    When setting the entity classification, then the entity id is set to 'bn' (beneficial owner).
  • Context - beneficial owner entity id has been set:
    For Extract Consignee CHOP Code:
    When processing beneficial owner identification codes, then the consignee chop code is extracted and stored in the beneficial owner segment.
  • Context - beneficial owner entity information has been processed:
    For Search for BN Address Segment:
    When searching for beneficial owner address data, then the system retrieves address segment information for the beneficial owner.
  • Context - beneficial owner address segment exists:
    For Extract Address Line 1 and 2:
    When processing beneficial owner address information, then address line 1 and address line 2 are extracted and stored in the beneficial owner segment.
  • Context - beneficial owner address segment does not exist:
    For Set Default Address to 'NA':
    When processing beneficial owner address information, then the address line 1 is set to 'na' (not available) as default value.
  • Context - beneficial owner address processing is complete:
    For Search for BN City/State Segment:
    When searching for beneficial owner city and state data, then the system retrieves city/state segment information for the beneficial owner.
  • Context - beneficial owner city/state segment exists:
    For Extract City, State, Postal Code, Country:
    When processing beneficial owner location information, then city, state, postal code, and country are extracted and stored in the beneficial owner segment.
  • Context - beneficial owner city/state segment does not exist:
    For Clear City/State Information:
    When processing beneficial owner location information, then all city, state, postal code, and country fields are cleared (set to spaces).
  • Context - beneficial owner location processing is complete:
    For Clear Contact Information:
    When finalizing beneficial owner segment data, then all contact function code, name, communication qualifier, and communication number fields are cleared.
  • Context - all beneficial owner segment fields have been processed:
    For Validate BN Segment Data:
    When validating the beneficial owner segment, then the segment data is validated according to business rules for entity segments.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing beneficial owner information
GIVEN
The system is processing beneficial owner information
Applied to: Initialize BN Segment Record
WHEN
Starting beneficial owner segment creation
THEN
A new beneficial owner segment record is initialized with empty values
Context: The system needs to search for beneficial owner transportation data
GIVEN
The system needs to search for beneficial owner transportation data
Applied to: Set BN Entity ID for Search
WHEN
Preparing to search transportation segments
THEN
The entity ID is set to 'BN' for beneficial owner identification
Context: The entity ID is set to 'BN' for beneficial owner
GIVEN
The entity ID is set to 'BN' for beneficial owner
Applied to: Search Transportation Segments for BN
WHEN
Searching transportation segments database
THEN
The system retrieves transportation segments matching the beneficial owner entity ID
Context: A search for beneficial owner transportation segments has been performed
GIVEN
A search for beneficial owner transportation segments has been performed
Applied to: BN Transportation Segment Found?
WHEN
Evaluating the search results
THEN
The system determines whether beneficial owner transportation segment data exists or processing should be skipped
Context: Beneficial owner transportation segment exists
GIVEN
Beneficial owner transportation segment exists
Applied to: Search for BN Entity in EDI BOL
WHEN
Searching EDI BOL entity segments for beneficial owner data
THEN
The system retrieves beneficial owner entity information from EDI BOL segments
Context: A search for beneficial owner entity in EDI BOL has been performed
GIVEN
A search for beneficial owner entity in EDI BOL has been performed
Applied to: BN Entity Found in EDI BOL?
WHEN
Evaluating the EDI BOL search results
THEN
The system determines whether to proceed with beneficial owner processing or skip it based on entity existence
Applied to: BN Entity Found in EDI BOL?
WHEN
Checking if beneficial owner entity data exists
THEN
If beneficial owner entity is found, proceed to extract entity details; otherwise, end beneficial owner processing
Context: Beneficial owner entity is found in EDI BOL
GIVEN
Beneficial owner entity is found in EDI BOL
Applied to: Set BN Entity ID Code
WHEN
Processing beneficial owner entity information
THEN
The entity ID code 'BN' is assigned to the customs segment
Context: Beneficial owner entity data is available in EDI BOL
GIVEN
Beneficial owner entity data is available in EDI BOL
Applied to: Extract Beneficial Owner Name
WHEN
Processing beneficial owner information
THEN
The beneficial owner name is extracted and assigned to the customs segment
Context: Beneficial owner entity information is being processed
GIVEN
Beneficial owner entity information is being processed
Applied to: Set Consignee CHOP Code
WHEN
Setting up beneficial owner segment data
THEN
The consignee CHOP code is assigned to the beneficial owner customs segment
Context: Beneficial owner entity processing is in progress
GIVEN
Beneficial owner entity processing is in progress
Applied to: Search for BN Address Segment
WHEN
Searching for beneficial owner address information
THEN
The system retrieves address segments matching the beneficial owner entity
Context: A search for beneficial owner address has been performed
GIVEN
A search for beneficial owner address has been performed
Applied to: BN Address Found?
WHEN
Evaluating address search results
THEN
The system determines whether to use found address data or set default address values
Applied to: BN Address Found?
WHEN
Checking if address data exists for beneficial owner
THEN
If address is found, extract address lines; otherwise, set default address to 'NA'
Context: Beneficial owner address segment is found in EDI
GIVEN
Beneficial owner address segment is found in EDI
Applied to: Extract Address Information
WHEN
Processing address information
THEN
Address line 1 and address line 2 are extracted and assigned to the customs segment
Context: Beneficial owner address segment is not found in EDI
GIVEN
Beneficial owner address segment is not found in EDI
Applied to: Set Default 'NA' Address
WHEN
Processing address information
THEN
Address line 1 is set to 'NA' as default value
Context: Beneficial owner address processing is in progress
GIVEN
Beneficial owner address processing is in progress
Applied to: Search for BN City/State Segment
WHEN
Searching for city and state information
THEN
The system retrieves city/state segments matching the beneficial owner entity
Context: A search for beneficial owner city/state has been performed
GIVEN
A search for beneficial owner city/state has been performed
Applied to: BN City/State Found?
WHEN
Evaluating city/state search results
THEN
The system determines whether to use found city/state data or clear the city/state information
Applied to: BN City/State Found?
WHEN
Checking if city/state data exists for beneficial owner
THEN
If city/state is found, extract location details; otherwise, clear city/state information
Context: Beneficial owner city/state segment is found in EDI
GIVEN
Beneficial owner city/state segment is found in EDI
Applied to: Extract City, State, Postal, Country
WHEN
Processing city and state information
THEN
City name, state/province code, postal code, and country code are extracted and assigned to the customs segment
Context: Beneficial owner city/state segment is not found in EDI
GIVEN
Beneficial owner city/state segment is not found in EDI
Applied to: Clear City/State Information
WHEN
Processing city and state information
THEN
City, state, postal code, and country fields are cleared in the customs segment
Context: Beneficial owner segment processing is continuing
GIVEN
Beneficial owner segment processing is continuing
Applied to: Clear Contact Information
WHEN
Setting up contact information
THEN
All contact function code, name, communication qualifier, and communication number fields are cleared
Context: Beneficial owner segment data has been populated
GIVEN
Beneficial owner segment data has been populated
Applied to: Validate BN Segment Data
WHEN
Validating the segment before database insertion
THEN
The beneficial owner segment data is validated according to customs data requirements
Context: Beneficial owner segment data has been validated successfully
GIVEN
Beneficial owner segment data has been validated successfully
Applied to: Insert BN Record into Customs Database
WHEN
Inserting the record into the customs database
THEN
The beneficial owner segment record is inserted into the customs database with sequence number between 0003 and 0025
Applied to: Insert BN Record into Customs Database
WHEN
Storing the beneficial owner information
THEN
The beneficial owner record is inserted into the customs database with sequence numbers 0003-0025
Context: Beneficial owner transportation segment or entity data is not found
GIVEN
Beneficial owner transportation segment or entity data is not found
Applied to: Skip BN Processing
WHEN
Determining processing path
THEN
Beneficial owner processing is skipped and the system continues to the next processing step
Context: The system needs to process beneficial owner information
GIVEN
The system needs to process beneficial owner information
Applied to: Initialize BN Segment Record
WHEN
Starting beneficial owner segment processing
THEN
A new beneficial owner segment record is initialized with empty values
Context: A beneficial owner segment is being processed
GIVEN
A beneficial owner segment is being processed
Applied to: Set Organization ID to 'BN'
WHEN
Setting up the organization identifier for transportation segment search
THEN
The organization ID is set to 'BN' (Beneficial Owner)
Context: The organization ID is set to 'BN'
GIVEN
The organization ID is set to 'BN'
Applied to: Search for Transportation Segment with BN ID
WHEN
Searching for transportation segment data
THEN
The system retrieves transportation segment information for beneficial owner entity
Context: A search for beneficial owner transportation segment has been performed
GIVEN
A search for beneficial owner transportation segment has been performed
Applied to: Transportation Segment Found?
WHEN
Checking if transportation segment data exists
THEN
If transportation segment is found, proceed to search for BN entity; otherwise, end beneficial owner processing
Context: A transportation segment exists for beneficial owner
GIVEN
A transportation segment exists for beneficial owner
Applied to: Search for BN Entity in EDI BOL
WHEN
Searching for beneficial owner entity in EDI BOL data
THEN
The system retrieves beneficial owner entity information from EDI BOL
Context: Beneficial owner entity exists in EDI BOL
GIVEN
Beneficial owner entity exists in EDI BOL
Applied to: Extract BN Entity Name
WHEN
Processing beneficial owner entity information
THEN
The beneficial owner entity name is extracted and stored in the segment record
Context: Beneficial owner entity name has been extracted
GIVEN
Beneficial owner entity name has been extracted
Applied to: Set Entity ID to 'BN'
WHEN
Setting the entity classification
THEN
The entity ID is set to 'BN' (Beneficial Owner)
Context: Beneficial owner entity ID has been set
GIVEN
Beneficial owner entity ID has been set
Applied to: Extract Consignee CHOP Code
WHEN
Processing beneficial owner identification codes
THEN
The consignee CHOP code is extracted and stored in the beneficial owner segment
Context: Beneficial owner entity information has been processed
GIVEN
Beneficial owner entity information has been processed
Applied to: Search for BN Address Segment
WHEN
Searching for beneficial owner address data
THEN
The system retrieves address segment information for the beneficial owner
Context: Beneficial owner address segment exists
GIVEN
Beneficial owner address segment exists
Applied to: Extract Address Line 1 and 2
WHEN
Processing beneficial owner address information
THEN
Address line 1 and address line 2 are extracted and stored in the beneficial owner segment
Context: Beneficial owner address segment does not exist
GIVEN
Beneficial owner address segment does not exist
Applied to: Set Default Address to 'NA'
WHEN
Processing beneficial owner address information
THEN
The address line 1 is set to 'NA' (Not Available) as default value
Context: Beneficial owner address processing is complete
GIVEN
Beneficial owner address processing is complete
Applied to: Search for BN City/State Segment
WHEN
Searching for beneficial owner city and state data
THEN
The system retrieves city/state segment information for the beneficial owner
Context: Beneficial owner city/state segment exists
GIVEN
Beneficial owner city/state segment exists
Applied to: Extract City, State, Postal Code, Country
WHEN
Processing beneficial owner location information
THEN
City, state, postal code, and country are extracted and stored in the beneficial owner segment
Context: Beneficial owner city/state segment does not exist
GIVEN
Beneficial owner city/state segment does not exist
Applied to: Clear City/State Information
WHEN
Processing beneficial owner location information
THEN
All city, state, postal code, and country fields are cleared (set to spaces)
Context: Beneficial owner location processing is complete
GIVEN
Beneficial owner location processing is complete
Applied to: Clear Contact Information
WHEN
Finalizing beneficial owner segment data
THEN
All contact function code, name, communication qualifier, and communication number fields are cleared
Context: All beneficial owner segment fields have been processed
GIVEN
All beneficial owner segment fields have been processed
Applied to: Validate BN Segment Data
WHEN
Validating the beneficial owner segment
THEN
The segment data is validated according to business rules for entity segments
R-GCX122A-cbl-00537 (+3) File: GCX122A.cbl Update Test Train Acknowledgment Timestamp Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Test Train Acknowledgment Timestamp':
  • Context - a test train message is being processed and the t2 table segment has been retrieved:
    For Update Test Train Acknowledgment Timestamp - Record current system date, century, and time in T2-358-ACK field:
    When the system processes the test train acknowledgment, then the current system date (6 digits), century (2 digits), and time (4 digits) are recorded in the t2-358-ack field with date in positions 3-8, century in positions 1-2, and time in positions 9-12.
  • Context - a test cargo message is being processed and the t2 table segment has been retrieved:
    For Update Test Train Acknowledgment Timestamp - Record current system date, century, and time in T2-358-ACK field:
    When the system processes the test cargo acknowledgment, then the current system date (6 digits), century (2 digits), and time (4 digits) are recorded in the t2-309-ack field with date in positions 3-8, century in positions 1-2, and time in positions 9-12.
  • Context - a test message (train or cargo) needs timestamp processing:
    For Retrieve T2 Table Segment:
    When the system prepares to update acknowledgment timestamps, then the t2 table segment is retrieved using table id 't2' and empty sequence id, and if retrieval fails an error message 't2 check table entry not found' is generated.
  • Context - the t2 table segment has been updated with new acknowledgment timestamps:
    For Save Updated T2 Table Segment:
    When the timestamp updates are complete, then the updated t2 table segment is saved back to the database using the repl function.
👨‍💻 Technical ACs (Gherkin)
Context: A test train message is being processed and the T2 table segment has been retrieved
GIVEN
A test train message is being processed and the T2 table segment has been retrieved
Applied to: Update Test Train Acknowledgment Timestamp - Record current system date, century, and time in T2-358-ACK field
WHEN
The system processes the test train acknowledgment
THEN
The current system date (6 digits), century (2 digits), and time (4 digits) are recorded in the T2-358-ACK field with date in positions 3-8, century in positions 1-2, and time in positions 9-12
Context: A test cargo message is being processed and the T2 table segment has been retrieved
GIVEN
A test cargo message is being processed and the T2 table segment has been retrieved
Applied to: Update Test Train Acknowledgment Timestamp - Record current system date, century, and time in T2-358-ACK field
WHEN
The system processes the test cargo acknowledgment
THEN
The current system date (6 digits), century (2 digits), and time (4 digits) are recorded in the T2-309-ACK field with date in positions 3-8, century in positions 1-2, and time in positions 9-12
Context: A test message (train or cargo) needs timestamp processing
GIVEN
A test message (train or cargo) needs timestamp processing
Applied to: Retrieve T2 Table Segment
WHEN
The system prepares to update acknowledgment timestamps
THEN
The T2 table segment is retrieved using table ID 'T2' and empty sequence ID, and if retrieval fails an error message 'T2 CHECK TABLE ENTRY NOT FOUND' is generated
Context: The T2 table segment has been updated with new acknowledgment timestamps
GIVEN
The T2 table segment has been updated with new acknowledgment timestamps
Applied to: Save Updated T2 Table Segment
WHEN
The timestamp updates are complete
THEN
The updated T2 table segment is saved back to the database using the REPL function
R-GCX122A-cbl-00541 (+5) File: GCX122A.cbl Update Test Acknowledgment Timestamp Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Update Test Acknowledgment Timestamp':
  • Context - a test acknowledgment processing request is initiated:
    For Retrieve T2 Test Table Entry:
    When the system attempts to retrieve the t2 test table entry with empty sequence id, then the system should fetch the t2 table segment for timestamp update operations.
  • Context - the system has attempted to retrieve the t2 test table entry:
    For Table Entry Found?:
    When the table retrieval operation completes, then if the return flag is not '0', the system should display an error message 't2 check table entry not found' and terminate processing.
  • Context - a valid t2 test table entry has been retrieved:
    For Message Type?:
    When the system evaluates the transaction type from the oti message, then if oti-02-train is true, process as train test; if oti-02-cargo is true, process as cargo test.
  • Context - the message type is identified as train test (oti-02-train is true) and t2 table entry is available:
    For Update T2-358-ACK Field for Train Test:
    When the system processes the train test acknowledgment, then the system should move the machine century to positions 1-2, machine date to positions 3-8, and machine time (first 4 digits) to positions 9-12 of the t2-358-ack field.
  • Context - the message type is identified as cargo test (oti-02-cargo is true) and t2 table entry is available:
    For Update T2-309-ACK Field for Cargo Test:
    When the system processes the cargo test acknowledgment, then the system should move the machine century to positions 1-2, machine date to positions 3-8, and machine time (first 4 digits) to positions 9-12 of the t2-309-ack field.
  • Context - the appropriate timestamp field (t2-358-ack or t2-309-ack) has been updated with current system date and time:
    For Save Updated T2 Table Entry:
    When the timestamp update is complete, then the system should perform a repl operation to save the updated t2 table segment back to the database.
👨‍💻 Technical ACs (Gherkin)
Context: A test acknowledgment processing request is initiated
GIVEN
A test acknowledgment processing request is initiated
Applied to: Retrieve T2 Test Table Entry
WHEN
The system attempts to retrieve the T2 test table entry with empty sequence ID
THEN
The system should fetch the T2 table segment for timestamp update operations
Context: The system has attempted to retrieve the T2 test table entry
GIVEN
The system has attempted to retrieve the T2 test table entry
Applied to: Table Entry Found?
WHEN
The table retrieval operation completes
THEN
If the return flag is not '0', the system should display an error message 'T2 CHECK TABLE ENTRY NOT FOUND' and terminate processing
Context: A valid T2 test table entry has been retrieved
GIVEN
A valid T2 test table entry has been retrieved
Applied to: Message Type?
WHEN
The system evaluates the transaction type from the OTI message
THEN
If OTI-02-TRAIN is true, process as train test; if OTI-02-CARGO is true, process as cargo test
Context: The message type is identified as train test (OTI-02-TRAIN is true) and T2 table entry is available
GIVEN
The message type is identified as train test (OTI-02-TRAIN is true) and T2 table entry is available
Applied to: Update T2-358-ACK Field for Train Test
WHEN
The system processes the train test acknowledgment
THEN
The system should move the machine century to positions 1-2, machine date to positions 3-8, and machine time (first 4 digits) to positions 9-12 of the T2-358-ACK field
Context: The message type is identified as cargo test (OTI-02-CARGO is true) and T2 table entry is available
GIVEN
The message type is identified as cargo test (OTI-02-CARGO is true) and T2 table entry is available
Applied to: Update T2-309-ACK Field for Cargo Test
WHEN
The system processes the cargo test acknowledgment
THEN
The system should move the machine century to positions 1-2, machine date to positions 3-8, and machine time (first 4 digits) to positions 9-12 of the T2-309-ACK field
Context: The appropriate timestamp field (T2-358-ACK or T2-309-ACK) has been updated with current system date and time
GIVEN
The appropriate timestamp field (T2-358-ACK or T2-309-ACK) has been updated with current system date and time
Applied to: Save Updated T2 Table Entry
WHEN
The timestamp update is complete
THEN
The system should perform a REPL operation to save the updated T2 table segment back to the database
R-GCX122A-cbl-00547 (+6) File: GCX122A.cbl Prepare Message for Transmission Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Prepare Message for Transmission':
  • Context - a cargo arrival processing request is initiated:
    For Initialize Message Structure:
    When the system begins preparing the arrival message, then the message input structure is completely cleared of any previous data.
  • Context - an arrival message is being prepared for transmission:
    For Set Security Level to High:
    When the security level is being configured, then the security byte is set to high-value to ensure maximum protection.
  • Context - a cargo record exists with a valid cargo control number:
    For Extract Cargo Control Number:
    When an arrival message is being prepared, then the cargo control number is extracted and assigned to the message identifier field.
  • Context - an arrival message is being prepared for cargo:
    For Set Message Type to Cargo:
    When the message type classification is being set, then the message is marked as a cargo-type message.
  • Context - a cargo arrival message is being prepared:
    For Set Action Code to 'CAA' - Cargo Arrival:
    When the action code is being assigned, then the action code is set to 'caa' to indicate cargo arrival.
  • Context - a cargo record contains manifest transaction information with a port code:
    For Extract Port Code from Manifest:
    When an arrival message is being prepared, then the port code from the manifest transaction is extracted and assigned to the message port code field.
  • Context - an arrival message has been fully formatted with all required information:
    For Prepare Message for Transmission:
    When the message is ready for transmission, then the message is sent through the messaging system and the transmission queue is purged.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo arrival processing request is initiated
GIVEN
A cargo arrival processing request is initiated
Applied to: Initialize Message Structure
WHEN
The system begins preparing the arrival message
THEN
The message input structure is completely cleared of any previous data
Context: An arrival message is being prepared for transmission
GIVEN
An arrival message is being prepared for transmission
Applied to: Set Security Level to High
WHEN
The security level is being configured
THEN
The security byte is set to high-value to ensure maximum protection
Context: A cargo record exists with a valid cargo control number
GIVEN
A cargo record exists with a valid cargo control number
Applied to: Extract Cargo Control Number
WHEN
An arrival message is being prepared
THEN
The cargo control number is extracted and assigned to the message identifier field
Context: An arrival message is being prepared for cargo
GIVEN
An arrival message is being prepared for cargo
Applied to: Set Message Type to Cargo
WHEN
The message type classification is being set
THEN
The message is marked as a cargo-type message
Context: A cargo arrival message is being prepared
GIVEN
A cargo arrival message is being prepared
Applied to: Set Action Code to 'CAA' - Cargo Arrival
WHEN
The action code is being assigned
THEN
The action code is set to 'CAA' to indicate cargo arrival
Context: A cargo record contains manifest transaction information with a port code
GIVEN
A cargo record contains manifest transaction information with a port code
Applied to: Extract Port Code from Manifest
WHEN
An arrival message is being prepared
THEN
The port code from the manifest transaction is extracted and assigned to the message port code field
Context: An arrival message has been fully formatted with all required information
GIVEN
An arrival message has been fully formatted with all required information
Applied to: Prepare Message for Transmission
WHEN
The message is ready for transmission
THEN
The message is sent through the messaging system and the transmission queue is purged
R-GCCCCADD-cbl-00552 (+32) File: GCCCCADD.cbl Carrier Entity Processing Merged 33 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Carrier Entity Processing':
  • Context - a c1 carrier entity processing request is initiated:
    For Initialize C1 Entity Segment:
    When the system begins c1 entity segment creation, then a new c1 entity segment structure is initialized with empty values.
  • Context - a c1 carrier entity segment is being created:
    For Set Entity Type to 'C1':
    When the entity type needs to be specified, then the entity type code is set to 'c1' to identify it as a carrier entity.
  • Context - edi bol transportation data is available for processing:
    For Search EDI BOL Transportation Segments:
    When the system searches for c1 carrier entity information, then the system looks up transportation segments with entity type 'c1' in the edi bol data.
  • Context - the system has searched edi bol transportation segments for c1 entity data:
    For C1 Entity Found in EDI BOL?:
    When evaluating the availability of c1 carrier information, then if c1 entity is found in edi bol, use edi data; otherwise check fastway data source.
  • Context - c1 carrier entity data exists in edi bol transportation segments:
    For Extract Carrier Data from EDI BOL:
    When processing carrier information from edi source, then the system extracts carrier name, id, and related data from the edi bol transportation segments.
  • Context - c1 carrier entity data is available in edi bol transportation segments:
    For Get Carrier Name and ID:
    When extracting carrier identification information, then the carrier name is assigned to entity name field and carrier id is assigned to entity id field.
  • Context - edi t2 transportation segment data is available for the carrier:
    For Get Carrier Address from T2 Segment:
    When processing carrier address information, then the address lines are extracted from t2 segment and assigned to carrier address fields.
  • Context - edi ta transportation segment data is available for the carrier:
    For Get Carrier City/State from TA Segment:
    When processing carrier location information, then the city name, state code, postal code, and country code are extracted from ta segment.
  • Context - edi t3 transportation segment data is available for the carrier:
    For Get Carrier Contact from T3 Segment:
    When processing carrier contact information, then the contact function code, contact name, communication qualifier, and communication number are extracted from t3 segment.
  • Context - c1 carrier entity data is not found in edi bol transportation segments:
    For Carrier Data Available in Fastway?:
    When evaluating alternative data sources for carrier information, then if consignee data field 2 contains carrier information, use fastway data; otherwise end c1 processing.
  • Context - carrier information is available in fastway consignee data and consignee data code field 2 equals 'c':
    For Extract Carrier from Fastway Consignee Data:
    When processing carrier information from fastway source, then the system extracts carrier data from consignee data fields in the shipment root.
  • Context - carrier information is being extracted from fastway consignee data:
    For Get Carrier Name from Consignee Field 2:
    When processing carrier name from fastway source, then the carrier name is assigned from consignee data field 2 to the entity name field.
    For Get Carrier Address from Consignee Field 3:
    When processing carrier address from fastway source, then the carrier address is assigned from consignee data field 3 to the address field, or 'na' if field 3 is empty.
    For Use Consignee Address as Carrier Address:
    When address information is needed for the carrier, then consignee address field 3 is used as carrier address line 1, with 'na' default if empty, and address line 2 is cleared.
  • Context - carrier information is being extracted from fastway consignee data field 4:
    For Parse City/State/Postal from Consignee Field 4:
    When processing carrier location information from fastway source, then the city name, state code, and postal code are parsed from consignee data field 4 and assigned to respective location fields.
  • Context - a state or province code is available for the carrier:
    For Lookup Country Code from State:
    When determining the corresponding country code, then the system searches the state-country lookup table to find the matching country code for the given state/province code.
  • Context - carrier address information is being processed:
    For Set Default Address if Missing:
    When the carrier address field is empty or contains only spaces, then the address field is set to 'na' as the default value.
  • Context - a c1 carrier entity segment has been populated with data:
    For Validate C1 Entity Segment:
    When validating the carrier entity information, then the system validates required fields, data formats, and business rules for the c1 entity segment.
  • Context - a validated c1 carrier entity segment is ready for insertion:
    For Insert C1 Entity into Customs Record:
    When adding the carrier entity to the customs record, then the c1 entity segment is inserted into the customs record with the appropriate sequence number between 0003 and 0025.
  • Context - the system needs to process c1 carrier entity information:
    For Initialize C1 Segment:
    When c1 carrier entity processing begins, then a new c1 segment structure is initialized with empty values.
  • Context - a c1 carrier entity segment is being processed:
    For Set Organization ID to 'C1':
    When the organization identifier needs to be set, then the organization id is set to 'c1' to identify this as a carrier entity.
  • Context - edi bol data is available for processing:
    For Search EDI BOL Transportation Segments:
    When the system searches for c1 carrier transportation segments, then transportation segments with organization id 'c1' are retrieved from edi bol data.
  • Context - c1 carrier transportation segment is found in edi bol data:
    For Extract Carrier Information from EDI BOL:
    When carrier information needs to be extracted, then carrier organization id, name, id code qualifier, and id code are extracted from the transportation segment.
  • Context - c1 carrier is found in edi bol transportation segments:
    For Get Transportation Address Data:
    When address information is needed for the carrier, then address line 1 and address line 2 are retrieved from t2 transportation address segments.
    For Get Transportation City/State Data:
    When city and state information is needed for the carrier, then city name, state/province code, postal code, and country code are retrieved from ta transportation segments.
    For Get Transportation Contact Data:
    When contact information is needed for the carrier, then contact function code, contact name, communication number qualifier, and communication number are retrieved from t3 transportation segments.
  • Context - c1 carrier address information is being processed:
    For Set Default Address if Missing:
    When the address line 1 is empty or missing, then the address line 1 is set to 'na' as a default value.
  • Context - c1 carrier is not found in edi bol transportation segments:
    For Check Fastway Consignee Data:
    When the system checks fastway consignee data for carrier information, then the consignee data code is evaluated to determine if it equals 'c' indicating carrier type.
  • Context - fastway consignee data code equals 'c' indicating carrier type:
    For Extract Carrier from Fastway Consignee Field:
    When carrier information needs to be extracted from fastway data, then the entity id is set to 'c1', carrier name is extracted from consignee data field 2, and id code qualifiers are cleared.
  • Context - fastway consignee address is being used as carrier address:
    For Parse City/State/Postal from Address:
    When city, state, and postal code information needs to be extracted, then consignee data field 4 is parsed to extract city name, state/province code, and postal code.
  • Context - state/province code is available from parsed fastway address data:
    For Lookup Country Code from State:
    When country code needs to be determined for the carrier address, then the state-country lookup table is searched to find the corresponding country code for the state/province code.
  • Context - c1 carrier segment data has been populated from either edi bol or fastway sources:
    For Validate C1 Segment Data:
    When the c1 segment needs to be validated before insertion, then the n1 segment validation routine is performed to check required fields and data formats.
  • Context - c1 carrier segment has been validated and is ready for insertion:
    For Insert C1 Segment into Customs Record:
    When the segment needs to be added to the customs record, then the c1 segment is inserted into the customs record array with sequence numbers 0003-0025.
👨‍💻 Technical ACs (Gherkin)
Context: A C1 carrier entity processing request is initiated
GIVEN
A C1 carrier entity processing request is initiated
Applied to: Initialize C1 Entity Segment
WHEN
The system begins C1 entity segment creation
THEN
A new C1 entity segment structure is initialized with empty values
Context: A C1 carrier entity segment is being created
GIVEN
A C1 carrier entity segment is being created
Applied to: Set Entity Type to 'C1'
WHEN
The entity type needs to be specified
THEN
The entity type code is set to 'C1' to identify it as a carrier entity
Context: EDI BOL transportation data is available for processing
GIVEN
EDI BOL transportation data is available for processing
Applied to: Search EDI BOL Transportation Segments
WHEN
The system searches for C1 carrier entity information
THEN
The system looks up transportation segments with entity type 'C1' in the EDI BOL data
Context: The system has searched EDI BOL transportation segments for C1 entity data
GIVEN
The system has searched EDI BOL transportation segments for C1 entity data
Applied to: C1 Entity Found in EDI BOL?
WHEN
Evaluating the availability of C1 carrier information
THEN
If C1 entity is found in EDI BOL, use EDI data; otherwise check Fastway data source
Context: C1 carrier entity data exists in EDI BOL transportation segments
GIVEN
C1 carrier entity data exists in EDI BOL transportation segments
Applied to: Extract Carrier Data from EDI BOL
WHEN
Processing carrier information from EDI source
THEN
The system extracts carrier name, ID, and related data from the EDI BOL transportation segments
Context: C1 carrier entity data is available in EDI BOL transportation segments
GIVEN
C1 carrier entity data is available in EDI BOL transportation segments
Applied to: Get Carrier Name and ID
WHEN
Extracting carrier identification information
THEN
The carrier name is assigned to entity name field and carrier ID is assigned to entity ID field
Context: EDI T2 transportation segment data is available for the carrier
GIVEN
EDI T2 transportation segment data is available for the carrier
Applied to: Get Carrier Address from T2 Segment
WHEN
Processing carrier address information
THEN
The address lines are extracted from T2 segment and assigned to carrier address fields
Context: EDI TA transportation segment data is available for the carrier
GIVEN
EDI TA transportation segment data is available for the carrier
Applied to: Get Carrier City/State from TA Segment
WHEN
Processing carrier location information
THEN
The city name, state code, postal code, and country code are extracted from TA segment
Context: EDI T3 transportation segment data is available for the carrier
GIVEN
EDI T3 transportation segment data is available for the carrier
Applied to: Get Carrier Contact from T3 Segment
WHEN
Processing carrier contact information
THEN
The contact function code, contact name, communication qualifier, and communication number are extracted from T3 segment
Context: C1 carrier entity data is not found in EDI BOL transportation segments
GIVEN
C1 carrier entity data is not found in EDI BOL transportation segments
Applied to: Carrier Data Available in Fastway?
WHEN
Evaluating alternative data sources for carrier information
THEN
If consignee data field 2 contains carrier information, use Fastway data; otherwise end C1 processing
Context: Carrier information is available in Fastway consignee data and consignee data code field 2 equals 'C'
GIVEN
Carrier information is available in Fastway consignee data and consignee data code field 2 equals 'C'
Applied to: Extract Carrier from Fastway Consignee Data
WHEN
Processing carrier information from Fastway source
THEN
The system extracts carrier data from consignee data fields in the shipment root
Context: Carrier information is being extracted from Fastway consignee data
GIVEN
Carrier information is being extracted from Fastway consignee data
Applied to: Get Carrier Name from Consignee Field 2
WHEN
Processing carrier name from Fastway source
THEN
The carrier name is assigned from consignee data field 2 to the entity name field
Applied to: Get Carrier Address from Consignee Field 3
WHEN
Processing carrier address from Fastway source
THEN
The carrier address is assigned from consignee data field 3 to the address field, or 'NA' if field 3 is empty
Applied to: Use Consignee Address as Carrier Address
WHEN
Address information is needed for the carrier
THEN
Consignee address field 3 is used as carrier address line 1, with 'NA' default if empty, and address line 2 is cleared
Context: Carrier information is being extracted from Fastway consignee data field 4
GIVEN
Carrier information is being extracted from Fastway consignee data field 4
Applied to: Parse City/State/Postal from Consignee Field 4
WHEN
Processing carrier location information from Fastway source
THEN
The city name, state code, and postal code are parsed from consignee data field 4 and assigned to respective location fields
Context: A state or province code is available for the carrier
GIVEN
A state or province code is available for the carrier
Applied to: Lookup Country Code from State
WHEN
Determining the corresponding country code
THEN
The system searches the state-country lookup table to find the matching country code for the given state/province code
Context: Carrier address information is being processed
GIVEN
Carrier address information is being processed
Applied to: Set Default Address if Missing
WHEN
The carrier address field is empty or contains only spaces
THEN
The address field is set to 'NA' as the default value
Context: A C1 carrier entity segment has been populated with data
GIVEN
A C1 carrier entity segment has been populated with data
Applied to: Validate C1 Entity Segment
WHEN
Validating the carrier entity information
THEN
The system validates required fields, data formats, and business rules for the C1 entity segment
Context: A validated C1 carrier entity segment is ready for insertion
GIVEN
A validated C1 carrier entity segment is ready for insertion
Applied to: Insert C1 Entity into Customs Record
WHEN
Adding the carrier entity to the customs record
THEN
The C1 entity segment is inserted into the customs record with the appropriate sequence number between 0003 and 0025
Context: The system needs to process C1 carrier entity information
GIVEN
The system needs to process C1 carrier entity information
Applied to: Initialize C1 Segment
WHEN
C1 carrier entity processing begins
THEN
A new C1 segment structure is initialized with empty values
Context: A C1 carrier entity segment is being processed
GIVEN
A C1 carrier entity segment is being processed
Applied to: Set Organization ID to 'C1'
WHEN
The organization identifier needs to be set
THEN
The organization ID is set to 'C1' to identify this as a carrier entity
Context: EDI BOL data is available for processing
GIVEN
EDI BOL data is available for processing
Applied to: Search EDI BOL Transportation Segments
WHEN
The system searches for C1 carrier transportation segments
THEN
Transportation segments with organization ID 'C1' are retrieved from EDI BOL data
Context: C1 carrier transportation segment is found in EDI BOL data
GIVEN
C1 carrier transportation segment is found in EDI BOL data
Applied to: Extract Carrier Information from EDI BOL
WHEN
Carrier information needs to be extracted
THEN
Carrier organization ID, name, ID code qualifier, and ID code are extracted from the transportation segment
Context: C1 carrier is found in EDI BOL transportation segments
GIVEN
C1 carrier is found in EDI BOL transportation segments
Applied to: Get Transportation Address Data
WHEN
Address information is needed for the carrier
THEN
Address line 1 and address line 2 are retrieved from T2 transportation address segments
Applied to: Get Transportation City/State Data
WHEN
City and state information is needed for the carrier
THEN
City name, state/province code, postal code, and country code are retrieved from TA transportation segments
Applied to: Get Transportation Contact Data
WHEN
Contact information is needed for the carrier
THEN
Contact function code, contact name, communication number qualifier, and communication number are retrieved from T3 transportation segments
Context: C1 carrier address information is being processed
GIVEN
C1 carrier address information is being processed
Applied to: Set Default Address if Missing
WHEN
The address line 1 is empty or missing
THEN
The address line 1 is set to 'NA' as a default value
Context: C1 carrier is not found in EDI BOL transportation segments
GIVEN
C1 carrier is not found in EDI BOL transportation segments
Applied to: Check Fastway Consignee Data
WHEN
The system checks Fastway consignee data for carrier information
THEN
The consignee data code is evaluated to determine if it equals 'C' indicating carrier type
Context: Fastway consignee data code equals 'C' indicating carrier type
GIVEN
Fastway consignee data code equals 'C' indicating carrier type
Applied to: Extract Carrier from Fastway Consignee Field
WHEN
Carrier information needs to be extracted from Fastway data
THEN
The entity ID is set to 'C1', carrier name is extracted from consignee data field 2, and ID code qualifiers are cleared
Context: Fastway consignee address is being used as carrier address
GIVEN
Fastway consignee address is being used as carrier address
Applied to: Parse City/State/Postal from Address
WHEN
City, state, and postal code information needs to be extracted
THEN
Consignee data field 4 is parsed to extract city name, state/province code, and postal code
Context: State/province code is available from parsed Fastway address data
GIVEN
State/province code is available from parsed Fastway address data
Applied to: Lookup Country Code from State
WHEN
Country code needs to be determined for the carrier address
THEN
The state-country lookup table is searched to find the corresponding country code for the state/province code
Context: C1 carrier segment data has been populated from either EDI BOL or Fastway sources
GIVEN
C1 carrier segment data has been populated from either EDI BOL or Fastway sources
Applied to: Validate C1 Segment Data
WHEN
The C1 segment needs to be validated before insertion
THEN
The N1 segment validation routine is performed to check required fields and data formats
Context: C1 carrier segment has been validated and is ready for insertion
GIVEN
C1 carrier segment has been validated and is ready for insertion
Applied to: Insert C1 Segment into Customs Record
WHEN
The segment needs to be added to the customs record
THEN
The C1 segment is inserted into the customs record array with sequence numbers 0003-0025
R-GCX122A-cbl-00554 File: GCX122A.cbl Extract Shipment ID from Reference Numbers
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Shipment ID from Reference Numbers':
  • Context - a cargo record exists with multiple n901/n902 reference number pairs:
    For Extract Shipment ID from Reference Numbers - Loop through N901/N902 reference number pairs to find CN qualifier and extract shipment ID:
    When the system processes the cargo record for shipment id extraction, then the system loops through up to 10 reference number pairs, finds the pair where n901 qualifier equals 'cn', and extracts the corresponding n902 reference number as the shipment id.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo record exists with multiple N901/N902 reference number pairs
GIVEN
A cargo record exists with multiple N901/N902 reference number pairs
Applied to: Extract Shipment ID from Reference Numbers - Loop through N901/N902 reference number pairs to find CN qualifier and extract shipment ID
WHEN
The system processes the cargo record for shipment ID extraction
THEN
The system loops through up to 10 reference number pairs, finds the pair where N901 qualifier equals 'CN', and extracts the corresponding N902 reference number as the shipment ID
R-GCCCCADD-cbl-00570 (+48) File: GCCCCADD.cbl Notify Party Processing Merged 49 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Notify Party Processing':
  • Context - the system needs to process notify party information:
    For Initialize N1 Segment Record:
    When starting notify party processing, then a new n1 segment record is initialized with empty values.
  • Context - an initialized n1 segment record exists:
    For Set Entity ID to 'N1':
    When processing notify party entity information, then the entity id code is set to 'n1' to identify this as a notify party record.
  • Context - edi bol data is available for processing:
    For Search EDI BOL for Transportation Segments:
    When searching for notify party transportation segments, then the system iterates through transportation segments starting from sequence 1 until found or maximum sequences reached.
  • Context - a transportation segment lookup is performed:
    For Transportation Segment Found?:
    When checking for segment existence in edi bol data, then if segment exists, continue processing; otherwise skip to end of notify party processing.
  • Context - a valid transportation segment is found:
    For Extract Organization ID from Segment:
    When processing the segment data, then the organization id is extracted from the d5-org-id field.
  • Context - an organization id is extracted from transportation segment:
    For Organization ID Matches 'N1'?:
    When validating entity type for notify party processing, then if organization id equals 'n1', continue with notify party processing; otherwise search next segment.
  • Context - a transportation segment with organization id 'n1' is found:
    For Extract Entity Name:
    When processing notify party entity information, then the entity name is extracted from d5-name field and stored in the n1 segment.
  • Context - notify party entity name is extracted:
    For Clear ID Code Qualifier and ID Code:
    When setting up notify party n1 segment fields, then id code qualifier and id code fields are set to spaces.
  • Context - notify party entity information is processed:
    For Get Address Information from T2 Segment:
    When looking for address details, then system searches for t2 segment with matching sequence number.
  • Context - a t2 address segment lookup is performed:
    For Address Segment Found?:
    When checking for address information availability, then if t2 segment exists, extract address lines; otherwise proceed to city/state processing.
  • Context - a valid t2 address segment is found:
    For Extract Address Line 1 and 2:
    When processing address information, then address line 1 and address line 2 are extracted from d6-addl-name-addr-1 and d6-addl-name-addr-2 fields.
  • Context - address line processing is complete or skipped:
    For Get City/State Information from TA Segment:
    When looking for geographic location details, then system searches for ta segment with matching sequence number.
  • Context - a ta city/state segment lookup is performed:
    For City/State Segment Found?:
    When checking for geographic information availability, then if ta segment exists, extract geographic details; otherwise proceed to contact processing.
  • Context - a valid ta geographic segment is found:
    For Extract City, State, Postal Code, Country:
    When processing geographic information, then city, state, postal code, and country are extracted from d7 fields and stored in n4 segment data.
  • Context - geographic information processing is complete or skipped:
    For Get Contact Information from T3 Segment:
    When looking for contact person details, then system searches for t3 segment with matching sequence number.
  • Context - a t3 contact segment lookup is performed:
    For Contact Segment Found?:
    When checking for contact information availability, then if t3 segment exists, extract contact details; otherwise proceed to address defaulting.
  • Context - a valid t3 contact segment is found:
    For Extract Contact Function, Name, Phone Qualifier, Phone Number:
    When processing contact information, then contact function, name, phone qualifier, and phone number are extracted from per fields and stored in per segment data.
  • Context - address information processing is complete:
    For Set Default Address if Missing:
    When address line 1 is empty or spaces, then address line 1 is set to 'na' as default value.
  • Context - all notify party information is extracted and processed:
    For Validate N1 Segment Data:
    When validating segment data for customs compliance, then system performs field validation checks and generates error messages for missing required data.
  • Context - n1 segment data validation is successful:
    For Insert N1 Record into Customs Database:
    When storing notify party information in customs database, then the n1 record is inserted into the customs database with sequence number between 0003-0025.
  • Context - all transportation segments have been searched:
    For Skip - No N1 Entity Found:
    When no segments with organization id 'n1' are found, then notify party processing is skipped and control returns to main processing.
  • Context - edi bol transportation segments exist in the system:
    For Search EDI BOL Transportation Segments:
    When searching for notify party information, then the system iterates through transportation segments looking for organization id 'n1'.
  • Context - a search for transportation segments has been performed:
    For Transportation Segment Found?:
    When checking if transportation segment data is available, then processing continues if segment found, otherwise notify party processing ends.
  • Context - a transportation segment has been found:
    For Extract Organization ID:
    When processing the segment data, then the organization id is extracted from the segment for entity type validation.
  • Context - an organization id has been extracted from transportation segment:
    For Organization ID = 'N1'?:
    When validating the entity type, then processing continues if organization id equals 'n1', otherwise the segment is skipped.
  • Context - a transportation segment with organization id 'n1' has been found:
    For Extract Entity Name:
    When processing the n1 entity data, then the entity name is extracted and stored in the n1 segment record.
  • Context - an n1 entity record is being processed:
    For Clear ID Code Qualifier and ID Code:
    When setting up the entity identification fields, then both id code qualifier and id code fields are set to spaces.
  • Context - an n1 transportation entity has been processed:
    For Get Transportation Address Segment T2:
    When retrieving address information for the entity, then the system attempts to get the corresponding t2 address segment.
  • Context - a request for t2 address segment has been made:
    For Address Segment Found?:
    When checking if address data is available, then address processing continues if t2 segment found, otherwise skip to city/state processing.
  • Context - a t2 address segment has been found:
    For Extract Address Line 1:
    When processing address information, then the first address line is extracted and stored in the n1 segment record.
  • Context - a t2 address segment has been found and address line 1 processed:
    For Extract Address Line 2:
    When processing additional address information, then the second address line is extracted and stored in the n1 segment record.
  • Context - address processing has been completed or skipped:
    For Get Transportation City/State Segment TA:
    When retrieving city and state information for the entity, then the system attempts to get the corresponding ta city/state segment.
  • Context - a request for ta city/state segment has been made:
    For City/State Segment Found?:
    When checking if city/state data is available, then city/state processing continues if ta segment found, otherwise skip to contact processing.
  • Context - a ta city/state segment has been found:
    For Extract City Name:
    When processing city information, then the city name is extracted and stored in the n1 segment record.
  • Context - a ta city/state segment has been found and city processed:
    For Extract State/Province Code:
    When processing state/province information, then the state/province code is extracted and stored in the n1 segment record.
  • Context - a ta city/state segment has been found and state/province processed:
    For Extract Postal Code:
    When processing postal code information, then the postal code is extracted and stored in the n1 segment record.
  • Context - a ta city/state segment has been found and postal code processed:
    For Extract Country Code:
    When processing country information, then the country code is extracted and stored in the n1 segment record.
  • Context - city/state processing has been completed or skipped:
    For Get Transportation Contact Segment T3:
    When retrieving contact information for the entity, then the system attempts to get the corresponding t3 contact segment.
  • Context - a request for t3 contact segment has been made:
    For Contact Segment Found?:
    When checking if contact data is available, then contact processing continues if t3 segment found, otherwise skip to address defaulting.
  • Context - a t3 contact segment has been found:
    For Extract Contact Function Code:
    When processing contact function information, then the contact function code is extracted and stored in the n1 segment record.
  • Context - a t3 contact segment has been found and contact function processed:
    For Extract Contact Name:
    When processing contact name information, then the contact name is extracted and stored in the n1 segment record.
  • Context - a t3 contact segment has been found and contact name processed:
    For Extract Communication Number Qualifier:
    When processing communication qualifier information, then the communication number qualifier is extracted and stored in the n1 segment record.
  • Context - a t3 contact segment has been found and communication qualifier processed:
    For Extract Communication Number:
    When processing communication number information, then the communication number is extracted and stored in the n1 segment record.
  • Context - all segment processing has been completed:
    For Set Default Address if Missing:
    When the first address line is empty or spaces, then the first address line is set to 'na' as a default value.
  • Context - an n1 segment record has been populated with entity data:
    For Validate N1 Segment Data:
    When validating the segment before database insertion, then all required fields are validated and any validation errors are recorded.
  • Context - a validated n1 segment record exists:
    For Insert N1 Record into Customs Database:
    When inserting the record into the customs database, then the n1 record is successfully stored in the gcsccs55 customs database table.
  • Context - a transportation segment has been found with an organization id:
    For Skip - Not N1 Entity:
    When the organization id is not equal to 'n1', then the segment is skipped and processing continues with the next segment.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process notify party information
GIVEN
The system needs to process notify party information
Applied to: Initialize N1 Segment Record
WHEN
Starting notify party processing
THEN
A new N1 segment record is initialized with empty values
Context: An initialized N1 segment record exists
GIVEN
An initialized N1 segment record exists
Applied to: Set Entity ID to 'N1'
WHEN
Processing notify party entity information
THEN
The entity ID code is set to 'N1' to identify this as a notify party record
Context: EDI BOL data is available for processing
GIVEN
EDI BOL data is available for processing
Applied to: Search EDI BOL for Transportation Segments
WHEN
Searching for notify party transportation segments
THEN
The system iterates through transportation segments starting from sequence 1 until found or maximum sequences reached
Context: A transportation segment lookup is performed
GIVEN
A transportation segment lookup is performed
Applied to: Transportation Segment Found?
WHEN
Checking for segment existence in EDI BOL data
THEN
If segment exists, continue processing; otherwise skip to end of notify party processing
Context: A valid transportation segment is found
GIVEN
A valid transportation segment is found
Applied to: Extract Organization ID from Segment
WHEN
Processing the segment data
THEN
The organization ID is extracted from the D5-ORG-ID field
Context: An organization ID is extracted from transportation segment
GIVEN
An organization ID is extracted from transportation segment
Applied to: Organization ID Matches 'N1'?
WHEN
Validating entity type for notify party processing
THEN
If organization ID equals 'N1', continue with notify party processing; otherwise search next segment
Context: A transportation segment with organization ID 'N1' is found
GIVEN
A transportation segment with organization ID 'N1' is found
Applied to: Extract Entity Name
WHEN
Processing notify party entity information
THEN
The entity name is extracted from D5-NAME field and stored in the N1 segment
Context: Notify party entity name is extracted
GIVEN
Notify party entity name is extracted
Applied to: Clear ID Code Qualifier and ID Code
WHEN
Setting up notify party N1 segment fields
THEN
ID code qualifier and ID code fields are set to spaces
Context: Notify party entity information is processed
GIVEN
Notify party entity information is processed
Applied to: Get Address Information from T2 Segment
WHEN
Looking for address details
THEN
System searches for T2 segment with matching sequence number
Context: A T2 address segment lookup is performed
GIVEN
A T2 address segment lookup is performed
Applied to: Address Segment Found?
WHEN
Checking for address information availability
THEN
If T2 segment exists, extract address lines; otherwise proceed to city/state processing
Context: A valid T2 address segment is found
GIVEN
A valid T2 address segment is found
Applied to: Extract Address Line 1 and 2
WHEN
Processing address information
THEN
Address line 1 and address line 2 are extracted from D6-ADDL-NAME-ADDR-1 and D6-ADDL-NAME-ADDR-2 fields
Context: Address line processing is complete or skipped
GIVEN
Address line processing is complete or skipped
Applied to: Get City/State Information from TA Segment
WHEN
Looking for geographic location details
THEN
System searches for TA segment with matching sequence number
Context: A TA city/state segment lookup is performed
GIVEN
A TA city/state segment lookup is performed
Applied to: City/State Segment Found?
WHEN
Checking for geographic information availability
THEN
If TA segment exists, extract geographic details; otherwise proceed to contact processing
Context: A valid TA geographic segment is found
GIVEN
A valid TA geographic segment is found
Applied to: Extract City, State, Postal Code, Country
WHEN
Processing geographic information
THEN
City, state, postal code, and country are extracted from D7 fields and stored in N4 segment data
Context: Geographic information processing is complete or skipped
GIVEN
Geographic information processing is complete or skipped
Applied to: Get Contact Information from T3 Segment
WHEN
Looking for contact person details
THEN
System searches for T3 segment with matching sequence number
Context: A T3 contact segment lookup is performed
GIVEN
A T3 contact segment lookup is performed
Applied to: Contact Segment Found?
WHEN
Checking for contact information availability
THEN
If T3 segment exists, extract contact details; otherwise proceed to address defaulting
Context: A valid T3 contact segment is found
GIVEN
A valid T3 contact segment is found
Applied to: Extract Contact Function, Name, Phone Qualifier, Phone Number
WHEN
Processing contact information
THEN
Contact function, name, phone qualifier, and phone number are extracted from PER fields and stored in PER segment data
Context: Address information processing is complete
GIVEN
Address information processing is complete
Applied to: Set Default Address if Missing
WHEN
Address line 1 is empty or spaces
THEN
Address line 1 is set to 'NA' as default value
Context: All notify party information is extracted and processed
GIVEN
All notify party information is extracted and processed
Applied to: Validate N1 Segment Data
WHEN
Validating segment data for customs compliance
THEN
System performs field validation checks and generates error messages for missing required data
Context: N1 segment data validation is successful
GIVEN
N1 segment data validation is successful
Applied to: Insert N1 Record into Customs Database
WHEN
Storing notify party information in customs database
THEN
The N1 record is inserted into the customs database with sequence number between 0003-0025
Context: All transportation segments have been searched
GIVEN
All transportation segments have been searched
Applied to: Skip - No N1 Entity Found
WHEN
No segments with organization ID 'N1' are found
THEN
Notify party processing is skipped and control returns to main processing
Context: EDI BOL transportation segments exist in the system
GIVEN
EDI BOL transportation segments exist in the system
Applied to: Search EDI BOL Transportation Segments
WHEN
Searching for notify party information
THEN
The system iterates through transportation segments looking for organization ID 'N1'
Context: A search for transportation segments has been performed
GIVEN
A search for transportation segments has been performed
Applied to: Transportation Segment Found?
WHEN
Checking if transportation segment data is available
THEN
Processing continues if segment found, otherwise notify party processing ends
Context: A transportation segment has been found
GIVEN
A transportation segment has been found
Applied to: Extract Organization ID
WHEN
Processing the segment data
THEN
The organization ID is extracted from the segment for entity type validation
Context: An organization ID has been extracted from transportation segment
GIVEN
An organization ID has been extracted from transportation segment
Applied to: Organization ID = 'N1'?
WHEN
Validating the entity type
THEN
Processing continues if organization ID equals 'N1', otherwise the segment is skipped
Context: A transportation segment with organization ID 'N1' has been found
GIVEN
A transportation segment with organization ID 'N1' has been found
Applied to: Extract Entity Name
WHEN
Processing the N1 entity data
THEN
The entity name is extracted and stored in the N1 segment record
Context: An N1 entity record is being processed
GIVEN
An N1 entity record is being processed
Applied to: Clear ID Code Qualifier and ID Code
WHEN
Setting up the entity identification fields
THEN
Both ID code qualifier and ID code fields are set to spaces
Context: An N1 transportation entity has been processed
GIVEN
An N1 transportation entity has been processed
Applied to: Get Transportation Address Segment T2
WHEN
Retrieving address information for the entity
THEN
The system attempts to get the corresponding T2 address segment
Context: A request for T2 address segment has been made
GIVEN
A request for T2 address segment has been made
Applied to: Address Segment Found?
WHEN
Checking if address data is available
THEN
Address processing continues if T2 segment found, otherwise skip to city/state processing
Context: A T2 address segment has been found
GIVEN
A T2 address segment has been found
Applied to: Extract Address Line 1
WHEN
Processing address information
THEN
The first address line is extracted and stored in the N1 segment record
Context: A T2 address segment has been found and address line 1 processed
GIVEN
A T2 address segment has been found and address line 1 processed
Applied to: Extract Address Line 2
WHEN
Processing additional address information
THEN
The second address line is extracted and stored in the N1 segment record
Context: Address processing has been completed or skipped
GIVEN
Address processing has been completed or skipped
Applied to: Get Transportation City/State Segment TA
WHEN
Retrieving city and state information for the entity
THEN
The system attempts to get the corresponding TA city/state segment
Context: A request for TA city/state segment has been made
GIVEN
A request for TA city/state segment has been made
Applied to: City/State Segment Found?
WHEN
Checking if city/state data is available
THEN
City/state processing continues if TA segment found, otherwise skip to contact processing
Context: A TA city/state segment has been found
GIVEN
A TA city/state segment has been found
Applied to: Extract City Name
WHEN
Processing city information
THEN
The city name is extracted and stored in the N1 segment record
Context: A TA city/state segment has been found and city processed
GIVEN
A TA city/state segment has been found and city processed
Applied to: Extract State/Province Code
WHEN
Processing state/province information
THEN
The state/province code is extracted and stored in the N1 segment record
Context: A TA city/state segment has been found and state/province processed
GIVEN
A TA city/state segment has been found and state/province processed
Applied to: Extract Postal Code
WHEN
Processing postal code information
THEN
The postal code is extracted and stored in the N1 segment record
Context: A TA city/state segment has been found and postal code processed
GIVEN
A TA city/state segment has been found and postal code processed
Applied to: Extract Country Code
WHEN
Processing country information
THEN
The country code is extracted and stored in the N1 segment record
Context: City/state processing has been completed or skipped
GIVEN
City/state processing has been completed or skipped
Applied to: Get Transportation Contact Segment T3
WHEN
Retrieving contact information for the entity
THEN
The system attempts to get the corresponding T3 contact segment
Context: A request for T3 contact segment has been made
GIVEN
A request for T3 contact segment has been made
Applied to: Contact Segment Found?
WHEN
Checking if contact data is available
THEN
Contact processing continues if T3 segment found, otherwise skip to address defaulting
Context: A T3 contact segment has been found
GIVEN
A T3 contact segment has been found
Applied to: Extract Contact Function Code
WHEN
Processing contact function information
THEN
The contact function code is extracted and stored in the N1 segment record
Context: A T3 contact segment has been found and contact function processed
GIVEN
A T3 contact segment has been found and contact function processed
Applied to: Extract Contact Name
WHEN
Processing contact name information
THEN
The contact name is extracted and stored in the N1 segment record
Context: A T3 contact segment has been found and contact name processed
GIVEN
A T3 contact segment has been found and contact name processed
Applied to: Extract Communication Number Qualifier
WHEN
Processing communication qualifier information
THEN
The communication number qualifier is extracted and stored in the N1 segment record
Context: A T3 contact segment has been found and communication qualifier processed
GIVEN
A T3 contact segment has been found and communication qualifier processed
Applied to: Extract Communication Number
WHEN
Processing communication number information
THEN
The communication number is extracted and stored in the N1 segment record
Context: All segment processing has been completed
GIVEN
All segment processing has been completed
Applied to: Set Default Address if Missing
WHEN
The first address line is empty or spaces
THEN
The first address line is set to 'NA' as a default value
Context: An N1 segment record has been populated with entity data
GIVEN
An N1 segment record has been populated with entity data
Applied to: Validate N1 Segment Data
WHEN
Validating the segment before database insertion
THEN
All required fields are validated and any validation errors are recorded
Context: A validated N1 segment record exists
GIVEN
A validated N1 segment record exists
Applied to: Insert N1 Record into Customs Database
WHEN
Inserting the record into the customs database
THEN
The N1 record is successfully stored in the GCSCCS55 customs database table
Context: A transportation segment has been found with an organization ID
GIVEN
A transportation segment has been found with an organization ID
Applied to: Skip - Not N1 Entity
WHEN
The organization ID is not equal to 'N1'
THEN
The segment is skipped and processing continues with the next segment
R-GCCCCADD-cbl-00591 (+39) File: GCCCCADD.cbl MCOA Segment Processing Merged 40 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MCOA Segment Processing':
  • Context - mcoa segment processing is starting:
    For Initialize Empty N1 Segment:
    When the system begins to process pf or ss entity segments, then an empty n1 segment structure is initialized with spaces.
    For Initialize Entity Segment:
    When the system begins to build pf or ss entity segments, then the entity segment data structure is initialized to spaces.
  • Context - a sequence number for mcoa segment processing:
    For Retrieve MCOA Segment by Sequence Number:
    When the system attempts to retrieve mcoa segment data, then the system calls ebclgio to fetch ebsmcoa segment with type 'ot' using the sequence number.
  • Context - an attempt to retrieve mcoa segment data:
    For MCOA Segment Found?:
    When the system checks the retrieval result, then if status code is spaces and segment type equals 'ot', set mcoa found flag to true, otherwise set to false.
  • Context - a successfully retrieved mcoa segment:
    For Entity Type is PF or SS?:
    When the system checks the organization id in the segment, then if f5-org-id equals 'pf' or 'ss', continue processing, otherwise skip to next sequence.
  • Context - a valid mcoa segment with pf or ss entity type:
    For Extract Entity Information:
    When the system processes the entity information, then extract organization id, name, id code qualifier, and id code from f5 fields.
  • Context - extracted entity information from mcoa segment:
    For Set Entity ID Code & Set Entity Name & Set ID Code Qualifier & Set ID Code:
    When the system populates the n1 segment, then move f5-org-id to gccs-n101-entity-id-cde and move f5-name to gccs-n102-name and move f5-id-code-qual to gccs-n103-id-cde-qual and move f5-id-code to gccs-n104-id-cde.
  • Context - processing pf or ss entity from mcoa segment:
    For Extract Entity Information:
    When the system sets up the n1 segment, then move spaces to gccs-sc301-chop-cde.
  • Context - a valid mcoa entity segment:
    For Retrieve Address Information:
    When the system needs address information, then call ebclgio to retrieve ebsmcoa segment with type 'on' using the same sequence number.
    For Retrieve City/State Information:
    When the system needs city and state information, then call ebclgio to retrieve ebsmcoa segment with type 'oc' using the same sequence number.
  • Context - an attempt to retrieve address segment:
    For Address Segment Found?:
    When the system checks the retrieval result, then if status code is spaces, set address found flag to true, otherwise set to false.
  • Context - a successfully retrieved address segment:
    For Extract Address Line 1, Extract Address Line 2:
    When the system processes address information, then move f6-addl-name-addr-1 to gccs-n301-address-info-1 and f6-addl-name-addr-2 to gccs-n302-address-info-2.
  • Context - address segment retrieval failed:
    For Set Default Address as 'NA':
    When the system needs to populate address fields, then move 'na' to gccs-n301-address-info-1 and spaces to gccs-n302-address-info-2.
  • Context - an attempt to retrieve city/state segment:
    For City/State Segment Found?:
    When the system checks the retrieval result, then if status code is spaces, set city/state found flag to true, otherwise set to false.
  • Context - a successfully retrieved city/state segment:
    For Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code:
    When the system processes geographic information, then move f7-city-name to gccs-n401-city-name, f7-state-prov-code to gccs-n402-state-prov-cde, f7-postal-code to gccs-n403-postal-cde, and f7-country-code to gccs-n404-country-cde.
  • Context - city/state segment retrieval failed:
    For Clear City/State Information:
    When the system needs to populate geographic fields, then move spaces to gccs-n401-city-name, gccs-n402-state-prov-cde, gccs-n403-postal-cde, and gccs-n404-country-cde.
  • Context - a completed n1 segment with entity and address information:
    For Validate N1 Segment Data:
    When the system validates the segment data, then perform y100-edit-n1-segment to validate all required fields and data integrity.
  • Context - a validated n1 segment:
    For Insert N1 Segment into Database:
    When the system stores the segment data, then perform z950-isrt-gcsccs55-0003-0025 to insert the segment into gcsccs55 database with sequence numbers 0003-0025.
  • Context - completion of current mcoa segment processing:
    For Increment Sequence Counter:
    When the system continues the processing loop, then increment ws-mcoa-seq-nbr and continue until sw-ebsmcoa-not-found is true.
  • Context - an edi bol key and mcoa sequence number are available:
    For Retrieve MCOA Segment Data:
    When the system retrieves mcoa segment data with type 'ot', then the mcoa segment is fetched from the edi database.
  • Context - mcoa segment retrieval has been attempted:
    For MCOA Segment Found?:
    When the system checks if segment data exists and type equals 'ot', then processing continues if segment is found, otherwise moves to next sequence.
  • Context - a valid mcoa segment has been found:
    For Entity Type is PF or SS?:
    When the entity organization id is checked, then processing continues only if the entity type is 'pf' or 'ss'.
  • Context - a mcoa segment with entity type pf or ss:
    For Extract Entity Information:
    When entity information is extracted, then entity id, name, id code qualifier, and id code are captured from the segment.
  • Context - mcoa segment data with valid entity information:
    For Set Entity ID and Name:
    When entity identification fields are populated, then the entity id code is set to the organization id and entity name is set to the organization name.
  • Context - mcoa segment with entity identification data:
    For Set ID Code Qualifier and Code:
    When id code fields are populated, then the id code qualifier and id code are set from the mcoa segment, and chop code is cleared.
  • Context - a valid mcoa entity with the current sequence number:
    For Retrieve Address Information:
    When address information is retrieved using mcoa on segment type, then address data is fetched from the edi database for the entity.
    For Retrieve City/State Information:
    When city and state information is retrieved using mcoa oc segment type, then geographic data is fetched from the edi database for the entity.
  • Context - address information retrieval has been attempted:
    For Address Data Found?:
    When the system checks if mcoa on segment data exists, then address processing continues if data is found, otherwise default address is set.
  • Context - valid mcoa on segment address data:
    For Set Address Lines from MCOA:
    When address fields are populated, then address line 1 and address line 2 are set from the mcoa segment data.
  • Context - mcoa on segment address data is not found:
    For Set Default Address as 'NA':
    When address fields need to be populated, then address line 1 is set to 'na' and address line 2 is cleared.
  • Context - city/state information retrieval has been attempted:
    For City/State Data Found?:
    When the system checks if mcoa oc segment data exists, then geographic data processing continues if found, otherwise fields are cleared.
  • Context - valid mcoa oc segment geographic data:
    For Set City, State, Postal, Country:
    When geographic fields are populated, then city name, state/province code, postal code, and country code are set from mcoa segment.
  • Context - mcoa oc segment geographic data is not found:
    For Clear City/State Fields:
    When geographic fields need to be populated, then city name, state/province code, postal code, and country code are all cleared.
  • Context - a completed entity segment with all available data:
    For Validate Entity Segment:
    When entity segment validation is performed, then the segment is validated according to n1 segment validation rules.
  • Context - a validated entity segment:
    For Insert Entity Record:
    When the entity record is inserted, then the segment is stored in the gcsccs55 table with sequence numbers 0003-0025.
  • Context - current mcoa sequence processing is complete:
    For Process Next MCOA Sequence:
    When the system checks for additional sequences, then the mcoa sequence number is incremented for next iteration.
  • Context - mcoa sequence processing loop is active:
    For More MCOA Sequences?:
    When the system checks for more sequences to process, then processing continues if more mcoa sequences are found, otherwise processing ends.
👨‍💻 Technical ACs (Gherkin)
Context: MCOA segment processing is starting
GIVEN
MCOA segment processing is starting
Applied to: Initialize Empty N1 Segment
WHEN
the system begins to process PF or SS entity segments
THEN
an empty N1 segment structure is initialized with spaces
Applied to: Initialize Entity Segment
WHEN
the system begins to build PF or SS entity segments
THEN
the entity segment data structure is initialized to spaces
Context: a sequence number for MCOA segment processing
GIVEN
a sequence number for MCOA segment processing
Applied to: Retrieve MCOA Segment by Sequence Number
WHEN
the system attempts to retrieve MCOA segment data
THEN
the system calls EBCLGIO to fetch EBSMCOA segment with type 'OT' using the sequence number
Context: an attempt to retrieve MCOA segment data
GIVEN
an attempt to retrieve MCOA segment data
Applied to: MCOA Segment Found?
WHEN
the system checks the retrieval result
THEN
if status code is spaces and segment type equals 'OT', set MCOA found flag to true, otherwise set to false
Context: a successfully retrieved MCOA segment
GIVEN
a successfully retrieved MCOA segment
Applied to: Entity Type is PF or SS?
WHEN
the system checks the organization ID in the segment
THEN
if F5-ORG-ID equals 'PF' or 'SS', continue processing, otherwise skip to next sequence
Context: a valid MCOA segment with PF or SS entity type
GIVEN
a valid MCOA segment with PF or SS entity type
Applied to: Extract Entity Information
WHEN
the system processes the entity information
THEN
extract organization ID, name, ID code qualifier, and ID code from F5 fields
Context: extracted entity information from MCOA segment
GIVEN
extracted entity information from MCOA segment
Applied to: Set Entity ID Code & Set Entity Name & Set ID Code Qualifier & Set ID Code
WHEN
the system populates the N1 segment
THEN
move F5-ORG-ID to GCCS-N101-ENTITY-ID-CDE AND move F5-NAME to GCCS-N102-NAME AND move F5-ID-CODE-QUAL to GCCS-N103-ID-CDE-QUAL AND move F5-ID-CODE to GCCS-N104-ID-CDE
Context: processing PF or SS entity from MCOA segment
GIVEN
processing PF or SS entity from MCOA segment
Applied to: Extract Entity Information
WHEN
the system sets up the N1 segment
THEN
move spaces to GCCS-SC301-CHOP-CDE
Context: a valid MCOA entity segment
GIVEN
a valid MCOA entity segment
Applied to: Retrieve Address Information
WHEN
the system needs address information
THEN
call EBCLGIO to retrieve EBSMCOA segment with type 'ON' using the same sequence number
Applied to: Retrieve City/State Information
WHEN
the system needs city and state information
THEN
call EBCLGIO to retrieve EBSMCOA segment with type 'OC' using the same sequence number
Context: an attempt to retrieve address segment
GIVEN
an attempt to retrieve address segment
Applied to: Address Segment Found?
WHEN
the system checks the retrieval result
THEN
if status code is spaces, set address found flag to true, otherwise set to false
Context: a successfully retrieved address segment
GIVEN
a successfully retrieved address segment
Applied to: Extract Address Line 1, Extract Address Line 2
WHEN
the system processes address information
THEN
move F6-ADDL-NAME-ADDR-1 to GCCS-N301-ADDRESS-INFO-1 and F6-ADDL-NAME-ADDR-2 to GCCS-N302-ADDRESS-INFO-2
Context: address segment retrieval failed
GIVEN
address segment retrieval failed
Applied to: Set Default Address as 'NA'
WHEN
the system needs to populate address fields
THEN
move 'NA' to GCCS-N301-ADDRESS-INFO-1 and spaces to GCCS-N302-ADDRESS-INFO-2
Context: an attempt to retrieve city/state segment
GIVEN
an attempt to retrieve city/state segment
Applied to: City/State Segment Found?
WHEN
the system checks the retrieval result
THEN
if status code is spaces, set city/state found flag to true, otherwise set to false
Context: a successfully retrieved city/state segment
GIVEN
a successfully retrieved city/state segment
Applied to: Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code
WHEN
the system processes geographic information
THEN
move F7-CITY-NAME to GCCS-N401-CITY-NAME, F7-STATE-PROV-CODE to GCCS-N402-STATE-PROV-CDE, F7-POSTAL-CODE to GCCS-N403-POSTAL-CDE, and F7-COUNTRY-CODE to GCCS-N404-COUNTRY-CDE
Context: city/state segment retrieval failed
GIVEN
city/state segment retrieval failed
Applied to: Clear City/State Information
WHEN
the system needs to populate geographic fields
THEN
move spaces to GCCS-N401-CITY-NAME, GCCS-N402-STATE-PROV-CDE, GCCS-N403-POSTAL-CDE, and GCCS-N404-COUNTRY-CDE
Context: a completed N1 segment with entity and address information
GIVEN
a completed N1 segment with entity and address information
Applied to: Validate N1 Segment Data
WHEN
the system validates the segment data
THEN
perform Y100-EDIT-N1-SEGMENT to validate all required fields and data integrity
Context: a validated N1 segment
GIVEN
a validated N1 segment
Applied to: Insert N1 Segment into Database
WHEN
the system stores the segment data
THEN
perform Z950-ISRT-GCSCCS55-0003-0025 to insert the segment into GCSCCS55 database with sequence numbers 0003-0025
Context: completion of current MCOA segment processing
GIVEN
completion of current MCOA segment processing
Applied to: Increment Sequence Counter
WHEN
the system continues the processing loop
THEN
increment WS-MCOA-SEQ-NBR and continue until SW-EBSMCOA-NOT-FOUND is true
Context: an EDI BOL key and MCOA sequence number are available
GIVEN
an EDI BOL key and MCOA sequence number are available
Applied to: Retrieve MCOA Segment Data
WHEN
the system retrieves MCOA segment data with type 'OT'
THEN
the MCOA segment is fetched from the EDI database
Context: MCOA segment retrieval has been attempted
GIVEN
MCOA segment retrieval has been attempted
Applied to: MCOA Segment Found?
WHEN
the system checks if segment data exists and type equals 'OT'
THEN
processing continues if segment is found, otherwise moves to next sequence
Context: a valid MCOA segment has been found
GIVEN
a valid MCOA segment has been found
Applied to: Entity Type is PF or SS?
WHEN
the entity organization ID is checked
THEN
processing continues only if the entity type is 'PF' or 'SS'
Context: a MCOA segment with entity type PF or SS
GIVEN
a MCOA segment with entity type PF or SS
Applied to: Extract Entity Information
WHEN
entity information is extracted
THEN
entity ID, name, ID code qualifier, and ID code are captured from the segment
Context: MCOA segment data with valid entity information
GIVEN
MCOA segment data with valid entity information
Applied to: Set Entity ID and Name
WHEN
entity identification fields are populated
THEN
the entity ID code is set to the organization ID and entity name is set to the organization name
Context: MCOA segment with entity identification data
GIVEN
MCOA segment with entity identification data
Applied to: Set ID Code Qualifier and Code
WHEN
ID code fields are populated
THEN
the ID code qualifier and ID code are set from the MCOA segment, and CHOP code is cleared
Context: a valid MCOA entity with the current sequence number
GIVEN
a valid MCOA entity with the current sequence number
Applied to: Retrieve Address Information
WHEN
address information is retrieved using MCOA ON segment type
THEN
address data is fetched from the EDI database for the entity
Applied to: Retrieve City/State Information
WHEN
city and state information is retrieved using MCOA OC segment type
THEN
geographic data is fetched from the EDI database for the entity
Context: address information retrieval has been attempted
GIVEN
address information retrieval has been attempted
Applied to: Address Data Found?
WHEN
the system checks if MCOA ON segment data exists
THEN
address processing continues if data is found, otherwise default address is set
Context: valid MCOA ON segment address data
GIVEN
valid MCOA ON segment address data
Applied to: Set Address Lines from MCOA
WHEN
address fields are populated
THEN
address line 1 and address line 2 are set from the MCOA segment data
Context: MCOA ON segment address data is not found
GIVEN
MCOA ON segment address data is not found
Applied to: Set Default Address as 'NA'
WHEN
address fields need to be populated
THEN
address line 1 is set to 'NA' and address line 2 is cleared
Context: city/state information retrieval has been attempted
GIVEN
city/state information retrieval has been attempted
Applied to: City/State Data Found?
WHEN
the system checks if MCOA OC segment data exists
THEN
geographic data processing continues if found, otherwise fields are cleared
Context: valid MCOA OC segment geographic data
GIVEN
valid MCOA OC segment geographic data
Applied to: Set City, State, Postal, Country
WHEN
geographic fields are populated
THEN
city name, state/province code, postal code, and country code are set from MCOA segment
Context: MCOA OC segment geographic data is not found
GIVEN
MCOA OC segment geographic data is not found
Applied to: Clear City/State Fields
WHEN
geographic fields need to be populated
THEN
city name, state/province code, postal code, and country code are all cleared
Context: a completed entity segment with all available data
GIVEN
a completed entity segment with all available data
Applied to: Validate Entity Segment
WHEN
entity segment validation is performed
THEN
the segment is validated according to N1 segment validation rules
Context: a validated entity segment
GIVEN
a validated entity segment
Applied to: Insert Entity Record
WHEN
the entity record is inserted
THEN
the segment is stored in the GCSCCS55 table with sequence numbers 0003-0025
Context: current MCOA sequence processing is complete
GIVEN
current MCOA sequence processing is complete
Applied to: Process Next MCOA Sequence
WHEN
the system checks for additional sequences
THEN
the MCOA sequence number is incremented for next iteration
Context: MCOA sequence processing loop is active
GIVEN
MCOA sequence processing loop is active
Applied to: More MCOA Sequences?
WHEN
the system checks for more sequences to process
THEN
processing continues if more MCOA sequences are found, otherwise processing ends
R-GCCCCADD-cbl-00612 (+17) File: GCCCCADD.cbl Additional Entity Processing Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Additional Entity Processing':
  • Context - a customs manifest is being created and entity type 11 processing is required:
    For Build 11 Entity Segment:
    When the system searches for edi bol tn segment with entity type 11, then if found, the system processes the entity data and creates a record 55 segment, otherwise skips to next entity type.
  • Context - nn entity processing is initiated with sequence number starting from 1:
    For Build NN Entity Segments:
    When the system searches for edi bol nn segments incrementally by sequence number, then the system continues processing each found nn segment until no more segments exist.
  • Context - an nn entity segment is found in edi bol data:
    For Validate NN Entity ID Code:
    When the system checks the entity id code against valid entity id values, then if the entity id is valid, processing continues; if invalid, the entity is skipped and importer data is cleared if no s55 importer found.
  • Context - a valid nn entity segment is found with acceptable entity id code:
    For Process NN Entity Data from EDI:
    When the system processes the nn entity data, then the system extracts entity name, consignee chop code, and builds address and contact information for the customs record.
  • Context - an nn entity is being processed and address information is needed:
    For Get NN Address Information:
    When the system searches for corresponding address segments (gc type), then if address segments are found, the system extracts address lines; if not found or address line 1 is empty, sets default 'na' value.
  • Context - an nn entity is being processed and geographic information is needed:
    For Get NN City/State Information:
    When the system searches for corresponding geographic segments (ga type), then if geographic segments are found, the system extracts city, state, postal code, and country; if not found, clears all geographic data fields.
  • Context - mc entity processing is required for the customs manifest:
    For Build MC Entity Segment:
    When the system searches for edi bol tn segment with entity type mc, then if found, the system processes the mc entity data and creates a record 55 segment, otherwise continues to next entity type.
  • Context - oo entity processing is required for the customs manifest:
    For Build OO Entity Segment:
    When the system searches for edi bol tn segment with entity type oo, then if found, the system processes the oo entity data and creates a record 55 segment, otherwise continues to next entity type.
  • Context - fw entity processing is required for the customs manifest:
    For Build FW Entity Segment:
    When the system searches for edi bol tn segment with entity type fw, then if found, the system processes the fw entity data and creates a record 55 segment, completing additional entity processing.
  • Context - importer data was found in previous processing steps and nn entity has invalid entity id:
    For Skip Entity Processing:
    When the system encounters an invalid nn entity id code, then the system retains the previously found importer data and sets importer found flag, skipping current nn entity processing.
  • Context - a customs manifest is being processed and entity type 11 data may exist in edi bol transportation segments:
    For Build 11 Entity Segment:
    When the system searches for edi bol tn segments with entity type 11 and finds matching data, then the system creates a customs database record with entity type 11 information including name, address, city/state, and contact details.
  • Context - nn entity segments are found in edi bol data with various entity id codes:
    For Validate Entity ID Code:
    When the system validates the entity id code against the list of valid entity values, then only entities with valid id codes (specific predefined values) are processed and invalid entities are skipped.
  • Context - valid nn entity segments exist in edi bol data with corresponding address and contact segments:
    For Process NN Entity Data:
    When the system processes nn entity data and retrieves associated gc and ga address segments, then the system creates a complete entity record with name from nn segment, address from gc segment, city/state/postal/country from ga segment, and inserts it into customs database.
  • Context - a customs manifest requires motor carrier information and mc entity data may exist in edi bol:
    For Build MC Entity Segment:
    When the system searches for edi bol tn segments with entity type mc and finds matching data, then the system processes the mc entity data and creates a customs database record with motor carrier information.
  • Context - a customs manifest may contain other organization information and oo entity data exists in edi bol:
    For Build OO Entity Segment:
    When the system searches for edi bol tn segments with entity type oo and finds matching data, then the system processes the oo entity data and creates a customs database record with other organization information.
  • Context - a customs manifest may contain freight forwarder information and fw entity data exists in edi bol:
    For Build FW Entity Segment:
    When the system searches for edi bol tn segments with entity type fw and finds matching data, then the system processes the fw entity data and creates a customs database record with freight forwarder information.
  • Context - entity data has been processed and validated for any entity type (11, nn, mc, oo, fw):
    For Insert Entity Record into Customs Database:
    When the system completes entity data processing and validation, then the system assigns the next available sequence number, validates the complete entity record, and inserts it into the customs database (gcsccs55).
  • Context - importer data was previously found and stored during earlier processing and nn entity processing is occurring:
    For Process NN Entity Data:
    When the system encounters nn entity data and importer information already exists from previous processing, then the system retains the existing importer data, sets importer found flag, and does not clear the importer information.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest is being created and entity type 11 processing is required
GIVEN
A customs manifest is being created and entity type 11 processing is required
Applied to: Build 11 Entity Segment
WHEN
The system searches for EDI BOL TN segment with entity type 11
THEN
If found, the system processes the entity data and creates a record 55 segment, otherwise skips to next entity type
Context: NN entity processing is initiated with sequence number starting from 1
GIVEN
NN entity processing is initiated with sequence number starting from 1
Applied to: Build NN Entity Segments
WHEN
The system searches for EDI BOL NN segments incrementally by sequence number
THEN
The system continues processing each found NN segment until no more segments exist
Context: An NN entity segment is found in EDI BOL data
GIVEN
An NN entity segment is found in EDI BOL data
Applied to: Validate NN Entity ID Code
WHEN
The system checks the entity ID code against valid entity ID values
THEN
If the entity ID is valid, processing continues; if invalid, the entity is skipped and importer data is cleared if no S55 importer found
Context: A valid NN entity segment is found with acceptable entity ID code
GIVEN
A valid NN entity segment is found with acceptable entity ID code
Applied to: Process NN Entity Data from EDI
WHEN
The system processes the NN entity data
THEN
The system extracts entity name, consignee chop code, and builds address and contact information for the customs record
Context: An NN entity is being processed and address information is needed
GIVEN
An NN entity is being processed and address information is needed
Applied to: Get NN Address Information
WHEN
The system searches for corresponding address segments (GC type)
THEN
If address segments are found, the system extracts address lines; if not found or address line 1 is empty, sets default 'NA' value
Context: An NN entity is being processed and geographic information is needed
GIVEN
An NN entity is being processed and geographic information is needed
Applied to: Get NN City/State Information
WHEN
The system searches for corresponding geographic segments (GA type)
THEN
If geographic segments are found, the system extracts city, state, postal code, and country; if not found, clears all geographic data fields
Context: MC entity processing is required for the customs manifest
GIVEN
MC entity processing is required for the customs manifest
Applied to: Build MC Entity Segment
WHEN
The system searches for EDI BOL TN segment with entity type MC
THEN
If found, the system processes the MC entity data and creates a record 55 segment, otherwise continues to next entity type
Context: OO entity processing is required for the customs manifest
GIVEN
OO entity processing is required for the customs manifest
Applied to: Build OO Entity Segment
WHEN
The system searches for EDI BOL TN segment with entity type OO
THEN
If found, the system processes the OO entity data and creates a record 55 segment, otherwise continues to next entity type
Context: FW entity processing is required for the customs manifest
GIVEN
FW entity processing is required for the customs manifest
Applied to: Build FW Entity Segment
WHEN
The system searches for EDI BOL TN segment with entity type FW
THEN
If found, the system processes the FW entity data and creates a record 55 segment, completing additional entity processing
Context: Importer data was found in previous processing steps and NN entity has invalid entity ID
GIVEN
Importer data was found in previous processing steps and NN entity has invalid entity ID
Applied to: Skip Entity Processing
WHEN
The system encounters an invalid NN entity ID code
THEN
The system retains the previously found importer data and sets importer found flag, skipping current NN entity processing
Context: A customs manifest is being processed and entity type 11 data may exist in EDI BOL transportation segments
GIVEN
A customs manifest is being processed and entity type 11 data may exist in EDI BOL transportation segments
Applied to: Build 11 Entity Segment
WHEN
The system searches for EDI BOL TN segments with entity type 11 and finds matching data
THEN
The system creates a customs database record with entity type 11 information including name, address, city/state, and contact details
Context: NN entity segments are found in EDI BOL data with various entity ID codes
GIVEN
NN entity segments are found in EDI BOL data with various entity ID codes
Applied to: Validate Entity ID Code
WHEN
The system validates the entity ID code against the list of valid entity values
THEN
Only entities with valid ID codes (specific predefined values) are processed and invalid entities are skipped
Context: Valid NN entity segments exist in EDI BOL data with corresponding address and contact segments
GIVEN
Valid NN entity segments exist in EDI BOL data with corresponding address and contact segments
Applied to: Process NN Entity Data
WHEN
The system processes NN entity data and retrieves associated GC and GA address segments
THEN
The system creates a complete entity record with name from NN segment, address from GC segment, city/state/postal/country from GA segment, and inserts it into customs database
Context: A customs manifest requires Motor Carrier information and MC entity data may exist in EDI BOL
GIVEN
A customs manifest requires Motor Carrier information and MC entity data may exist in EDI BOL
Applied to: Build MC Entity Segment
WHEN
The system searches for EDI BOL TN segments with entity type MC and finds matching data
THEN
The system processes the MC entity data and creates a customs database record with Motor Carrier information
Context: A customs manifest may contain Other Organization information and OO entity data exists in EDI BOL
GIVEN
A customs manifest may contain Other Organization information and OO entity data exists in EDI BOL
Applied to: Build OO Entity Segment
WHEN
The system searches for EDI BOL TN segments with entity type OO and finds matching data
THEN
The system processes the OO entity data and creates a customs database record with Other Organization information
Context: A customs manifest may contain Freight Forwarder information and FW entity data exists in EDI BOL
GIVEN
A customs manifest may contain Freight Forwarder information and FW entity data exists in EDI BOL
Applied to: Build FW Entity Segment
WHEN
The system searches for EDI BOL TN segments with entity type FW and finds matching data
THEN
The system processes the FW entity data and creates a customs database record with Freight Forwarder information
Context: Entity data has been processed and validated for any entity type (11, NN, MC, OO, FW)
GIVEN
Entity data has been processed and validated for any entity type (11, NN, MC, OO, FW)
Applied to: Insert Entity Record into Customs Database
WHEN
The system completes entity data processing and validation
THEN
The system assigns the next available sequence number, validates the complete entity record, and inserts it into the customs database (GCSCCS55)
Context: Importer data was previously found and stored during earlier processing and NN entity processing is occurring
GIVEN
Importer data was previously found and stored during earlier processing and NN entity processing is occurring
Applied to: Process NN Entity Data
WHEN
The system encounters NN entity data and importer information already exists from previous processing
THEN
The system retains the existing importer data, sets importer found flag, and does not clear the importer information
R-GCCCCADD-cbl-00622 (+24) File: GCCCCADD.cbl Original Importer Data Retention Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Original Importer Data Retention':
  • Context - a waybill is being processed with importer information:
    For Check if Corrector EDI with Existing Importer Data:
    When the system checks if importer name, business number, and business number qualifier are all present, then the system should identify if existing importer data exists and set appropriate processing flags.
  • Context - existing importer data has been identified for processing:
    For Read Existing Importer Record from Customs Database:
    When the system searches through sequence numbers 3 to 24 for importer entity records, then the system should retrieve the importer record with entity id 'im' and extract all importer details.
  • Context - an existing importer record has been found with entity id 'im':
    For Store Original Importer Name & Store Original Business Qualifier & Store Original Business Number & Store Original CSA Indicator & Store Original Address Information & Store Original Contact Details:
    When the system processes the importer record data, then the system should backup the chop code to temporary storage for later restoration and the system should backup the importer name to temporary storage for later restoration and the system should backup the business number qualifier to temporary storage for later restoration and the system should backup the business number to temporary storage for later restoration and the system should backup the csa indicator to temporary storage for later restoration and the system should backup all address information including address lines 1 and 2, city, state/province, postal code, and country to temporary storage and the system should backup contact function code, person name, communication qualifier, and communication number to temporary storage.
  • Context - original importer data has been successfully backed up:
    For Clear Current Importer Fields:
    When the system completes the backup process, then the system should clear the importer, business number, and business number qualifier fields from the current input data.
  • Context - original importer data has been successfully backed up and current fields cleared:
    For Set Backup Data Found Flag:
    When the backup process completes successfully, then the system should set the temporary importer found flag to indicate successful backup.
  • Context - original importer data has been backed up and the temporary importer found flag is set:
    For Restore Original Data if Needed:
    When the system needs to create the final importer record, then the system should restore all backed up importer information including chop code, name, business details, csa indicator, address, and contact information to the customs record.
  • Context - a corrector edi transaction is being processed:
    For Check if Corrector EDI has Importer Data:
    When the system checks for importer data presence in the transaction, then if importer name exists in temporary storage, proceed to read existing importer data, otherwise skip backup process.
  • Context - corrector edi contains importer data and backup process is initiated:
    For Read Existing Importer from Record 55:
    When the system searches for existing importer records in sequence 3-24 of record type 55, then read importer records until found or maximum sequence reached.
  • Context - the system has searched for existing importer records in record type 55:
    For Existing Importer Found?:
    When an importer record with entity id 'im' is found during the search, then proceed with backup process, otherwise skip backup and continue processing.
  • Context - an existing importer record is found in the customs database:
    For Backup Original Importer Data to Working Storage:
    When the backup process is initiated, then copy all importer data fields to working storage variables for later restoration.
  • Context - importer backup process is active and existing importer data is available:
    For Store Importer Name:
    When the system backs up importer information, then store the importer name from the customs record to temporary working storage.
    For Store Business Number:
    When the system backs up importer business identification, then store both the business number and business number qualifier from the customs record to temporary working storage.
    For Store CSA Indicator:
    When the system backs up importer csa status, then store the csa indicator value from the customs record to temporary working storage.
    For Store Address Information:
    When the system backs up importer address details, then store both address line 1 and address line 2 from the customs record to temporary working storage.
    For Store City/State/Postal:
    When the system backs up importer location information, then store city name, state/province code, postal code, and country code from the customs record to temporary working storage.
    For Store Contact Information:
    When the system backs up importer contact details, then store contact function code, person name, communication number qualifier, and communication number from the customs record to temporary working storage.
  • Context - original importer data has been successfully backed up to working storage:
    For Clear Current Importer Fields:
    When the backup process completes, then clear the importer, business number, and business number qualifier fields from the current processing area.
  • Context - all original importer data has been backed up and current fields cleared:
    For Set Backup Complete Flag:
    When the backup process finishes, then set the importer found flag to indicate successful backup completion.
  • Context - either no corrector edi importer data exists or no existing importer record is found:
    For No Backup Required:
    When the system evaluates backup requirements, then skip the backup process and continue with normal processing.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill is being processed with importer information
GIVEN
A waybill is being processed with importer information
Applied to: Check if Corrector EDI with Existing Importer Data
WHEN
The system checks if importer name, business number, and business number qualifier are all present
THEN
The system should identify if existing importer data exists and set appropriate processing flags
Context: Existing importer data has been identified for processing
GIVEN
Existing importer data has been identified for processing
Applied to: Read Existing Importer Record from Customs Database
WHEN
The system searches through sequence numbers 3 to 24 for importer entity records
THEN
The system should retrieve the importer record with entity ID 'IM' and extract all importer details
Context: An existing importer record has been found with entity ID 'IM'
GIVEN
An existing importer record has been found with entity ID 'IM'
Applied to: Store Original Importer Name & Store Original Business Qualifier & Store Original Business Number & Store Original CSA Indicator & Store Original Address Information & Store Original Contact Details
WHEN
The system processes the importer record data
THEN
The system should backup the CHOP code to temporary storage for later restoration AND The system should backup the importer name to temporary storage for later restoration AND The system should backup the business number qualifier to temporary storage for later restoration AND The system should backup the business number to temporary storage for later restoration AND The system should backup the CSA indicator to temporary storage for later restoration AND The system should backup all address information including address lines 1 and 2, city, state/province, postal code, and country to temporary storage AND The system should backup contact function code, person name, communication qualifier, and communication number to temporary storage
Context: Original importer data has been successfully backed up
GIVEN
Original importer data has been successfully backed up
Applied to: Clear Current Importer Fields
WHEN
The system completes the backup process
THEN
The system should clear the importer, business number, and business number qualifier fields from the current input data
Context: Original importer data has been successfully backed up and current fields cleared
GIVEN
Original importer data has been successfully backed up and current fields cleared
Applied to: Set Backup Data Found Flag
WHEN
The backup process completes successfully
THEN
The system should set the temporary importer found flag to indicate successful backup
Context: Original importer data has been backed up and the temporary importer found flag is set
GIVEN
Original importer data has been backed up and the temporary importer found flag is set
Applied to: Restore Original Data if Needed
WHEN
The system needs to create the final importer record
THEN
The system should restore all backed up importer information including CHOP code, name, business details, CSA indicator, address, and contact information to the customs record
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Check if Corrector EDI has Importer Data
WHEN
The system checks for importer data presence in the transaction
THEN
If importer name exists in temporary storage, proceed to read existing importer data, otherwise skip backup process
Context: Corrector EDI contains importer data and backup process is initiated
GIVEN
Corrector EDI contains importer data and backup process is initiated
Applied to: Read Existing Importer from Record 55
WHEN
The system searches for existing importer records in sequence 3-24 of record type 55
THEN
Read importer records until found or maximum sequence reached
Context: The system has searched for existing importer records in record type 55
GIVEN
The system has searched for existing importer records in record type 55
Applied to: Existing Importer Found?
WHEN
An importer record with entity ID 'IM' is found during the search
THEN
Proceed with backup process, otherwise skip backup and continue processing
Context: An existing importer record is found in the customs database
GIVEN
An existing importer record is found in the customs database
Applied to: Backup Original Importer Data to Working Storage
WHEN
The backup process is initiated
THEN
Copy all importer data fields to working storage variables for later restoration
Context: Importer backup process is active and existing importer data is available
GIVEN
Importer backup process is active and existing importer data is available
Applied to: Store Importer Name
WHEN
The system backs up importer information
THEN
Store the importer name from the customs record to temporary working storage
Applied to: Store Business Number
WHEN
The system backs up importer business identification
THEN
Store both the business number and business number qualifier from the customs record to temporary working storage
Applied to: Store CSA Indicator
WHEN
The system backs up importer CSA status
THEN
Store the CSA indicator value from the customs record to temporary working storage
Applied to: Store Address Information
WHEN
The system backs up importer address details
THEN
Store both address line 1 and address line 2 from the customs record to temporary working storage
Applied to: Store City/State/Postal
WHEN
The system backs up importer location information
THEN
Store city name, state/province code, postal code, and country code from the customs record to temporary working storage
Applied to: Store Contact Information
WHEN
The system backs up importer contact details
THEN
Store contact function code, person name, communication number qualifier, and communication number from the customs record to temporary working storage
Context: Original importer data has been successfully backed up to working storage
GIVEN
Original importer data has been successfully backed up to working storage
Applied to: Clear Current Importer Fields
WHEN
The backup process completes
THEN
Clear the importer, business number, and business number qualifier fields from the current processing area
Context: All original importer data has been backed up and current fields cleared
GIVEN
All original importer data has been backed up and current fields cleared
Applied to: Set Backup Complete Flag
WHEN
The backup process finishes
THEN
Set the importer found flag to indicate successful backup completion
Context: Either no corrector EDI importer data exists or no existing importer record is found
GIVEN
Either no corrector EDI importer data exists or no existing importer record is found
Applied to: No Backup Required
WHEN
The system evaluates backup requirements
THEN
Skip the backup process and continue with normal processing
R-GCCCCADD-cbl-00634 (+14) File: GCCCCADD.cbl Importer Record Creation Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Record Creation':
  • Context - the system is processing importer record creation and au table data has been retrieved:
    For AU Importer Data Found?:
    When the system checks if au importer data was found during the lookup process, then if au importer data is found, proceed to check s55 importer record status, otherwise end the process.
  • Context - au importer data has been found and the system needs to create an importer record:
    For S55 Importer Record Not Found?:
    When the system checks if an s55 importer record already exists, then if no s55 importer record is found, proceed to check sequence position availability, otherwise end the process.
  • Context - au importer data exists and no s55 importer record is found:
    For Available Sequence Position?:
    When the system checks if the current sequence index is less than or equal to the maximum sequence position, then if sequence position is available, proceed to initialize new record, otherwise use maximum sequence position.
  • Context - the current sequence index exceeds the maximum allowed sequence positions:
    For Use Maximum Sequence Position:
    When the system needs to assign a sequence position for the new importer record, then set the sequence index to the maximum sequence position value and mark that 24 n1 data records are found.
  • Context - a sequence position is available for creating a new importer record:
    For Initialize New Importer Record:
    When the system initializes the new importer record structure, then clear all fields in the gcsccs55 record, set the ccn key, record type to '55', and assign the sequence number.
  • Context - a new importer record has been initialized:
    For Set Entity ID to 'IM':
    When the system sets the entity identification code, then set the entity id code to 'im' to identify this record as an importer entity.
  • Context - the importer record is being populated with au table data:
    For Copy Importer Name from AU Table:
    When the system copies the importer name from the au table, then set both the customs record name field and the main importer field to the au table importer name.
    For Copy Business Number from AU Table:
    When the system copies the business number from the au table, then set both the customs record id code field and the main business number field to the au table business number.
  • Context - the importer record is being created from au table data:
    For Set Business Number Qualifier to 'M5':
    When the system sets the business number qualifier, then set both the customs record id code qualifier and the main business number qualifier to 'm5'.
    For Clear Address and Contact Fields:
    When the system initializes address and contact fields, then set secondary address, city, state, postal code, country, and all contact fields to spaces.
    For Set CSA Indicator ON:
    When the system sets the csa indicator, then set the csa indicator to on to indicate this importer is authorized for customs self assessment.
  • Context - the importer record is being populated from au table data:
    For Set Default Address to 'NA':
    When the system sets the address information, then set the primary address field to 'na' as the default value.
  • Context - the importer record has been populated with au table data and csa indicator is set:
    For 24 N1 Records Already Exist?:
    When the system checks if 24 n1 data records already exist, then if 24 n1 records exist, perform a replace operation, otherwise perform an insert operation.
  • Context - 24 n1 records already exist and a new importer record needs to be stored:
    For Replace Existing Record:
    When the system performs a replace operation, then call the customs i/o module with replace function to update the existing record at the current sequence position.
  • Context - less than 24 n1 records exist and a new importer record needs to be stored:
    For Insert New Record:
    When the system performs an insert operation, then validate the n1 segment and insert the new record into the sequence position array.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing importer record creation and AU table data has been retrieved
GIVEN
The system is processing importer record creation and AU table data has been retrieved
Applied to: AU Importer Data Found?
WHEN
The system checks if AU importer data was found during the lookup process
THEN
If AU importer data is found, proceed to check S55 importer record status, otherwise end the process
Context: AU importer data has been found and the system needs to create an importer record
GIVEN
AU importer data has been found and the system needs to create an importer record
Applied to: S55 Importer Record Not Found?
WHEN
The system checks if an S55 importer record already exists
THEN
If no S55 importer record is found, proceed to check sequence position availability, otherwise end the process
Context: AU importer data exists and no S55 importer record is found
GIVEN
AU importer data exists and no S55 importer record is found
Applied to: Available Sequence Position?
WHEN
The system checks if the current sequence index is less than or equal to the maximum sequence position
THEN
If sequence position is available, proceed to initialize new record, otherwise use maximum sequence position
Context: The current sequence index exceeds the maximum allowed sequence positions
GIVEN
The current sequence index exceeds the maximum allowed sequence positions
Applied to: Use Maximum Sequence Position
WHEN
The system needs to assign a sequence position for the new importer record
THEN
Set the sequence index to the maximum sequence position value and mark that 24 N1 data records are found
Context: A sequence position is available for creating a new importer record
GIVEN
A sequence position is available for creating a new importer record
Applied to: Initialize New Importer Record
WHEN
The system initializes the new importer record structure
THEN
Clear all fields in the GCSCCS55 record, set the CCN key, record type to '55', and assign the sequence number
Context: A new importer record has been initialized
GIVEN
A new importer record has been initialized
Applied to: Set Entity ID to 'IM'
WHEN
The system sets the entity identification code
THEN
Set the entity ID code to 'IM' to identify this record as an importer entity
Context: The importer record is being populated with AU table data
GIVEN
The importer record is being populated with AU table data
Applied to: Copy Importer Name from AU Table
WHEN
The system copies the importer name from the AU table
THEN
Set both the customs record name field and the main importer field to the AU table importer name
Applied to: Copy Business Number from AU Table
WHEN
The system copies the business number from the AU table
THEN
Set both the customs record ID code field and the main business number field to the AU table business number
Context: The importer record is being created from AU table data
GIVEN
The importer record is being created from AU table data
Applied to: Set Business Number Qualifier to 'M5'
WHEN
The system sets the business number qualifier
THEN
Set both the customs record ID code qualifier and the main business number qualifier to 'M5'
Applied to: Clear Address and Contact Fields
WHEN
The system initializes address and contact fields
THEN
Set secondary address, city, state, postal code, country, and all contact fields to spaces
Applied to: Set CSA Indicator ON
WHEN
The system sets the CSA indicator
THEN
Set the CSA indicator to ON to indicate this importer is authorized for customs self assessment
Context: The importer record is being populated from AU table data
GIVEN
The importer record is being populated from AU table data
Applied to: Set Default Address to 'NA'
WHEN
The system sets the address information
THEN
Set the primary address field to 'NA' as the default value
Context: The importer record has been populated with AU table data and CSA indicator is set
GIVEN
The importer record has been populated with AU table data and CSA indicator is set
Applied to: 24 N1 Records Already Exist?
WHEN
The system checks if 24 N1 data records already exist
THEN
If 24 N1 records exist, perform a replace operation, otherwise perform an insert operation
Context: 24 N1 records already exist and a new importer record needs to be stored
GIVEN
24 N1 records already exist and a new importer record needs to be stored
Applied to: Replace Existing Record
WHEN
The system performs a replace operation
THEN
Call the customs I/O module with replace function to update the existing record at the current sequence position
Context: Less than 24 N1 records exist and a new importer record needs to be stored
GIVEN
Less than 24 N1 records exist and a new importer record needs to be stored
Applied to: Insert New Record
WHEN
The system performs an insert operation
THEN
Validate the N1 segment and insert the new record into the sequence position array
R-GCCCCADD-cbl-00649 (+4) File: GCCCCADD.cbl N1 Record Override Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1 Record Override':
  • Context - the system is processing importer data from au table and importer data was found in au table and importer data was not found in existing 55 records and the current record index exceeds the maximum sequence of 24:
    For Check N1 Record Count:
    When the system attempts to add a new importer n1 record, then the system sets the record index to the maximum sequence (24) and sets the 24-n1-data-found flag to true and uses replace function instead of insert for the 24th record position.
  • Context - the current record sequence index is greater than the maximum sequence value of 24:
    For Identify 24th Record Position:
    When the system processes the record index, then the system sets the record index to the maximum sequence value of 24.
  • Context - the system is about to use the 24th record position for importer data:
    For Set Override Flag:
    When the record index is set to the maximum sequence, then the system sets the 24-n1-data-found flag to true.
  • Context - the 24-n1-data-found flag is set to true and importer record data is prepared for storage:
    For Override 24th Record with New Data:
    When the system stores the importer record, then the system calls the database i/o function with replace operation instead of insert operation.
  • Context - the 24-n1-data-found flag is set to false and importer record data is prepared for storage:
    For Add New Record Normally:
    When the system stores the importer record, then the system validates the n1 segment and performs the standard insert operation for the new record.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing importer data from AU table AND importer data was found in AU table AND importer data was not found in existing 55 records AND the current record index exceeds the maximum sequence of 24
GIVEN
The system is processing importer data from AU table AND importer data was found in AU table AND importer data was not found in existing 55 records AND the current record index exceeds the maximum sequence of 24
Applied to: Check N1 Record Count
WHEN
The system attempts to add a new importer N1 record
THEN
The system sets the record index to the maximum sequence (24) AND sets the 24-N1-data-found flag to true AND uses replace function instead of insert for the 24th record position
Context: The current record sequence index is greater than the maximum sequence value of 24
GIVEN
The current record sequence index is greater than the maximum sequence value of 24
Applied to: Identify 24th Record Position
WHEN
The system processes the record index
THEN
The system sets the record index to the maximum sequence value of 24
Context: The system is about to use the 24th record position for importer data
GIVEN
The system is about to use the 24th record position for importer data
Applied to: Set Override Flag
WHEN
The record index is set to the maximum sequence
THEN
The system sets the 24-N1-data-found flag to true
Context: The 24-N1-data-found flag is set to true AND importer record data is prepared for storage
GIVEN
The 24-N1-data-found flag is set to true AND importer record data is prepared for storage
Applied to: Override 24th Record with New Data
WHEN
The system stores the importer record
THEN
The system calls the database I/O function with replace operation instead of insert operation
Context: The 24-N1-data-found flag is set to false AND importer record data is prepared for storage
GIVEN
The 24-N1-data-found flag is set to false AND importer record data is prepared for storage
Applied to: Add New Record Normally
WHEN
The system stores the importer record
THEN
The system validates the N1 segment AND performs the standard insert operation for the new record
R-GCCCCADD-cbl-00654 (+13) File: GCCCCADD.cbl UN Number Extraction Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'UN Number Extraction':
  • Context - the system needs to process hazmat information for a shipment:
    For Initialize Hazmat Variables:
    When hazmat processing begins, then commodity description danger field and un number field are cleared, hazmat not found flag is set, and search sequence is initialized to 1.
  • Context - hazmat processing variables have been initialized:
    For Set Hazmat Search Sequence to 1:
    When beginning hazmat segment search, then hazmat search sequence counter is set to 1.
  • Context - a valid edi bol key exists and hazmat search sequence is set:
    For Get EDI BOL Hazmat Segment EBSBCCM-CH:
    When system attempts to retrieve hazmat segment ebsbccm with type 'ch' for current sequence, then edi bol hazmat segment is retrieved if it exists for the specified sequence.
  • Context - system has attempted to retrieve a hazmat segment:
    For Hazmat Segment Found?:
    When checking the retrieval status, then if segment exists, continue processing; if not found, end hazmat extraction with no un number found.
  • Context - a hazmat segment has been found with un/na identification code:
    For Code Starts with 'UN'?:
    When checking if the identification code represents a valid un number, then if code starts with 'un', extract the un number; otherwise increment sequence to check next segment.
  • Context - hazmat identification code starts with 'un':
    For Extract UN Number from LH1-UN-NA-ID-CD:
    When extracting un number for commodity classification, then un number is extracted from lh1-un-na-id-cd field and stored in commodity un number field.
  • Context - a valid un number has been extracted from hazmat data:
    For Set Hazmat Found Flag:
    When confirming successful hazmat data extraction, then hazmat found flag is set to indicate successful extraction.
  • Context - un number has been successfully extracted:
    For Initialize Hazmat Info Sequence to 1:
    When preparing to search for detailed hazmat information, then hazmat info sequence counter is set to 1.
  • Context - un number exists and hazmat info sequence is initialized:
    For Get Hazmat Info Segment EBSBCHI:
    When system attempts to retrieve hazmat info segment ebsbchi with type 'hs', then detailed hazmat information segment is retrieved if it exists.
  • Context - system has attempted to retrieve hazmat information segment:
    For Hazmat Info Found?:
    When checking retrieval status for detailed hazmat data, then if info segment exists, extract proper shipping name; otherwise complete extraction process.
  • Context - hazmat information segment is available:
    For Extract Proper Shipping Name from LH3-PROPER-SHIP-NAME:
    When extracting proper shipping name for commodity classification, then proper shipping name is extracted from lh3-proper-ship-name field.
  • Context - proper shipping name has been extracted from hazmat data:
    For Store in Commodity Description Danger Field:
    When storing hazmat description for customs documentation, then proper shipping name is stored in commodity description danger field.
  • Context - current hazmat segment does not contain valid un number format:
    For Increment Hazmat Search Sequence:
    When continuing search for valid hazmat data, then hazmat search sequence counter is incremented by 1.
  • Context - hazmat search sequence has been incremented:
    For More Sequences to Check?:
    When determining if additional hazmat segments should be searched, then if sequence is 98 or less, continue searching; otherwise end with no un number found.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process hazmat information for a shipment
GIVEN
The system needs to process hazmat information for a shipment
Applied to: Initialize Hazmat Variables
WHEN
Hazmat processing begins
THEN
Commodity description danger field and UN number field are cleared, hazmat not found flag is set, and search sequence is initialized to 1
Context: Hazmat processing variables have been initialized
GIVEN
Hazmat processing variables have been initialized
Applied to: Set Hazmat Search Sequence to 1
WHEN
Beginning hazmat segment search
THEN
Hazmat search sequence counter is set to 1
Context: A valid EDI BOL key exists and hazmat search sequence is set
GIVEN
A valid EDI BOL key exists and hazmat search sequence is set
Applied to: Get EDI BOL Hazmat Segment EBSBCCM-CH
WHEN
System attempts to retrieve hazmat segment EBSBCCM with type 'CH' for current sequence
THEN
EDI BOL hazmat segment is retrieved if it exists for the specified sequence
Context: System has attempted to retrieve a hazmat segment
GIVEN
System has attempted to retrieve a hazmat segment
Applied to: Hazmat Segment Found?
WHEN
Checking the retrieval status
THEN
If segment exists, continue processing; if not found, end hazmat extraction with no UN number found
Context: A hazmat segment has been found with UN/NA identification code
GIVEN
A hazmat segment has been found with UN/NA identification code
Applied to: Code Starts with 'UN'?
WHEN
Checking if the identification code represents a valid UN number
THEN
If code starts with 'UN', extract the UN number; otherwise increment sequence to check next segment
Context: Hazmat identification code starts with 'UN'
GIVEN
Hazmat identification code starts with 'UN'
Applied to: Extract UN Number from LH1-UN-NA-ID-CD
WHEN
Extracting UN number for commodity classification
THEN
UN number is extracted from LH1-UN-NA-ID-CD field and stored in commodity UN number field
Context: A valid UN number has been extracted from hazmat data
GIVEN
A valid UN number has been extracted from hazmat data
Applied to: Set Hazmat Found Flag
WHEN
Confirming successful hazmat data extraction
THEN
Hazmat found flag is set to indicate successful extraction
Context: UN number has been successfully extracted
GIVEN
UN number has been successfully extracted
Applied to: Initialize Hazmat Info Sequence to 1
WHEN
Preparing to search for detailed hazmat information
THEN
Hazmat info sequence counter is set to 1
Context: UN number exists and hazmat info sequence is initialized
GIVEN
UN number exists and hazmat info sequence is initialized
Applied to: Get Hazmat Info Segment EBSBCHI
WHEN
System attempts to retrieve hazmat info segment EBSBCHI with type 'HS'
THEN
Detailed hazmat information segment is retrieved if it exists
Context: System has attempted to retrieve hazmat information segment
GIVEN
System has attempted to retrieve hazmat information segment
Applied to: Hazmat Info Found?
WHEN
Checking retrieval status for detailed hazmat data
THEN
If info segment exists, extract proper shipping name; otherwise complete extraction process
Context: Hazmat information segment is available
GIVEN
Hazmat information segment is available
Applied to: Extract Proper Shipping Name from LH3-PROPER-SHIP-NAME
WHEN
Extracting proper shipping name for commodity classification
THEN
Proper shipping name is extracted from LH3-PROPER-SHIP-NAME field
Context: Proper shipping name has been extracted from hazmat data
GIVEN
Proper shipping name has been extracted from hazmat data
Applied to: Store in Commodity Description Danger Field
WHEN
Storing hazmat description for customs documentation
THEN
Proper shipping name is stored in commodity description danger field
Context: Current hazmat segment does not contain valid UN number format
GIVEN
Current hazmat segment does not contain valid UN number format
Applied to: Increment Hazmat Search Sequence
WHEN
Continuing search for valid hazmat data
THEN
Hazmat search sequence counter is incremented by 1
Context: Hazmat search sequence has been incremented
GIVEN
Hazmat search sequence has been incremented
Applied to: More Sequences to Check?
WHEN
Determining if additional hazmat segments should be searched
THEN
If sequence is 98 or less, continue searching; otherwise end with no UN number found
R-GCCCCADD-cbl-00668 (+10) File: GCCCCADD.cbl Fastway Hazmat Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fastway Hazmat Processing':
  • Context - a shipment exists in the system:
    For Get SHIPCOMM Data:
    When the system needs to process hazmat information from fastway data, then the system retrieves shipcomm segment data using the shipment root key.
  • Context - the system has attempted to retrieve shipcomm data:
    For SHIPCOMM Found?:
    When the system checks if commodity data was successfully retrieved, then if shipcomm data is found, continue with emergency response data retrieval, otherwise terminate hazmat processing.
  • Context - shipcomm data is available for the shipment:
    For Get SHIPERP Data:
    When the system processes hazmat information from fastway data, then the system retrieves shiperp segment using shipment root key and commodity id.
  • Context - the system has attempted to retrieve shiperp data:
    For SHIPERP Found?:
    When the system checks if emergency response data was successfully retrieved, then if shiperp data is found, validate un code format, otherwise terminate hazmat processing.
  • Context - emergency response data (shiperp) is available:
    For UN Code Starts with 'UN'?:
    When the system validates the hazmat identification code format, then if the un/na code starts with 'un', proceed with hazmat data extraction, otherwise terminate hazmat processing.
  • Context - emergency response data contains a valid un code starting with 'un':
    For Extract UN Number from SHIPERP:
    When the system processes hazmat identification information, then the system extracts the un/na code and assigns it to the customs un number field.
  • Context - a valid un number has been extracted from emergency response data:
    For Clear Hazmat Description:
    When the system prepares to retrieve hazmat description information, then the system clears the commodity description danger field to prepare for new data.
  • Context - a valid un number exists and hazmat description field is initialized:
    For Get SHIPERPD Data:
    When the system needs detailed hazmat description information, then the system retrieves shiperpd segment using shipment root key, commodity id, and emergency response stcc code.
  • Context - the system has attempted to retrieve shiperpd data:
    For SHIPERPD Found?:
    When the system checks if hazmat description data was successfully retrieved, then if shiperpd data is found, extract hazmat description, otherwise proceed with hazmat found flag setting.
  • Context - shiperpd data is available with hazmat description information:
    For Extract Hazmat Description from SHIPERPD:
    When the system processes detailed hazmat description, then the system extracts the first 15 characters of the hazmat description and assigns it to the commodity description danger field.
  • Context - valid un number has been extracted and hazmat description processing is complete:
    For Set Hazmat Found Flag:
    When the system completes fastway hazmat data processing, then the system sets the hazmat found flag to indicate successful hazmat data retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment exists in the system
GIVEN
A shipment exists in the system
Applied to: Get SHIPCOMM Data
WHEN
The system needs to process hazmat information from Fastway data
THEN
The system retrieves SHIPCOMM segment data using the shipment root key
Context: The system has attempted to retrieve SHIPCOMM data
GIVEN
The system has attempted to retrieve SHIPCOMM data
Applied to: SHIPCOMM Found?
WHEN
The system checks if commodity data was successfully retrieved
THEN
If SHIPCOMM data is found, continue with emergency response data retrieval, otherwise terminate hazmat processing
Context: SHIPCOMM data is available for the shipment
GIVEN
SHIPCOMM data is available for the shipment
Applied to: Get SHIPERP Data
WHEN
The system processes hazmat information from Fastway data
THEN
The system retrieves SHIPERP segment using shipment root key and commodity ID
Context: The system has attempted to retrieve SHIPERP data
GIVEN
The system has attempted to retrieve SHIPERP data
Applied to: SHIPERP Found?
WHEN
The system checks if emergency response data was successfully retrieved
THEN
If SHIPERP data is found, validate UN code format, otherwise terminate hazmat processing
Context: Emergency response data (SHIPERP) is available
GIVEN
Emergency response data (SHIPERP) is available
Applied to: UN Code Starts with 'UN'?
WHEN
The system validates the hazmat identification code format
THEN
If the UN/NA code starts with 'UN', proceed with hazmat data extraction, otherwise terminate hazmat processing
Context: Emergency response data contains a valid UN code starting with 'UN'
GIVEN
Emergency response data contains a valid UN code starting with 'UN'
Applied to: Extract UN Number from SHIPERP
WHEN
The system processes hazmat identification information
THEN
The system extracts the UN/NA code and assigns it to the customs UN number field
Context: A valid UN number has been extracted from emergency response data
GIVEN
A valid UN number has been extracted from emergency response data
Applied to: Clear Hazmat Description
WHEN
The system prepares to retrieve hazmat description information
THEN
The system clears the commodity description danger field to prepare for new data
Context: A valid UN number exists and hazmat description field is initialized
GIVEN
A valid UN number exists and hazmat description field is initialized
Applied to: Get SHIPERPD Data
WHEN
The system needs detailed hazmat description information
THEN
The system retrieves SHIPERPD segment using shipment root key, commodity ID, and emergency response STCC code
Context: The system has attempted to retrieve SHIPERPD data
GIVEN
The system has attempted to retrieve SHIPERPD data
Applied to: SHIPERPD Found?
WHEN
The system checks if hazmat description data was successfully retrieved
THEN
If SHIPERPD data is found, extract hazmat description, otherwise proceed with hazmat found flag setting
Context: SHIPERPD data is available with hazmat description information
GIVEN
SHIPERPD data is available with hazmat description information
Applied to: Extract Hazmat Description from SHIPERPD
WHEN
The system processes detailed hazmat description
THEN
The system extracts the first 15 characters of the hazmat description and assigns it to the commodity description danger field
Context: Valid UN number has been extracted and hazmat description processing is complete
GIVEN
Valid UN number has been extracted and hazmat description processing is complete
Applied to: Set Hazmat Found Flag
WHEN
The system completes Fastway hazmat data processing
THEN
The system sets the hazmat found flag to indicate successful hazmat data retrieval
R-GCCCCADD-cbl-00679 (+9) File: GCCCCADD.cbl Commodity Hazmat Description Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Commodity Hazmat Description':
  • Context - a cargo manifest is being processed:
    For Get Commodity Code from GCCC-COMODITY-CODE:
    When the system needs to build hazmat information, then the commodity code is retrieved from the cargo manifest record.
  • Context - a commodity code exists in the cargo manifest:
    For Call CIMS to Access Commodity Database:
    When the system needs to retrieve commodity description for hazmat processing, then the system calls cims to access the commodity database using the commodity code as the key.
  • Context - the system has attempted to retrieve a commodity record:
    For Commodity Record Found?:
    When the database lookup is completed, then if the status code is spaces, the commodity record is found, otherwise no record exists.
  • Context - a commodity record has been successfully retrieved from the database:
    For Extract Commodity Description from CMOD-DESC:
    When the system needs to populate hazmat description, then the commodity description is extracted from cmod-desc field of the commodity record.
  • Context - a commodity description has been extracted from the commodity record:
    For Store Description in GCCC-COMODITY-DESC-DANGER:
    When the system needs to update the cargo manifest with hazmat information, then the commodity description is moved to gccc-comodity-desc-danger field.
  • Context - a commodity record has been processed and commodity description stored:
    For Call CIMS to Get Next Commodity Record:
    When the system needs to retrieve un number for hazmat compliance, then the system calls cims with gnp function to access the isscd hazmat database.
  • Context - the system has attempted to retrieve a hazmat record from isscd database:
    For Hazmat Record Found?:
    When the database lookup is completed, then if the status code is spaces, the hazmat record is found, otherwise no hazmat record exists.
  • Context - a hazmat record has been successfully retrieved from the isscd database:
    For Extract UN Number from CMDOTID:
    When the system needs to populate un number for hazmat compliance, then the un number is extracted from cmdotid field of the hazmat record.
  • Context - a un number has been extracted from the hazmat record:
    For Store UN Number in GCCC-UN-NUMBER:
    When the system needs to update the cargo manifest with un number, then the un number is moved to gccc-un-number field.
  • Context - no hazmat record was found in the isscd database for the commodity:
    For Clear Hazmat Description and UN Number:
    When the system needs to finalize hazmat information, then both gccc-comodity-desc-danger and gccc-un-number fields are cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed
GIVEN
A cargo manifest is being processed
Applied to: Get Commodity Code from GCCC-COMODITY-CODE
WHEN
The system needs to build hazmat information
THEN
The commodity code is retrieved from the cargo manifest record
Context: A commodity code exists in the cargo manifest
GIVEN
A commodity code exists in the cargo manifest
Applied to: Call CIMS to Access Commodity Database
WHEN
The system needs to retrieve commodity description for hazmat processing
THEN
The system calls CIMS to access the commodity database using the commodity code as the key
Context: The system has attempted to retrieve a commodity record
GIVEN
The system has attempted to retrieve a commodity record
Applied to: Commodity Record Found?
WHEN
The database lookup is completed
THEN
If the status code is spaces, the commodity record is found, otherwise no record exists
Context: A commodity record has been successfully retrieved from the database
GIVEN
A commodity record has been successfully retrieved from the database
Applied to: Extract Commodity Description from CMOD-DESC
WHEN
The system needs to populate hazmat description
THEN
The commodity description is extracted from CMOD-DESC field of the commodity record
Context: A commodity description has been extracted from the commodity record
GIVEN
A commodity description has been extracted from the commodity record
Applied to: Store Description in GCCC-COMODITY-DESC-DANGER
WHEN
The system needs to update the cargo manifest with hazmat information
THEN
The commodity description is moved to GCCC-COMODITY-DESC-DANGER field
Context: A commodity record has been processed and commodity description stored
GIVEN
A commodity record has been processed and commodity description stored
Applied to: Call CIMS to Get Next Commodity Record
WHEN
The system needs to retrieve UN number for hazmat compliance
THEN
The system calls CIMS with GNP function to access the ISSCD hazmat database
Context: The system has attempted to retrieve a hazmat record from ISSCD database
GIVEN
The system has attempted to retrieve a hazmat record from ISSCD database
Applied to: Hazmat Record Found?
WHEN
The database lookup is completed
THEN
If the status code is spaces, the hazmat record is found, otherwise no hazmat record exists
Context: A hazmat record has been successfully retrieved from the ISSCD database
GIVEN
A hazmat record has been successfully retrieved from the ISSCD database
Applied to: Extract UN Number from CMDOTID
WHEN
The system needs to populate UN number for hazmat compliance
THEN
The UN number is extracted from CMDOTID field of the hazmat record
Context: A UN number has been extracted from the hazmat record
GIVEN
A UN number has been extracted from the hazmat record
Applied to: Store UN Number in GCCC-UN-NUMBER
WHEN
The system needs to update the cargo manifest with UN number
THEN
The UN number is moved to GCCC-UN-NUMBER field
Context: No hazmat record was found in the ISSCD database for the commodity
GIVEN
No hazmat record was found in the ISSCD database for the commodity
Applied to: Clear Hazmat Description and UN Number
WHEN
The system needs to finalize hazmat information
THEN
Both GCCC-COMODITY-DESC-DANGER and GCCC-UN-NUMBER fields are cleared to spaces
R-GCCCCADD-cbl-00689 (+28) File: GCCCCADD.cbl N1 Segment Validation Merged 29 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1 Segment Validation':
  • Context - a shipper or consignee segment (sequence 0001 or 0002) is being processed:
    For Are all required fields empty?:
    When the segment has empty name, address, city/state/postal/country fields, then generate required field error messages for name, address, city, state/province, postal code, and country.
  • Context - an n1 segment is being validated:
    For Entity ID present but Name missing?:
    When entity id code is not empty but entity name is empty, then generate a required name error message.
    For Entity ID present but Name missing?:
    When the entity id code is not empty and the entity name is empty, then generate a required name error message.
  • Context - an n1 segment contains address data, contact data, or other entity information:
    For Entity ID missing but other data present?:
    When entity id code is empty but address data, contact data, or other entity information is not empty, then generate a required entity id error message.
  • Context - an n1 segment with sequence number greater than 2 is being processed:
    For Is Entity ID valid for this segment type?:
    When entity id code is not empty and is not a valid entity type or is shipper, consignee, or customs broker, then generate an invalid entity id value error message.
  • Context - an n1 segment has an entity id code:
    For Entity ID present but Address missing?:
    When entity id code is not empty but address line 1 is empty, then generate a required address error message.
  • Context - an n1 segment contains address information (n4 data is not empty):
    For City name present?:
    When city name is empty, then generate a required city name error message.
  • Context - an n1 segment has a city name provided:
    For City name length >= 2 characters?:
    When city name length is less than 2 characters, then generate a minimum length requirement error message.
    For City name too short?:
    When the city name length is less than 2 characters, then generate a minimum length requirement error message.
  • Context - an n1 segment has a postal code provided:
    For Postal code length >= 3 characters?:
    When postal code is not empty and length is less than 3 characters, then generate a minimum length requirement error message.
    For Postal code too short?:
    When the postal code length is less than 3 characters, then generate a postal code minimum length error message.
  • Context - an n1 segment has address information for canada, usa, or mexico:
    For State/Province code present?:
    When country code is canada, usa, or mexico and state/province code is empty, then generate a required state/province error message.
  • Context - an n1 segment has both state/province code and country code provided:
    For State/Province and Country combination valid?:
    When the state/province code is not valid for the specified country according to the state-country lookup table, then generate an invalid state/province error message.
    For Invalid State/Country combination?:
    When the state/province code is not found in the state-country lookup table for the specified country, then generate an invalid state/province code error message.
  • Context - an n1 segment has state/province code but missing country code:
    For Lookup Country from State/Province:
    When country code is empty, then look up and assign the corresponding country code from the state-country lookup table.
  • Context - an n1 segment requires country information:
    For Country code still missing?:
    When country code is empty after attempting to derive from state/province code, then generate a required country code error message.
  • Context - an n1 segment contains contact information:
    For Contact name present but qualifier missing?:
    When contact name is not empty but communication number qualifier is empty, then generate a required communication qualifier error message.
    For Communication number present but qualifier missing?:
    When communication number is not empty but communication number qualifier is empty, then generate a required communication qualifier error message.
    For Qualifier or name present but number missing?:
    When communication qualifier is not empty or contact name is not empty but communication number is empty, then generate a required communication number error message.
  • Context - an n1 segment has a communication qualifier specified:
    For Communication qualifier is valid?:
    When communication qualifier is not blank, 'fx' (fax), or 'te' (telephone), then generate an invalid communication qualifier value error message.
  • Context - a shipper or consignee n1 segment is being processed with sequence number 1 or 2:
    For Are all required fields empty?:
    When the segment has empty name and empty address data and empty city/state data and empty contact information, then generate required shipper error for sequence 1 or required consignee error for sequence 2.
  • Context - an n1 segment contains address data or city/state data or contact information:
    For Address data present but Entity ID/Name missing?:
    When the entity id code is empty or the entity name is empty, then generate required entity id error if id is missing and generate required name error if name is missing.
  • Context - an n1 segment with sequence number greater than 2 is being validated:
    For Entity ID is invalid type?:
    When the entity id code is not empty and the entity id is not a valid entity type or is a shipper code or is a consignee code or is a customs broker code, then generate an invalid entity id value error message.
  • Context - an n1 segment has a valid entity id code:
    For Address missing when Entity ID present?:
    When the address information field is empty, then generate a required address error message.
  • Context - an n1 segment contains city/state data:
    For City name missing?:
    When the city name field is empty, then generate a required city name error message.
    For Country code missing?:
    When the country code field is empty, then generate a required country code error message.
  • Context - an n1 segment has country code of canada or usa or mexico:
    For State missing?:
    When the state or province code is empty, then generate a required state/province error message.
  • Context - an n1 segment has contact information with a communication qualifier:
    For Contact qualifier invalid?:
    When the communication qualifier is not empty and not 'fx' (fax) and not 'te' (telephone), then generate an invalid communication qualifier error message.
  • Context - an n1 segment has contact information:
    For Contact number missing when required?:
    When the communication qualifier is not empty or the contact name is not empty and the communication number is empty, then generate a required communication number error message.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper or consignee segment (sequence 0001 or 0002) is being processed
GIVEN
A shipper or consignee segment (sequence 0001 or 0002) is being processed
Applied to: Are all required fields empty?
WHEN
The segment has empty name, address, city/state/postal/country fields
THEN
Generate required field error messages for name, address, city, state/province, postal code, and country
Context: An N1 segment is being validated
GIVEN
An N1 segment is being validated
Applied to: Entity ID present but Name missing?
WHEN
Entity ID code is not empty but entity name is empty
THEN
Generate a required name error message
Applied to: Entity ID present but Name missing?
WHEN
The entity ID code is not empty AND the entity name is empty
THEN
Generate a required name error message
Context: An N1 segment contains address data, contact data, or other entity information
GIVEN
An N1 segment contains address data, contact data, or other entity information
Applied to: Entity ID missing but other data present?
WHEN
Entity ID code is empty but address data, contact data, or other entity information is not empty
THEN
Generate a required entity ID error message
Context: An N1 segment with sequence number greater than 2 is being processed
GIVEN
An N1 segment with sequence number greater than 2 is being processed
Applied to: Is Entity ID valid for this segment type?
WHEN
Entity ID code is not empty and is not a valid entity type or is shipper, consignee, or customs broker
THEN
Generate an invalid entity ID value error message
Context: An N1 segment has an entity ID code
GIVEN
An N1 segment has an entity ID code
Applied to: Entity ID present but Address missing?
WHEN
Entity ID code is not empty but address line 1 is empty
THEN
Generate a required address error message
Context: An N1 segment contains address information (N4 data is not empty)
GIVEN
An N1 segment contains address information (N4 data is not empty)
Applied to: City name present?
WHEN
City name is empty
THEN
Generate a required city name error message
Context: An N1 segment has a city name provided
GIVEN
An N1 segment has a city name provided
Applied to: City name length >= 2 characters?
WHEN
City name length is less than 2 characters
THEN
Generate a minimum length requirement error message
Applied to: City name too short?
WHEN
The city name length is less than 2 characters
THEN
Generate a minimum length requirement error message
Context: An N1 segment has a postal code provided
GIVEN
An N1 segment has a postal code provided
Applied to: Postal code length >= 3 characters?
WHEN
Postal code is not empty and length is less than 3 characters
THEN
Generate a minimum length requirement error message
Applied to: Postal code too short?
WHEN
The postal code length is less than 3 characters
THEN
Generate a postal code minimum length error message
Context: An N1 segment has address information for Canada, USA, or Mexico
GIVEN
An N1 segment has address information for Canada, USA, or Mexico
Applied to: State/Province code present?
WHEN
Country code is Canada, USA, or Mexico and state/province code is empty
THEN
Generate a required state/province error message
Context: An N1 segment has both state/province code and country code provided
GIVEN
An N1 segment has both state/province code and country code provided
Applied to: State/Province and Country combination valid?
WHEN
The state/province code is not valid for the specified country according to the state-country lookup table
THEN
Generate an invalid state/province error message
Applied to: Invalid State/Country combination?
WHEN
The state/province code is not found in the state-country lookup table for the specified country
THEN
Generate an invalid state/province code error message
Context: An N1 segment has state/province code but missing country code
GIVEN
An N1 segment has state/province code but missing country code
Applied to: Lookup Country from State/Province
WHEN
Country code is empty
THEN
Look up and assign the corresponding country code from the state-country lookup table
Context: An N1 segment requires country information
GIVEN
An N1 segment requires country information
Applied to: Country code still missing?
WHEN
Country code is empty after attempting to derive from state/province code
THEN
Generate a required country code error message
Context: An N1 segment contains contact information
GIVEN
An N1 segment contains contact information
Applied to: Contact name present but qualifier missing?
WHEN
Contact name is not empty but communication number qualifier is empty
THEN
Generate a required communication qualifier error message
Applied to: Communication number present but qualifier missing?
WHEN
Communication number is not empty but communication number qualifier is empty
THEN
Generate a required communication qualifier error message
Applied to: Qualifier or name present but number missing?
WHEN
Communication qualifier is not empty or contact name is not empty but communication number is empty
THEN
Generate a required communication number error message
Context: An N1 segment has a communication qualifier specified
GIVEN
An N1 segment has a communication qualifier specified
Applied to: Communication qualifier is valid?
WHEN
Communication qualifier is not blank, 'FX' (fax), or 'TE' (telephone)
THEN
Generate an invalid communication qualifier value error message
Context: A shipper or consignee N1 segment is being processed with sequence number 1 or 2
GIVEN
A shipper or consignee N1 segment is being processed with sequence number 1 or 2
Applied to: Are all required fields empty?
WHEN
The segment has empty name AND empty address data AND empty city/state data AND empty contact information
THEN
Generate required shipper error for sequence 1 or required consignee error for sequence 2
Context: An N1 segment contains address data OR city/state data OR contact information
GIVEN
An N1 segment contains address data OR city/state data OR contact information
Applied to: Address data present but Entity ID/Name missing?
WHEN
The entity ID code is empty OR the entity name is empty
THEN
Generate required entity ID error if ID is missing AND generate required name error if name is missing
Context: An N1 segment with sequence number greater than 2 is being validated
GIVEN
An N1 segment with sequence number greater than 2 is being validated
Applied to: Entity ID is invalid type?
WHEN
The entity ID code is not empty AND the entity ID is not a valid entity type OR is a shipper code OR is a consignee code OR is a customs broker code
THEN
Generate an invalid entity ID value error message
Context: An N1 segment has a valid entity ID code
GIVEN
An N1 segment has a valid entity ID code
Applied to: Address missing when Entity ID present?
WHEN
The address information field is empty
THEN
Generate a required address error message
Context: An N1 segment contains city/state data
GIVEN
An N1 segment contains city/state data
Applied to: City name missing?
WHEN
The city name field is empty
THEN
Generate a required city name error message
Applied to: Country code missing?
WHEN
The country code field is empty
THEN
Generate a required country code error message
Context: An N1 segment has country code of Canada OR USA OR Mexico
GIVEN
An N1 segment has country code of Canada OR USA OR Mexico
Applied to: State missing?
WHEN
The state or province code is empty
THEN
Generate a required state/province error message
Context: An N1 segment has contact information with a communication qualifier
GIVEN
An N1 segment has contact information with a communication qualifier
Applied to: Contact qualifier invalid?
WHEN
The communication qualifier is not empty AND not 'FX' (fax) AND not 'TE' (telephone)
THEN
Generate an invalid communication qualifier error message
Context: An N1 segment has contact information
GIVEN
An N1 segment has contact information
Applied to: Contact number missing when required?
WHEN
The communication qualifier is not empty OR the contact name is not empty AND the communication number is empty
THEN
Generate a required communication number error message
R-GCCCCADD-cbl-00705 (+29) File: GCCCCADD.cbl Required Field Validation Merged 30 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Required Field Validation':
  • Context - a record is identified as shipper (sequence 1) or consignee (sequence 2) and all n1 segment data fields (name, address, city, state, postal code, country, contact) are empty:
    For All N1 Data Empty?:
    When the system validates the n1 segment data completeness, then generate required field error messages for name (n102), address (n301), city (n401), state/province (n402), postal code (n403), country (n404) and add each error message to the validation results.
  • Context - an n1 segment where entity id is empty and at least one of address data, city data, contact data is not empty:
    For Entity ID Missing but Address Data Present?:
    When the system validates entity id requirements, then generate error message indicating entity id is required.
  • Context - an n1 segment where entity id is not empty and name field is empty:
    For Name Missing but Entity ID Present?:
    When the system validates name field requirements, then generate error message indicating name is required.
    For Entity ID Present but Name Missing?:
    When the system validates the relationship between entity id and name, then generate error message indicating name is required.
  • Context - a record with sequence number greater than 2 and entity id is not empty and entity id is not in the valid values list or entity id is 'sh' (shipper) or entity id is 'cn' (consignee) or entity id is 'bn' (customs broker):
    For Invalid Entity ID Value?:
    When the system validates entity id values for non-primary records, then generate error message indicating invalid entity id value.
  • Context - an n1 segment where entity id is not empty and address field is empty:
    For Entity ID Present but Address Missing?:
    When the system validates address field requirements, then generate error message indicating address is required.
  • Context - an n1 segment where city name is not empty and the length of city name after removing trailing spaces is less than 2 characters:
    For City Name Length < 2?:
    When the system validates city name length requirements, then generate error message indicating minimum 2 characters required.
  • Context - an n1 segment where postal code is not empty and the length of postal code after removing trailing spaces is less than 3 characters:
    For Postal Code Length < 3?:
    When the system validates postal code length requirements, then generate error message indicating minimum 3 characters required.
  • Context - an n1 segment where country code is 'ca' (canada) or 'us' (usa) or 'mx' (mexico) and state/province code is empty:
    For State/Province Missing?:
    When the system validates state/province requirements for north american countries, then generate error message indicating state/province is required.
  • Context - an n1 segment where state/province code is not empty and country code is not empty and the state/province code is not found in the state-country lookup table for the specified country:
    For Invalid State/Country Combination?:
    When the system validates state/province and country code combination, then generate error message indicating invalid state/province code.
  • Context - an n1 segment where contact name is not empty and communication qualifier is empty:
    For Contact Name Present but Communication Qualifier Missing?:
    When the system validates communication qualifier requirements for contact information, then generate error message indicating communication qualifier is required.
  • Context - an n1 segment where communication number is not empty and communication qualifier is empty:
    For Communication Number Present but Communication Qualifier Missing?:
    When the system validates communication qualifier requirements for communication number, then generate error message indicating communication qualifier is required.
  • Context - an n1 segment where communication qualifier is not empty and communication qualifier is not equal to spaces and not equal to 'fx' (fax) and not equal to 'te' (telephone):
    For Invalid Communication Qualifier Value?:
    When the system validates communication qualifier values, then generate error message indicating invalid communication qualifier value.
  • Context - an n1 segment where (communication qualifier is not empty or contact name is not empty) and communication number is empty:
    For Communication Qualifier Present but Communication Number Missing?:
    When the system validates communication number requirements, then generate error message indicating communication number is required.
  • Context - a shipper or consignee record (sequence 1 or 2) is being validated:
    For All Required Fields Empty?:
    When the entity name is empty and address information is empty and location information is empty and contact information is empty, then generate required field errors for entity name, address, city, state, postal code, and country.
  • Context - an n1 segment record is being validated:
    For Entity ID Missing but Address/Contact Present?:
    When the entity id code is empty and (address information is not empty or location information is not empty or contact information is not empty), then generate an error indicating entity id code is required.
    For Name Missing but Address/Contact Present?:
    When the entity name is empty and (address information is not empty or location information is not empty or contact information is not empty), then generate an error indicating entity name is required.
    For Entity ID Present but Name Missing?:
    When the entity id code is not empty and the entity name is empty, then generate an error indicating entity name is required.
    For Entity ID Present but Address Missing?:
    When the entity id code is not empty and the primary address line is empty, then generate an error indicating address information is required.
  • Context - an n1 segment record with sequence number greater than 2 is being validated:
    For Invalid Entity ID Value?:
    When the entity id code is not empty and the entity id is not a valid entity type and the entity id is not 'sh' (shipper) and the entity id is not 'cn' (consignee) and the entity id is not 'cb' (customs broker), then generate an error indicating invalid entity id value.
  • Context - an n1 segment record with location information is being validated:
    For City Name Missing?:
    When location information is not empty and city name is empty, then generate an error indicating city name is required.
    For Country is CA/US/MX and State Missing?:
    When country code is 'ca' (canada) or 'us' (united states) or 'mx' (mexico) and state/province code is empty, then generate an error indicating state/province code is required.
    For Country Code Missing?:
    When location information is not empty and country code is empty, then generate an error indicating country code is required.
  • Context - an n1 segment record with city name is being validated:
    For City Name Length < 2?:
    When city name is not empty and city name length is less than 2 characters, then generate an error indicating minimum length of 2 characters is required.
  • Context - an n1 segment record with postal code is being validated:
    For Postal Code Length < 3?:
    When postal code is not empty and postal code length is less than 3 characters, then generate an error indicating minimum length of 3 characters is required.
  • Context - an n1 segment record with state and country codes is being validated:
    For Invalid State/Country Combination?:
    When state/province code and country code combination is not found in the state-country reference table, then generate an error indicating invalid state/province code for the specified country.
  • Context - an n1 segment record with contact information is being validated:
    For Contact Name Present but Qualifier Missing?:
    When contact person name is not empty and communication number qualifier is empty, then generate an error indicating communication number qualifier is required.
    For Communication Number Present but Qualifier Missing?:
    When communication number is not empty and communication number qualifier is empty, then generate an error indicating communication number qualifier is required.
    For Qualifier or Name Present but Number Missing?:
    When (communication number qualifier is not empty or contact person name is not empty) and communication number is empty, then generate an error indicating communication number is required.
  • Context - an n1 segment record with communication qualifier is being validated:
    For Invalid Communication Qualifier Value?:
    When communication number qualifier is not empty and qualifier is not 'te' (telephone) and qualifier is not 'fx' (fax) and qualifier is not spaces, then generate an error indicating invalid communication qualifier value.
👨‍💻 Technical ACs (Gherkin)
Context: A record is identified as shipper (sequence 1) or consignee (sequence 2) AND all N1 segment data fields (name, address, city, state, postal code, country, contact) are empty
GIVEN
A record is identified as shipper (sequence 1) or consignee (sequence 2) AND all N1 segment data fields (name, address, city, state, postal code, country, contact) are empty
Applied to: All N1 Data Empty?
WHEN
The system validates the N1 segment data completeness
THEN
Generate required field error messages for name (N102), address (N301), city (N401), state/province (N402), postal code (N403), country (N404) AND add each error message to the validation results
Context: An N1 segment where entity ID is empty AND at least one of address data, city data, contact data is not empty
GIVEN
An N1 segment where entity ID is empty AND at least one of address data, city data, contact data is not empty
Applied to: Entity ID Missing but Address Data Present?
WHEN
The system validates entity ID requirements
THEN
Generate error message indicating entity ID is required
Context: An N1 segment where entity ID is not empty AND name field is empty
GIVEN
An N1 segment where entity ID is not empty AND name field is empty
Applied to: Name Missing but Entity ID Present?
WHEN
The system validates name field requirements
THEN
Generate error message indicating name is required
Applied to: Entity ID Present but Name Missing?
WHEN
The system validates the relationship between entity ID and name
THEN
Generate error message indicating name is required
Context: A record with sequence number greater than 2 AND entity ID is not empty AND entity ID is not in the valid values list OR entity ID is 'SH' (shipper) OR entity ID is 'CN' (consignee) OR entity ID is 'BN' (customs broker)
GIVEN
A record with sequence number greater than 2 AND entity ID is not empty AND entity ID is not in the valid values list OR entity ID is 'SH' (shipper) OR entity ID is 'CN' (consignee) OR entity ID is 'BN' (customs broker)
Applied to: Invalid Entity ID Value?
WHEN
The system validates entity ID values for non-primary records
THEN
Generate error message indicating invalid entity ID value
Context: An N1 segment where entity ID is not empty AND address field is empty
GIVEN
An N1 segment where entity ID is not empty AND address field is empty
Applied to: Entity ID Present but Address Missing?
WHEN
The system validates address field requirements
THEN
Generate error message indicating address is required
Context: An N1 segment where city name is not empty AND the length of city name after removing trailing spaces is less than 2 characters
GIVEN
An N1 segment where city name is not empty AND the length of city name after removing trailing spaces is less than 2 characters
Applied to: City Name Length < 2?
WHEN
The system validates city name length requirements
THEN
Generate error message indicating minimum 2 characters required
Context: An N1 segment where postal code is not empty AND the length of postal code after removing trailing spaces is less than 3 characters
GIVEN
An N1 segment where postal code is not empty AND the length of postal code after removing trailing spaces is less than 3 characters
Applied to: Postal Code Length < 3?
WHEN
The system validates postal code length requirements
THEN
Generate error message indicating minimum 3 characters required
Context: An N1 segment where country code is 'CA' (Canada) OR 'US' (USA) OR 'MX' (Mexico) AND state/province code is empty
GIVEN
An N1 segment where country code is 'CA' (Canada) OR 'US' (USA) OR 'MX' (Mexico) AND state/province code is empty
Applied to: State/Province Missing?
WHEN
The system validates state/province requirements for North American countries
THEN
Generate error message indicating state/province is required
Context: An N1 segment where state/province code is not empty AND country code is not empty AND the state/province code is not found in the state-country lookup table for the specified country
GIVEN
An N1 segment where state/province code is not empty AND country code is not empty AND the state/province code is not found in the state-country lookup table for the specified country
Applied to: Invalid State/Country Combination?
WHEN
The system validates state/province and country code combination
THEN
Generate error message indicating invalid state/province code
Context: An N1 segment where contact name is not empty AND communication qualifier is empty
GIVEN
An N1 segment where contact name is not empty AND communication qualifier is empty
Applied to: Contact Name Present but Communication Qualifier Missing?
WHEN
The system validates communication qualifier requirements for contact information
THEN
Generate error message indicating communication qualifier is required
Context: An N1 segment where communication number is not empty AND communication qualifier is empty
GIVEN
An N1 segment where communication number is not empty AND communication qualifier is empty
Applied to: Communication Number Present but Communication Qualifier Missing?
WHEN
The system validates communication qualifier requirements for communication number
THEN
Generate error message indicating communication qualifier is required
Context: An N1 segment where communication qualifier is not empty AND communication qualifier is not equal to spaces AND not equal to 'FX' (fax) AND not equal to 'TE' (telephone)
GIVEN
An N1 segment where communication qualifier is not empty AND communication qualifier is not equal to spaces AND not equal to 'FX' (fax) AND not equal to 'TE' (telephone)
Applied to: Invalid Communication Qualifier Value?
WHEN
The system validates communication qualifier values
THEN
Generate error message indicating invalid communication qualifier value
Context: An N1 segment where (communication qualifier is not empty OR contact name is not empty) AND communication number is empty
GIVEN
An N1 segment where (communication qualifier is not empty OR contact name is not empty) AND communication number is empty
Applied to: Communication Qualifier Present but Communication Number Missing?
WHEN
The system validates communication number requirements
THEN
Generate error message indicating communication number is required
Context: A shipper or consignee record (sequence 1 or 2) is being validated
GIVEN
A shipper or consignee record (sequence 1 or 2) is being validated
Applied to: All Required Fields Empty?
WHEN
The entity name is empty AND address information is empty AND location information is empty AND contact information is empty
THEN
Generate required field errors for entity name, address, city, state, postal code, and country
Context: An N1 segment record is being validated
GIVEN
An N1 segment record is being validated
Applied to: Entity ID Missing but Address/Contact Present?
WHEN
The entity ID code is empty AND (address information is not empty OR location information is not empty OR contact information is not empty)
THEN
Generate an error indicating entity ID code is required
Applied to: Name Missing but Address/Contact Present?
WHEN
The entity name is empty AND (address information is not empty OR location information is not empty OR contact information is not empty)
THEN
Generate an error indicating entity name is required
Applied to: Entity ID Present but Name Missing?
WHEN
The entity ID code is not empty AND the entity name is empty
THEN
Generate an error indicating entity name is required
Applied to: Entity ID Present but Address Missing?
WHEN
The entity ID code is not empty AND the primary address line is empty
THEN
Generate an error indicating address information is required
Context: An N1 segment record with sequence number greater than 2 is being validated
GIVEN
An N1 segment record with sequence number greater than 2 is being validated
Applied to: Invalid Entity ID Value?
WHEN
The entity ID code is not empty AND the entity ID is not a valid entity type AND the entity ID is not 'SH' (shipper) AND the entity ID is not 'CN' (consignee) AND the entity ID is not 'CB' (customs broker)
THEN
Generate an error indicating invalid entity ID value
Context: An N1 segment record with location information is being validated
GIVEN
An N1 segment record with location information is being validated
Applied to: City Name Missing?
WHEN
Location information is not empty AND city name is empty
THEN
Generate an error indicating city name is required
Applied to: Country is CA/US/MX and State Missing?
WHEN
Country code is 'CA' (Canada) OR 'US' (United States) OR 'MX' (Mexico) AND state/province code is empty
THEN
Generate an error indicating state/province code is required
Applied to: Country Code Missing?
WHEN
Location information is not empty AND country code is empty
THEN
Generate an error indicating country code is required
Context: An N1 segment record with city name is being validated
GIVEN
An N1 segment record with city name is being validated
Applied to: City Name Length < 2?
WHEN
City name is not empty AND city name length is less than 2 characters
THEN
Generate an error indicating minimum length of 2 characters is required
Context: An N1 segment record with postal code is being validated
GIVEN
An N1 segment record with postal code is being validated
Applied to: Postal Code Length < 3?
WHEN
Postal code is not empty AND postal code length is less than 3 characters
THEN
Generate an error indicating minimum length of 3 characters is required
Context: An N1 segment record with state and country codes is being validated
GIVEN
An N1 segment record with state and country codes is being validated
Applied to: Invalid State/Country Combination?
WHEN
State/province code and country code combination is not found in the state-country reference table
THEN
Generate an error indicating invalid state/province code for the specified country
Context: An N1 segment record with contact information is being validated
GIVEN
An N1 segment record with contact information is being validated
Applied to: Contact Name Present but Qualifier Missing?
WHEN
Contact person name is not empty AND communication number qualifier is empty
THEN
Generate an error indicating communication number qualifier is required
Applied to: Communication Number Present but Qualifier Missing?
WHEN
Communication number is not empty AND communication number qualifier is empty
THEN
Generate an error indicating communication number qualifier is required
Applied to: Qualifier or Name Present but Number Missing?
WHEN
(Communication number qualifier is not empty OR contact person name is not empty) AND communication number is empty
THEN
Generate an error indicating communication number is required
Context: An N1 segment record with communication qualifier is being validated
GIVEN
An N1 segment record with communication qualifier is being validated
Applied to: Invalid Communication Qualifier Value?
WHEN
Communication number qualifier is not empty AND qualifier is not 'TE' (telephone) AND qualifier is not 'FX' (fax) AND qualifier is not spaces
THEN
Generate an error indicating invalid communication qualifier value
R-GCCCCADD-cbl-00719 (+26) File: GCCCCADD.cbl State Country Combination Validation Merged 27 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'State Country Combination Validation':
  • Context - a record with address information is being processed:
    For Address Data Present?:
    When the system evaluates the n4 segment data for presence of address fields, then if n4 data is empty or spaces, skip validation; otherwise proceed with state-country validation.
  • Context - address data is present in the n4 segment:
    For Get State/Province Code:
    When the system processes the n402 state/province code field, then the state/province code is extracted and prepared for country validation lookup.
  • Context - address data is present with state/province code extracted:
    For Get Country Code:
    When the system processes the n404 country code field, then the country code is extracted and prepared for state-country combination validation.
  • Context - state/province code and country code have been extracted from address data:
    For Search State-Country Lookup Table:
    When the system searches the tb-state-country table for matching state and country combination, then the system locates the corresponding entry or determines no match exists.
  • Context - a search has been performed on the tb-state-country lookup table:
    For State-Country Combination Found?:
    When the system evaluates if the state entry matches the state/province code and the country entry matches the country code, then if both match, mark as valid combination; otherwise mark as invalid combination.
  • Context - the state/province code and country code combination exists in the tb-state-country lookup table:
    For Mark as Valid Combination:
    When the system confirms the combination is valid, then the system sets the valid province flag to true and continues processing without errors.
  • Context - the state/province code and country code combination does not exist in the tb-state-country lookup table:
    For Generate Invalid State/Province Error:
    When the system determines the combination is invalid, then the system generates error code gccs-e-invalid-n402 for invalid state/province code.
  • Context - an invalid state/province error has been generated:
    For Add Error Message to Validation Results:
    When the system processes the error for reporting, then the error message is retrieved using z400-retrieve-err-msg and added to the message array using z100-add-message.
  • Context - an address has a country code of canada, usa, or mexico:
    For Canada/USA/Mexico require state/province:
    When the system validates the n402 state/province code field, then if the state/province code is spaces, generate required field error gccs-e-gen-required-n402.
  • Context - a state/province code and country code are provided in address data:
    For State must match country in lookup table:
    When the system searches the tb-state-country lookup table, then the state entry must match the provided state/province code and the country entry must match the provided country code.
  • Context - an address has a state/province code but no country code specified:
    For Other countries auto-assign country from state:
    When the system looks up the state/province in the tb-state-country table, then the system automatically assigns the corresponding country code from the lookup table to the n404 country field.
  • Context - an n4 address segment is being processed for validation:
    For N4 Address Data Present?:
    When the system checks if the n4 address data field contains any information, then if n4 data is empty or spaces, skip address validation; otherwise proceed with validation.
  • Context - an address contains a country code:
    For Country is Canada, USA, or Mexico?:
    When the system evaluates the country code value, then if country code is canada, usa, or mexico, require state/province validation; otherwise skip state/province requirement.
  • Context - an address for canada, usa, or mexico is being validated:
    For State/Province Code Present?:
    When the system checks the state/province code field, then if state/province code is missing or spaces, generate required state/province error; otherwise proceed with validation.
  • Context - a state/province code and country code are provided:
    For Search State-Country Lookup Table:
    When the system searches the state-country lookup table, then find matching entry where state code equals table state entry and country code equals table country entry.
  • Context - a state-country lookup has been performed:
    For State-Country Combination Found?:
    When the system evaluates the search results, then if combination found, mark as valid; if not found, generate invalid state/province error.
  • Context - a state/province and country combination has been found in the lookup table:
    For Mark as Valid State/Province:
    When the validation process confirms the combination is valid, then set the validation flag to indicate valid state/province combination.
  • Context - a state/province and country combination is not found in the lookup table:
    For Generate Invalid State/Province Error:
    When the validation process determines the combination is invalid, then generate error message indicating invalid state/province code for the country.
  • Context - an address for canada, usa, or mexico is missing state/province code:
    For Generate Required State/Province Error:
    When the validation process checks for required state/province code, then generate error message indicating state/province code is required.
  • Context - an address is being validated:
    For Country Code Missing?:
    When the system checks the country code field, then if country code is spaces or missing, attempt to derive from state/province; otherwise complete validation.
  • Context - country code is missing but state/province code is provided:
    For Search State-Country Table for Country:
    When the system searches the state-country table using state/province code, then find matching entry where state/province code equals table state entry.
  • Context - a matching state entry is found in the state-country table:
    For Set Country Code from Table:
    When the system retrieves the corresponding country code, then set the country code field to the table country entry value.
  • Context - country code is missing and cannot be derived from state/province code:
    For Generate Required Country Code Error:
    When the validation process completes country code determination, then generate error message indicating country code is required.
  • Context - an address record with country code of canada (ca), usa (us), or mexico (mx):
    For State/Province Code Present?:
    When the state or province code field is empty or spaces, then generate a required state/province code error message.
  • Context - an address record with both state/province code and country code populated:
    For State/Province and Country Match Found?:
    When the state/province code and country code combination is searched in the state-country lookup table, then if a matching combination is found, set valid province flag; otherwise set invalid province flag and generate invalid state/province error.
  • Context - an address record with state/province code populated but country code is empty or spaces:
    For Lookup Country by State/Province:
    When the state/province code is searched in the state-country lookup table, then if a matching state/province is found, assign the corresponding country code from the lookup table; otherwise generate a required country code error.
  • Context - an address record being validated:
    For Generate Required Country Code Error:
    When the country code field is empty or spaces and cannot be determined from state/province lookup, then generate a required country code error message.
👨‍💻 Technical ACs (Gherkin)
Context: A record with address information is being processed
GIVEN
A record with address information is being processed
Applied to: Address Data Present?
WHEN
The system evaluates the N4 segment data for presence of address fields
THEN
If N4 data is empty or spaces, skip validation; otherwise proceed with state-country validation
Context: Address data is present in the N4 segment
GIVEN
Address data is present in the N4 segment
Applied to: Get State/Province Code
WHEN
The system processes the N402 state/province code field
THEN
The state/province code is extracted and prepared for country validation lookup
Context: Address data is present with state/province code extracted
GIVEN
Address data is present with state/province code extracted
Applied to: Get Country Code
WHEN
The system processes the N404 country code field
THEN
The country code is extracted and prepared for state-country combination validation
Context: State/province code and country code have been extracted from address data
GIVEN
State/province code and country code have been extracted from address data
Applied to: Search State-Country Lookup Table
WHEN
The system searches the TB-STATE-COUNTRY table for matching state and country combination
THEN
The system locates the corresponding entry or determines no match exists
Context: A search has been performed on the TB-STATE-COUNTRY lookup table
GIVEN
A search has been performed on the TB-STATE-COUNTRY lookup table
Applied to: State-Country Combination Found?
WHEN
The system evaluates if the state entry matches the state/province code AND the country entry matches the country code
THEN
If both match, mark as valid combination; otherwise mark as invalid combination
Context: The state/province code and country code combination exists in the TB-STATE-COUNTRY lookup table
GIVEN
The state/province code and country code combination exists in the TB-STATE-COUNTRY lookup table
Applied to: Mark as Valid Combination
WHEN
The system confirms the combination is valid
THEN
The system sets the valid province flag to TRUE and continues processing without errors
Context: The state/province code and country code combination does not exist in the TB-STATE-COUNTRY lookup table
GIVEN
The state/province code and country code combination does not exist in the TB-STATE-COUNTRY lookup table
Applied to: Generate Invalid State/Province Error
WHEN
The system determines the combination is invalid
THEN
The system generates error code GCCS-E-INVALID-N402 for invalid state/province code
Context: An invalid state/province error has been generated
GIVEN
An invalid state/province error has been generated
Applied to: Add Error Message to Validation Results
WHEN
The system processes the error for reporting
THEN
The error message is retrieved using Z400-RETRIEVE-ERR-MSG and added to the message array using Z100-ADD-MESSAGE
Context: An address has a country code of Canada, USA, or Mexico
GIVEN
An address has a country code of Canada, USA, or Mexico
Applied to: Canada/USA/Mexico require state/province
WHEN
The system validates the N402 state/province code field
THEN
If the state/province code is spaces, generate required field error GCCS-E-GEN-REQUIRED-N402
Context: A state/province code and country code are provided in address data
GIVEN
A state/province code and country code are provided in address data
Applied to: State must match country in lookup table
WHEN
The system searches the TB-STATE-COUNTRY lookup table
THEN
The state entry must match the provided state/province code AND the country entry must match the provided country code
Context: An address has a state/province code but no country code specified
GIVEN
An address has a state/province code but no country code specified
Applied to: Other countries auto-assign country from state
WHEN
The system looks up the state/province in the TB-STATE-COUNTRY table
THEN
The system automatically assigns the corresponding country code from the lookup table to the N404 country field
Context: An N4 address segment is being processed for validation
GIVEN
An N4 address segment is being processed for validation
Applied to: N4 Address Data Present?
WHEN
The system checks if the N4 address data field contains any information
THEN
If N4 data is empty or spaces, skip address validation; otherwise proceed with validation
Context: An address contains a country code
GIVEN
An address contains a country code
Applied to: Country is Canada, USA, or Mexico?
WHEN
The system evaluates the country code value
THEN
If country code is Canada, USA, or Mexico, require state/province validation; otherwise skip state/province requirement
Context: An address for Canada, USA, or Mexico is being validated
GIVEN
An address for Canada, USA, or Mexico is being validated
Applied to: State/Province Code Present?
WHEN
The system checks the state/province code field
THEN
If state/province code is missing or spaces, generate required state/province error; otherwise proceed with validation
Context: A state/province code and country code are provided
GIVEN
A state/province code and country code are provided
Applied to: Search State-Country Lookup Table
WHEN
The system searches the state-country lookup table
THEN
Find matching entry where state code equals table state entry and country code equals table country entry
Context: A state-country lookup has been performed
GIVEN
A state-country lookup has been performed
Applied to: State-Country Combination Found?
WHEN
The system evaluates the search results
THEN
If combination found, mark as valid; if not found, generate invalid state/province error
Context: A state/province and country combination has been found in the lookup table
GIVEN
A state/province and country combination has been found in the lookup table
Applied to: Mark as Valid State/Province
WHEN
The validation process confirms the combination is valid
THEN
Set the validation flag to indicate valid state/province combination
Context: A state/province and country combination is not found in the lookup table
GIVEN
A state/province and country combination is not found in the lookup table
Applied to: Generate Invalid State/Province Error
WHEN
The validation process determines the combination is invalid
THEN
Generate error message indicating invalid state/province code for the country
Context: An address for Canada, USA, or Mexico is missing state/province code
GIVEN
An address for Canada, USA, or Mexico is missing state/province code
Applied to: Generate Required State/Province Error
WHEN
The validation process checks for required state/province code
THEN
Generate error message indicating state/province code is required
Context: An address is being validated
GIVEN
An address is being validated
Applied to: Country Code Missing?
WHEN
The system checks the country code field
THEN
If country code is spaces or missing, attempt to derive from state/province; otherwise complete validation
Context: Country code is missing but state/province code is provided
GIVEN
Country code is missing but state/province code is provided
Applied to: Search State-Country Table for Country
WHEN
The system searches the state-country table using state/province code
THEN
Find matching entry where state/province code equals table state entry
Context: A matching state entry is found in the state-country table
GIVEN
A matching state entry is found in the state-country table
Applied to: Set Country Code from Table
WHEN
The system retrieves the corresponding country code
THEN
Set the country code field to the table country entry value
Context: Country code is missing and cannot be derived from state/province code
GIVEN
Country code is missing and cannot be derived from state/province code
Applied to: Generate Required Country Code Error
WHEN
The validation process completes country code determination
THEN
Generate error message indicating country code is required
Context: An address record with country code of Canada (CA), USA (US), or Mexico (MX)
GIVEN
An address record with country code of Canada (CA), USA (US), or Mexico (MX)
Applied to: State/Province Code Present?
WHEN
The state or province code field is empty or spaces
THEN
Generate a required state/province code error message
Context: An address record with both state/province code and country code populated
GIVEN
An address record with both state/province code and country code populated
Applied to: State/Province and Country Match Found?
WHEN
The state/province code and country code combination is searched in the state-country lookup table
THEN
If a matching combination is found, set valid province flag; otherwise set invalid province flag and generate invalid state/province error
Context: An address record with state/province code populated but country code is empty or spaces
GIVEN
An address record with state/province code populated but country code is empty or spaces
Applied to: Lookup Country by State/Province
WHEN
The state/province code is searched in the state-country lookup table
THEN
If a matching state/province is found, assign the corresponding country code from the lookup table; otherwise generate a required country code error
Context: An address record being validated
GIVEN
An address record being validated
Applied to: Generate Required Country Code Error
WHEN
The country code field is empty or spaces and cannot be determined from state/province lookup
THEN
Generate a required country code error message
R-GCCCCADD-cbl-00730 (+33) File: GCCCCADD.cbl Error Message Generation Merged 34 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Generation':
  • Context - a validation error has been detected and an error message number has been set:
    For Retrieve Error Message Text from MS Table:
    When the system attempts to retrieve the error message text from the ms table using the error message number, then the system should lookup the message text in the ms table and store the retrieved english text for display.
  • Context - an error message needs to be added to the error message array:
    For Check Message Index Limit:
    When the current message index is checked against the maximum limit of 10, then if the index is less than 10, the message should be added; otherwise, the message should be skipped to prevent array overflow.
  • Context - the error message array has available space (index less than 10) and a formatted error message is ready:
    For Add Message to Error Array:
    When the system adds the error message to the array, then the message should be stored in the array at the current index position, the error number should be stored in the corresponding error number array, the message index should be incremented by 1, and the return error flag should be set to indicate an error condition.
  • Context - an error message has been processed and added to the error array:
    For Clear Working Variables:
    When the error processing is complete, then the working message variable and working error message number variable should be cleared to spaces to prepare for the next error processing cycle.
  • Context - a customs manifest is being created:
    For Required Field Missing:
    When the shipper name field is validated, then if the shipper name is blank or spaces, an error message for invalid shipper name should be generated and added to the error collection.
    For Required Field Missing:
    When the consignee name field is validated, then if the consignee name is blank or spaces, an error message for invalid consignee name should be generated and added to the error collection.
  • Context - a customs manifest is being processed:
    For Required Field Missing:
    When the origin station name is validated, then if the origin station name is blank or spaces, an error message for invalid origin station name should be generated and added to the error collection.
    For Required Field Missing:
    When the destination station name is validated, then if the destination station name is blank or spaces, an error message for invalid destination station name should be generated and added to the error collection.
    For Required Field Missing:
    When the origin province state code is validated, then if the origin province state code is blank or spaces, an error message for invalid origin province state code should be generated and added to the error collection.
    For Required Field Missing:
    When the manifest upon port is validated, then if the manifest upon port is blank or spaces, error flag 1 should be set to indicate a missing manifest upon port.
  • Context - a manifest port needs to be validated:
    For Invalid Manifest Port:
    When the system looks up the manifest port in the mc table, then if the manifest port is not found in the mc table, an error message for invalid manifest port should be generated and added to the error collection.
  • Context - a manifest port has been found in the mc table:
    For Invalid Customs Code:
    When the canadian customs code is validated, then if the canadian customs code equals '00000', an error message for invalid canadian customs code should be generated and added to the error collection.
  • Context - a conveying car initial is provided:
    For Invalid Entity ID:
    When the conveying car is validated using the car validation system, then if the car validation returns all asterisks indicating an invalid car, an error message for invalid conveying car should be generated using the original car value as the message number.
  • Context - a shipper province state code is provided:
    For Invalid State/Country Combination:
    When the system validates the province state code against the state-country lookup table, then if no matching country is found for the province state code, an error message for invalid shipper province state code should be generated using the province state code as the message number.
  • Context - a consignee province state code is provided:
    For Invalid State/Country Combination:
    When the system validates the province state code against the state-country lookup table, then if no matching country is found for the province state code, an error message for invalid consignee province state code should be generated using the province state code as the message number.
  • Context - a destination station is being processed and sub-location validation is required:
    For Missing Address Information:
    When the sub-location code is validated against business rules, then if the sub-location code is missing and none of the exemption conditions are met (csa indicator on, same manifest ports not iis-a6, us destination, or arrival indicator y), an error message for invalid destination station sub-location code should be generated.
  • Context - a waybill date is being processed for eta calculation:
    For Invalid Entity ID:
    When the date calculation system processes the waybill date, then if the date calculation fails, an error message for invalid waybill date should be generated and added to the error collection.
  • Context - an n1 segment is being validated and an entity id is present:
    For Required Field Missing:
    When the n102 name field is checked for completeness, then if the n102 name field is blank or spaces, an error message for required n102 field should be generated and added to the error collection.
  • Context - an n1 segment contains n3, n4, or per data:
    For Required Field Missing:
    When the n101 entity id field is validated, then if the n101 entity id field is blank or spaces while other segment data exists, an error message for required n101 field should be generated and added to the error collection.
  • Context - an n1 segment with sequence number greater than 2 is being validated:
    For Invalid Entity ID:
    When the entity id value is checked against valid values, then if the entity id is not in the valid values list or is sh (shipper), cn (consignee), or cb (customs broker), an error message for invalid n101 value should be generated and added to the error collection.
  • Context - an n1 segment has a valid entity id:
    For Missing Address Information:
    When the n301 address information field is validated, then if the n301 address information field is blank or spaces, an error message for required n301 field should be generated and added to the error collection.
  • Context - an n4 segment contains location data:
    For Required Field Missing:
    When the n401 city name field is validated, then if the n401 city name field is blank or spaces, an error message for required n401 field should be generated and added to the error collection.
    For Required Field Missing:
    When the n404 country code field is validated, then if the n404 country code field is blank or spaces, an error message for required n404 field should be generated and added to the error collection.
  • Context - a city name is provided in the n401 field:
    For Minimum Length Not Met:
    When the length of the city name is validated, then if the city name has fewer than 2 non-space characters, an error message for minimum length 2 required should be generated and added to the error collection.
  • Context - a postal code is provided in the n403 field:
    For Minimum Length Not Met:
    When the length of the postal code is validated, then if the postal code has fewer than 3 non-space characters, an error message for minimum length 3 required should be generated and added to the error collection.
  • Context - the country code indicates canada, usa, or mexico:
    For Required Field Missing:
    When the n402 state province code field is validated, then if the n402 state province code field is blank or spaces, an error message for required n402 field should be generated and added to the error collection.
  • Context - both state province code and country code are provided for north american countries:
    For Invalid State/Country Combination:
    When the combination is validated against the state-country lookup table, then if no valid combination is found in the lookup table, an error message for invalid n402 should be generated and added to the error collection.
  • Context - a per segment contains contact name or communication number:
    For Required Field Missing:
    When the per03 communication number qualifier is validated, then if the per03 field is blank while per02 name or per04 communication number is provided, an error message for required per03 field should be generated and added to the error collection.
  • Context - a communication number qualifier is provided in per03:
    For Invalid Communication Qualifier:
    When the qualifier value is validated against approved values, then if the per03 value is not spaces, 'fx' (fax), or 'te' (telephone), an error message for invalid per03 value should be generated and added to the error collection.
  • Context - a per segment contains communication qualifier or contact name:
    For Required Field Missing:
    When the per04 communication number field is validated, then if the per04 field is blank while per03 qualifier or per02 name is provided, an error message for required per04 field should be generated and added to the error collection.
  • Context - a customs manifest is being validated:
    For Required Field Missing:
    When the lading quantity qualifier field is checked, then if the lading quantity qualifier is blank or spaces, an error message for required n1010 field should be generated and added to the error collection.
  • Context - a lading quantity qualifier is provided:
    For Invalid Entity ID:
    When the qualifier is looked up in the mu table, then if the qualifier is not found in the mu table, an error message for not found on mu should be generated and added to the error collection.
  • Context - a segment with shipper sequence number (0001) contains no name, address, location, or contact data:
    For Required Field Missing:
    When the segment is validated for completeness, then an error message for shipper required should be generated and added to the error collection.
  • Context - a segment with consignee sequence number (0002) contains no name, address, location, or contact data:
    For Required Field Missing:
    When the segment is validated for completeness, then an error message for consignee required should be generated and added to the error collection.
👨‍💻 Technical ACs (Gherkin)
Context: A validation error has been detected and an error message number has been set
GIVEN
A validation error has been detected and an error message number has been set
Applied to: Retrieve Error Message Text from MS Table
WHEN
The system attempts to retrieve the error message text from the MS table using the error message number
THEN
The system should lookup the message text in the MS table and store the retrieved English text for display
Context: An error message needs to be added to the error message array
GIVEN
An error message needs to be added to the error message array
Applied to: Check Message Index Limit
WHEN
The current message index is checked against the maximum limit of 10
THEN
If the index is less than 10, the message should be added; otherwise, the message should be skipped to prevent array overflow
Context: The error message array has available space (index less than 10) and a formatted error message is ready
GIVEN
The error message array has available space (index less than 10) and a formatted error message is ready
Applied to: Add Message to Error Array
WHEN
The system adds the error message to the array
THEN
The message should be stored in the array at the current index position, the error number should be stored in the corresponding error number array, the message index should be incremented by 1, and the return error flag should be set to indicate an error condition
Context: An error message has been processed and added to the error array
GIVEN
An error message has been processed and added to the error array
Applied to: Clear Working Variables
WHEN
The error processing is complete
THEN
The working message variable and working error message number variable should be cleared to spaces to prepare for the next error processing cycle
Context: A customs manifest is being created
GIVEN
A customs manifest is being created
Applied to: Required Field Missing
WHEN
The shipper name field is validated
THEN
If the shipper name is blank or spaces, an error message for invalid shipper name should be generated and added to the error collection
Applied to: Required Field Missing
WHEN
The consignee name field is validated
THEN
If the consignee name is blank or spaces, an error message for invalid consignee name should be generated and added to the error collection
Context: A customs manifest is being processed
GIVEN
A customs manifest is being processed
Applied to: Required Field Missing
WHEN
The origin station name is validated
THEN
If the origin station name is blank or spaces, an error message for invalid origin station name should be generated and added to the error collection
Applied to: Required Field Missing
WHEN
The destination station name is validated
THEN
If the destination station name is blank or spaces, an error message for invalid destination station name should be generated and added to the error collection
Applied to: Required Field Missing
WHEN
The origin province state code is validated
THEN
If the origin province state code is blank or spaces, an error message for invalid origin province state code should be generated and added to the error collection
Applied to: Required Field Missing
WHEN
The manifest upon port is validated
THEN
If the manifest upon port is blank or spaces, error flag 1 should be set to indicate a missing manifest upon port
Context: A manifest port needs to be validated
GIVEN
A manifest port needs to be validated
Applied to: Invalid Manifest Port
WHEN
The system looks up the manifest port in the MC table
THEN
If the manifest port is not found in the MC table, an error message for invalid manifest port should be generated and added to the error collection
Context: A manifest port has been found in the MC table
GIVEN
A manifest port has been found in the MC table
Applied to: Invalid Customs Code
WHEN
The Canadian customs code is validated
THEN
If the Canadian customs code equals '00000', an error message for invalid Canadian customs code should be generated and added to the error collection
Context: A conveying car initial is provided
GIVEN
A conveying car initial is provided
Applied to: Invalid Entity ID
WHEN
The conveying car is validated using the car validation system
THEN
If the car validation returns all asterisks indicating an invalid car, an error message for invalid conveying car should be generated using the original car value as the message number
Context: A shipper province state code is provided
GIVEN
A shipper province state code is provided
Applied to: Invalid State/Country Combination
WHEN
The system validates the province state code against the state-country lookup table
THEN
If no matching country is found for the province state code, an error message for invalid shipper province state code should be generated using the province state code as the message number
Context: A consignee province state code is provided
GIVEN
A consignee province state code is provided
Applied to: Invalid State/Country Combination
WHEN
The system validates the province state code against the state-country lookup table
THEN
If no matching country is found for the province state code, an error message for invalid consignee province state code should be generated using the province state code as the message number
Context: A destination station is being processed and sub-location validation is required
GIVEN
A destination station is being processed and sub-location validation is required
Applied to: Missing Address Information
WHEN
The sub-location code is validated against business rules
THEN
If the sub-location code is missing and none of the exemption conditions are met (CSA indicator on, same manifest ports not IIS-A6, US destination, or arrival indicator Y), an error message for invalid destination station sub-location code should be generated
Context: A waybill date is being processed for ETA calculation
GIVEN
A waybill date is being processed for ETA calculation
Applied to: Invalid Entity ID
WHEN
The date calculation system processes the waybill date
THEN
If the date calculation fails, an error message for invalid waybill date should be generated and added to the error collection
Context: An N1 segment is being validated and an entity ID is present
GIVEN
An N1 segment is being validated and an entity ID is present
Applied to: Required Field Missing
WHEN
The N102 name field is checked for completeness
THEN
If the N102 name field is blank or spaces, an error message for required N102 field should be generated and added to the error collection
Context: An N1 segment contains N3, N4, or PER data
GIVEN
An N1 segment contains N3, N4, or PER data
Applied to: Required Field Missing
WHEN
The N101 entity ID field is validated
THEN
If the N101 entity ID field is blank or spaces while other segment data exists, an error message for required N101 field should be generated and added to the error collection
Context: An N1 segment with sequence number greater than 2 is being validated
GIVEN
An N1 segment with sequence number greater than 2 is being validated
Applied to: Invalid Entity ID
WHEN
The entity ID value is checked against valid values
THEN
If the entity ID is not in the valid values list or is SH (shipper), CN (consignee), or CB (customs broker), an error message for invalid N101 value should be generated and added to the error collection
Context: An N1 segment has a valid entity ID
GIVEN
An N1 segment has a valid entity ID
Applied to: Missing Address Information
WHEN
The N301 address information field is validated
THEN
If the N301 address information field is blank or spaces, an error message for required N301 field should be generated and added to the error collection
Context: An N4 segment contains location data
GIVEN
An N4 segment contains location data
Applied to: Required Field Missing
WHEN
The N401 city name field is validated
THEN
If the N401 city name field is blank or spaces, an error message for required N401 field should be generated and added to the error collection
Applied to: Required Field Missing
WHEN
The N404 country code field is validated
THEN
If the N404 country code field is blank or spaces, an error message for required N404 field should be generated and added to the error collection
Context: A city name is provided in the N401 field
GIVEN
A city name is provided in the N401 field
Applied to: Minimum Length Not Met
WHEN
The length of the city name is validated
THEN
If the city name has fewer than 2 non-space characters, an error message for minimum length 2 required should be generated and added to the error collection
Context: A postal code is provided in the N403 field
GIVEN
A postal code is provided in the N403 field
Applied to: Minimum Length Not Met
WHEN
The length of the postal code is validated
THEN
If the postal code has fewer than 3 non-space characters, an error message for minimum length 3 required should be generated and added to the error collection
Context: The country code indicates Canada, USA, or Mexico
GIVEN
The country code indicates Canada, USA, or Mexico
Applied to: Required Field Missing
WHEN
The N402 state province code field is validated
THEN
If the N402 state province code field is blank or spaces, an error message for required N402 field should be generated and added to the error collection
Context: Both state province code and country code are provided for North American countries
GIVEN
Both state province code and country code are provided for North American countries
Applied to: Invalid State/Country Combination
WHEN
The combination is validated against the state-country lookup table
THEN
If no valid combination is found in the lookup table, an error message for invalid N402 should be generated and added to the error collection
Context: A PER segment contains contact name or communication number
GIVEN
A PER segment contains contact name or communication number
Applied to: Required Field Missing
WHEN
The PER03 communication number qualifier is validated
THEN
If the PER03 field is blank while PER02 name or PER04 communication number is provided, an error message for required PER03 field should be generated and added to the error collection
Context: A communication number qualifier is provided in PER03
GIVEN
A communication number qualifier is provided in PER03
Applied to: Invalid Communication Qualifier
WHEN
The qualifier value is validated against approved values
THEN
If the PER03 value is not spaces, 'FX' (fax), or 'TE' (telephone), an error message for invalid PER03 value should be generated and added to the error collection
Context: A PER segment contains communication qualifier or contact name
GIVEN
A PER segment contains communication qualifier or contact name
Applied to: Required Field Missing
WHEN
The PER04 communication number field is validated
THEN
If the PER04 field is blank while PER03 qualifier or PER02 name is provided, an error message for required PER04 field should be generated and added to the error collection
Context: A customs manifest is being validated
GIVEN
A customs manifest is being validated
Applied to: Required Field Missing
WHEN
The lading quantity qualifier field is checked
THEN
If the lading quantity qualifier is blank or spaces, an error message for required N1010 field should be generated and added to the error collection
Context: A lading quantity qualifier is provided
GIVEN
A lading quantity qualifier is provided
Applied to: Invalid Entity ID
WHEN
The qualifier is looked up in the MU table
THEN
If the qualifier is not found in the MU table, an error message for not found on MU should be generated and added to the error collection
Context: A segment with shipper sequence number (0001) contains no name, address, location, or contact data
GIVEN
A segment with shipper sequence number (0001) contains no name, address, location, or contact data
Applied to: Required Field Missing
WHEN
The segment is validated for completeness
THEN
An error message for shipper required should be generated and added to the error collection
Context: A segment with consignee sequence number (0002) contains no name, address, location, or contact data
GIVEN
A segment with consignee sequence number (0002) contains no name, address, location, or contact data
Applied to: Required Field Missing
WHEN
The segment is validated for completeness
THEN
An error message for consignee required should be generated and added to the error collection
R-GCCCCADD-cbl-00764 (+5) File: GCCCCADD.cbl String Length Calculation Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'String Length Calculation':
  • Context - a string with potential trailing spaces needs length calculation:
    For String Length Calculation - Calculate actual length of strings excluding trailing spaces:
    When the system processes the string from end to beginning checking each character, then the system returns the length excluding all trailing spaces, with zero length if string contains only spaces.
  • Context - a string length calculation process is starting:
    For Initialize String Length Counter:
    When the system begins the length calculation routine, then the system sets the string length counter to the maximum possible string length to start counting backwards.
  • Context - the system is examining a character at a specific position in the string:
    For Current Character = Space?:
    When the character at the current position is evaluated, then the system determines whether the character is a space and proceeds accordingly with either continuing the search or finalizing the length.
  • Context - a space character is found at the current position during string length calculation:
    For Move to Previous Character, Decrement Counter:
    When the system needs to continue searching for non-space characters, then the system decrements the position counter by one to examine the previous character position.
  • Context - the system is processing characters backward through a string:
    For Counter = 0?:
    When the position counter reaches zero, then the system recognizes that the entire string contains only spaces and sets the final length accordingly.
  • Context - the system has found the last non-space character position or determined the string contains only spaces:
    For Set Final String Length:
    When the string length calculation process is complete, then the system sets the final string length to the current counter value representing the meaningful content length.
👨‍💻 Technical ACs (Gherkin)
Context: A string with potential trailing spaces needs length calculation
GIVEN
A string with potential trailing spaces needs length calculation
Applied to: String Length Calculation - Calculate actual length of strings excluding trailing spaces
WHEN
The system processes the string from end to beginning checking each character
THEN
The system returns the length excluding all trailing spaces, with zero length if string contains only spaces
Context: A string length calculation process is starting
GIVEN
A string length calculation process is starting
Applied to: Initialize String Length Counter
WHEN
The system begins the length calculation routine
THEN
The system sets the string length counter to the maximum possible string length to start counting backwards
Context: The system is examining a character at a specific position in the string
GIVEN
The system is examining a character at a specific position in the string
Applied to: Current Character = Space?
WHEN
The character at the current position is evaluated
THEN
The system determines whether the character is a space and proceeds accordingly with either continuing the search or finalizing the length
Context: A space character is found at the current position during string length calculation
GIVEN
A space character is found at the current position during string length calculation
Applied to: Move to Previous Character, Decrement Counter
WHEN
The system needs to continue searching for non-space characters
THEN
The system decrements the position counter by one to examine the previous character position
Context: The system is processing characters backward through a string
GIVEN
The system is processing characters backward through a string
Applied to: Counter = 0?
WHEN
The position counter reaches zero
THEN
The system recognizes that the entire string contains only spaces and sets the final length accordingly
Context: The system has found the last non-space character position or determined the string contains only spaces
GIVEN
The system has found the last non-space character position or determined the string contains only spaces
Applied to: Set Final String Length
WHEN
The string length calculation process is complete
THEN
The system sets the final string length to the current counter value representing the meaningful content length
R-GCCCCADD-cbl-00770 (+30) File: GCCCCADD.cbl Haulage Rights Processing Merged 31 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Haulage Rights Processing':
  • Context - a shipment with an ima code:
    For IMA Code = 'HM'?:
    When the ima code is evaluated for haulage requirements, then if ima code equals 'hm' then haulage processing is required, otherwise haulage fields are cleared.
  • Context - a shipment in haulage mode:
    For Haulage Right Carrier exists?:
    When the haulage right carrier field is checked, then if haulage right carrier is spaces then set unknown scac and reject haulage, otherwise proceed with carrier lookup.
  • Context - a valid haulage right carrier code:
    For Lookup Carrier Code in CC Table:
    When the carrier code is looked up in the cc table, then the system retrieves the corresponding ccra code for the carrier.
    For Lookup Carrier in CC Table:
    When the system looks up the carrier in the cc table, then retrieve the corresponding ccra code for the haulage rights scac.
  • Context - a carrier code lookup has been performed:
    For Carrier Code Found?:
    When the lookup result is evaluated, then if carrier code is found then set haulage rights scac from table, otherwise set unknown scac and reject haulage.
  • Context - a call from gcx011 with a ccn key starting with '6105':
    For Called from GCX011 and CCN starts with '6105'?:
    When the bill-as scac is valid (not 'unkn', spaces, low-values, or '6105'), then replace the first 4 characters of ccn key with the bill-as scac.
  • Context - a modified ccn key for haulage processing:
    For Automated Haulage?:
    When the automated haulage flag is checked, then if automated haulage then set ccn key suffix to 'e' and bill owner to '6105', otherwise set ccn key suffix to 'p' and bill owner to bill-as scac.
  • Context - a shipment with ima code not equal to 'hm':
    For Clear Haulage Fields for Non-HM:
    When haulage processing is performed, then clear haulage rights scac, haulage automated flag, and reject haulage indicator.
  • Context - canadian customs code from manifest station:
    For Build SS Table Key with Port Code:
    When ss table key is constructed, then build key with 'c' prefix followed by last 3 digits of canadian customs code, and use '6105' if haulage rights scac is spaces, otherwise use haulage rights scac.
  • Context - a constructed ss table key:
    For Lookup SS Table Entry:
    When the ss table is queried, then retrieve the corresponding station and scac configuration data.
  • Context - ss table data for a haulage shipment:
    For Haulage Agreement = 'Y'?:
    When the haulage agreement flag is evaluated, then if haulage agreement equals 'y' then accept haulage, otherwise reject haulage.
  • Context - a haulage shipment with ss table data found:
    For Set Automated Carrier Flag:
    When automated carrier processing is performed, then set haulage automated flag from ss table automated carrier field, and if automated haulage then set bill owner to '6105'.
  • Context - a haulage shipment with valid ss table data:
    For Set Bill-As SCAC from Haulage Bill Init:
    When bill-as scac assignment is performed, then set bill-as scac from ss table haulage bill initial field.
  • Context - a non-haulage shipment with valid ss table data:
    For Set Bill-As SCAC from Line Bill Init:
    When bill-as scac assignment is performed, then set bill-as scac from ss table line bill initial field.
  • Context - a haulage shipment where ss table lookup fails:
    For Handle SS Table Not Found - Set Defaults:
    When default values are set, then clear haulage automated flag, reject haulage, and set bill owner and bill-as scac to 'unkn'.
  • Context - a non-haulage shipment where ss table lookup fails:
    For Set Standard Bill Owner and SCAC to '6105':
    When default values are set, then set bill owner and bill-as scac to '6105'.
  • Context - a shipment record with an ima code:
    For IMA Code = 'HM'?:
    When the system evaluates the ima code, then if ima code equals 'hm' then process haulage rights, otherwise clear all haulage-related fields and flags.
  • Context - a shipment with ima code 'hm' requiring haulage processing:
    For Haulage Right Carrier exists?:
    When the system checks for haulage right carrier information, then if haulage right carrier is blank then set unknown scac code, clear automated flag, set bill owner to unknown, and reject haulage.
  • Context - a haulage right carrier code that needs to be validated:
    For Carrier Found in CC Table?:
    When the carrier lookup in cc table fails, then set haulage rights scac to unknown, clear automated flag, reject haulage, and set bill owner to unknown.
  • Context - a successful cc table lookup for the haulage right carrier:
    For Set Haulage Rights SCAC from CC Table:
    When the system processes the cc table result, then set the haulage rights scac to the ccra code from the cc table entry.
  • Context - a processed haulage request with calling program context and ccn key:
    For Called from GCX011 and CCN starts with '6105'?:
    When the system checks if called from gcx011 and ccn key starts with '6105', then if both conditions are true then proceed with bill-as scac validation, otherwise continue with ss table processing.
  • Context - a ccn key starting with '6105' from gcx011 call:
    For Bill-As SCAC is valid?:
    When the system validates the bill-as scac code, then if bill-as scac is not 'unkn', not spaces, not low-values, and not '6105' then modify ccn key with bill-as scac.
  • Context - a valid bill-as scac code requiring ccn key modification:
    For Automated Haulage?:
    When the system determines if haulage is automated, then if automated haulage then set ccn key suffix to 'e' and bill owner to '6105', otherwise set ccn key suffix to 'p' and bill owner to bill-as scac.
  • Context - a shipment with ima code other than 'hm':
    For Clear Haulage Rights and Flags:
    When the system processes non-haulage shipments, then clear haulage rights scac, automated flag, and reject haulage indicator.
  • Context - canadian customs code from manifest station processing:
    For Build SS Table Key with Port Code:
    When the system builds ss table lookup key, then construct port code with 'c' prefix plus last 3 digits of canadian customs code, and combine with appropriate scac code.
  • Context - a requirement to lookup ss table entry:
    For Haulage Rights SCAC exists?:
    When the system determines which scac code to use, then if haulage rights scac is blank then use '6105' as scac code, otherwise use the haulage rights scac.
  • Context - a constructed ss table key with port code and scac code:
    For Lookup SS Table Entry:
    When the system performs ss table lookup, then retrieve the ss table entry containing haulage agreement and billing information.
  • Context - a successfully retrieved ss table entry:
    For Process SS Table Data for Haulage:
    When the system processes ss table data for haulage shipments, then set automated carrier flag from ss table, evaluate haulage agreement status, and configure bill owner and bill-as scac accordingly.
  • Context - an ss table entry with haulage agreement indicator:
    For Haulage Agreement = 'Y'?:
    When the system evaluates the haulage agreement status, then if haulage agreement equals 'y' then accept haulage, otherwise reject haulage.
  • Context - a failed ss table lookup for a haulage shipment:
    For Handle SS Table Not Found - Set Defaults:
    When the system handles the ss table not found condition, then clear automated flag, reject haulage, set bill owner to unknown, and set bill-as scac to unknown.
  • Context - a failed ss table lookup for a non-haulage shipment:
    For Handle SS Table Not Found - Set Defaults:
    When the system handles the ss table not found condition, then set bill owner to '6105' and set bill-as scac to '6105'.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA code
GIVEN
A shipment with an IMA code
Applied to: IMA Code = 'HM'?
WHEN
The IMA code is evaluated for haulage requirements
THEN
If IMA code equals 'HM' then haulage processing is required, otherwise haulage fields are cleared
Context: A shipment in haulage mode
GIVEN
A shipment in haulage mode
Applied to: Haulage Right Carrier exists?
WHEN
The haulage right carrier field is checked
THEN
If haulage right carrier is spaces then set unknown SCAC and reject haulage, otherwise proceed with carrier lookup
Context: A valid haulage right carrier code
GIVEN
A valid haulage right carrier code
Applied to: Lookup Carrier Code in CC Table
WHEN
The carrier code is looked up in the CC table
THEN
The system retrieves the corresponding CCRA code for the carrier
Applied to: Lookup Carrier in CC Table
WHEN
The system looks up the carrier in the CC table
THEN
Retrieve the corresponding CCRA code for the haulage rights SCAC
Context: A carrier code lookup has been performed
GIVEN
A carrier code lookup has been performed
Applied to: Carrier Code Found?
WHEN
The lookup result is evaluated
THEN
If carrier code is found then set haulage rights SCAC from table, otherwise set unknown SCAC and reject haulage
Context: A call from GCX011 with a CCN key starting with '6105'
GIVEN
A call from GCX011 with a CCN key starting with '6105'
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The bill-as SCAC is valid (not 'UNKN', spaces, low-values, or '6105')
THEN
Replace the first 4 characters of CCN key with the bill-as SCAC
Context: A modified CCN key for haulage processing
GIVEN
A modified CCN key for haulage processing
Applied to: Automated Haulage?
WHEN
The automated haulage flag is checked
THEN
If automated haulage then set CCN key suffix to 'E' and bill owner to '6105', otherwise set CCN key suffix to 'P' and bill owner to bill-as SCAC
Context: A shipment with IMA code not equal to 'HM'
GIVEN
A shipment with IMA code not equal to 'HM'
Applied to: Clear Haulage Fields for Non-HM
WHEN
Haulage processing is performed
THEN
Clear haulage rights SCAC, haulage automated flag, and reject haulage indicator
Context: Canadian customs code from manifest station
GIVEN
Canadian customs code from manifest station
Applied to: Build SS Table Key with Port Code
WHEN
SS table key is constructed
THEN
Build key with 'C' prefix followed by last 3 digits of Canadian customs code, and use '6105' if haulage rights SCAC is spaces, otherwise use haulage rights SCAC
Context: A constructed SS table key
GIVEN
A constructed SS table key
Applied to: Lookup SS Table Entry
WHEN
The SS table is queried
THEN
Retrieve the corresponding station and SCAC configuration data
Context: SS table data for a haulage shipment
GIVEN
SS table data for a haulage shipment
Applied to: Haulage Agreement = 'Y'?
WHEN
The haulage agreement flag is evaluated
THEN
If haulage agreement equals 'Y' then accept haulage, otherwise reject haulage
Context: A haulage shipment with SS table data found
GIVEN
A haulage shipment with SS table data found
Applied to: Set Automated Carrier Flag
WHEN
Automated carrier processing is performed
THEN
Set haulage automated flag from SS table automated carrier field, and if automated haulage then set bill owner to '6105'
Context: A haulage shipment with valid SS table data
GIVEN
A haulage shipment with valid SS table data
Applied to: Set Bill-As SCAC from Haulage Bill Init
WHEN
Bill-as SCAC assignment is performed
THEN
Set bill-as SCAC from SS table haulage bill initial field
Context: A non-haulage shipment with valid SS table data
GIVEN
A non-haulage shipment with valid SS table data
Applied to: Set Bill-As SCAC from Line Bill Init
WHEN
Bill-as SCAC assignment is performed
THEN
Set bill-as SCAC from SS table line bill initial field
Context: A haulage shipment where SS table lookup fails
GIVEN
A haulage shipment where SS table lookup fails
Applied to: Handle SS Table Not Found - Set Defaults
WHEN
Default values are set
THEN
Clear haulage automated flag, reject haulage, and set bill owner and bill-as SCAC to 'UNKN'
Context: A non-haulage shipment where SS table lookup fails
GIVEN
A non-haulage shipment where SS table lookup fails
Applied to: Set Standard Bill Owner and SCAC to '6105'
WHEN
Default values are set
THEN
Set bill owner and bill-as SCAC to '6105'
Context: A shipment record with an IMA code
GIVEN
A shipment record with an IMA code
Applied to: IMA Code = 'HM'?
WHEN
The system evaluates the IMA code
THEN
If IMA code equals 'HM' then process haulage rights, otherwise clear all haulage-related fields and flags
Context: A shipment with IMA code 'HM' requiring haulage processing
GIVEN
A shipment with IMA code 'HM' requiring haulage processing
Applied to: Haulage Right Carrier exists?
WHEN
The system checks for haulage right carrier information
THEN
If haulage right carrier is blank then set unknown SCAC code, clear automated flag, set bill owner to unknown, and reject haulage
Context: A haulage right carrier code that needs to be validated
GIVEN
A haulage right carrier code that needs to be validated
Applied to: Carrier Found in CC Table?
WHEN
The carrier lookup in CC table fails
THEN
Set haulage rights SCAC to unknown, clear automated flag, reject haulage, and set bill owner to unknown
Context: A successful CC table lookup for the haulage right carrier
GIVEN
A successful CC table lookup for the haulage right carrier
Applied to: Set Haulage Rights SCAC from CC Table
WHEN
The system processes the CC table result
THEN
Set the haulage rights SCAC to the CCRA code from the CC table entry
Context: A processed haulage request with calling program context and CCN key
GIVEN
A processed haulage request with calling program context and CCN key
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The system checks if called from GCX011 and CCN key starts with '6105'
THEN
If both conditions are true then proceed with bill-as SCAC validation, otherwise continue with SS table processing
Context: A CCN key starting with '6105' from GCX011 call
GIVEN
A CCN key starting with '6105' from GCX011 call
Applied to: Bill-As SCAC is valid?
WHEN
The system validates the bill-as SCAC code
THEN
If bill-as SCAC is not 'UNKN', not spaces, not low-values, and not '6105' then modify CCN key with bill-as SCAC
Context: A valid bill-as SCAC code requiring CCN key modification
GIVEN
A valid bill-as SCAC code requiring CCN key modification
Applied to: Automated Haulage?
WHEN
The system determines if haulage is automated
THEN
If automated haulage then set CCN key suffix to 'E' and bill owner to '6105', otherwise set CCN key suffix to 'P' and bill owner to bill-as SCAC
Context: A shipment with IMA code other than 'HM'
GIVEN
A shipment with IMA code other than 'HM'
Applied to: Clear Haulage Rights and Flags
WHEN
The system processes non-haulage shipments
THEN
Clear haulage rights SCAC, automated flag, and reject haulage indicator
Context: Canadian customs code from manifest station processing
GIVEN
Canadian customs code from manifest station processing
Applied to: Build SS Table Key with Port Code
WHEN
The system builds SS table lookup key
THEN
Construct port code with 'C' prefix plus last 3 digits of Canadian customs code, and combine with appropriate SCAC code
Context: A requirement to lookup SS table entry
GIVEN
A requirement to lookup SS table entry
Applied to: Haulage Rights SCAC exists?
WHEN
The system determines which SCAC code to use
THEN
If haulage rights SCAC is blank then use '6105' as SCAC code, otherwise use the haulage rights SCAC
Context: A constructed SS table key with port code and SCAC code
GIVEN
A constructed SS table key with port code and SCAC code
Applied to: Lookup SS Table Entry
WHEN
The system performs SS table lookup
THEN
Retrieve the SS table entry containing haulage agreement and billing information
Context: A successfully retrieved SS table entry
GIVEN
A successfully retrieved SS table entry
Applied to: Process SS Table Data for Haulage
WHEN
The system processes SS table data for haulage shipments
THEN
Set automated carrier flag from SS table, evaluate haulage agreement status, and configure bill owner and bill-as SCAC accordingly
Context: An SS table entry with haulage agreement indicator
GIVEN
An SS table entry with haulage agreement indicator
Applied to: Haulage Agreement = 'Y'?
WHEN
The system evaluates the haulage agreement status
THEN
If haulage agreement equals 'Y' then accept haulage, otherwise reject haulage
Context: A failed SS table lookup for a haulage shipment
GIVEN
A failed SS table lookup for a haulage shipment
Applied to: Handle SS Table Not Found - Set Defaults
WHEN
The system handles the SS table not found condition
THEN
Clear automated flag, reject haulage, set bill owner to unknown, and set bill-as SCAC to unknown
Context: A failed SS table lookup for a non-haulage shipment
GIVEN
A failed SS table lookup for a non-haulage shipment
Applied to: Handle SS Table Not Found - Set Defaults
WHEN
The system handles the SS table not found condition
THEN
Set bill owner to '6105' and set bill-as SCAC to '6105'
R-GCCCCADD-cbl-00785 (+3) File: GCCCCADD.cbl Error Message Retrieval Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Retrieval':
  • Context - a business validation error has occurred and an error message number has been identified:
    For Error Message Retrieval Request:
    When the system needs to retrieve the corresponding error message text, then the system should lookup the message text from the message table using the error number as the key.
  • Context - an error message retrieval request is initiated:
    For Initialize Table Lookup Parameters:
    When setting up the table lookup operation, then the system should clear all lookup parameters, set function code to 'gu' for get unique operation, set table identifier to 'ms' for message table, and use the error message number as the search key.
  • Context - a message table lookup operation has been performed:
    For Table Access Successful?:
    When the table access returns successfully, then the system should move the table segment to the message structure, extract the english text from the message table, and move the english text to the message label field.
    For Table Access Successful?:
    When the table access fails or returns no data, then the system should clear the message structure by setting it to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A business validation error has occurred and an error message number has been identified
GIVEN
A business validation error has occurred and an error message number has been identified
Applied to: Error Message Retrieval Request
WHEN
The system needs to retrieve the corresponding error message text
THEN
The system should lookup the message text from the message table using the error number as the key
Context: An error message retrieval request is initiated
GIVEN
An error message retrieval request is initiated
Applied to: Initialize Table Lookup Parameters
WHEN
Setting up the table lookup operation
THEN
The system should clear all lookup parameters, set function code to 'GU' for get unique operation, set table identifier to 'MS' for message table, and use the error message number as the search key
Context: A message table lookup operation has been performed
GIVEN
A message table lookup operation has been performed
Applied to: Table Access Successful?
WHEN
The table access returns successfully
THEN
The system should move the table segment to the message structure, extract the English text from the message table, and move the English text to the message label field
Applied to: Table Access Successful?
WHEN
The table access fails or returns no data
THEN
The system should clear the message structure by setting it to spaces
R-GCCCCADD-cbl-00789 (+21) File: GCCCCADD.cbl EDI BOL Segment Retrieval Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI BOL Segment Retrieval':
  • Context - an edi bol segment retrieval operation is initiated:
    For Initialize EDI BOL Access Parameters:
    When the system prepares to access edi bol data, then the edi bol i/o work area is cleared to spaces, the database accept status is set to 'ge', and all segment data areas are initialized to spaces.
  • Context - edi bol access parameters are being configured for a specific segment type:
    For Set Segment Type and Function Code:
    When the system determines the segment type (ebsnrsc, ebsnrsa, ebsnrtd, ebsmcoa, or ebsbcks), then the segment type is set in the i/o work area and the function code is set to 'gu' (get unique) for database retrieval.
  • Context - an edi bol key exists for record 55 processing:
    For Set Root Key from EDI BOL Key:
    When the system prepares to access edi bol segments, then the edi bol key for record 55 is moved to the root key field in the i/o work area.
  • Context - a specific edi bol segment needs to be retrieved with known entity type and sequence:
    For Set Entity Type and Sequence Numbers:
    When the system configures segment access parameters, then the entity type code (hn, ha, hc, gp, cn, ca, cc, pn, pa, pc, un, ua, uc, bn, bt, by, tn, t2, t3, ta, nn, gc, ga, ot, on, oc, sh, ch, hs, cm, cr) is set in type-1 field, sequence numbers are set to appropriate values (typically '01'), and the operator is set to '=' for exact match.
  • Context - all edi bol access parameters are properly configured:
    For Call EDI BOL I/O Service:
    When the system needs to retrieve edi bol segment data, then the ebclgio service is called with the communication control block, i/o work area, and target segment data area.
  • Context - an edi bol i/o service call has been completed:
    For Segment Found?:
    When the system checks the result of the segment retrieval, then if the database status code is spaces, the segment was found successfully; otherwise, the segment was not found.
  • Context - an edi bol segment has been successfully retrieved from the database:
    For Load Segment Data:
    When the segment data needs to be made available for processing, then the segment found flag is set to true and the retrieved data remains in the segment data area for further processing.
  • Context - an edi bol segment retrieval has failed or returned no data:
    For Clear Segment Data:
    When the system needs to handle the unsuccessful retrieval, then the target segment data area is cleared to spaces and the segment not found flag is set to true.
    For Return Not Found Status:
    When the segment retrieval operation completes, then the segment not found status flag is set to indicate unsuccessful retrieval.
  • Context - an edi bol segment has been successfully retrieved and loaded:
    For Return Success Status:
    When the segment retrieval operation completes, then the segment found status flag is set to indicate successful retrieval.
  • Context - edi bol data exists with shipper information:
    For HN - Shipper Name Segment:
    When the system needs to retrieve shipper name details for customs processing, then the hn segment is accessed from ebsnrsc data source with entity type 'hn' and sequence '01', containing shipper name and identification codes.
  • Context - edi bol data exists with shipper address information:
    For HA - Shipper Address Segment:
    When the system needs to retrieve shipper address details for customs processing, then the ha segment is accessed from ebsnrsa data source with entity type 'ha' and sequence '01', containing shipper street address lines.
  • Context - edi bol data exists with shipper geographic information:
    For HC - Shipper City/State Segment:
    When the system needs to retrieve shipper city, state, postal code, and country details for customs processing, then the hc segment is accessed from ebsnrsa data source with entity type 'hc' and sequence '01', containing shipper city, state, postal code, and country code.
  • Context - edi bol data exists with contact person information:
    For GP - Contact Person Segment:
    When the system needs to retrieve contact details for customs processing, then the gp segment is accessed from ebsnrsa data source with entity type 'gp' and sequence '01', containing contact function code, name, communication number qualifier, and communication number.
  • Context - edi bol data exists with consignee information:
    For CN - Consignee Name Segment:
    When the system needs to retrieve consignee name details for customs processing, then the cn segment is accessed from ebsnrsc data source with entity type 'cn' and sequence '01', containing consignee name and identification codes.
  • Context - edi bol data exists with consignee address information:
    For CA - Consignee Address Segment:
    When the system needs to retrieve consignee address details for customs processing, then the ca segment is accessed from ebsnrsa data source with entity type 'ca' and sequence '01', containing consignee street address lines.
  • Context - edi bol data exists with consignee geographic information:
    For CC - Consignee City/State Segment:
    When the system needs to retrieve consignee city, state, postal code, and country details for customs processing, then the cc segment is accessed from ebsnrsa data source with entity type 'cc' and sequence '01', containing consignee city, state, postal code, and country code.
  • Context - edi bol data exists with stuffer information:
    For PN - Stuffer Name Segment:
    When the system needs to retrieve stuffer name details for customs processing, then the pn segment is accessed from ebsnrsc data source with entity type 'pn' and sequence '01', containing stuffer name and identification codes.
  • Context - edi bol data exists with ultimate consignee information:
    For UN - Ultimate Consignee Name Segment:
    When the system needs to retrieve ultimate consignee name details for customs processing, then the un segment is accessed from ebsnrsc data source with entity type 'un' and sequence '01', containing ultimate consignee name and identification codes.
  • Context - edi bol data exists with beneficial owner information:
    For BN - Beneficial Owner Name Segment:
    When the system needs to retrieve beneficial owner name details for customs processing, then the bn segment is accessed from ebsnrsc data source with entity type 'bn' and sequence '01', containing beneficial owner name and identification codes.
  • Context - edi bol data exists with transportation entity information:
    For TN - Transportation Name Segment:
    When the system needs to retrieve transportation entity name details for customs processing, then the tn segment is accessed from ebsnrtd data source with varying sequence numbers until the desired organization id is found, containing transportation entity name and organization id.
  • Context - edi bol data exists with additional named entity information:
    For NN - Additional Entity Name Segment:
    When the system needs to retrieve additional entity name details for customs processing, then the nn segment is accessed from ebsnrsc data source with varying sequence numbers, containing entity name and identification codes for various entity types.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL segment retrieval operation is initiated
GIVEN
An EDI BOL segment retrieval operation is initiated
Applied to: Initialize EDI BOL Access Parameters
WHEN
The system prepares to access EDI BOL data
THEN
The EDI BOL I/O work area is cleared to spaces, the database accept status is set to 'GE', and all segment data areas are initialized to spaces
Context: EDI BOL access parameters are being configured for a specific segment type
GIVEN
EDI BOL access parameters are being configured for a specific segment type
Applied to: Set Segment Type and Function Code
WHEN
The system determines the segment type (EBSNRSC, EBSNRSA, EBSNRTD, EBSMCOA, or EBSBCKS)
THEN
The segment type is set in the I/O work area and the function code is set to 'GU' (Get Unique) for database retrieval
Context: An EDI BOL key exists for record 55 processing
GIVEN
An EDI BOL key exists for record 55 processing
Applied to: Set Root Key from EDI BOL Key
WHEN
The system prepares to access EDI BOL segments
THEN
The EDI BOL key for record 55 is moved to the root key field in the I/O work area
Context: A specific EDI BOL segment needs to be retrieved with known entity type and sequence
GIVEN
A specific EDI BOL segment needs to be retrieved with known entity type and sequence
Applied to: Set Entity Type and Sequence Numbers
WHEN
The system configures segment access parameters
THEN
The entity type code (HN, HA, HC, GP, CN, CA, CC, PN, PA, PC, UN, UA, UC, BN, BT, BY, TN, T2, T3, TA, NN, GC, GA, OT, ON, OC, SH, CH, HS, CM, CR) is set in TYPE-1 field, sequence numbers are set to appropriate values (typically '01'), and the operator is set to '=' for exact match
Context: All EDI BOL access parameters are properly configured
GIVEN
All EDI BOL access parameters are properly configured
Applied to: Call EDI BOL I/O Service
WHEN
The system needs to retrieve EDI BOL segment data
THEN
The EBCLGIO service is called with the communication control block, I/O work area, and target segment data area
Context: An EDI BOL I/O service call has been completed
GIVEN
An EDI BOL I/O service call has been completed
Applied to: Segment Found?
WHEN
The system checks the result of the segment retrieval
THEN
If the database status code is spaces, the segment was found successfully; otherwise, the segment was not found
Context: An EDI BOL segment has been successfully retrieved from the database
GIVEN
An EDI BOL segment has been successfully retrieved from the database
Applied to: Load Segment Data
WHEN
The segment data needs to be made available for processing
THEN
The segment found flag is set to TRUE and the retrieved data remains in the segment data area for further processing
Context: An EDI BOL segment retrieval has failed or returned no data
GIVEN
An EDI BOL segment retrieval has failed or returned no data
Applied to: Clear Segment Data
WHEN
The system needs to handle the unsuccessful retrieval
THEN
The target segment data area is cleared to spaces and the segment not found flag is set to TRUE
Applied to: Return Not Found Status
WHEN
The segment retrieval operation completes
THEN
The segment not found status flag is set to indicate unsuccessful retrieval
Context: An EDI BOL segment has been successfully retrieved and loaded
GIVEN
An EDI BOL segment has been successfully retrieved and loaded
Applied to: Return Success Status
WHEN
The segment retrieval operation completes
THEN
The segment found status flag is set to indicate successful retrieval
Context: EDI BOL data exists with shipper information
GIVEN
EDI BOL data exists with shipper information
Applied to: HN - Shipper Name Segment
WHEN
The system needs to retrieve shipper name details for customs processing
THEN
The HN segment is accessed from EBSNRSC data source with entity type 'HN' and sequence '01', containing shipper name and identification codes
Context: EDI BOL data exists with shipper address information
GIVEN
EDI BOL data exists with shipper address information
Applied to: HA - Shipper Address Segment
WHEN
The system needs to retrieve shipper address details for customs processing
THEN
The HA segment is accessed from EBSNRSA data source with entity type 'HA' and sequence '01', containing shipper street address lines
Context: EDI BOL data exists with shipper geographic information
GIVEN
EDI BOL data exists with shipper geographic information
Applied to: HC - Shipper City/State Segment
WHEN
The system needs to retrieve shipper city, state, postal code, and country details for customs processing
THEN
The HC segment is accessed from EBSNRSA data source with entity type 'HC' and sequence '01', containing shipper city, state, postal code, and country code
Context: EDI BOL data exists with contact person information
GIVEN
EDI BOL data exists with contact person information
Applied to: GP - Contact Person Segment
WHEN
The system needs to retrieve contact details for customs processing
THEN
The GP segment is accessed from EBSNRSA data source with entity type 'GP' and sequence '01', containing contact function code, name, communication number qualifier, and communication number
Context: EDI BOL data exists with consignee information
GIVEN
EDI BOL data exists with consignee information
Applied to: CN - Consignee Name Segment
WHEN
The system needs to retrieve consignee name details for customs processing
THEN
The CN segment is accessed from EBSNRSC data source with entity type 'CN' and sequence '01', containing consignee name and identification codes
Context: EDI BOL data exists with consignee address information
GIVEN
EDI BOL data exists with consignee address information
Applied to: CA - Consignee Address Segment
WHEN
The system needs to retrieve consignee address details for customs processing
THEN
The CA segment is accessed from EBSNRSA data source with entity type 'CA' and sequence '01', containing consignee street address lines
Context: EDI BOL data exists with consignee geographic information
GIVEN
EDI BOL data exists with consignee geographic information
Applied to: CC - Consignee City/State Segment
WHEN
The system needs to retrieve consignee city, state, postal code, and country details for customs processing
THEN
The CC segment is accessed from EBSNRSA data source with entity type 'CC' and sequence '01', containing consignee city, state, postal code, and country code
Context: EDI BOL data exists with stuffer information
GIVEN
EDI BOL data exists with stuffer information
Applied to: PN - Stuffer Name Segment
WHEN
The system needs to retrieve stuffer name details for customs processing
THEN
The PN segment is accessed from EBSNRSC data source with entity type 'PN' and sequence '01', containing stuffer name and identification codes
Context: EDI BOL data exists with ultimate consignee information
GIVEN
EDI BOL data exists with ultimate consignee information
Applied to: UN - Ultimate Consignee Name Segment
WHEN
The system needs to retrieve ultimate consignee name details for customs processing
THEN
The UN segment is accessed from EBSNRSC data source with entity type 'UN' and sequence '01', containing ultimate consignee name and identification codes
Context: EDI BOL data exists with beneficial owner information
GIVEN
EDI BOL data exists with beneficial owner information
Applied to: BN - Beneficial Owner Name Segment
WHEN
The system needs to retrieve beneficial owner name details for customs processing
THEN
The BN segment is accessed from EBSNRSC data source with entity type 'BN' and sequence '01', containing beneficial owner name and identification codes
Context: EDI BOL data exists with transportation entity information
GIVEN
EDI BOL data exists with transportation entity information
Applied to: TN - Transportation Name Segment
WHEN
The system needs to retrieve transportation entity name details for customs processing
THEN
The TN segment is accessed from EBSNRTD data source with varying sequence numbers until the desired organization ID is found, containing transportation entity name and organization ID
Context: EDI BOL data exists with additional named entity information
GIVEN
EDI BOL data exists with additional named entity information
Applied to: NN - Additional Entity Name Segment
WHEN
The system needs to retrieve additional entity name details for customs processing
THEN
The NN segment is accessed from EBSNRSC data source with varying sequence numbers, containing entity name and identification codes for various entity types
R-GCCCCADD-cbl-00811 (+9) File: GCCCCADD.cbl Transportation Segment Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transportation Segment Processing':
  • Context - transportation segment processing is starting:
    For Initialize Search Variables:
    When the system initializes search parameters, then the d5-org-id found flag is set to false and tn segment found flag is set to true.
  • Context - a sequence number is available for transportation segment lookup:
    For Retrieve TN Segment by Sequence Number:
    When the system retrieves a tn segment from ebsnrtd using the current sequence number, then the transportation segment data is loaded if found, otherwise segment not found status is returned.
  • Context - a transportation segment retrieval attempt has been made:
    For TN Segment Found?:
    When the system checks the retrieval status, then if segment is found, continue with organization id matching, otherwise set tn segment not found flag.
  • Context - a transportation segment has been successfully retrieved:
    For Check if D5-ORG-ID Matches Target:
    When the system compares the d5-org-id from the segment with the target organization id, then the organization ids are evaluated for exact match.
  • Context - organization id comparison has been completed:
    For D5-ORG-ID Match Found?:
    When the system evaluates the match result, then if match is found, set d5-org-id found flag to true, otherwise increment sequence counter and continue search.
  • Context - the d5-org-id from transportation segment matches the target organization id:
    For Set D5-ORG-ID Found Flag:
    When the system processes the successful match, then the d5-org-id found flag is set to true to indicate successful search completion.
  • Context - the current transportation segment organization id does not match the target:
    For Increment Sequence Counter:
    When the system prepares for the next search iteration, then the sequence counter is incremented by 1 to retrieve the next transportation segment.
  • Context - a transportation segment has been processed and sequence counter incremented:
    For Continue Search?:
    When the system evaluates search continuation criteria, then if target organization id not found and more segments may exist, continue search loop, otherwise terminate search.
  • Context - no transportation segment was retrieved or search loop has completed without finding target:
    For Set TN Segment Not Found Flag:
    When the system terminates the search process, then the tn segment found flag is set to false to indicate search termination.
  • Context - transportation segment search has completed either successfully or unsuccessfully:
    For Adjust Final Sequence Counter:
    When the system finalizes the search results, then the sequence counter is decremented by 1 to reflect the actual last processed sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: Transportation segment processing is starting
GIVEN
Transportation segment processing is starting
Applied to: Initialize Search Variables
WHEN
The system initializes search parameters
THEN
The D5-ORG-ID found flag is set to false and TN segment found flag is set to true
Context: A sequence number is available for transportation segment lookup
GIVEN
A sequence number is available for transportation segment lookup
Applied to: Retrieve TN Segment by Sequence Number
WHEN
The system retrieves a TN segment from EBSNRTD using the current sequence number
THEN
The transportation segment data is loaded if found, otherwise segment not found status is returned
Context: A transportation segment retrieval attempt has been made
GIVEN
A transportation segment retrieval attempt has been made
Applied to: TN Segment Found?
WHEN
The system checks the retrieval status
THEN
If segment is found, continue with organization ID matching, otherwise set TN segment not found flag
Context: A transportation segment has been successfully retrieved
GIVEN
A transportation segment has been successfully retrieved
Applied to: Check if D5-ORG-ID Matches Target
WHEN
The system compares the D5-ORG-ID from the segment with the target organization ID
THEN
The organization IDs are evaluated for exact match
Context: Organization ID comparison has been completed
GIVEN
Organization ID comparison has been completed
Applied to: D5-ORG-ID Match Found?
WHEN
The system evaluates the match result
THEN
If match is found, set D5-ORG-ID found flag to true, otherwise increment sequence counter and continue search
Context: The D5-ORG-ID from transportation segment matches the target organization ID
GIVEN
The D5-ORG-ID from transportation segment matches the target organization ID
Applied to: Set D5-ORG-ID Found Flag
WHEN
The system processes the successful match
THEN
The D5-ORG-ID found flag is set to true to indicate successful search completion
Context: The current transportation segment organization ID does not match the target
GIVEN
The current transportation segment organization ID does not match the target
Applied to: Increment Sequence Counter
WHEN
The system prepares for the next search iteration
THEN
The sequence counter is incremented by 1 to retrieve the next transportation segment
Context: A transportation segment has been processed and sequence counter incremented
GIVEN
A transportation segment has been processed and sequence counter incremented
Applied to: Continue Search?
WHEN
The system evaluates search continuation criteria
THEN
If target organization ID not found and more segments may exist, continue search loop, otherwise terminate search
Context: No transportation segment was retrieved or search loop has completed without finding target
GIVEN
No transportation segment was retrieved or search loop has completed without finding target
Applied to: Set TN Segment Not Found Flag
WHEN
The system terminates the search process
THEN
The TN segment found flag is set to false to indicate search termination
Context: Transportation segment search has completed either successfully or unsuccessfully
GIVEN
Transportation segment search has completed either successfully or unsuccessfully
Applied to: Adjust Final Sequence Counter
WHEN
The system finalizes the search results
THEN
The sequence counter is decremented by 1 to reflect the actual last processed sequence number
R-GCCCCADD-cbl-00821 (+7) File: GCCCCADD.cbl Business Type Segment Processing Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Business Type Segment Processing':
  • Context - a customs manifest is being processed and bn segment processing is initiated:
    For Search for BN Entity in Transportation Data:
    When the system searches for bn entity in transportation data segments with organization id 'bn', then if bn entity is found, initialize bn segment record and proceed with bn processing, otherwise skip bn processing entirely.
  • Context - a bn entity has been found in transportation data segments:
    For Extract Entity Name:
    When the system processes the bn entity data, then set entity id code to 'bn', extract entity name from transportation data, extract consignee chop code, and clear identification code fields.
  • Context - a bn entity is being processed and address information is being extracted:
    For Extract Business Address Line 1:
    When the system searches for bt address segments and finds address data, then extract address line 1 and address line 2 from bt segments, and if address line 1 is empty, set default value 'na' for address line 1.
    For Set Default 'NA' Address:
    When bt address segments are not found or address line 1 is empty, then clear all address data fields and set address line 1 to default value 'na'.
  • Context - a bn entity is being processed and geographic information is being extracted:
    For Extract City Name:
    When the system searches for by geographic segments and finds geographic data, then extract city name, state/province code, postal code, and country code from by segments.
    For Clear Geographic Data:
    When by geographic segments are not found, then clear all geographic data fields including city name, state/province code, postal code, and country code.
  • Context - a bn entity is being processed:
    For Clear Contact Information:
    When contact information processing is initiated, then clear all contact function code, name, communication number qualifier, and communication number fields.
  • Context - a bn entity has been processed with all required data extracted:
    For Insert BN Record into Database:
    When the system completes bn segment data processing, then validate the n1 segment data and insert the bn record into the customs database with sequence numbers between 0003 and 0025.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest is being processed and BN segment processing is initiated
GIVEN
A customs manifest is being processed and BN segment processing is initiated
Applied to: Search for BN Entity in Transportation Data
WHEN
The system searches for BN entity in transportation data segments with organization ID 'BN'
THEN
If BN entity is found, initialize BN segment record and proceed with BN processing, otherwise skip BN processing entirely
Context: A BN entity has been found in transportation data segments
GIVEN
A BN entity has been found in transportation data segments
Applied to: Extract Entity Name
WHEN
The system processes the BN entity data
THEN
Set entity ID code to 'BN', extract entity name from transportation data, extract consignee CHOP code, and clear identification code fields
Context: A BN entity is being processed and address information is being extracted
GIVEN
A BN entity is being processed and address information is being extracted
Applied to: Extract Business Address Line 1
WHEN
The system searches for BT address segments and finds address data
THEN
Extract address line 1 and address line 2 from BT segments, and if address line 1 is empty, set default value 'NA' for address line 1
Applied to: Set Default 'NA' Address
WHEN
BT address segments are not found or address line 1 is empty
THEN
Clear all address data fields and set address line 1 to default value 'NA'
Context: A BN entity is being processed and geographic information is being extracted
GIVEN
A BN entity is being processed and geographic information is being extracted
Applied to: Extract City Name
WHEN
The system searches for BY geographic segments and finds geographic data
THEN
Extract city name, state/province code, postal code, and country code from BY segments
Applied to: Clear Geographic Data
WHEN
BY geographic segments are not found
THEN
Clear all geographic data fields including city name, state/province code, postal code, and country code
Context: A BN entity is being processed
GIVEN
A BN entity is being processed
Applied to: Clear Contact Information
WHEN
Contact information processing is initiated
THEN
Clear all contact function code, name, communication number qualifier, and communication number fields
Context: A BN entity has been processed with all required data extracted
GIVEN
A BN entity has been processed with all required data extracted
Applied to: Insert BN Record into Database
WHEN
The system completes BN segment data processing
THEN
Validate the N1 segment data and insert the BN record into the customs database with sequence numbers between 0003 and 0025
R-GCCCCADD-cbl-00829 (+24) File: GCCCCADD.cbl MCOA Charge Processing Merged 25 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'MCOA Charge Processing':
  • Context - mcoa charge processing is initiated:
    For Initialize MCOA Sequence Counter:
    When the system begins processing miscellaneous charges or allowances, then the mcoa sequence counter is initialized to 1 to start processing from the first segment.
  • Context - an mcoa sequence number is available:
    For Get MCOA Segment by Sequence:
    When the system attempts to retrieve the mcoa segment, then the system calls the edi bol interface to get the mcoa segment data for the specified sequence number.
  • Context - an attempt to retrieve an mcoa segment has been made:
    For MCOA Segment Found?:
    When the system checks the retrieval result, then if no mcoa segment is found, processing moves to check for more segments, otherwise processing continues with the found segment.
  • Context - an mcoa segment has been found:
    For Entity Type is PF or SS?:
    When the system checks the entity type in the segment, then if the entity type is pf or ss, the segment is processed for customs data creation, otherwise the segment is skipped.
  • Context - an mcoa segment with entity type pf or ss is being processed:
    For Extract Entity Information:
    When the system extracts entity information, then the entity id code, entity name, id code qualifier, and id code are extracted from the mcoa segment.
  • Context - entity information has been extracted from an mcoa segment:
    For Set Entity ID Code & Set Entity Name & Set ID Code Qualifier & Set ID Code:
    When the system creates the customs record, then the entity id code from the mcoa segment is assigned to the n101 entity id code field in the customs record and the entity name from the mcoa segment is assigned to the n102 name field in the customs record and the id code qualifier from the mcoa segment is assigned to the n103 id code qualifier field in the customs record and the id code from the mcoa segment is assigned to the n104 id code field in the customs record.
  • Context - an mcoa entity segment is being processed:
    For Get MCOA Address Segment:
    When the system attempts to get address information, then the system calls the edi bol interface to retrieve the on type segment for the current mcoa sequence.
    For Get MCOA City/State Segment:
    When the system attempts to get city and state information, then the system calls the edi bol interface to retrieve the oc type segment for the current mcoa sequence.
  • Context - an attempt to retrieve mcoa address information has been made:
    For Address Segment Found?:
    When the system checks if address data was found, then if address data is found, extract address lines 1 and 2, otherwise set default address as 'na'.
  • Context - an mcoa address segment has been found:
    For Extract Address Line 1 & Extract Address Line 2:
    When the system processes the address information, then the first additional name/address field is extracted and assigned to the n301 address info field and the second additional name/address field is extracted and assigned to the n302 address info field.
  • Context - no mcoa address segment was found:
    For Set Default Address as 'NA':
    When the system needs to populate address fields, then the n301 address field is set to 'na' and the n302 address field is set to spaces.
  • Context - an attempt to retrieve mcoa city/state information has been made:
    For City/State Segment Found?:
    When the system checks if city/state data was found, then if city/state data is found, extract all location fields, otherwise clear all address fields.
  • Context - an mcoa city/state segment has been found:
    For Extract City Name & Extract State/Province Code & Extract Postal Code & Extract Country Code:
    When the system processes the location information, then the city name field is extracted and assigned to the n401 city name field and the state/province code field is extracted and assigned to the n402 state/province code field and the postal code field is extracted and assigned to the n403 postal code field and the country code field is extracted and assigned to the n404 country code field.
  • Context - no mcoa city/state segment was found:
    For Clear Address Fields:
    When the system needs to populate location fields, then all location fields (city name, state/province code, postal code, country code) are set to spaces.
  • Context - an n1 segment has been constructed from mcoa data:
    For Validate N1 Segment Data:
    When the system validates the segment data, then all required fields are checked for completeness and validity according to customs requirements.
  • Context - a validated n1 segment has been created from mcoa data:
    For Insert Record into Customs Database:
    When the system inserts the record, then the record is inserted into the customs database with the appropriate sequence number and record type 55.
  • Context - an mcoa segment has been processed:
    For Increment Sequence Counter:
    When the system completes processing the current segment, then the mcoa sequence counter is incremented by 1 to move to the next segment.
  • Context - an mcoa segment has been processed and the counter incremented:
    For More MCOA Segments?:
    When the system checks for more segments to process, then if more mcoa segments are found, processing continues with the next segment, otherwise mcoa processing ends.
👨‍💻 Technical ACs (Gherkin)
Context: MCOA charge processing is initiated
GIVEN
MCOA charge processing is initiated
Applied to: Initialize MCOA Sequence Counter
WHEN
the system begins processing miscellaneous charges or allowances
THEN
the MCOA sequence counter is initialized to 1 to start processing from the first segment
Context: an MCOA sequence number is available
GIVEN
an MCOA sequence number is available
Applied to: Get MCOA Segment by Sequence
WHEN
the system attempts to retrieve the MCOA segment
THEN
the system calls the EDI BOL interface to get the MCOA segment data for the specified sequence number
Context: an attempt to retrieve an MCOA segment has been made
GIVEN
an attempt to retrieve an MCOA segment has been made
Applied to: MCOA Segment Found?
WHEN
the system checks the retrieval result
THEN
if no MCOA segment is found, processing moves to check for more segments, otherwise processing continues with the found segment
Context: an MCOA segment has been found
GIVEN
an MCOA segment has been found
Applied to: Entity Type is PF or SS?
WHEN
the system checks the entity type in the segment
THEN
if the entity type is PF or SS, the segment is processed for customs data creation, otherwise the segment is skipped
Context: an MCOA segment with entity type PF or SS is being processed
GIVEN
an MCOA segment with entity type PF or SS is being processed
Applied to: Extract Entity Information
WHEN
the system extracts entity information
THEN
the entity ID code, entity name, ID code qualifier, and ID code are extracted from the MCOA segment
Context: entity information has been extracted from an MCOA segment
GIVEN
entity information has been extracted from an MCOA segment
Applied to: Set Entity ID Code & Set Entity Name & Set ID Code Qualifier & Set ID Code
WHEN
the system creates the customs record
THEN
the entity ID code from the MCOA segment is assigned to the N101 entity ID code field in the customs record AND the entity name from the MCOA segment is assigned to the N102 name field in the customs record AND the ID code qualifier from the MCOA segment is assigned to the N103 ID code qualifier field in the customs record AND the ID code from the MCOA segment is assigned to the N104 ID code field in the customs record
Context: an MCOA entity segment is being processed
GIVEN
an MCOA entity segment is being processed
Applied to: Get MCOA Address Segment
WHEN
the system attempts to get address information
THEN
the system calls the EDI BOL interface to retrieve the ON type segment for the current MCOA sequence
Applied to: Get MCOA City/State Segment
WHEN
the system attempts to get city and state information
THEN
the system calls the EDI BOL interface to retrieve the OC type segment for the current MCOA sequence
Context: an attempt to retrieve MCOA address information has been made
GIVEN
an attempt to retrieve MCOA address information has been made
Applied to: Address Segment Found?
WHEN
the system checks if address data was found
THEN
if address data is found, extract address lines 1 and 2, otherwise set default address as 'NA'
Context: an MCOA address segment has been found
GIVEN
an MCOA address segment has been found
Applied to: Extract Address Line 1 & Extract Address Line 2
WHEN
the system processes the address information
THEN
the first additional name/address field is extracted and assigned to the N301 address info field AND the second additional name/address field is extracted and assigned to the N302 address info field
Context: no MCOA address segment was found
GIVEN
no MCOA address segment was found
Applied to: Set Default Address as 'NA'
WHEN
the system needs to populate address fields
THEN
the N301 address field is set to 'NA' and the N302 address field is set to spaces
Context: an attempt to retrieve MCOA city/state information has been made
GIVEN
an attempt to retrieve MCOA city/state information has been made
Applied to: City/State Segment Found?
WHEN
the system checks if city/state data was found
THEN
if city/state data is found, extract all location fields, otherwise clear all address fields
Context: an MCOA city/state segment has been found
GIVEN
an MCOA city/state segment has been found
Applied to: Extract City Name & Extract State/Province Code & Extract Postal Code & Extract Country Code
WHEN
the system processes the location information
THEN
the city name field is extracted and assigned to the N401 city name field AND the state/province code field is extracted and assigned to the N402 state/province code field AND the postal code field is extracted and assigned to the N403 postal code field AND the country code field is extracted and assigned to the N404 country code field
Context: no MCOA city/state segment was found
GIVEN
no MCOA city/state segment was found
Applied to: Clear Address Fields
WHEN
the system needs to populate location fields
THEN
all location fields (city name, state/province code, postal code, country code) are set to spaces
Context: an N1 segment has been constructed from MCOA data
GIVEN
an N1 segment has been constructed from MCOA data
Applied to: Validate N1 Segment Data
WHEN
the system validates the segment data
THEN
all required fields are checked for completeness and validity according to customs requirements
Context: a validated N1 segment has been created from MCOA data
GIVEN
a validated N1 segment has been created from MCOA data
Applied to: Insert Record into Customs Database
WHEN
the system inserts the record
THEN
the record is inserted into the customs database with the appropriate sequence number and record type 55
Context: an MCOA segment has been processed
GIVEN
an MCOA segment has been processed
Applied to: Increment Sequence Counter
WHEN
the system completes processing the current segment
THEN
the MCOA sequence counter is incremented by 1 to move to the next segment
Context: an MCOA segment has been processed and the counter incremented
GIVEN
an MCOA segment has been processed and the counter incremented
Applied to: More MCOA Segments?
WHEN
the system checks for more segments to process
THEN
if more MCOA segments are found, processing continues with the next segment, otherwise MCOA processing ends
R-GCCCCADD-cbl-00854 (+5) File: GCCCCADD.cbl Geographic Segment Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Geographic Segment Processing':
  • Context - an edi bol key exists and entity processing is in progress:
    For Get EBSNRSA Geographic Code Segment - GC:
    When the system attempts to retrieve the ebsnrsa geographic code segment with type 'gc', then the geographic code segment data is retrieved if found, otherwise processing continues without gc data.
  • Context - a geographic code segment (gc) has been successfully retrieved from edi data:
    For Extract Address Information from GC Segment:
    When the system processes the address information from the gc segment, then address line 1 is moved to n301 field and address line 2 is moved to n302 field.
  • Context - address information is being processed for an entity record:
    For Set Default 'NA' for Address Line 1:
    When the address line 1 field (n301) is empty or contains only spaces, then the system sets the address line 1 to 'na' as the default value.
  • Context - an edi bol key exists and geographic processing is in progress:
    For Get EBSNRSA Geographic Address Segment - GA:
    When the system attempts to retrieve the ebsnrsa geographic address segment with type 'ga', then the geographic address segment data is retrieved if found, otherwise geographic data fields are set to spaces.
  • Context - a geographic address segment (ga) has been successfully retrieved from edi data:
    For Extract Geographic Address Data:
    When the system processes the geographic address information from the ga segment, then city name is moved to n401, state/province code to n402, postal code to n403, and country code to n404.
  • Context - geographic address segment processing is attempted:
    For Set Geographic Data to Spaces:
    When the geographic address segment (ga) is not found in the edi data, then all geographic data fields (n401, n402, n403, n404) are set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists and entity processing is in progress
GIVEN
An EDI BOL key exists and entity processing is in progress
Applied to: Get EBSNRSA Geographic Code Segment - GC
WHEN
The system attempts to retrieve the EBSNRSA geographic code segment with type 'GC'
THEN
The geographic code segment data is retrieved if found, otherwise processing continues without GC data
Context: A geographic code segment (GC) has been successfully retrieved from EDI data
GIVEN
A geographic code segment (GC) has been successfully retrieved from EDI data
Applied to: Extract Address Information from GC Segment
WHEN
The system processes the address information from the GC segment
THEN
Address line 1 is moved to N301 field and address line 2 is moved to N302 field
Context: Address information is being processed for an entity record
GIVEN
Address information is being processed for an entity record
Applied to: Set Default 'NA' for Address Line 1
WHEN
The address line 1 field (N301) is empty or contains only spaces
THEN
The system sets the address line 1 to 'NA' as the default value
Context: An EDI BOL key exists and geographic processing is in progress
GIVEN
An EDI BOL key exists and geographic processing is in progress
Applied to: Get EBSNRSA Geographic Address Segment - GA
WHEN
The system attempts to retrieve the EBSNRSA geographic address segment with type 'GA'
THEN
The geographic address segment data is retrieved if found, otherwise geographic data fields are set to spaces
Context: A geographic address segment (GA) has been successfully retrieved from EDI data
GIVEN
A geographic address segment (GA) has been successfully retrieved from EDI data
Applied to: Extract Geographic Address Data
WHEN
The system processes the geographic address information from the GA segment
THEN
City name is moved to N401, state/province code to N402, postal code to N403, and country code to N404
Context: Geographic address segment processing is attempted
GIVEN
Geographic address segment processing is attempted
Applied to: Set Geographic Data to Spaces
WHEN
The geographic address segment (GA) is not found in the EDI data
THEN
All geographic data fields (N401, N402, N403, N404) are set to spaces
R-GCCCCADD-cbl-00860 (+22) File: GCCCCADD.cbl Customs Record 55 Insertion Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customs Record 55 Insertion':
  • Context - the customs record 55 processing is starting:
    For Initialize Record 55 Variables:
    When the system initializes record 55 variables, then the sequence index is set to 3 and the record 55 array is cleared to spaces.
  • Context - a shipment requires shipper information for customs record 55:
    For Build Shipper Record - Sequence 0001:
    When the system builds the shipper record and edi bol shipper data (ebsnrsc-hn) is found, then the system creates entity id 'sh', extracts shipper name and chop code from edi data, gets address from ebsnrsa-ha segment, gets city/state/postal/country from ebsnrsa-hc segment, and gets contact information from ebsnrsa-gp segment.
    For Build Shipper Record - Sequence 0001:
    When the system builds the shipper record and edi bol shipper data is not found, then the system creates entity id 'sh', uses shipper name and chop from shiproot, uses shipper address from shiproot, and derives city/state/postal/country from shiproot address data.
  • Context - a shipment requires consignee information for customs record 55:
    For Build Consignee Record - Sequence 0002:
    When the system builds the consignee record and edi bol consignee data (ebsnrsc-cn) is found, then the system creates entity id 'cn', extracts consignee name and chop code from edi data, gets address from ebsnrsa-ca segment, gets city/state/postal/country from ebsnrsa-cc segment, and gets contact information from ebsnrsa-gp segment.
    For Build Consignee Record - Sequence 0002:
    When the system builds the consignee record and edi bol consignee data is not found, then the system creates entity id 'cn', uses consignee name and chop from shiproot, uses consignee address from shiproot, and derives city/state/postal/country from shiproot address data.
  • Context - a shipment may have stuffer information:
    For Build Stuffer Entity SF:
    When the system finds edi bol stuffer data (ebsnrsc-pn), then the system creates entity id 'sf', extracts stuffer name from edi data, gets address from ebsnrsa-pa segment, gets city/state/postal/country from ebsnrsa-pc segment, gets contact information from ebsnrsa-gp segment, and inserts the record into customs database.
  • Context - a shipment may have ultimate consignee information:
    For Build Ultimate Consignee Entity UC:
    When the system finds edi bol ultimate consignee data (ebsnrsc-un), then the system creates entity id 'uc', extracts ultimate consignee name from edi data, gets address from ebsnrsa-ua segment or sets default 'na', gets city/state/postal/country from ebsnrsa-uc segment or sets to spaces, gets contact information from ebsnrsa-gp segment, and inserts the record into customs database.
  • Context - a shipment may have beneficial owner information:
    For Build Beneficial Owner Entity BN:
    When the system finds edi bol beneficial owner data (ebsnrsc-bn) and organization id is 'bn', then the system creates entity id 'bn', extracts beneficial owner name and chop from edi data, gets address from ebsnrsa-bt segment or sets default 'na', gets city/state/postal/country from ebsnrsa-by segment or sets to spaces, and inserts the record into customs database.
  • Context - a shipment may have carrier information:
    For Build Carrier Entity C1:
    When the system finds edi bol carrier data with organization id 'c1' or fastway consignee data code 'c', then the system creates entity id 'c1', extracts carrier name from edi or fastway data, gets address information from appropriate segments, gets city/state/postal/country information, gets contact information, and inserts the record into customs database.
  • Context - a shipment may have notify party information:
    For Build Notify Party Entity N1:
    When the system finds edi bol data with organization id 'n1', then the system creates entity id 'n1', extracts notify party name from edi data, gets address information from t2 segment, gets city/state/postal/country from ta segment, gets contact information from t3 segment, and inserts the record into customs database.
  • Context - a shipment may have payment or service entity information:
    For Build Payment/Service Entity PF/SS:
    When the system finds edi bol mcoa data with organization id 'pf' or 'ss', then the system creates entity id matching the organization id, extracts entity name and id codes from mcoa data, gets address from on segment or sets default 'na', gets city/state/postal/country from oc segment or sets to spaces, and inserts the record into customs database.
  • Context - a shipment may have various other entity types:
    For Build Other Entity Types 11/NN/MC/OO/FW:
    When the system finds edi bol data with organization ids '11', 'nn', 'mc', 'oo', or 'fw', then the system creates entity records with matching entity ids, extracts entity names and details from appropriate edi segments, gets address and contact information from corresponding segments, validates entity id values for sequences greater than 2, and inserts valid records into customs database.
  • Context - a shipment requires importer information for customs record 55:
    For Build Importer Entity IM:
    When the system finds edi bol importer data with entity id 'im' and existing importer data is available from initialization, then the system retains the existing importer data including chop code, name, business number qualifier, business number, csa indicator, address, city, state, postal code, country, and contact information, and inserts the record into customs database.
    For Build Importer Entity IM:
    When the system finds edi bol importer data with entity id 'im' and no existing importer data is available, then the system creates entity id 'im', extracts importer name and business information from edi data, gets address from n3 segment or sets default 'na', gets city/state/postal/country from n4 segment, sets contact information to spaces, and inserts the record into customs database.
  • Context - a shipment requires importer information and au table importer data was found during initialization:
    For Finalize Importer Processing:
    When the system finalizes importer processing and no importer record was created from edi data and sequence index is within maximum limit, then the system creates entity id 'im', uses importer name and business number from au table, sets business number qualifier to 'm5', sets address to 'na', clears city/state/postal/country and contact information, sets csa indicator on, and either replaces existing record or inserts new record based on availability.
  • Context - an entity record is being validated for customs record 55:
    For Validate N1 Segment Data:
    When the entity has address, city/state, or contact information but missing entity id or name, or entity id is invalid for sequences greater than 2, then the system generates appropriate error messages for missing entity id, missing name when entity id exists, or invalid entity id values for non-shipper/consignee/broker entities.
  • Context - an entity record has entity id and name populated:
    For Validate N1 Segment Data:
    When the address information is missing, then the system generates an error message indicating address information is required.
  • Context - an entity record has city/state information:
    For Validate N1 Segment Data:
    When the city name is provided but has less than 2 characters, then the system generates an error message indicating minimum 2 character length requirement.
    For Validate N1 Segment Data:
    When the country code is missing after state/province validation, then the system generates an error message indicating country code is required.
  • Context - an entity record has postal code information:
    For Validate N1 Segment Data:
    When the postal code is provided but has less than 3 characters, then the system generates an error message indicating minimum 3 character length requirement.
  • Context - an entity record has city/state information for canada, usa, or mexico:
    For Validate N1 Segment Data:
    When the state/province code is missing or the state/province and country combination is invalid, then the system generates error messages for missing state/province or invalid state/province combinations, and derives country code from state/province when country is missing.
  • Context - an entity record has contact information:
    For Validate N1 Segment Data:
    When communication number qualifier is missing but contact name or communication number is provided, or communication number qualifier is invalid, or communication number is missing when qualifier or contact name is provided, then the system generates appropriate error messages for missing communication number qualifier, invalid qualifier values (must be spaces, 'fx', or 'te'), or missing communication number.
  • Context - an entity record is being built with missing address information:
    For Build Shipper Record - Sequence 0001:
    When the address line 1 is spaces or address line 2 is effectively empty, then the system sets address line 1 to 'na' when missing and sets default country codes ('us' for shipper, 'ca' for consignee) when address line 2 is incomplete.
👨‍💻 Technical ACs (Gherkin)
Context: The customs record 55 processing is starting
GIVEN
The customs record 55 processing is starting
Applied to: Initialize Record 55 Variables
WHEN
The system initializes record 55 variables
THEN
The sequence index is set to 3 and the record 55 array is cleared to spaces
Context: A shipment requires shipper information for customs record 55
GIVEN
A shipment requires shipper information for customs record 55
Applied to: Build Shipper Record - Sequence 0001
WHEN
The system builds the shipper record and EDI BOL shipper data (EBSNRSC-HN) is found
THEN
The system creates entity ID 'SH', extracts shipper name and CHOP code from EDI data, gets address from EBSNRSA-HA segment, gets city/state/postal/country from EBSNRSA-HC segment, and gets contact information from EBSNRSA-GP segment
Applied to: Build Shipper Record - Sequence 0001
WHEN
The system builds the shipper record and EDI BOL shipper data is not found
THEN
The system creates entity ID 'SH', uses shipper name and CHOP from SHIPROOT, uses shipper address from SHIPROOT, and derives city/state/postal/country from SHIPROOT address data
Context: A shipment requires consignee information for customs record 55
GIVEN
A shipment requires consignee information for customs record 55
Applied to: Build Consignee Record - Sequence 0002
WHEN
The system builds the consignee record and EDI BOL consignee data (EBSNRSC-CN) is found
THEN
The system creates entity ID 'CN', extracts consignee name and CHOP code from EDI data, gets address from EBSNRSA-CA segment, gets city/state/postal/country from EBSNRSA-CC segment, and gets contact information from EBSNRSA-GP segment
Applied to: Build Consignee Record - Sequence 0002
WHEN
The system builds the consignee record and EDI BOL consignee data is not found
THEN
The system creates entity ID 'CN', uses consignee name and CHOP from SHIPROOT, uses consignee address from SHIPROOT, and derives city/state/postal/country from SHIPROOT address data
Context: A shipment may have stuffer information
GIVEN
A shipment may have stuffer information
Applied to: Build Stuffer Entity SF
WHEN
The system finds EDI BOL stuffer data (EBSNRSC-PN)
THEN
The system creates entity ID 'SF', extracts stuffer name from EDI data, gets address from EBSNRSA-PA segment, gets city/state/postal/country from EBSNRSA-PC segment, gets contact information from EBSNRSA-GP segment, and inserts the record into customs database
Context: A shipment may have ultimate consignee information
GIVEN
A shipment may have ultimate consignee information
Applied to: Build Ultimate Consignee Entity UC
WHEN
The system finds EDI BOL ultimate consignee data (EBSNRSC-UN)
THEN
The system creates entity ID 'UC', extracts ultimate consignee name from EDI data, gets address from EBSNRSA-UA segment or sets default 'NA', gets city/state/postal/country from EBSNRSA-UC segment or sets to spaces, gets contact information from EBSNRSA-GP segment, and inserts the record into customs database
Context: A shipment may have beneficial owner information
GIVEN
A shipment may have beneficial owner information
Applied to: Build Beneficial Owner Entity BN
WHEN
The system finds EDI BOL beneficial owner data (EBSNRSC-BN) and organization ID is 'BN'
THEN
The system creates entity ID 'BN', extracts beneficial owner name and CHOP from EDI data, gets address from EBSNRSA-BT segment or sets default 'NA', gets city/state/postal/country from EBSNRSA-BY segment or sets to spaces, and inserts the record into customs database
Context: A shipment may have carrier information
GIVEN
A shipment may have carrier information
Applied to: Build Carrier Entity C1
WHEN
The system finds EDI BOL carrier data with organization ID 'C1' or Fastway consignee data code 'C'
THEN
The system creates entity ID 'C1', extracts carrier name from EDI or Fastway data, gets address information from appropriate segments, gets city/state/postal/country information, gets contact information, and inserts the record into customs database
Context: A shipment may have notify party information
GIVEN
A shipment may have notify party information
Applied to: Build Notify Party Entity N1
WHEN
The system finds EDI BOL data with organization ID 'N1'
THEN
The system creates entity ID 'N1', extracts notify party name from EDI data, gets address information from T2 segment, gets city/state/postal/country from TA segment, gets contact information from T3 segment, and inserts the record into customs database
Context: A shipment may have payment or service entity information
GIVEN
A shipment may have payment or service entity information
Applied to: Build Payment/Service Entity PF/SS
WHEN
The system finds EDI BOL MCOA data with organization ID 'PF' or 'SS'
THEN
The system creates entity ID matching the organization ID, extracts entity name and ID codes from MCOA data, gets address from ON segment or sets default 'NA', gets city/state/postal/country from OC segment or sets to spaces, and inserts the record into customs database
Context: A shipment may have various other entity types
GIVEN
A shipment may have various other entity types
Applied to: Build Other Entity Types 11/NN/MC/OO/FW
WHEN
The system finds EDI BOL data with organization IDs '11', 'NN', 'MC', 'OO', or 'FW'
THEN
The system creates entity records with matching entity IDs, extracts entity names and details from appropriate EDI segments, gets address and contact information from corresponding segments, validates entity ID values for sequences greater than 2, and inserts valid records into customs database
Context: A shipment requires importer information for customs record 55
GIVEN
A shipment requires importer information for customs record 55
Applied to: Build Importer Entity IM
WHEN
The system finds EDI BOL importer data with entity ID 'IM' and existing importer data is available from initialization
THEN
The system retains the existing importer data including CHOP code, name, business number qualifier, business number, CSA indicator, address, city, state, postal code, country, and contact information, and inserts the record into customs database
Applied to: Build Importer Entity IM
WHEN
The system finds EDI BOL importer data with entity ID 'IM' and no existing importer data is available
THEN
The system creates entity ID 'IM', extracts importer name and business information from EDI data, gets address from N3 segment or sets default 'NA', gets city/state/postal/country from N4 segment, sets contact information to spaces, and inserts the record into customs database
Context: A shipment requires importer information and AU table importer data was found during initialization
GIVEN
A shipment requires importer information and AU table importer data was found during initialization
Applied to: Finalize Importer Processing
WHEN
The system finalizes importer processing and no importer record was created from EDI data and sequence index is within maximum limit
THEN
The system creates entity ID 'IM', uses importer name and business number from AU table, sets business number qualifier to 'M5', sets address to 'NA', clears city/state/postal/country and contact information, sets CSA indicator on, and either replaces existing record or inserts new record based on availability
Context: An entity record is being validated for customs record 55
GIVEN
An entity record is being validated for customs record 55
Applied to: Validate N1 Segment Data
WHEN
The entity has address, city/state, or contact information but missing entity ID or name, or entity ID is invalid for sequences greater than 2
THEN
The system generates appropriate error messages for missing entity ID, missing name when entity ID exists, or invalid entity ID values for non-shipper/consignee/broker entities
Context: An entity record has entity ID and name populated
GIVEN
An entity record has entity ID and name populated
Applied to: Validate N1 Segment Data
WHEN
The address information is missing
THEN
The system generates an error message indicating address information is required
Context: An entity record has city/state information
GIVEN
An entity record has city/state information
Applied to: Validate N1 Segment Data
WHEN
The city name is provided but has less than 2 characters
THEN
The system generates an error message indicating minimum 2 character length requirement
Applied to: Validate N1 Segment Data
WHEN
The country code is missing after state/province validation
THEN
The system generates an error message indicating country code is required
Context: An entity record has postal code information
GIVEN
An entity record has postal code information
Applied to: Validate N1 Segment Data
WHEN
The postal code is provided but has less than 3 characters
THEN
The system generates an error message indicating minimum 3 character length requirement
Context: An entity record has city/state information for Canada, USA, or Mexico
GIVEN
An entity record has city/state information for Canada, USA, or Mexico
Applied to: Validate N1 Segment Data
WHEN
The state/province code is missing or the state/province and country combination is invalid
THEN
The system generates error messages for missing state/province or invalid state/province combinations, and derives country code from state/province when country is missing
Context: An entity record has contact information
GIVEN
An entity record has contact information
Applied to: Validate N1 Segment Data
WHEN
Communication number qualifier is missing but contact name or communication number is provided, or communication number qualifier is invalid, or communication number is missing when qualifier or contact name is provided
THEN
The system generates appropriate error messages for missing communication number qualifier, invalid qualifier values (must be spaces, 'FX', or 'TE'), or missing communication number
Context: An entity record is being built with missing address information
GIVEN
An entity record is being built with missing address information
Applied to: Build Shipper Record - Sequence 0001
WHEN
The address line 1 is spaces or address line 2 is effectively empty
THEN
The system sets address line 1 to 'NA' when missing and sets default country codes ('US' for shipper, 'CA' for consignee) when address line 2 is incomplete
R-GCCCCADD-cbl-00883 (+12) File: GCCCCADD.cbl Importer Segment Building Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Segment Building':
  • Context - a customs manifest processing request is initiated:
    For Check for Existing Importer Data from Corrector EDI:
    When the system checks for existing importer data from corrector edi transactions, then the system identifies whether backup importer data exists and sets the appropriate processing flag.
  • Context - existing importer data is found from corrector edi and importer name exists in temporary storage:
    For Backup Original Importer Data:
    When the system processes importer segment building, then the system backs up all importer details including name, business number qualifier, business number, csa indicator, address, city, province, postal code, country, and contact information.
  • Context - an edi bol key exists for the shipment:
    For Retrieve Importer N1 Segment from EDI BOL:
    When the system retrieves importer n1 segment data using entity type 'im', then the system obtains importer entity information from the edi bol database or returns empty if not found.
  • Context - importer n1 segment is found in edi bol and no corrector edi backup data exists:
    For Process New Importer N1 Segment:
    When the system processes the importer n1 segment with entity id code equal to 'im', then the system extracts importer name to customs importer field, moves id code qualifier to business number qualifier, moves id code to business number, and sets importer found flag to true.
  • Context - importer data is found from au table and importer segment is found and business number qualifier is 'bn' or spaces:
    For Set CSA Indicator Management:
    When the system processes csa indicator management, then the system turns off the csa indicator.
  • Context - importer n3 segment data is available from edi bol:
    For Process Address Information:
    When the system processes address information and address line 1 is spaces or low-values, then the system sets address line 1 to 'na' and copies address line 2, otherwise copies both address lines as provided.
  • Context - importer n3 segment is not found in edi bol:
    For Set Default 'NA' if Address Missing:
    When the system processes address information, then the system clears n3 data fields and sets address line 1 to 'na'.
  • Context - importer n4 segment data is available from edi bol:
    For Process City, State, Postal, Country:
    When the system processes city and state information, then the system copies city name, state/province code, postal code, and country code from the n4 segment.
  • Context - importer n4 segment is not found in edi bol:
    For Process City, State, Postal, Country:
    When the system processes city and state information, then the system clears all n4 data fields including city, state, postal code, and country.
  • Context - importer segment processing is in progress:
    For Clear Contact Information:
    When the system processes contact information, then the system clears all contact data fields including contact function code, name, communication number qualifier, and communication number.
  • Context - corrector edi backup data exists and importer segment is found:
    For Restore Backed Up Importer Data:
    When the system processes importer data restoration, then the system restores all backed up importer details including consignee chop code, entity id code, importer name, business number qualifier, business number, csa indicator, address lines, city, province, postal code, country, and contact information, and sets importer found flag to true.
  • Context - importer n1 segment is not found in edi bol and backup importer name exists and importer segment is not found:
    For Handle Importer Data Deletion:
    When the system handles importer data deletion, then the system restores backed up importer data and manages csa indicator, otherwise clears importer name if no importer segment found.
  • Context - no valid importer data is found and importer segment is not found:
    For Clear Importer Fields:
    When the system processes importer field clearing, then the system clears the importer name field and entity id code.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest processing request is initiated
GIVEN
A customs manifest processing request is initiated
Applied to: Check for Existing Importer Data from Corrector EDI
WHEN
The system checks for existing importer data from corrector EDI transactions
THEN
The system identifies whether backup importer data exists and sets the appropriate processing flag
Context: Existing importer data is found from corrector EDI and importer name exists in temporary storage
GIVEN
Existing importer data is found from corrector EDI and importer name exists in temporary storage
Applied to: Backup Original Importer Data
WHEN
The system processes importer segment building
THEN
The system backs up all importer details including name, business number qualifier, business number, CSA indicator, address, city, province, postal code, country, and contact information
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Retrieve Importer N1 Segment from EDI BOL
WHEN
The system retrieves importer N1 segment data using entity type 'IM'
THEN
The system obtains importer entity information from the EDI BOL database or returns empty if not found
Context: Importer N1 segment is found in EDI BOL and no corrector EDI backup data exists
GIVEN
Importer N1 segment is found in EDI BOL and no corrector EDI backup data exists
Applied to: Process New Importer N1 Segment
WHEN
The system processes the importer N1 segment with entity ID code equal to 'IM'
THEN
The system extracts importer name to customs importer field, moves ID code qualifier to business number qualifier, moves ID code to business number, and sets importer found flag to true
Context: Importer data is found from AU table and importer segment is found and business number qualifier is 'BN' or spaces
GIVEN
Importer data is found from AU table and importer segment is found and business number qualifier is 'BN' or spaces
Applied to: Set CSA Indicator Management
WHEN
The system processes CSA indicator management
THEN
The system turns off the CSA indicator
Context: Importer N3 segment data is available from EDI BOL
GIVEN
Importer N3 segment data is available from EDI BOL
Applied to: Process Address Information
WHEN
The system processes address information and address line 1 is spaces or low-values
THEN
The system sets address line 1 to 'NA' and copies address line 2, otherwise copies both address lines as provided
Context: Importer N3 segment is not found in EDI BOL
GIVEN
Importer N3 segment is not found in EDI BOL
Applied to: Set Default 'NA' if Address Missing
WHEN
The system processes address information
THEN
The system clears N3 data fields and sets address line 1 to 'NA'
Context: Importer N4 segment data is available from EDI BOL
GIVEN
Importer N4 segment data is available from EDI BOL
Applied to: Process City, State, Postal, Country
WHEN
The system processes city and state information
THEN
The system copies city name, state/province code, postal code, and country code from the N4 segment
Context: Importer N4 segment is not found in EDI BOL
GIVEN
Importer N4 segment is not found in EDI BOL
Applied to: Process City, State, Postal, Country
WHEN
The system processes city and state information
THEN
The system clears all N4 data fields including city, state, postal code, and country
Context: Importer segment processing is in progress
GIVEN
Importer segment processing is in progress
Applied to: Clear Contact Information
WHEN
The system processes contact information
THEN
The system clears all contact data fields including contact function code, name, communication number qualifier, and communication number
Context: Corrector EDI backup data exists and importer segment is found
GIVEN
Corrector EDI backup data exists and importer segment is found
Applied to: Restore Backed Up Importer Data
WHEN
The system processes importer data restoration
THEN
The system restores all backed up importer details including consignee chop code, entity ID code, importer name, business number qualifier, business number, CSA indicator, address lines, city, province, postal code, country, and contact information, and sets importer found flag to true
Context: Importer N1 segment is not found in EDI BOL and backup importer name exists and importer segment is not found
GIVEN
Importer N1 segment is not found in EDI BOL and backup importer name exists and importer segment is not found
Applied to: Handle Importer Data Deletion
WHEN
The system handles importer data deletion
THEN
The system restores backed up importer data and manages CSA indicator, otherwise clears importer name if no importer segment found
Context: No valid importer data is found and importer segment is not found
GIVEN
No valid importer data is found and importer segment is not found
Applied to: Clear Importer Fields
WHEN
The system processes importer field clearing
THEN
The system clears the importer name field and entity ID code
R-GCCCCADD-cbl-00896 (+13) File: GCCCCADD.cbl Corrector EDI Importer Processing Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Corrector EDI Importer Processing':
  • Context - a corrector edi transaction is being processed:
    For Check if Corrector EDI has Importer Data:
    When the system checks for importer entity data in the edi bol segments, then the system determines if importer data exists and proceeds with appropriate processing path.
  • Context - corrector edi contains importer data and existing importer data is found in temporary variables:
    For Backup Original Importer Data to Temporary Variables:
    When the system processes the corrector edi importer information, then the system retains the original importer data from backup variables including name, business number, qualifier, csa indicator, address, city, province, postal code, country, and contact information.
  • Context - corrector edi processing is initiated:
    For Search Existing Records for Importer Entity 'IM':
    When the system searches for existing importer records with entity id 'im' in sequences 3 through 24, then the system identifies if an existing importer record is found and sets the appropriate processing flag.
  • Context - corrector edi contains importer n1 segment data and no existing importer record is found:
    For Process New Importer Data from EDI BOL N1 Segment:
    When the system processes the edi bol n1 segment for importer entity, then the system extracts importer name, business number qualifier, business number, and sets the importer found flag.
  • Context - importer data is available from corrector edi n1 segment:
    For Set Importer Information in Customs Record:
    When the system processes the importer information, then the system updates the customs record with importer name in both gccc-importer and gccs-n102-name fields, and sets the importer found flag.
  • Context - importer n1 segment contains business number qualifier and business number:
    For Update Business Number and Qualifier:
    When the system processes the importer business identification, then the system updates both customs record fields (gccc-business-nbr-qual, gccc-business-nbr) and n1 segment fields (gccs-n103-id-cde-qual, gccs-n104-id-cde) with the business number qualifier and business number.
  • Context - corrector edi contains importer n3 address segment data:
    For Process Importer Address from N3 Segment:
    When the system processes the n3 segment for importer address, then the system sets address line 1 to 'na' if the address is blank or low-values, otherwise uses the provided address, and sets address line 2 from the segment data.
  • Context - corrector edi contains importer n4 city/state segment data:
    For Process Importer City/State from N4 Segment:
    When the system processes the n4 segment for importer location, then the system updates the customs record with city name, state/province code, postal code, and country code from the n4 segment.
  • Context - importer record is being processed from corrector edi:
    For Clear Contact Information PER Segment Data:
    When the system handles contact information for the importer, then the system clears all per segment contact fields (contact function code, name, communication number qualifier, and communication number).
  • Context - corrector edi processing is in progress:
    For Is this Corrector EDI Deletion Request?:
    When the system evaluates if this is a deletion request based on the absence of importer data in edi segments, then the system determines the appropriate action path for either deletion or update processing.
  • Context - corrector edi deletion request is identified and original importer data exists in backup variables and no importer record found in sequence 55:
    For Restore Original Importer Data from Backup if Available:
    When the system processes the deletion request, then the system restores the original importer data from backup variables if available, otherwise clears the importer fields.
  • Context - importer data is found in au table and importer data is found in sequence 55 and business number qualifier is 'bn' or blank:
    For Reset CSA Indicator if Conditions Met:
    When the system evaluates csa indicator conditions, then the system turns off the csa indicator.
  • Context - importer n1 segment data has been processed:
    For Validate N1 Segment Data:
    When the system validates the n1 segment information, then the system performs comprehensive validation including entity id, name, address, city/state, and contact information requirements.
  • Context - importer record has been validated and processed and sequence index is within maximum allowed range:
    For Insert Updated Record into Customs Database:
    When the system saves the importer record, then the system inserts the customs record with ccn key, record type '55', sequence number, and all importer data into the customs database array.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Check if Corrector EDI has Importer Data
WHEN
The system checks for importer entity data in the EDI BOL segments
THEN
The system determines if importer data exists and proceeds with appropriate processing path
Context: Corrector EDI contains importer data AND existing importer data is found in temporary variables
GIVEN
Corrector EDI contains importer data AND existing importer data is found in temporary variables
Applied to: Backup Original Importer Data to Temporary Variables
WHEN
The system processes the corrector EDI importer information
THEN
The system retains the original importer data from backup variables including name, business number, qualifier, CSA indicator, address, city, province, postal code, country, and contact information
Context: Corrector EDI processing is initiated
GIVEN
Corrector EDI processing is initiated
Applied to: Search Existing Records for Importer Entity 'IM'
WHEN
The system searches for existing importer records with entity ID 'IM' in sequences 3 through 24
THEN
The system identifies if an existing importer record is found and sets the appropriate processing flag
Context: Corrector EDI contains importer N1 segment data AND no existing importer record is found
GIVEN
Corrector EDI contains importer N1 segment data AND no existing importer record is found
Applied to: Process New Importer Data from EDI BOL N1 Segment
WHEN
The system processes the EDI BOL N1 segment for importer entity
THEN
The system extracts importer name, business number qualifier, business number, and sets the importer found flag
Context: Importer data is available from corrector EDI N1 segment
GIVEN
Importer data is available from corrector EDI N1 segment
Applied to: Set Importer Information in Customs Record
WHEN
The system processes the importer information
THEN
The system updates the customs record with importer name in both GCCC-IMPORTER and GCCS-N102-NAME fields, and sets the importer found flag
Context: Importer N1 segment contains business number qualifier and business number
GIVEN
Importer N1 segment contains business number qualifier and business number
Applied to: Update Business Number and Qualifier
WHEN
The system processes the importer business identification
THEN
The system updates both customs record fields (GCCC-BUSINESS-NBR-QUAL, GCCC-BUSINESS-NBR) and N1 segment fields (GCCS-N103-ID-CDE-QUAL, GCCS-N104-ID-CDE) with the business number qualifier and business number
Context: Corrector EDI contains importer N3 address segment data
GIVEN
Corrector EDI contains importer N3 address segment data
Applied to: Process Importer Address from N3 Segment
WHEN
The system processes the N3 segment for importer address
THEN
The system sets address line 1 to 'NA' if the address is blank or low-values, otherwise uses the provided address, and sets address line 2 from the segment data
Context: Corrector EDI contains importer N4 city/state segment data
GIVEN
Corrector EDI contains importer N4 city/state segment data
Applied to: Process Importer City/State from N4 Segment
WHEN
The system processes the N4 segment for importer location
THEN
The system updates the customs record with city name, state/province code, postal code, and country code from the N4 segment
Context: Importer record is being processed from corrector EDI
GIVEN
Importer record is being processed from corrector EDI
Applied to: Clear Contact Information PER Segment Data
WHEN
The system handles contact information for the importer
THEN
The system clears all PER segment contact fields (contact function code, name, communication number qualifier, and communication number)
Context: Corrector EDI processing is in progress
GIVEN
Corrector EDI processing is in progress
Applied to: Is this Corrector EDI Deletion Request?
WHEN
The system evaluates if this is a deletion request based on the absence of importer data in EDI segments
THEN
The system determines the appropriate action path for either deletion or update processing
Context: Corrector EDI deletion request is identified AND original importer data exists in backup variables AND no importer record found in sequence 55
GIVEN
Corrector EDI deletion request is identified AND original importer data exists in backup variables AND no importer record found in sequence 55
Applied to: Restore Original Importer Data from Backup if Available
WHEN
The system processes the deletion request
THEN
The system restores the original importer data from backup variables if available, otherwise clears the importer fields
Context: Importer data is found in AU table AND importer data is found in sequence 55 AND business number qualifier is 'BN' or blank
GIVEN
Importer data is found in AU table AND importer data is found in sequence 55 AND business number qualifier is 'BN' or blank
Applied to: Reset CSA Indicator if Conditions Met
WHEN
The system evaluates CSA indicator conditions
THEN
The system turns off the CSA indicator
Context: Importer N1 segment data has been processed
GIVEN
Importer N1 segment data has been processed
Applied to: Validate N1 Segment Data
WHEN
The system validates the N1 segment information
THEN
The system performs comprehensive validation including entity ID, name, address, city/state, and contact information requirements
Context: Importer record has been validated and processed AND sequence index is within maximum allowed range
GIVEN
Importer record has been validated and processed AND sequence index is within maximum allowed range
Applied to: Insert Updated Record into Customs Database
WHEN
The system saves the importer record
THEN
The system inserts the customs record with CCN key, record type '55', sequence number, and all importer data into the customs database array
R-GCCCCADD-cbl-00910 (+10) File: GCCCCADD.cbl Importer Address Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Address Processing':
  • Context - the system is processing importer address information:
    For EDI BOL Available?:
    When the system checks for edi bol data availability, then the system should proceed with edi bol processing if available, otherwise use default address processing.
  • Context - edi bol data is available for processing:
    For Retrieve Importer N3 Segment from EDI BOL:
    When the system retrieves the importer n3 address segment, then the system should extract the address segment from the edi bol data source.
  • Context - the system has attempted to retrieve the n3 address segment from edi bol:
    For N3 Segment Found?:
    When the system checks if the n3 segment was found, then the system should proceed with address extraction if found, otherwise use default address processing.
  • Context - the n3 address segment has been successfully retrieved from edi bol:
    For Extract Address Line 1 from N3 Segment:
    When the system extracts address line 1 from the n3 segment, then the system should capture the first address line data for further processing.
  • Context - the n3 address segment has been successfully retrieved and address line 1 has been extracted:
    For Extract Address Line 2 from N3 Segment:
    When the system extracts address line 2 from the n3 segment, then the system should capture the second address line data for storage.
  • Context - address line 1 has been extracted from the n3 segment:
    For Address Line 1 Empty?:
    When the system checks if address line 1 is empty or contains only spaces or low-values, then the system should set a default value if empty, otherwise keep the original value.
  • Context - address line 1 from the n3 segment is empty, spaces, or low-values:
    For Set Address Line 1 to 'NA':
    When the system processes the empty address line 1, then the system should set address line 1 to 'na' as the default value.
  • Context - address line 1 from the n3 segment contains valid data:
    For Keep Original Address Line 1:
    When the system processes the address line 1, then the system should retain the original address line 1 value without modification.
  • Context - address line 2 has been extracted from the n3 segment and address line 1 has been processed:
    For Store Address Line 2:
    When the system stores address line 2, then the system should store the address line 2 data as extracted, whether empty or populated.
  • Context - edi bol data is not available for importer address processing:
    For Set Default 'NA' for Address Line 1:
    When the system processes importer address information, then the system should set address line 1 to 'na' as the default value.
  • Context - edi bol data is not available and default address line 1 has been set:
    For Clear Address Line 2:
    When the system processes address line 2, then the system should clear address line 2 to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: The system is processing importer address information
GIVEN
The system is processing importer address information
Applied to: EDI BOL Available?
WHEN
The system checks for EDI BOL data availability
THEN
The system should proceed with EDI BOL processing if available, otherwise use default address processing
Context: EDI BOL data is available for processing
GIVEN
EDI BOL data is available for processing
Applied to: Retrieve Importer N3 Segment from EDI BOL
WHEN
The system retrieves the importer N3 address segment
THEN
The system should extract the address segment from the EDI BOL data source
Context: The system has attempted to retrieve the N3 address segment from EDI BOL
GIVEN
The system has attempted to retrieve the N3 address segment from EDI BOL
Applied to: N3 Segment Found?
WHEN
The system checks if the N3 segment was found
THEN
The system should proceed with address extraction if found, otherwise use default address processing
Context: The N3 address segment has been successfully retrieved from EDI BOL
GIVEN
The N3 address segment has been successfully retrieved from EDI BOL
Applied to: Extract Address Line 1 from N3 Segment
WHEN
The system extracts address line 1 from the N3 segment
THEN
The system should capture the first address line data for further processing
Context: The N3 address segment has been successfully retrieved and address line 1 has been extracted
GIVEN
The N3 address segment has been successfully retrieved and address line 1 has been extracted
Applied to: Extract Address Line 2 from N3 Segment
WHEN
The system extracts address line 2 from the N3 segment
THEN
The system should capture the second address line data for storage
Context: Address line 1 has been extracted from the N3 segment
GIVEN
Address line 1 has been extracted from the N3 segment
Applied to: Address Line 1 Empty?
WHEN
The system checks if address line 1 is empty or contains only spaces or low-values
THEN
The system should set a default value if empty, otherwise keep the original value
Context: Address line 1 from the N3 segment is empty, spaces, or low-values
GIVEN
Address line 1 from the N3 segment is empty, spaces, or low-values
Applied to: Set Address Line 1 to 'NA'
WHEN
The system processes the empty address line 1
THEN
The system should set address line 1 to 'NA' as the default value
Context: Address line 1 from the N3 segment contains valid data
GIVEN
Address line 1 from the N3 segment contains valid data
Applied to: Keep Original Address Line 1
WHEN
The system processes the address line 1
THEN
The system should retain the original address line 1 value without modification
Context: Address line 2 has been extracted from the N3 segment and address line 1 has been processed
GIVEN
Address line 2 has been extracted from the N3 segment and address line 1 has been processed
Applied to: Store Address Line 2
WHEN
The system stores address line 2
THEN
The system should store the address line 2 data as extracted, whether empty or populated
Context: EDI BOL data is not available for importer address processing
GIVEN
EDI BOL data is not available for importer address processing
Applied to: Set Default 'NA' for Address Line 1
WHEN
The system processes importer address information
THEN
The system should set address line 1 to 'NA' as the default value
Context: EDI BOL data is not available and default address line 1 has been set
GIVEN
EDI BOL data is not available and default address line 1 has been set
Applied to: Clear Address Line 2
WHEN
The system processes address line 2
THEN
The system should clear address line 2 to spaces
R-GCCCCADD-cbl-00921 (+9) File: GCCCCADD.cbl Importer City State Processing Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer City State Processing':
  • Context - an edi bill of lading exists with importer address segments:
    For Retrieve Importer N4 Segment from EDI BOL:
    When the system processes importer n4 segment data, then the system retrieves city, state, postal code and country information from the edi bol n4 segment.
  • Context - an importer n4 address segment is successfully retrieved from edi bol:
    For Extract City Name from N4 Segment:
    When the n4 segment contains city name information, then the system extracts the city name from the d4-city-name field.
    For Extract State/Province Code from N4 Segment:
    When the n4 segment contains state or province code information, then the system extracts the state/province code from the d4-state-prov-code field.
    For Extract Postal Code from N4 Segment:
    When the n4 segment contains postal code information, then the system extracts the postal code from the d4-postal-code field.
    For Extract Country Code from N4 Segment:
    When the n4 segment contains country code information, then the system extracts the country code from the d4-country-code field.
  • Context - city name has been extracted from the importer n4 segment:
    For Move City to Customs Record:
    When the system processes the address information for customs record, then the city name is stored in the gccs-n401-city-name field of the customs record.
  • Context - state or province code has been extracted from the importer n4 segment:
    For Move State/Province to Customs Record:
    When the system processes the address information for customs record, then the state/province code is stored in the gccs-n402-state-prov-cde field of the customs record.
  • Context - postal code has been extracted from the importer n4 segment:
    For Move Postal Code to Customs Record:
    When the system processes the address information for customs record, then the postal code is stored in the gccs-n403-postal-cde field of the customs record.
  • Context - country code has been extracted from the importer n4 segment:
    For Move Country Code to Customs Record:
    When the system processes the address information for customs record, then the country code is stored in the gccs-n404-country-cde field of the customs record.
  • Context - the system attempts to retrieve importer n4 segment from edi bol:
    For Clear All N4 Data Fields:
    When the n4 segment is not found or retrieval fails, then the system clears all n4 data fields in the customs record (gcsccs55-n4-data).
👨‍💻 Technical ACs (Gherkin)
Context: An EDI Bill of Lading exists with importer address segments
GIVEN
An EDI Bill of Lading exists with importer address segments
Applied to: Retrieve Importer N4 Segment from EDI BOL
WHEN
The system processes importer N4 segment data
THEN
The system retrieves city, state, postal code and country information from the EDI BOL N4 segment
Context: An importer N4 address segment is successfully retrieved from EDI BOL
GIVEN
An importer N4 address segment is successfully retrieved from EDI BOL
Applied to: Extract City Name from N4 Segment
WHEN
The N4 segment contains city name information
THEN
The system extracts the city name from the D4-CITY-NAME field
Applied to: Extract State/Province Code from N4 Segment
WHEN
The N4 segment contains state or province code information
THEN
The system extracts the state/province code from the D4-STATE-PROV-CODE field
Applied to: Extract Postal Code from N4 Segment
WHEN
The N4 segment contains postal code information
THEN
The system extracts the postal code from the D4-POSTAL-CODE field
Applied to: Extract Country Code from N4 Segment
WHEN
The N4 segment contains country code information
THEN
The system extracts the country code from the D4-COUNTRY-CODE field
Context: City name has been extracted from the importer N4 segment
GIVEN
City name has been extracted from the importer N4 segment
Applied to: Move City to Customs Record
WHEN
The system processes the address information for customs record
THEN
The city name is stored in the GCCS-N401-CITY-NAME field of the customs record
Context: State or province code has been extracted from the importer N4 segment
GIVEN
State or province code has been extracted from the importer N4 segment
Applied to: Move State/Province to Customs Record
WHEN
The system processes the address information for customs record
THEN
The state/province code is stored in the GCCS-N402-STATE-PROV-CDE field of the customs record
Context: Postal code has been extracted from the importer N4 segment
GIVEN
Postal code has been extracted from the importer N4 segment
Applied to: Move Postal Code to Customs Record
WHEN
The system processes the address information for customs record
THEN
The postal code is stored in the GCCS-N403-POSTAL-CDE field of the customs record
Context: Country code has been extracted from the importer N4 segment
GIVEN
Country code has been extracted from the importer N4 segment
Applied to: Move Country Code to Customs Record
WHEN
The system processes the address information for customs record
THEN
The country code is stored in the GCCS-N404-COUNTRY-CDE field of the customs record
Context: The system attempts to retrieve importer N4 segment from EDI BOL
GIVEN
The system attempts to retrieve importer N4 segment from EDI BOL
Applied to: Clear All N4 Data Fields
WHEN
The N4 segment is not found or retrieval fails
THEN
The system clears all N4 data fields in the customs record (GCSCCS55-N4-DATA)
R-GCCCCADD-cbl-00931 (+8) File: GCCCCADD.cbl Importer Contact Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Contact Processing':
  • Context - an edi bill of lading exists for the shipment:
    For Retrieve Importer PER Segment from EDI BOL:
    When the system processes importer contact information, then the system attempts to retrieve the per segment for importer contact details from the edi bol.
  • Context - an importer per segment is found in the edi bol:
    For Extract Contact Function Code & Extract Contact Person Name & Extract Communication Number Qualifier & Extract Communication Number:
    When the system processes the contact information, then the system extracts the contact function code from the per segment and stores it in the importer record and the system extracts the contact person name from the per segment and stores it in the importer record and the system extracts the communication number qualifier from the per segment and stores it in the importer record and the system extracts the communication number from the per segment and stores it in the importer record.
  • Context - no importer per segment is found in the edi bol or no edi bol data is available:
    For Clear Contact Information Fields:
    When the system processes importer contact information, then the system clears all contact information fields in the importer record.
  • Context - a contact person name is provided in the importer contact information:
    For Generate Error: Communication Qualifier Required:
    When the communication qualifier is blank or not provided, then the system generates an error indicating that communication qualifier is required.
  • Context - either a communication qualifier is provided or a contact person name is provided:
    For Generate Error: Communication Number Required:
    When the communication number is blank or not provided, then the system generates an error indicating that communication number is required.
  • Context - a communication qualifier is provided in the importer contact information:
    For Generate Error: Invalid Communication Qualifier:
    When the communication qualifier is not blank, 'fx' (fax), or 'te' (telephone), then the system generates an error indicating invalid communication qualifier value.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI Bill of Lading exists for the shipment
GIVEN
An EDI Bill of Lading exists for the shipment
Applied to: Retrieve Importer PER Segment from EDI BOL
WHEN
The system processes importer contact information
THEN
The system attempts to retrieve the PER segment for importer contact details from the EDI BOL
Context: An importer PER segment is found in the EDI BOL
GIVEN
An importer PER segment is found in the EDI BOL
Applied to: Extract Contact Function Code & Extract Contact Person Name & Extract Communication Number Qualifier & Extract Communication Number
WHEN
The system processes the contact information
THEN
The system extracts the contact function code from the PER segment and stores it in the importer record AND The system extracts the contact person name from the PER segment and stores it in the importer record AND The system extracts the communication number qualifier from the PER segment and stores it in the importer record AND The system extracts the communication number from the PER segment and stores it in the importer record
Context: No importer PER segment is found in the EDI BOL or no EDI BOL data is available
GIVEN
No importer PER segment is found in the EDI BOL or no EDI BOL data is available
Applied to: Clear Contact Information Fields
WHEN
The system processes importer contact information
THEN
The system clears all contact information fields in the importer record
Context: A contact person name is provided in the importer contact information
GIVEN
A contact person name is provided in the importer contact information
Applied to: Generate Error: Communication Qualifier Required
WHEN
The communication qualifier is blank or not provided
THEN
The system generates an error indicating that communication qualifier is required
Context: Either a communication qualifier is provided or a contact person name is provided
GIVEN
Either a communication qualifier is provided or a contact person name is provided
Applied to: Generate Error: Communication Number Required
WHEN
The communication number is blank or not provided
THEN
The system generates an error indicating that communication number is required
Context: A communication qualifier is provided in the importer contact information
GIVEN
A communication qualifier is provided in the importer contact information
Applied to: Generate Error: Invalid Communication Qualifier
WHEN
The communication qualifier is not blank, 'FX' (fax), or 'TE' (telephone)
THEN
The system generates an error indicating invalid communication qualifier value
R-GCCCCADD-cbl-00940 (+5) File: GCCCCADD.cbl Importer Data Deletion Handling Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Deletion Handling':
  • Context - a corrector edi transaction is being processed and importer information exists in the original shipment data:
    For Check for Existing Importer Data:
    When the system searches for importer records in sequence 3 through 24 and finds an entity with id 'im', then the system should capture and store all existing importer details including chop code, name, business number qualifier, business number, csa indicator, address information, and contact details.
  • Context - original importer data has been found in the shipment records and corrector edi processing is about to begin:
    For Backup Original Importer Data:
    When the system identifies importer entity data with all associated fields populated, then the system should store all importer fields in temporary variables including chop code, name, address lines, city, province/state, postal code, country, contact information, business number, business number qualifier, and csa indicator.
  • Context - original importer data exists in backup variables and corrector edi processing has been completed:
    For Importer Data Deleted by Corrector?:
    When the system checks for importer entity records in the corrected edi data and no importer records are found or importer fields are cleared, then the system should identify this as an importer data deletion scenario requiring restoration of original data.
  • Context - corrector edi has deleted importer information and original importer data exists in backup variables:
    For Retain Original Importer Data:
    When the system processes the importer data restoration, then the system should restore all original importer fields from backup variables including chop code as sc301, entity id as 'im', name as n102, business number qualifier as n103, business number as n104, csa indicator, address lines as n301/n302, city as n401, state/province as n402, postal code as n403, country as n404, and contact information as per segments.
  • Context - original importer data is being restored from backup variables and the original csa indicator value exists:
    For Preserve CSA Indicator:
    When the system restores importer information to the customs record, then the system should set the csa indicator to the original backed-up value to maintain the customs processing status.
  • Context - corrector edi contains importer information modifications and importer data has not been completely deleted:
    For Apply Corrector Changes:
    When the system processes the corrector edi transaction, then the system should apply the corrector changes to update the importer information with the new values provided in the corrector edi.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed AND importer information exists in the original shipment data
GIVEN
A corrector EDI transaction is being processed AND importer information exists in the original shipment data
Applied to: Check for Existing Importer Data
WHEN
The system searches for importer records in sequence 3 through 24 AND finds an entity with ID 'IM'
THEN
The system should capture and store all existing importer details including CHOP code, name, business number qualifier, business number, CSA indicator, address information, and contact details
Context: Original importer data has been found in the shipment records AND corrector EDI processing is about to begin
GIVEN
Original importer data has been found in the shipment records AND corrector EDI processing is about to begin
Applied to: Backup Original Importer Data
WHEN
The system identifies importer entity data with all associated fields populated
THEN
The system should store all importer fields in temporary variables including CHOP code, name, address lines, city, province/state, postal code, country, contact information, business number, business number qualifier, and CSA indicator
Context: Original importer data exists in backup variables AND corrector EDI processing has been completed
GIVEN
Original importer data exists in backup variables AND corrector EDI processing has been completed
Applied to: Importer Data Deleted by Corrector?
WHEN
The system checks for importer entity records in the corrected EDI data AND no importer records are found OR importer fields are cleared
THEN
The system should identify this as an importer data deletion scenario requiring restoration of original data
Context: Corrector EDI has deleted importer information AND original importer data exists in backup variables
GIVEN
Corrector EDI has deleted importer information AND original importer data exists in backup variables
Applied to: Retain Original Importer Data
WHEN
The system processes the importer data restoration
THEN
The system should restore all original importer fields from backup variables including CHOP code as SC301, entity ID as 'IM', name as N102, business number qualifier as N103, business number as N104, CSA indicator, address lines as N301/N302, city as N401, state/province as N402, postal code as N403, country as N404, and contact information as PER segments
Context: Original importer data is being restored from backup variables AND the original CSA indicator value exists
GIVEN
Original importer data is being restored from backup variables AND the original CSA indicator value exists
Applied to: Preserve CSA Indicator
WHEN
The system restores importer information to the customs record
THEN
The system should set the CSA indicator to the original backed-up value to maintain the customs processing status
Context: Corrector EDI contains importer information modifications AND importer data has not been completely deleted
GIVEN
Corrector EDI contains importer information modifications AND importer data has not been completely deleted
Applied to: Apply Corrector Changes
WHEN
The system processes the corrector EDI transaction
THEN
The system should apply the corrector changes to update the importer information with the new values provided in the corrector EDI
R-GCCCCADD-cbl-00946 (+11) File: GCCCCADD.cbl Transit Description Enhancement with CCN Reference Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transit Description Enhancement with CCN Reference':
  • Context - a cargo manifest exists with current description data in gcsccrt and gcsccs53 segments:
    For Save Current Description Data:
    When the transit description enhancement process begins, then the system saves the current manifest data to backup variables and preserves all 46 cargo description array elements for potential restoration.
  • Context - a reference ccn is provided for description enhancement:
    For Set CCN Key from Reference CCN:
    When the system needs to retrieve description data from another ccn, then the system sets the ccn key to the reference ccn value and configures the retrieval parameters.
  • Context - a valid reference ccn key is set:
    For Retrieve Description from Reference CCN:
    When the system attempts to retrieve description data, then the system calls gccccio2 to fetch all description segments and populates the description arrays if successful.
  • Context - an attempt to retrieve description data from reference ccn has been made:
    For Description Retrieved Successfully?:
    When the retrieval operation completes, then if no error occurred, proceed with description enhancement, otherwise restore original data and exit.
  • Context - description data has been successfully retrieved from the reference ccn:
    For Extract Description Components:
    When the system processes the retrieved data, then the system extracts the lading description from gccc segment and copies all 46 cargo description elements to the working description array.
  • Context - description components have been extracted and an action code is specified:
    For Action Code Check:
    When the system evaluates the action code, then if action code is 'us', build us transit description; if 'rt', build rt transit description; otherwise use original description.
  • Context - action code is 'us' and original description data is available:
    For Build US Transit Description:
    When building the enhanced description, then the system concatenates the reference ccn + ' moving in transit through canada ' + original description into the enhanced description.
  • Context - action code is 'rt' and original description data is available:
    For Build RT Transit Description:
    When building the enhanced description, then the system concatenates the reference ccn + ' moving in transit through us ' + original description into the enhanced description.
  • Context - action code is neither 'us' nor 'rt' and original description data is available:
    For Use Original Description:
    When building the description, then the system uses the original retrieved description without any transit-specific modifications.
  • Context - an enhanced description has been built with specified length parameters:
    For Compress Enhanced Description:
    When the compression process is executed, then the system calls gcccomp with 45000 and 22500 length parameters to compress the description data into the target format.
  • Context - description data has been successfully enhanced and compressed:
    For Update Current Description Data:
    When updating the current manifest, then the system moves the compressed lading description to gccc segment and copies all 46 enhanced cargo description elements to the cargo data array.
  • Context - the description enhancement process has failed and original data was previously saved:
    For Restore Original Data on Error:
    When an error occurs during enhancement, then the system restores the original gcsccrt and gcsccs52 data and clears all 46 cargo description array elements before restoring the saved values.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest exists with current description data in GCSCCRT and GCSCCS53 segments
GIVEN
A cargo manifest exists with current description data in GCSCCRT and GCSCCS53 segments
Applied to: Save Current Description Data
WHEN
The transit description enhancement process begins
THEN
The system saves the current manifest data to backup variables and preserves all 46 cargo description array elements for potential restoration
Context: A reference CCN is provided for description enhancement
GIVEN
A reference CCN is provided for description enhancement
Applied to: Set CCN Key from Reference CCN
WHEN
The system needs to retrieve description data from another CCN
THEN
The system sets the CCN key to the reference CCN value and configures the retrieval parameters
Context: A valid reference CCN key is set
GIVEN
A valid reference CCN key is set
Applied to: Retrieve Description from Reference CCN
WHEN
The system attempts to retrieve description data
THEN
The system calls GCCCCIO2 to fetch all description segments and populates the description arrays if successful
Context: An attempt to retrieve description data from reference CCN has been made
GIVEN
An attempt to retrieve description data from reference CCN has been made
Applied to: Description Retrieved Successfully?
WHEN
The retrieval operation completes
THEN
If no error occurred, proceed with description enhancement, otherwise restore original data and exit
Context: Description data has been successfully retrieved from the reference CCN
GIVEN
Description data has been successfully retrieved from the reference CCN
Applied to: Extract Description Components
WHEN
The system processes the retrieved data
THEN
The system extracts the lading description from GCCC segment and copies all 46 cargo description elements to the working description array
Context: Description components have been extracted and an action code is specified
GIVEN
Description components have been extracted and an action code is specified
Applied to: Action Code Check
WHEN
The system evaluates the action code
THEN
If action code is 'US', build US transit description; if 'RT', build RT transit description; otherwise use original description
Context: Action code is 'US' and original description data is available
GIVEN
Action code is 'US' and original description data is available
Applied to: Build US Transit Description
WHEN
Building the enhanced description
THEN
The system concatenates the reference CCN + ' MOVING IN TRANSIT THROUGH CANADA ' + original description into the enhanced description
Context: Action code is 'RT' and original description data is available
GIVEN
Action code is 'RT' and original description data is available
Applied to: Build RT Transit Description
WHEN
Building the enhanced description
THEN
The system concatenates the reference CCN + ' MOVING IN TRANSIT THROUGH US ' + original description into the enhanced description
Context: Action code is neither 'US' nor 'RT' and original description data is available
GIVEN
Action code is neither 'US' nor 'RT' and original description data is available
Applied to: Use Original Description
WHEN
Building the description
THEN
The system uses the original retrieved description without any transit-specific modifications
Context: An enhanced description has been built with specified length parameters
GIVEN
An enhanced description has been built with specified length parameters
Applied to: Compress Enhanced Description
WHEN
The compression process is executed
THEN
The system calls GCCCOMP with 45000 and 22500 length parameters to compress the description data into the target format
Context: Description data has been successfully enhanced and compressed
GIVEN
Description data has been successfully enhanced and compressed
Applied to: Update Current Description Data
WHEN
Updating the current manifest
THEN
The system moves the compressed lading description to GCCC segment and copies all 46 enhanced cargo description elements to the cargo data array
Context: The description enhancement process has failed and original data was previously saved
GIVEN
The description enhancement process has failed and original data was previously saved
Applied to: Restore Original Data on Error
WHEN
An error occurs during enhancement
THEN
The system restores the original GCSCCRT and GCSCCS52 data and clears all 46 cargo description array elements before restoring the saved values
R-GCCCCADD-cbl-00958 (+1) File: GCCCCADD.cbl Multiple Manifest Processing Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multiple Manifest Processing':
  • Context - a shipment is being processed and the action type is iis-a6 or the multi-manifest indicator is 'y':
    For Set Manifest From Port to 'IIS-A6':
    When the manifest from port field is blank (spaces), then the manifest from port should be set to 'iis-a6'.
    For Set Manifest To Port to 'IIS-A6':
    When the manifest to port field is blank (spaces), then the manifest to port should be set to 'iis-a6'.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed AND the action type is IIS-A6 OR the multi-manifest indicator is 'Y'
GIVEN
A shipment is being processed AND the action type is IIS-A6 OR the multi-manifest indicator is 'Y'
Applied to: Set Manifest From Port to 'IIS-A6'
WHEN
The manifest from port field is blank (spaces)
THEN
The manifest from port should be set to 'IIS-A6'
Applied to: Set Manifest To Port to 'IIS-A6'
WHEN
The manifest to port field is blank (spaces)
THEN
The manifest to port should be set to 'IIS-A6'
R-GCCCCADD-cbl-00960 File: GCCCCADD.cbl Ocean Shipment Broker Exemption
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Ocean Shipment Broker Exemption':
  • Context - a shipment is being processed for customs manifest creation:
    For Set Broker Name to 'NOT-REQ':
    When the shipment has ocean in-transit status and the ccn key starts with '6105e', then the broker name should be set to 'not-req' to exempt the shipment from broker requirements.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Set Broker Name to 'NOT-REQ'
WHEN
The shipment has ocean in-transit status AND the CCN key starts with '6105E'
THEN
The broker name should be set to 'NOT-REQ' to exempt the shipment from broker requirements
R-GCCCCADD-cbl-00961 (+8) File: GCCCCADD.cbl Crossing Table Broker Lookup Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Crossing Table Broker Lookup':
  • Context - a shipment requires broker information lookup:
    For Set Initial Search Parameters:
    When the broker lookup process is initiated, then all search parameters are populated with shipper chop, consignee chop, origin station, destination station with road number, and commodity code.
  • Context - all search parameters are populated with specific values:
    For Call Crossing Table Search - First Attempt:
    When the crossing table search is executed with full criteria, then the system attempts to find broker data matching all specified parameters.
  • Context - the crossing table search has been executed with full criteria:
    For Broker Data Found?:
    When the search results are evaluated, then if broker data is found, the lookup process completes successfully, otherwise proceed to secondary search with wildcards.
  • Context - the primary search with full criteria did not find broker data:
    For Call Crossing Table Search - Second Attempt:
    When the shipper chop and origin station are set to wildcard values and the crossing table search is executed, then the system attempts to find broker data with the broadened search criteria.
  • Context - the crossing table search has been executed with shipper and origin wildcards:
    For Broker Data Found?:
    When the search results are evaluated, then if broker data is found, the lookup process completes successfully, otherwise proceed to final search with commodity wildcard.
  • Context - both primary and secondary searches did not find broker data:
    For Call Crossing Table Search - Third Attempt:
    When the commodity code is set to wildcard and the crossing table search is executed, then the system attempts to find broker data with the most general search criteria.
  • Context - the crossing table search has been executed with maximum wildcard criteria:
    For Broker Data Found?:
    When the final search results are evaluated, then if broker data is found, the lookup process completes successfully, otherwise no broker information is available.
  • Context - one of the crossing table searches has successfully found broker data:
    For Broker Information Retrieved Successfully:
    When the broker information is retrieved, then the broker lookup process completes with valid broker information available for use.
  • Context - all three crossing table search attempts have been executed:
    For No Broker Information Found:
    When none of the searches found matching broker data, then the broker lookup process completes with no broker information available.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires broker information lookup
GIVEN
A shipment requires broker information lookup
Applied to: Set Initial Search Parameters
WHEN
The broker lookup process is initiated
THEN
All search parameters are populated with shipper CHOP, consignee CHOP, origin station, destination station with road number, and commodity code
Context: All search parameters are populated with specific values
GIVEN
All search parameters are populated with specific values
Applied to: Call Crossing Table Search - First Attempt
WHEN
The crossing table search is executed with full criteria
THEN
The system attempts to find broker data matching all specified parameters
Context: The crossing table search has been executed with full criteria
GIVEN
The crossing table search has been executed with full criteria
Applied to: Broker Data Found?
WHEN
The search results are evaluated
THEN
If broker data is found, the lookup process completes successfully, otherwise proceed to secondary search with wildcards
Context: The primary search with full criteria did not find broker data
GIVEN
The primary search with full criteria did not find broker data
Applied to: Call Crossing Table Search - Second Attempt
WHEN
The shipper CHOP and origin station are set to wildcard values and the crossing table search is executed
THEN
The system attempts to find broker data with the broadened search criteria
Context: The crossing table search has been executed with shipper and origin wildcards
GIVEN
The crossing table search has been executed with shipper and origin wildcards
Applied to: Broker Data Found?
WHEN
The search results are evaluated
THEN
If broker data is found, the lookup process completes successfully, otherwise proceed to final search with commodity wildcard
Context: Both primary and secondary searches did not find broker data
GIVEN
Both primary and secondary searches did not find broker data
Applied to: Call Crossing Table Search - Third Attempt
WHEN
The commodity code is set to wildcard and the crossing table search is executed
THEN
The system attempts to find broker data with the most general search criteria
Context: The crossing table search has been executed with maximum wildcard criteria
GIVEN
The crossing table search has been executed with maximum wildcard criteria
Applied to: Broker Data Found?
WHEN
The final search results are evaluated
THEN
If broker data is found, the lookup process completes successfully, otherwise no broker information is available
Context: One of the crossing table searches has successfully found broker data
GIVEN
One of the crossing table searches has successfully found broker data
Applied to: Broker Information Retrieved Successfully
WHEN
The broker information is retrieved
THEN
The broker lookup process completes with valid broker information available for use
Context: All three crossing table search attempts have been executed
GIVEN
All three crossing table search attempts have been executed
Applied to: No Broker Information Found
WHEN
None of the searches found matching broker data
THEN
The broker lookup process completes with no broker information available
R-GCCCCADD-cbl-00970 (+5) File: GCCCCADD.cbl Broker Override Processing Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Broker Override Processing':
  • Context - a crossing table lookup has been performed for broker information:
    For Crossing Table Data Found?:
    When the system checks the crossing table return status, then if data is found, proceed with broker override processing, otherwise skip broker override logic.
  • Context - crossing table data is available with an override flag:
    For Override Flag = 'Y'?:
    When the override flag is evaluated, then if override flag equals 'y', force override of existing broker data, otherwise check existing broker status.
  • Context - override flag is not 'y' and existing broker name exists:
    For Existing Broker Name is Empty, UNKNOWN, or NOT-REQ?:
    When the existing broker name is evaluated, then if broker name is spaces, 'unknown', or 'not-req', use crossing table data, otherwise keep existing broker data.
  • Context - crossing table contains valid broker data and override conditions are satisfied:
    For Move Broker Name from Crossing Table:
    When broker name assignment is performed, then the broker name from crossing table is moved to the customs record broker field.
  • Context - broker information has been processed from crossing table:
    For Manifest-To Station Available in Crossing Table?:
    When the crossing table manifest-to station field is checked, then if manifest-to station is not spaces, proceed with manifest-to station override, otherwise complete processing.
  • Context - crossing table contains valid manifest-to station information:
    For Override Manifest-To Station Information:
    When manifest-to station override is performed, then reset error flags, update manifest-to station name, lookup station in mc table, validate canadian customs code, and update destination station information including station number and call letters.
👨‍💻 Technical ACs (Gherkin)
Context: A crossing table lookup has been performed for broker information
GIVEN
A crossing table lookup has been performed for broker information
Applied to: Crossing Table Data Found?
WHEN
The system checks the crossing table return status
THEN
If data is found, proceed with broker override processing, otherwise skip broker override logic
Context: Crossing table data is available with an override flag
GIVEN
Crossing table data is available with an override flag
Applied to: Override Flag = 'Y'?
WHEN
The override flag is evaluated
THEN
If override flag equals 'Y', force override of existing broker data, otherwise check existing broker status
Context: Override flag is not 'Y' and existing broker name exists
GIVEN
Override flag is not 'Y' and existing broker name exists
Applied to: Existing Broker Name is Empty, UNKNOWN, or NOT-REQ?
WHEN
The existing broker name is evaluated
THEN
If broker name is SPACES, 'UNKNOWN', or 'NOT-REQ', use crossing table data, otherwise keep existing broker data
Context: Crossing table contains valid broker data and override conditions are satisfied
GIVEN
Crossing table contains valid broker data and override conditions are satisfied
Applied to: Move Broker Name from Crossing Table
WHEN
Broker name assignment is performed
THEN
The broker name from crossing table is moved to the customs record broker field
Context: Broker information has been processed from crossing table
GIVEN
Broker information has been processed from crossing table
Applied to: Manifest-To Station Available in Crossing Table?
WHEN
The crossing table manifest-to station field is checked
THEN
If manifest-to station is not SPACES, proceed with manifest-to station override, otherwise complete processing
Context: Crossing table contains valid manifest-to station information
GIVEN
Crossing table contains valid manifest-to station information
Applied to: Override Manifest-To Station Information
WHEN
Manifest-to station override is performed
THEN
Reset error flags, update manifest-to station name, lookup station in MC table, validate Canadian customs code, and update destination station information including station number and call letters
R-GCCCCADD-cbl-00976 (+10) File: GCCCCADD.cbl Manifest Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest':
  • Context - a crossing table entry exists with broker data:
    For Crossing Table CDN Manifest-To Available?:
    When the system checks for cdn manifest-to field availability, then the system determines if manifest-to station override should proceed based on field presence.
  • Context - crossing table contains cdn manifest-to override data:
    For Reset Error Flags:
    When the system begins manifest-to station override processing, then all manifest-to related error flags are reset to off state.
  • Context - crossing table contains a valid cdn manifest-to value:
    For Set Manifest-To Station from Crossing Table:
    When the system processes manifest-to station override, then the manifest-to station name is updated with the crossing table cdn manifest-to value.
  • Context - a manifest-to station name has been set from crossing table:
    For Lookup MC Table for Manifest-To Port:
    When the system looks up the manifest port in mc table, then the system attempts to retrieve mc table data for the specified manifest port.
  • Context - an mc table lookup has been performed for a manifest port:
    For MC Table Lookup Successful?:
    When the system evaluates the lookup result, then the system determines success or failure based on data retrieval status.
  • Context - mc table data has been successfully retrieved for a manifest port:
    For Validate Canadian Customs Code:
    When the system validates the canadian customs code, then the system checks if the customs code is not equal to '00000' which indicates an invalid code.
  • Context - a valid canadian customs code has been retrieved from mc table:
    For Set Manifest-To Station Code:
    When the system configures the manifest-to station, then the manifest-to station code is set to the canadian customs code from mc table.
  • Context - valid mc table data exists for the manifest-to station:
    For Set Destination Station Number:
    When the system sets destination station configuration, then the destination station number for index is set to the mc table station number.
    For Set Batch Print Call Letters:
    When the system configures batch printing parameters, then the batch print call letters are set to the mc table call letters value.
  • Context - mc table lookup was successful but canadian customs code equals '00000':
    For Set Error Flag 2 - Invalid Customs Code:
    When the system validates the customs code, then error flag 2 is set to on and the manifest port name is saved for error reporting.
  • Context - mc table lookup failed to retrieve data for the manifest-to station:
    For Set Error Flag 3 - Invalid MC Port:
    When the system processes the lookup failure, then error flag 3 is set to on and the manifest port name is saved for error reporting.
👨‍💻 Technical ACs (Gherkin)
Context: A crossing table entry exists with broker data
GIVEN
A crossing table entry exists with broker data
Applied to: Crossing Table CDN Manifest-To Available?
WHEN
The system checks for CDN manifest-to field availability
THEN
The system determines if manifest-to station override should proceed based on field presence
Context: Crossing table contains CDN manifest-to override data
GIVEN
Crossing table contains CDN manifest-to override data
Applied to: Reset Error Flags
WHEN
The system begins manifest-to station override processing
THEN
All manifest-to related error flags are reset to OFF state
Context: Crossing table contains a valid CDN manifest-to value
GIVEN
Crossing table contains a valid CDN manifest-to value
Applied to: Set Manifest-To Station from Crossing Table
WHEN
The system processes manifest-to station override
THEN
The manifest-to station name is updated with the crossing table CDN manifest-to value
Context: A manifest-to station name has been set from crossing table
GIVEN
A manifest-to station name has been set from crossing table
Applied to: Lookup MC Table for Manifest-To Port
WHEN
The system looks up the manifest port in MC table
THEN
The system attempts to retrieve MC table data for the specified manifest port
Context: An MC table lookup has been performed for a manifest port
GIVEN
An MC table lookup has been performed for a manifest port
Applied to: MC Table Lookup Successful?
WHEN
The system evaluates the lookup result
THEN
The system determines success or failure based on data retrieval status
Context: MC table data has been successfully retrieved for a manifest port
GIVEN
MC table data has been successfully retrieved for a manifest port
Applied to: Validate Canadian Customs Code
WHEN
The system validates the Canadian customs code
THEN
The system checks if the customs code is not equal to '00000' which indicates an invalid code
Context: A valid Canadian customs code has been retrieved from MC table
GIVEN
A valid Canadian customs code has been retrieved from MC table
Applied to: Set Manifest-To Station Code
WHEN
The system configures the manifest-to station
THEN
The manifest-to station code is set to the Canadian customs code from MC table
Context: Valid MC table data exists for the manifest-to station
GIVEN
Valid MC table data exists for the manifest-to station
Applied to: Set Destination Station Number
WHEN
The system sets destination station configuration
THEN
The destination station number for index is set to the MC table station number
Applied to: Set Batch Print Call Letters
WHEN
The system configures batch printing parameters
THEN
The batch print call letters are set to the MC table call letters value
Context: MC table lookup was successful but Canadian customs code equals '00000'
GIVEN
MC table lookup was successful but Canadian customs code equals '00000'
Applied to: Set Error Flag 2 - Invalid Customs Code
WHEN
The system validates the customs code
THEN
Error flag 2 is set to ON and the manifest port name is saved for error reporting
Context: MC table lookup failed to retrieve data for the manifest-to station
GIVEN
MC table lookup failed to retrieve data for the manifest-to station
Applied to: Set Error Flag 3 - Invalid MC Port
WHEN
The system processes the lookup failure
THEN
Error flag 3 is set to ON and the manifest port name is saved for error reporting
R-GCCCCADD-cbl-00987 (+5) File: GCCCCADD.cbl Origin Country Determination from AU Table Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Origin Country Determination from AU Table':
  • Context - the origin country determination process is starting:
    For Initialize Origin Country to Spaces:
    When the system begins to determine the origin country, then the origin country field should be initialized to spaces (blank).
  • Context - the system needs to lookup authorized user information:
    For Setup AU Table Lookup Parameters:
    When setting up au table lookup parameters, then the table id should be set to 'au', the consignee chop code should be used as the chop key, and the commodity code should be used as the commodity key.
  • Context - au table lookup parameters are configured with consignee chop and commodity code:
    For Call Table Lookup Service:
    When the table lookup service is called, then the system should execute the lookup and return the result status.
  • Context - the au table lookup service has been executed:
    For AU Table Record Found?:
    When the lookup result is evaluated, then if the lookup is successful, the au table data should be loaded; otherwise, the au table data should be cleared to spaces.
  • Context - the au table lookup has been processed:
    For Origin Country is Mexico?:
    When the current origin country value is evaluated, then if the origin country is 'mx' (mexico), the process should exit and preserve the mexico designation; otherwise, continue with state-country table lookup.
  • Context - the origin country is not mexico and state-country lookup is needed:
    For Lookup State-Country Table:
    When the state-country table is searched using the origin station state code, then if a matching state code is found, the corresponding country should be set as the origin country.
👨‍💻 Technical ACs (Gherkin)
Context: The origin country determination process is starting
GIVEN
The origin country determination process is starting
Applied to: Initialize Origin Country to Spaces
WHEN
The system begins to determine the origin country
THEN
The origin country field should be initialized to spaces (blank)
Context: The system needs to lookup authorized user information
GIVEN
The system needs to lookup authorized user information
Applied to: Setup AU Table Lookup Parameters
WHEN
Setting up AU table lookup parameters
THEN
The table ID should be set to 'AU', the consignee CHOP code should be used as the CHOP key, and the commodity code should be used as the commodity key
Context: AU table lookup parameters are configured with consignee CHOP and commodity code
GIVEN
AU table lookup parameters are configured with consignee CHOP and commodity code
Applied to: Call Table Lookup Service
WHEN
The table lookup service is called
THEN
The system should execute the lookup and return the result status
Context: The AU table lookup service has been executed
GIVEN
The AU table lookup service has been executed
Applied to: AU Table Record Found?
WHEN
The lookup result is evaluated
THEN
If the lookup is successful, the AU table data should be loaded; otherwise, the AU table data should be cleared to spaces
Context: The AU table lookup has been processed
GIVEN
The AU table lookup has been processed
Applied to: Origin Country is Mexico?
WHEN
The current origin country value is evaluated
THEN
If the origin country is 'MX' (Mexico), the process should exit and preserve the Mexico designation; otherwise, continue with state-country table lookup
Context: The origin country is not Mexico and state-country lookup is needed
GIVEN
The origin country is not Mexico and state-country lookup is needed
Applied to: Lookup State-Country Table
WHEN
The state-country table is searched using the origin station state code
THEN
If a matching state code is found, the corresponding country should be set as the origin country
R-GCCCCADD-cbl-00993 (+6) File: GCCCCADD.cbl Mexico Origin Country Handling Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Mexico Origin Country Handling':
  • Context - a shipment requires origin country determination:
    For Initialize Origin Country to Spaces:
    When the mexico origin country handling process begins, then the origin country field should be initialized to spaces.
  • Context - a shipment has a consignee chop code and commodity code:
    For Lookup Authorized User Table with Consignee CHOP and Commodity Code:
    When origin country determination is required, then the system should lookup the authorized user table using the consignee chop and commodity code as search keys.
  • Context - an authorized user table lookup has been performed:
    For Store AU Table Data:
    When the lookup returns valid data, then the authorized user table data should be stored in the working storage area.
    For Clear AU Table Data:
    When the lookup does not return valid data, then the authorized user table data area should be cleared to spaces.
  • Context - the origin country has been determined from authorized user data:
    For Exit - Keep Mexico as Origin Country:
    When the origin country is 'mx' (mexico), then the system should preserve mexico as the origin country and exit the country determination process.
  • Context - the origin country is not mexico and needs to be determined:
    For Lookup State-Country Table with Origin Station State Code:
    When the origin station state code is available, then the system should lookup the state-country table using the origin station state code to determine the origin country.
  • Context - a state-country table lookup has been performed using the origin station state code:
    For Set Origin Country from State-Country Lookup:
    When the lookup returns a valid country code, then the origin country should be set to the country code returned from the state-country lookup.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires origin country determination
GIVEN
A shipment requires origin country determination
Applied to: Initialize Origin Country to Spaces
WHEN
The Mexico origin country handling process begins
THEN
The origin country field should be initialized to spaces
Context: A shipment has a consignee CHOP code and commodity code
GIVEN
A shipment has a consignee CHOP code and commodity code
Applied to: Lookup Authorized User Table with Consignee CHOP and Commodity Code
WHEN
Origin country determination is required
THEN
The system should lookup the authorized user table using the consignee CHOP and commodity code as search keys
Context: An authorized user table lookup has been performed
GIVEN
An authorized user table lookup has been performed
Applied to: Store AU Table Data
WHEN
The lookup returns valid data
THEN
The authorized user table data should be stored in the working storage area
Applied to: Clear AU Table Data
WHEN
The lookup does not return valid data
THEN
The authorized user table data area should be cleared to spaces
Context: The origin country has been determined from authorized user data
GIVEN
The origin country has been determined from authorized user data
Applied to: Exit - Keep Mexico as Origin Country
WHEN
The origin country is 'MX' (Mexico)
THEN
The system should preserve Mexico as the origin country and exit the country determination process
Context: The origin country is not Mexico and needs to be determined
GIVEN
The origin country is not Mexico and needs to be determined
Applied to: Lookup State-Country Table with Origin Station State Code
WHEN
The origin station state code is available
THEN
The system should lookup the state-country table using the origin station state code to determine the origin country
Context: A state-country table lookup has been performed using the origin station state code
GIVEN
A state-country table lookup has been performed using the origin station state code
Applied to: Set Origin Country from State-Country Lookup
WHEN
The lookup returns a valid country code
THEN
The origin country should be set to the country code returned from the state-country lookup
R-GCCCCADD-cbl-01000 (+12) File: GCCCCADD.cbl Postal Code Padding Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Postal Code Padding':
  • Context - the cargo manifest creation process is executing:
    For Called from GCX011?:
    When the system checks the calling program source, then if called from gcx011, proceed with postal code validation and padding, otherwise skip postal code processing.
  • Context - the system is processing postal codes for gcx011 integration:
    For Shipper Postal Code Not Empty?:
    When the shipper postal code field is evaluated, then if shipper postal code is not empty, proceed to check its length, otherwise skip to consignee postal code processing.
  • Context - the shipper postal code is not empty:
    For Calculate Shipper Postal Code Length:
    When the system calculates the string length of the shipper postal code, then the actual character length is determined by counting non-space characters from the end.
  • Context - the shipper postal code length has been calculated:
    For Length < 5 Characters?:
    When the system compares the length to the minimum requirement of 5 characters, then if length is less than 5 characters, proceed with padding, otherwise continue to consignee processing.
  • Context - the shipper postal code is shorter than 5 characters:
    For Pad Shipper Postal Code with Periods to 5 Characters:
    When the system applies padding to meet minimum length requirements, then periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length.
  • Context - the system has completed shipper postal code processing:
    For Consignee Postal Code Not Empty?:
    When the consignee postal code field is evaluated, then if consignee postal code is not empty, proceed to check its length, otherwise skip to notify party postal code processing.
  • Context - the consignee postal code is not empty:
    For Calculate Consignee Postal Code Length:
    When the system calculates the string length of the consignee postal code, then the actual character length is determined by counting non-space characters from the end.
  • Context - the consignee postal code length has been calculated:
    For Length < 5 Characters?:
    When the system compares the length to the minimum requirement of 5 characters, then if length is less than 5 characters, proceed with padding, otherwise continue to notify party processing.
  • Context - the consignee postal code is shorter than 5 characters:
    For Pad Consignee Postal Code with Periods to 5 Characters:
    When the system applies padding to meet minimum length requirements, then periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length.
  • Context - the system has completed consignee postal code processing:
    For Notify Party Postal Code Not Empty?:
    When the notify party postal code field is evaluated, then if notify party postal code is not empty, proceed to check its length, otherwise complete postal code processing.
  • Context - the notify party postal code is not empty:
    For Calculate Notify Party Postal Code Length:
    When the system calculates the string length of the notify party postal code, then the actual character length is determined by counting non-space characters from the end.
  • Context - the notify party postal code length has been calculated:
    For Length < 5 Characters?:
    When the system compares the length to the minimum requirement of 5 characters, then if length is less than 5 characters, proceed with padding, otherwise complete processing.
  • Context - the notify party postal code is shorter than 5 characters:
    For Pad Notify Party Postal Code with Periods to 5 Characters:
    When the system applies padding to meet minimum length requirements, then periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length.
👨‍💻 Technical ACs (Gherkin)
Context: The cargo manifest creation process is executing
GIVEN
The cargo manifest creation process is executing
Applied to: Called from GCX011?
WHEN
The system checks the calling program source
THEN
If called from GCX011, proceed with postal code validation and padding, otherwise skip postal code processing
Context: The system is processing postal codes for GCX011 integration
GIVEN
The system is processing postal codes for GCX011 integration
Applied to: Shipper Postal Code Not Empty?
WHEN
The shipper postal code field is evaluated
THEN
If shipper postal code is not empty, proceed to check its length, otherwise skip to consignee postal code processing
Context: The shipper postal code is not empty
GIVEN
The shipper postal code is not empty
Applied to: Calculate Shipper Postal Code Length
WHEN
The system calculates the string length of the shipper postal code
THEN
The actual character length is determined by counting non-space characters from the end
Context: The shipper postal code length has been calculated
GIVEN
The shipper postal code length has been calculated
Applied to: Length < 5 Characters?
WHEN
The system compares the length to the minimum requirement of 5 characters
THEN
If length is less than 5 characters, proceed with padding, otherwise continue to consignee processing
Context: The shipper postal code is shorter than 5 characters
GIVEN
The shipper postal code is shorter than 5 characters
Applied to: Pad Shipper Postal Code with Periods to 5 Characters
WHEN
The system applies padding to meet minimum length requirements
THEN
Periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length
Context: The system has completed shipper postal code processing
GIVEN
The system has completed shipper postal code processing
Applied to: Consignee Postal Code Not Empty?
WHEN
The consignee postal code field is evaluated
THEN
If consignee postal code is not empty, proceed to check its length, otherwise skip to notify party postal code processing
Context: The consignee postal code is not empty
GIVEN
The consignee postal code is not empty
Applied to: Calculate Consignee Postal Code Length
WHEN
The system calculates the string length of the consignee postal code
THEN
The actual character length is determined by counting non-space characters from the end
Context: The consignee postal code length has been calculated
GIVEN
The consignee postal code length has been calculated
Applied to: Length < 5 Characters?
WHEN
The system compares the length to the minimum requirement of 5 characters
THEN
If length is less than 5 characters, proceed with padding, otherwise continue to notify party processing
Context: The consignee postal code is shorter than 5 characters
GIVEN
The consignee postal code is shorter than 5 characters
Applied to: Pad Consignee Postal Code with Periods to 5 Characters
WHEN
The system applies padding to meet minimum length requirements
THEN
Periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length
Context: The system has completed consignee postal code processing
GIVEN
The system has completed consignee postal code processing
Applied to: Notify Party Postal Code Not Empty?
WHEN
The notify party postal code field is evaluated
THEN
If notify party postal code is not empty, proceed to check its length, otherwise complete postal code processing
Context: The notify party postal code is not empty
GIVEN
The notify party postal code is not empty
Applied to: Calculate Notify Party Postal Code Length
WHEN
The system calculates the string length of the notify party postal code
THEN
The actual character length is determined by counting non-space characters from the end
Context: The notify party postal code length has been calculated
GIVEN
The notify party postal code length has been calculated
Applied to: Length < 5 Characters?
WHEN
The system compares the length to the minimum requirement of 5 characters
THEN
If length is less than 5 characters, proceed with padding, otherwise complete processing
Context: The notify party postal code is shorter than 5 characters
GIVEN
The notify party postal code is shorter than 5 characters
Applied to: Pad Notify Party Postal Code with Periods to 5 Characters
WHEN
The system applies padding to meet minimum length requirements
THEN
Periods are added to positions 5 through 5 of the postal code field to ensure 5-character minimum length
R-GCCCCADD-cbl-01013 (+11) File: GCCCCADD.cbl Waybill Date Validation and ETA Calculation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Waybill Date Validation and ETA Calculation':
  • Context - a shipment root record exists with waybill date information:
    For Extract Waybill Date from Shipment Root:
    When the system processes the shipment for customs manifest creation, then the waybill date is extracted from the shipment root and stored for further processing.
  • Context - a waybill date has been extracted from the shipment root:
    For Move Waybill Date to Working Storage:
    When the system prepares for date calculations, then the waybill date is moved to working storage variables and also set as the waybill date index.
  • Context - the waybill date is available in working storage:
    For Set Up Date Calculation Parameters:
    When the system prepares to calculate the border arrival eta, then the date calculation parameters are set to add mode for days calculation with the waybill date as the original date.
  • Context - the waybill date is in 6-digit format (yymmdd):
    For Add Machine Century to Date:
    When the system prepares the date for calculation, then the machine century is added to the year portion to create a complete 8-digit date format.
  • Context - the date calculation utility parameters are being configured:
    For Set Calculation Mode to ADD DAYS:
    When the system sets up the calculation mode, then the calculation mode is set to add and the unit is set to days.
  • Context - a configured number of days for eta calculation exists:
    For Set Days Amount from Configuration:
    When the system sets up the date calculation parameters, then the configured days amount is set as the amount to add to the waybill date.
  • Context - all date calculation parameters are properly configured:
    For Call Date Calculation Utility ISCDTCAL:
    When the system needs to calculate the border arrival eta, then the iscdtcal utility is called with the configured parameters.
  • Context - the date calculation utility has been called:
    For Date Calculation Successful?:
    When the system evaluates the calculation result, then if the calculation was successful, the new date is used; otherwise, an error is processed.
  • Context - the date calculation utility executed successfully:
    For Set Border Arrival ETA Date:
    When the system processes the successful calculation result, then the calculated new date is assigned as the border arrival eta.
  • Context - the date calculation utility failed to execute successfully:
    For Set Invalid Waybill Date Error:
    When the system processes the failed calculation result, then an invalid waybill date error code is set for message retrieval.
  • Context - an invalid waybill date error code has been set:
    For Retrieve Error Message Text:
    When the system needs to provide error details, then the error message retrieval process is performed to get the descriptive error text.
  • Context - an error message has been retrieved for the invalid waybill date:
    For Add Error to Message Queue:
    When the system processes the error condition, then the error message is added to the message queue for user notification.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment root record exists with waybill date information
GIVEN
A shipment root record exists with waybill date information
Applied to: Extract Waybill Date from Shipment Root
WHEN
The system processes the shipment for customs manifest creation
THEN
The waybill date is extracted from the shipment root and stored for further processing
Context: A waybill date has been extracted from the shipment root
GIVEN
A waybill date has been extracted from the shipment root
Applied to: Move Waybill Date to Working Storage
WHEN
The system prepares for date calculations
THEN
The waybill date is moved to working storage variables and also set as the waybill date index
Context: The waybill date is available in working storage
GIVEN
The waybill date is available in working storage
Applied to: Set Up Date Calculation Parameters
WHEN
The system prepares to calculate the border arrival ETA
THEN
The date calculation parameters are set to ADD mode for DAYS calculation with the waybill date as the original date
Context: The waybill date is in 6-digit format (YYMMDD)
GIVEN
The waybill date is in 6-digit format (YYMMDD)
Applied to: Add Machine Century to Date
WHEN
The system prepares the date for calculation
THEN
The machine century is added to the year portion to create a complete 8-digit date format
Context: The date calculation utility parameters are being configured
GIVEN
The date calculation utility parameters are being configured
Applied to: Set Calculation Mode to ADD DAYS
WHEN
The system sets up the calculation mode
THEN
The calculation mode is set to ADD and the unit is set to DAYS
Context: A configured number of days for ETA calculation exists
GIVEN
A configured number of days for ETA calculation exists
Applied to: Set Days Amount from Configuration
WHEN
The system sets up the date calculation parameters
THEN
The configured days amount is set as the amount to add to the waybill date
Context: All date calculation parameters are properly configured
GIVEN
All date calculation parameters are properly configured
Applied to: Call Date Calculation Utility ISCDTCAL
WHEN
The system needs to calculate the border arrival ETA
THEN
The ISCDTCAL utility is called with the configured parameters
Context: The date calculation utility has been called
GIVEN
The date calculation utility has been called
Applied to: Date Calculation Successful?
WHEN
The system evaluates the calculation result
THEN
If the calculation was successful, the new date is used; otherwise, an error is processed
Context: The date calculation utility executed successfully
GIVEN
The date calculation utility executed successfully
Applied to: Set Border Arrival ETA Date
WHEN
The system processes the successful calculation result
THEN
The calculated new date is assigned as the border arrival ETA
Context: The date calculation utility failed to execute successfully
GIVEN
The date calculation utility failed to execute successfully
Applied to: Set Invalid Waybill Date Error
WHEN
The system processes the failed calculation result
THEN
An invalid waybill date error code is set for message retrieval
Context: An invalid waybill date error code has been set
GIVEN
An invalid waybill date error code has been set
Applied to: Retrieve Error Message Text
WHEN
The system needs to provide error details
THEN
The error message retrieval process is performed to get the descriptive error text
Context: An error message has been retrieved for the invalid waybill date
GIVEN
An error message has been retrieved for the invalid waybill date
Applied to: Add Error to Message Queue
WHEN
The system processes the error condition
THEN
The error message is added to the message queue for user notification
R-GCCCCADD-cbl-01025 (+2) File: GCCCCADD.cbl Station Number Conversion Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Station Number Conversion':
  • Context - a shipment record contains an origin station number in character format:
    For Convert Character to Numeric Format:
    When the system processes the origin station data for customs manifest creation, then the origin station number is converted to numeric format and stored in the customs record origin station number field.
  • Context - a shipment record contains a destination station number in character format:
    For Convert Character to Numeric Format:
    When the system processes the destination station data for customs manifest creation, then the destination station number is converted to numeric format and stored in the customs record destination station number field.
  • Context - a manifest to station has been validated and contains a station number in the mc table lookup result:
    For Store Numeric Destination Station Number:
    When the system processes the manifest to station information, then the station number is converted to numeric format and stored in both the destination station number index and destination station number index station fields.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record contains an origin station number in character format
GIVEN
A shipment record contains an origin station number in character format
Applied to: Convert Character to Numeric Format
WHEN
The system processes the origin station data for customs manifest creation
THEN
The origin station number is converted to numeric format and stored in the customs record origin station number field
Context: A shipment record contains a destination station number in character format
GIVEN
A shipment record contains a destination station number in character format
Applied to: Convert Character to Numeric Format
WHEN
The system processes the destination station data for customs manifest creation
THEN
The destination station number is converted to numeric format and stored in the customs record destination station number field
Context: A manifest to station has been validated and contains a station number in the MC table lookup result
GIVEN
A manifest to station has been validated and contains a station number in the MC table lookup result
Applied to: Store Numeric Destination Station Number
WHEN
The system processes the manifest to station information
THEN
The station number is converted to numeric format and stored in both the destination station number index and destination station number index station fields
R-GCCCCADD-cbl-01028 (+1) File: GCCCCADD.cbl Manifest Port Default Setting Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Port Default Setting':
  • Context - a shipment is being processed with action code iis-a6 or multi-manifest indicator equals 'y':
    For Set Manifest From Port to 'IIS-A6':
    When the manifest from port field is blank or empty, then the manifest from port should be set to 'iis-a6'.
    For Set Manifest To Port to 'IIS-A6':
    When the manifest to port field is blank or empty, then the manifest to port should be set to 'iis-a6'.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed with action code IIS-A6 OR multi-manifest indicator equals 'Y'
GIVEN
A shipment is being processed with action code IIS-A6 OR multi-manifest indicator equals 'Y'
Applied to: Set Manifest From Port to 'IIS-A6'
WHEN
The manifest from port field is blank or empty
THEN
The manifest from port should be set to 'IIS-A6'
Applied to: Set Manifest To Port to 'IIS-A6'
WHEN
The manifest to port field is blank or empty
THEN
The manifest to port should be set to 'IIS-A6'
R-GCCCCADD-cbl-01030 (+5) File: GCCCCADD.cbl Canadian Customs Code Validation Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Canadian Customs Code Validation':
  • Context - a manifest from port value exists in the shipment root:
    For Lookup MC Table with Manifest From Port:
    When the system looks up the manifest from port in the mc table, then the system retrieves the corresponding manifest code record or determines if no record exists.
  • Context - a canadian customs code has been retrieved from the mc table:
    For Canadian Customs Code = '00000'?:
    When the canadian customs code equals '00000', then the system identifies this as an invalid customs code and clears the mc table data.
  • Context - the canadian customs code from mc table equals '00000':
    For Set Error Message: Invalid Manifest Port Canadian Customs Code:
    When the system detects this invalid customs code, then the system generates an error message for invalid manifest port canadian customs code and adds it to the message array.
  • Context - a manifest from port value needs to be validated:
    For Set Error Message: Invalid Manifest Port in MC Table:
    When the mc table lookup fails to find a matching record, then the system generates an error message for invalid manifest port and adds it to the message array.
  • Context - a valid canadian customs code has been retrieved from mc table:
    For Set Canadian Customs Code to Manifest From Station Code:
    When the canadian customs code is not '00000', then the system assigns the canadian customs code to the manifest from station code field.
  • Context - valid mc table data has been retrieved:
    For Continue Processing:
    When processing continues after validation, then the system assigns the us port of exit code from the mc table to the corresponding field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest from port value exists in the shipment root
GIVEN
A manifest from port value exists in the shipment root
Applied to: Lookup MC Table with Manifest From Port
WHEN
The system looks up the manifest from port in the MC table
THEN
The system retrieves the corresponding manifest code record or determines if no record exists
Context: A Canadian customs code has been retrieved from the MC table
GIVEN
A Canadian customs code has been retrieved from the MC table
Applied to: Canadian Customs Code = '00000'?
WHEN
The Canadian customs code equals '00000'
THEN
The system identifies this as an invalid customs code and clears the MC table data
Context: The Canadian customs code from MC table equals '00000'
GIVEN
The Canadian customs code from MC table equals '00000'
Applied to: Set Error Message: Invalid Manifest Port Canadian Customs Code
WHEN
The system detects this invalid customs code
THEN
The system generates an error message for invalid manifest port Canadian customs code and adds it to the message array
Context: A manifest from port value needs to be validated
GIVEN
A manifest from port value needs to be validated
Applied to: Set Error Message: Invalid Manifest Port in MC Table
WHEN
The MC table lookup fails to find a matching record
THEN
The system generates an error message for invalid manifest port and adds it to the message array
Context: A valid Canadian customs code has been retrieved from MC table
GIVEN
A valid Canadian customs code has been retrieved from MC table
Applied to: Set Canadian Customs Code to Manifest From Station Code
WHEN
The Canadian customs code is not '00000'
THEN
The system assigns the Canadian customs code to the manifest from station code field
Context: Valid MC table data has been retrieved
GIVEN
Valid MC table data has been retrieved
Applied to: Continue Processing
WHEN
Processing continues after validation
THEN
The system assigns the US port of exit code from the MC table to the corresponding field
R-GCCCCADD-cbl-01036 (+7) File: GCCCCADD.cbl US Port Exit Code Setting Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'US Port Exit Code Setting':
  • Context - a shipment has a manifest from port defined in the shipment root data:
    For Set GCCC-US-PORT-OF-EXIT-CODE:
    When the system looks up the manifest from port in the mc table and finds a matching record, then the us port of exit code from the mc table record is assigned to the cargo manifest us port of exit code field.
    For Log Error - Invalid Manifest Port:
    When the system attempts to look up the manifest from port in the mc table and the lookup fails, then the system clears the mc table data and logs an error message for invalid manifest port.
  • Context - a manifest from port lookup in the mc table is successful:
    For Extract US Port Exit Code from MC Table:
    When the canadian customs code in the mc table record equals '00000', then the system clears the mc table data and adds an error message for invalid canadian customs code.
  • Context - the action is iis-a6 or the multi-manifest indicator is 'y':
    For Get Manifest From Port from Shipment Root:
    When the manifest from port in the shipment root is blank, then the system sets the manifest from port to 'iis-a6'.
    For Get Manifest To Port from Shipment Root:
    When the manifest to port in the shipment root is blank, then the system sets the manifest to port to 'iis-a6'.
  • Context - a shipment is being processed for customs manifest creation:
    For Log Error - Invalid Manifest Port:
    When the manifest to port is blank or not provided, then the system sets error flag 1 to indicate missing manifest to port.
  • Context - a manifest to port lookup in the mc table is successful:
    For Set US Port Exit Code for Manifest To Station:
    When the canadian customs code in the mc table record equals '00000', then the system clears the mc table data and sets error flag 2 with the port name for invalid canadian customs code.
  • Context - a shipment has a manifest to port defined:
    For Log Error - Invalid Manifest Port:
    When the system attempts to look up the manifest to port in the mc table and the lookup fails, then the system clears the mc table data and sets error flag 3 with the port name for invalid manifest port.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has a manifest from port defined in the shipment root data
GIVEN
A shipment has a manifest from port defined in the shipment root data
Applied to: Set GCCC-US-PORT-OF-EXIT-CODE
WHEN
The system looks up the manifest from port in the MC table and finds a matching record
THEN
The US port of exit code from the MC table record is assigned to the cargo manifest US port of exit code field
Applied to: Log Error - Invalid Manifest Port
WHEN
The system attempts to look up the manifest from port in the MC table and the lookup fails
THEN
The system clears the MC table data and logs an error message for invalid manifest port
Context: A manifest from port lookup in the MC table is successful
GIVEN
A manifest from port lookup in the MC table is successful
Applied to: Extract US Port Exit Code from MC Table
WHEN
The Canadian customs code in the MC table record equals '00000'
THEN
The system clears the MC table data and adds an error message for invalid Canadian customs code
Context: The action is IIS-A6 or the multi-manifest indicator is 'Y'
GIVEN
The action is IIS-A6 or the multi-manifest indicator is 'Y'
Applied to: Get Manifest From Port from Shipment Root
WHEN
The manifest from port in the shipment root is blank
THEN
The system sets the manifest from port to 'IIS-A6'
Applied to: Get Manifest To Port from Shipment Root
WHEN
The manifest to port in the shipment root is blank
THEN
The system sets the manifest to port to 'IIS-A6'
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Log Error - Invalid Manifest Port
WHEN
The manifest to port is blank or not provided
THEN
The system sets error flag 1 to indicate missing manifest to port
Context: A manifest to port lookup in the MC table is successful
GIVEN
A manifest to port lookup in the MC table is successful
Applied to: Set US Port Exit Code for Manifest To Station
WHEN
The Canadian customs code in the MC table record equals '00000'
THEN
The system clears the MC table data and sets error flag 2 with the port name for invalid Canadian customs code
Context: A shipment has a manifest to port defined
GIVEN
A shipment has a manifest to port defined
Applied to: Log Error - Invalid Manifest Port
WHEN
The system attempts to look up the manifest to port in the MC table and the lookup fails
THEN
The system clears the MC table data and sets error flag 3 with the port name for invalid manifest port
R-GCCCCADD-cbl-01044 (+4) File: GCCCCADD.cbl Special CCN Type 9 Processing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special CCN Type 9 Processing':
  • Context - a shipment with a ccn key is being processed:
    For Check CCN Type:
    When the system checks the ccn type from the ccn key, then the system identifies if the ccn type equals '9' for special processing.
  • Context - a shipment with ccn type 9 is being processed:
    For Are Current Settings Valid for Type 9?:
    When the system evaluates the us exit code, manifest from station name, manifest to station name, and their relationship, then the system determines settings are invalid if us exit code is not '00000' or manifest from station is not 'iis-a6' or manifest to station is not 'iis-a6' or manifest from station does not equal manifest to station.
  • Context - a shipment with ccn type 9 has invalid current manifest port settings:
    For Apply Special Type 9 Rules:
    When the system applies special type 9 processing rules, then the system sets both manifest from station name and manifest to station name to 'iis-a6'.
  • Context - a shipment with ccn type 9 has valid current manifest port settings:
    For Keep Existing Manifest Port Settings:
    When the system processes the manifest port information, then the system preserves the existing manifest to station code, destination station number, and call letters without modification.
  • Context - a shipment with ccn type that is not '9' is being processed:
    For Continue Normal Processing:
    When the system evaluates the ccn type, then the system continues with normal manifest port processing without applying special type 9 rules.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with a CCN key is being processed
GIVEN
A shipment with a CCN key is being processed
Applied to: Check CCN Type
WHEN
The system checks the CCN type from the CCN key
THEN
The system identifies if the CCN type equals '9' for special processing
Context: A shipment with CCN type 9 is being processed
GIVEN
A shipment with CCN type 9 is being processed
Applied to: Are Current Settings Valid for Type 9?
WHEN
The system evaluates the US exit code, manifest from station name, manifest to station name, and their relationship
THEN
The system determines settings are invalid if US exit code is not '00000' OR manifest from station is not 'IIS-A6' OR manifest to station is not 'IIS-A6' OR manifest from station does not equal manifest to station
Context: A shipment with CCN type 9 has invalid current manifest port settings
GIVEN
A shipment with CCN type 9 has invalid current manifest port settings
Applied to: Apply Special Type 9 Rules
WHEN
The system applies special type 9 processing rules
THEN
The system sets both manifest from station name and manifest to station name to 'IIS-A6'
Context: A shipment with CCN type 9 has valid current manifest port settings
GIVEN
A shipment with CCN type 9 has valid current manifest port settings
Applied to: Keep Existing Manifest Port Settings
WHEN
The system processes the manifest port information
THEN
The system preserves the existing manifest to station code, destination station number, and call letters without modification
Context: A shipment with CCN type that is not '9' is being processed
GIVEN
A shipment with CCN type that is not '9' is being processed
Applied to: Continue Normal Processing
WHEN
The system evaluates the CCN type
THEN
The system continues with normal manifest port processing without applying special type 9 rules
R-GCCCCADD-cbl-01049 (+5) File: GCCCCADD.cbl Destination Country Classification Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Destination Country Classification':
  • Context - a destination country classification process is starting:
    For Set Destination as Non-US by Default:
    When the system begins destination country determination, then the destination should be set as non-us by default.
  • Context - a state-country lookup needs to be performed:
    For Initialize State Lookup Index:
    When the system prepares to search the state-country table, then the lookup index should be set to position 1.
  • Context - a destination state code from shipment root and a state-country lookup table:
    For Does Destination State Match Table Entry?:
    When the system searches for the destination state code in the lookup table, then the system should identify if the destination state code matches any table entry.
  • Context - a state code match is found in the lookup table:
    For Is Country Code 'US'?:
    When the system checks the corresponding country code for the matched state, then the system should determine if the country code equals 'us'.
  • Context - a destination state code matches a lookup table entry with country code 'us':
    For Set Destination as US:
    When the state-country verification confirms us destination, then the destination should be classified as us.
  • Context - a destination state code either does not match any lookup table entry or matches an entry with non-us country code:
    For Keep Destination as Non-US:
    When the state-country verification does not confirm us destination, then the destination should remain classified as non-us.
👨‍💻 Technical ACs (Gherkin)
Context: A destination country classification process is starting
GIVEN
A destination country classification process is starting
Applied to: Set Destination as Non-US by Default
WHEN
The system begins destination country determination
THEN
The destination should be set as non-US by default
Context: A state-country lookup needs to be performed
GIVEN
A state-country lookup needs to be performed
Applied to: Initialize State Lookup Index
WHEN
The system prepares to search the state-country table
THEN
The lookup index should be set to position 1
Context: A destination state code from shipment root and a state-country lookup table
GIVEN
A destination state code from shipment root and a state-country lookup table
Applied to: Does Destination State Match Table Entry?
WHEN
The system searches for the destination state code in the lookup table
THEN
The system should identify if the destination state code matches any table entry
Context: A state code match is found in the lookup table
GIVEN
A state code match is found in the lookup table
Applied to: Is Country Code 'US'?
WHEN
The system checks the corresponding country code for the matched state
THEN
The system should determine if the country code equals 'US'
Context: A destination state code matches a lookup table entry with country code 'US'
GIVEN
A destination state code matches a lookup table entry with country code 'US'
Applied to: Set Destination as US
WHEN
The state-country verification confirms US destination
THEN
The destination should be classified as US
Context: A destination state code either does not match any lookup table entry or matches an entry with non-US country code
GIVEN
A destination state code either does not match any lookup table entry or matches an entry with non-US country code
Applied to: Keep Destination as Non-US
WHEN
The state-country verification does not confirm US destination
THEN
The destination should remain classified as non-US
R-GCCCCADD-cbl-01055 (+8) File: GCCCCADD.cbl Customer Bonded Siding Determination Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customer Bonded Siding Determination':
  • Context - a shipment with consignee chop code and destination station number:
    For Customer Bonded Siding Determination - Determine if consignee has bonded siding using RF table lookup with consignee CHOP and station:
    When the system performs rf table lookup using consignee chop and destination station, then the system sets customer bonded indicator to true if rf record is found, otherwise sets it to false.
  • Context - a request to lookup rf table data:
    For Initialize RF Table Lookup Parameters:
    When the system initializes rf table lookup parameters, then all lookup parameters are cleared and function code is set to 'gu' for table retrieval.
  • Context - shipment root data containing consignee chop code:
    For Set Consignee CHOP from Shipment Root:
    When the system prepares rf table lookup parameters, then the consignee chop code from shipment root is assigned to the rf table lookup key.
  • Context - customs cargo data with destination station number:
    For Set Destination Station Number:
    When the system prepares rf table lookup parameters, then the destination station number is assigned to the rf table lookup key.
  • Context - a requirement to lookup rail facility data:
    For Set Table ID to 'RF':
    When the system sets up table lookup parameters, then the table id is set to 'rf' to identify the rail facility table.
  • Context - rf table lookup parameters with consignee chop, destination station, and table id 'rf':
    For Call RF Table Lookup:
    When the system calls the table lookup function, then the system attempts to retrieve matching rf table record.
  • Context - a successful rf table lookup with retrieved record data:
    For Extract Sub-location Code from RF Record:
    When the system processes the rf table record, then the sub-location code is extracted from the rf record and assigned to customs cargo data.
  • Context - a successful rf table lookup that returns a matching record:
    For Set Customer Bonded Indicator to TRUE:
    When the system processes the lookup result, then the customer bonded indicator is set to true indicating the consignee has bonded siding.
  • Context - an unsuccessful rf table lookup that returns no matching record:
    For Set Customer Bonded Indicator to FALSE:
    When the system processes the lookup result, then the customer bonded indicator is set to false indicating the consignee does not have bonded siding.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with consignee CHOP code and destination station number
GIVEN
A shipment with consignee CHOP code and destination station number
Applied to: Customer Bonded Siding Determination - Determine if consignee has bonded siding using RF table lookup with consignee CHOP and station
WHEN
The system performs RF table lookup using consignee CHOP and destination station
THEN
The system sets customer bonded indicator to TRUE if RF record is found, otherwise sets it to FALSE
Context: A request to lookup RF table data
GIVEN
A request to lookup RF table data
Applied to: Initialize RF Table Lookup Parameters
WHEN
The system initializes RF table lookup parameters
THEN
All lookup parameters are cleared and function code is set to 'GU' for table retrieval
Context: Shipment root data containing consignee CHOP code
GIVEN
Shipment root data containing consignee CHOP code
Applied to: Set Consignee CHOP from Shipment Root
WHEN
The system prepares RF table lookup parameters
THEN
The consignee CHOP code from shipment root is assigned to the RF table lookup key
Context: Customs cargo data with destination station number
GIVEN
Customs cargo data with destination station number
Applied to: Set Destination Station Number
WHEN
The system prepares RF table lookup parameters
THEN
The destination station number is assigned to the RF table lookup key
Context: A requirement to lookup rail facility data
GIVEN
A requirement to lookup rail facility data
Applied to: Set Table ID to 'RF'
WHEN
The system sets up table lookup parameters
THEN
The table ID is set to 'RF' to identify the Rail Facility table
Context: RF table lookup parameters with consignee CHOP, destination station, and table ID 'RF'
GIVEN
RF table lookup parameters with consignee CHOP, destination station, and table ID 'RF'
Applied to: Call RF Table Lookup
WHEN
The system calls the table lookup function
THEN
The system attempts to retrieve matching RF table record
Context: A successful RF table lookup with retrieved record data
GIVEN
A successful RF table lookup with retrieved record data
Applied to: Extract Sub-location Code from RF Record
WHEN
The system processes the RF table record
THEN
The sub-location code is extracted from the RF record and assigned to customs cargo data
Context: A successful RF table lookup that returns a matching record
GIVEN
A successful RF table lookup that returns a matching record
Applied to: Set Customer Bonded Indicator to TRUE
WHEN
The system processes the lookup result
THEN
The customer bonded indicator is set to TRUE indicating the consignee has bonded siding
Context: An unsuccessful RF table lookup that returns no matching record
GIVEN
An unsuccessful RF table lookup that returns no matching record
Applied to: Set Customer Bonded Indicator to FALSE
WHEN
The system processes the lookup result
THEN
The customer bonded indicator is set to FALSE indicating the consignee does not have bonded siding
R-GCCCCADD-cbl-01070 (+2) File: GCCCCADD.cbl TOFC/COFC Conveying Car Default Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'TOFC/COFC Conveying Car Default':
  • Context - a shipment has conveying car initial information already populated:
    For Use Existing Conveying Car Initial and Number:
    When the system processes conveying car information, then the existing conveying car initial and number are retained and used.
  • Context - a shipment has no conveying car initial information and the shipment type is tofc (t) or cofc (c):
    For Set Default Conveying Car Initial = 'UNKN' Number = '00000001':
    When the system processes conveying car information, then the conveying car initial is set to 'unkn' and the conveying car number is set to '00000001'.
  • Context - a shipment has no conveying car initial information and the shipment type is neither tofc (t) nor cofc (c):
    For Clear Conveying Car Information Set to Spaces:
    When the system processes conveying car information, then the conveying car initial and number fields are cleared and set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has conveying car initial information already populated
GIVEN
A shipment has conveying car initial information already populated
Applied to: Use Existing Conveying Car Initial and Number
WHEN
The system processes conveying car information
THEN
The existing conveying car initial and number are retained and used
Context: A shipment has no conveying car initial information AND the shipment type is TOFC (T) or COFC (C)
GIVEN
A shipment has no conveying car initial information AND the shipment type is TOFC (T) or COFC (C)
Applied to: Set Default Conveying Car Initial = 'UNKN' Number = '00000001'
WHEN
The system processes conveying car information
THEN
The conveying car initial is set to 'UNKN' AND the conveying car number is set to '00000001'
Context: A shipment has no conveying car initial information AND the shipment type is neither TOFC (T) nor COFC (C)
GIVEN
A shipment has no conveying car initial information AND the shipment type is neither TOFC (T) nor COFC (C)
Applied to: Clear Conveying Car Information Set to Spaces
WHEN
The system processes conveying car information
THEN
The conveying car initial and number fields are cleared and set to spaces
R-GCCCCADD-cbl-01073 (+5) File: GCCCCADD.cbl Car ID Validation and Formatting Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Car ID Validation and Formatting':
  • Context - a shipment record with conveying car information:
    For Conveying Car Initial Present?:
    When the system checks for conveying car initial data, then if conveying car initial is not empty, proceed to validation; otherwise skip car id processing.
  • Context - conveying car initial is present:
    For Set Car Values for Validation:
    When the system prepares car data for validation, then clear car validation fields and set both original and destination car values to the conveying car identifier.
  • Context - car values are prepared for validation:
    For Call GCCCARID Utility:
    When the system calls the gcccarid validation utility, then the utility processes the car identification and returns validation results.
  • Context - car id validation has been performed:
    For Validation Successful?:
    When the system checks the validation result, then if destination car value contains all asterisks, validation failed; otherwise validation succeeded.
  • Context - car id validation was successful:
    For Update Car ID with Formatted Value:
    When the system updates the car identification, then set the conveying car field to the validated destination car value.
  • Context - car id validation failed:
    For Generate Invalid Car Error Message:
    When the system processes the validation failure, then generate an invalid conveying car error message using the original car value and add it to the message collection.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with conveying car information
GIVEN
A shipment record with conveying car information
Applied to: Conveying Car Initial Present?
WHEN
The system checks for conveying car initial data
THEN
If conveying car initial is not empty, proceed to validation; otherwise skip car ID processing
Context: Conveying car initial is present
GIVEN
Conveying car initial is present
Applied to: Set Car Values for Validation
WHEN
The system prepares car data for validation
THEN
Clear car validation fields and set both original and destination car values to the conveying car identifier
Context: Car values are prepared for validation
GIVEN
Car values are prepared for validation
Applied to: Call GCCCARID Utility
WHEN
The system calls the GCCCARID validation utility
THEN
The utility processes the car identification and returns validation results
Context: Car ID validation has been performed
GIVEN
Car ID validation has been performed
Applied to: Validation Successful?
WHEN
The system checks the validation result
THEN
If destination car value contains all asterisks, validation failed; otherwise validation succeeded
Context: Car ID validation was successful
GIVEN
Car ID validation was successful
Applied to: Update Car ID with Formatted Value
WHEN
The system updates the car identification
THEN
Set the conveying car field to the validated destination car value
Context: Car ID validation failed
GIVEN
Car ID validation failed
Applied to: Generate Invalid Car Error Message
WHEN
The system processes the validation failure
THEN
Generate an invalid conveying car error message using the original car value and add it to the message collection
R-GCCCCADD-cbl-01079 (+1) File: GCCCCADD.cbl Previous Carrier Control Number Processing Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Previous Carrier Control Number Processing':
  • Context - a shipment record with previous carrier number field:
    For Previous Carrier Number = '0000' or Spaces?:
    When the previous carrier number is '0000' or spaces, then the system continues processing without setting the previous carrier control number field.
  • Context - a shipment record with valid previous carrier number (not '0000' or spaces) and previous cargo control number:
    For Format Combined Previous CCN:
    When the system processes the previous carrier information, then the system combines the previous carrier number (positions 1-4) with the previous cargo control number (positions 5-21) and stores the result in the previous carrier control number field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with previous carrier number field
GIVEN
A shipment record with previous carrier number field
Applied to: Previous Carrier Number = '0000' or Spaces?
WHEN
The previous carrier number is '0000' or spaces
THEN
The system continues processing without setting the previous carrier control number field
Context: A shipment record with valid previous carrier number (not '0000' or spaces) and previous cargo control number
GIVEN
A shipment record with valid previous carrier number (not '0000' or spaces) and previous cargo control number
Applied to: Format Combined Previous CCN
WHEN
The system processes the previous carrier information
THEN
The system combines the previous carrier number (positions 1-4) with the previous cargo control number (positions 5-21) and stores the result in the previous carrier control number field
R-GCCCCADD-cbl-01081 (+3) File: GCCCCADD.cbl Load/Empty Status Quantity Qualifier Setting Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Load/Empty Status Quantity Qualifier Setting':
  • Context - equipment load/empty status is available from shipment data:
    For Set Quantity Qualifier to 'UNT' Units:
    When equipment status equals 'e' indicating empty equipment, then quantity qualifier is set to 'unt' for units measurement.
  • Context - equipment is loaded (not empty) and current quantity qualifier exists:
    For Set Quantity Qualifier to 'PCS' Pieces:
    When current quantity qualifier equals 'c/l' or 'cld' or 'cl ' or ' cl' indicating carload types, then quantity qualifier is set to 'pcs' for pieces measurement.
  • Context - a quantity qualifier has been determined for the shipment:
    For Validate Quantity Qualifier Against MU Table:
    When the quantity qualifier is looked up in the mu (measurement unit) table, then if qualifier is not found in mu table, generate error message indicating qualifier is not valid.
  • Context - shipment processing requires a quantity qualifier:
    For Validate Quantity Qualifier Against MU Table:
    When quantity qualifier is blank or spaces, then generate error message indicating quantity qualifier is required.
👨‍💻 Technical ACs (Gherkin)
Context: Equipment load/empty status is available from shipment data
GIVEN
Equipment load/empty status is available from shipment data
Applied to: Set Quantity Qualifier to 'UNT' Units
WHEN
Equipment status equals 'E' indicating empty equipment
THEN
Quantity qualifier is set to 'UNT' for units measurement
Context: Equipment is loaded (not empty) and current quantity qualifier exists
GIVEN
Equipment is loaded (not empty) and current quantity qualifier exists
Applied to: Set Quantity Qualifier to 'PCS' Pieces
WHEN
Current quantity qualifier equals 'C/L' or 'CLD' or 'CL ' or ' CL' indicating carload types
THEN
Quantity qualifier is set to 'PCS' for pieces measurement
Context: A quantity qualifier has been determined for the shipment
GIVEN
A quantity qualifier has been determined for the shipment
Applied to: Validate Quantity Qualifier Against MU Table
WHEN
The quantity qualifier is looked up in the MU (Measurement Unit) table
THEN
If qualifier is not found in MU table, generate error message indicating qualifier is not valid
Context: Shipment processing requires a quantity qualifier
GIVEN
Shipment processing requires a quantity qualifier
Applied to: Validate Quantity Qualifier Against MU Table
WHEN
Quantity qualifier is blank or spaces
THEN
Generate error message indicating quantity qualifier is required
R-GCCCCADD-cbl-01094 (+4) File: GCCCCADD.cbl Default Address Assignment Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Default Address Assignment':
  • Context - a shipment record is being processed for customs manifest creation:
    For Set Shipper Address 1 to 'NA':
    When the shipper address line 1 field is empty or contains only spaces, then the system shall set the shipper address line 1 to 'na'.
    For Set Consignee Address 1 to 'NA':
    When the consignee address line 1 field is empty or contains only spaces, then the system shall set the consignee address line 1 to 'na'.
  • Context - a shipment record is being processed and shipper address line 2 exists:
    For Set Shipper Address 2 to 'NA' and Country to 'US':
    When the shipper address line 2 is empty or (the first character is not empty and characters 2-18 are all spaces), then the system shall set shipper address line 2 positions 1-18 to 'na' and set shipper country code to 'us'.
  • Context - a shipment record is being processed and consignee address line 2 exists:
    For Set Consignee Address 2 to 'NA' and Country to 'CA':
    When the consignee address line 2 is empty or (the first character is not empty and characters 2-18 are all spaces), then the system shall set consignee address line 2 positions 1-18 to 'na' and set consignee country code to 'ca'.
  • Context - an n1 entity segment is being processed for customs record creation:
    For Set Entity Address to 'NA':
    When the entity address line 1 field is empty or contains only spaces, then the system shall set the entity address line 1 to 'na'.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record is being processed for customs manifest creation
GIVEN
A shipment record is being processed for customs manifest creation
Applied to: Set Shipper Address 1 to 'NA'
WHEN
The shipper address line 1 field is empty or contains only spaces
THEN
The system shall set the shipper address line 1 to 'NA'
Applied to: Set Consignee Address 1 to 'NA'
WHEN
The consignee address line 1 field is empty or contains only spaces
THEN
The system shall set the consignee address line 1 to 'NA'
Context: A shipment record is being processed and shipper address line 2 exists
GIVEN
A shipment record is being processed and shipper address line 2 exists
Applied to: Set Shipper Address 2 to 'NA' and Country to 'US'
WHEN
The shipper address line 2 is empty OR (the first character is not empty AND characters 2-18 are all spaces)
THEN
The system shall set shipper address line 2 positions 1-18 to 'NA' and set shipper country code to 'US'
Context: A shipment record is being processed and consignee address line 2 exists
GIVEN
A shipment record is being processed and consignee address line 2 exists
Applied to: Set Consignee Address 2 to 'NA' and Country to 'CA'
WHEN
The consignee address line 2 is empty OR (the first character is not empty AND characters 2-18 are all spaces)
THEN
The system shall set consignee address line 2 positions 1-18 to 'NA' and set consignee country code to 'CA'
Context: An N1 entity segment is being processed for customs record creation
GIVEN
An N1 entity segment is being processed for customs record creation
Applied to: Set Entity Address to 'NA'
WHEN
The entity address line 1 field is empty or contains only spaces
THEN
The system shall set the entity address line 1 to 'NA'
R-GCCCCADD-cbl-01099 (+5) File: GCCCCADD.cbl Country Code Assignment from State Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Country Code Assignment from State':
  • Context - a shipper address exists with a state/province code:
    For Get Shipper State/Province Code:
    When the system looks up the state/province code in the state-country reference table, then the corresponding country code is assigned to the shipper.
  • Context - shipper address is spaces or shipper address has only first character and remaining 17 characters are spaces:
    For Set Default US Country Code for Shipper:
    When the system processes shipper address information, then the shipper country code is set to 'us'.
  • Context - a shipper has a state/province code that is not spaces:
    For Generate Invalid State Error Message:
    When the state/province code is not found in the state-country lookup table, then an invalid shipper province/state code error message is generated.
  • Context - a consignee address exists with a state/province code:
    For Get Consignee State/Province Code:
    When the system looks up the state/province code in the state-country reference table, then the corresponding country code is assigned to the consignee.
  • Context - consignee address is spaces or consignee address has only first character and remaining 17 characters are spaces:
    For Set Default CA Country Code for Consignee:
    When the system processes consignee address information, then the consignee country code is set to 'ca'.
  • Context - a consignee has a state/province code that is not spaces:
    For Generate Invalid State Error Message:
    When the state/province code is not found in the state-country lookup table, then an invalid consignee province/state code error message is generated.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper address exists with a state/province code
GIVEN
A shipper address exists with a state/province code
Applied to: Get Shipper State/Province Code
WHEN
The system looks up the state/province code in the state-country reference table
THEN
The corresponding country code is assigned to the shipper
Context: Shipper address is spaces OR shipper address has only first character and remaining 17 characters are spaces
GIVEN
Shipper address is spaces OR shipper address has only first character and remaining 17 characters are spaces
Applied to: Set Default US Country Code for Shipper
WHEN
The system processes shipper address information
THEN
The shipper country code is set to 'US'
Context: A shipper has a state/province code that is not spaces
GIVEN
A shipper has a state/province code that is not spaces
Applied to: Generate Invalid State Error Message
WHEN
The state/province code is not found in the state-country lookup table
THEN
An invalid shipper province/state code error message is generated
Context: A consignee address exists with a state/province code
GIVEN
A consignee address exists with a state/province code
Applied to: Get Consignee State/Province Code
WHEN
The system looks up the state/province code in the state-country reference table
THEN
The corresponding country code is assigned to the consignee
Context: Consignee address is spaces OR consignee address has only first character and remaining 17 characters are spaces
GIVEN
Consignee address is spaces OR consignee address has only first character and remaining 17 characters are spaces
Applied to: Set Default CA Country Code for Consignee
WHEN
The system processes consignee address information
THEN
The consignee country code is set to 'CA'
Context: A consignee has a state/province code that is not spaces
GIVEN
A consignee has a state/province code that is not spaces
Applied to: Generate Invalid State Error Message
WHEN
The state/province code is not found in the state-country lookup table
THEN
An invalid consignee province/state code error message is generated
R-GCCCCADD-cbl-01105 (+4) File: GCCCCADD.cbl Notify Party Information Inheritance Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Notify Party Information Inheritance':
  • Context - a shipment record contains consignee data with name and address information:
    For Extract Notify Party Name from Shipment Data:
    When the notify party name field is extracted from the consignee data and is not blank, then the notify party address line 1, address line 2, and country code are automatically populated with the corresponding consignee address information.
  • Context - a shipment record has been processed and consignee information has been extracted:
    For Notify Party Name Exists?:
    When the system evaluates the notify party name field from the consignee data, then if the notify party name is not blank, the system proceeds with address inheritance, otherwise it skips the notify party address setup.
  • Context - a notify party name exists and consignee address line 1 is available:
    For Copy Consignee Address Line 1 to Notify Party Address Line 1:
    When the system processes notify party address inheritance, then the consignee's address line 1 is copied to the notify party's address line 1 field.
  • Context - a notify party name exists and consignee address line 2 is available:
    For Copy Consignee Address Line 2 to Notify Party Address Line 2:
    When the system processes notify party address inheritance, then the consignee's address line 2 is copied to the notify party's address line 2 field.
  • Context - a notify party name exists and consignee country code is available:
    For Copy Consignee Country Code to Notify Party Country Code:
    When the system processes notify party address inheritance, then the consignee's country code is copied to the notify party's country code field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record contains consignee data with name and address information
GIVEN
A shipment record contains consignee data with name and address information
Applied to: Extract Notify Party Name from Shipment Data
WHEN
The notify party name field is extracted from the consignee data and is not blank
THEN
The notify party address line 1, address line 2, and country code are automatically populated with the corresponding consignee address information
Context: A shipment record has been processed and consignee information has been extracted
GIVEN
A shipment record has been processed and consignee information has been extracted
Applied to: Notify Party Name Exists?
WHEN
The system evaluates the notify party name field from the consignee data
THEN
If the notify party name is not blank, the system proceeds with address inheritance, otherwise it skips the notify party address setup
Context: A notify party name exists and consignee address line 1 is available
GIVEN
A notify party name exists and consignee address line 1 is available
Applied to: Copy Consignee Address Line 1 to Notify Party Address Line 1
WHEN
The system processes notify party address inheritance
THEN
The consignee's address line 1 is copied to the notify party's address line 1 field
Context: A notify party name exists and consignee address line 2 is available
GIVEN
A notify party name exists and consignee address line 2 is available
Applied to: Copy Consignee Address Line 2 to Notify Party Address Line 2
WHEN
The system processes notify party address inheritance
THEN
The consignee's address line 2 is copied to the notify party's address line 2 field
Context: A notify party name exists and consignee country code is available
GIVEN
A notify party name exists and consignee country code is available
Applied to: Copy Consignee Country Code to Notify Party Country Code
WHEN
The system processes notify party address inheritance
THEN
The consignee's country code is copied to the notify party's country code field
R-GCCCCADD-cbl-01110 (+6) File: GCCCCADD.cbl Special Handling Code Description Processing Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Special Handling Code Description Processing':
  • Context - a shipment has special handling codes in positions 1 through 7:
    For Get Special Handling Code at Counter Position:
    When the system processes each special handling code position, then the system should extract the special handling code and instruction for each position.
  • Context - a special handling code exists at a specific position:
    For Code = 'VA' or 'EV' or 'VS'?:
    When the code is va, ev, or vs, then the system should process the code and its associated instruction.
  • Context - a valid special handling code (va, ev, or vs) is identified:
    For Extract Code and Instruction:
    When the system processes the code, then the system should extract both the code and its instruction into working storage.
  • Context - special handling code and instruction have been extracted:
    For First Special Handling Slot Empty?:
    When the first special handling slot is empty, then the system should store the code and instruction in the first slot.
  • Context - special handling code and instruction have been extracted and the first slot is occupied:
    For Second Special Handling Slot Empty?:
    When the second special handling slot is empty, then the system should store the code and instruction in the second slot.
  • Context - special handling code and instruction have been extracted and both first and second slots are occupied:
    For Store in Third Special Handling Slot:
    When the system needs to store the information, then the system should store the code and instruction in the third slot.
  • Context - the system is processing special handling codes:
    For Counter <= 7?:
    When the counter is less than or equal to 7, then the system should continue processing the next special handling code position.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has special handling codes in positions 1 through 7
GIVEN
A shipment has special handling codes in positions 1 through 7
Applied to: Get Special Handling Code at Counter Position
WHEN
The system processes each special handling code position
THEN
The system should extract the special handling code and instruction for each position
Context: A special handling code exists at a specific position
GIVEN
A special handling code exists at a specific position
Applied to: Code = 'VA' or 'EV' or 'VS'?
WHEN
The code is VA, EV, or VS
THEN
The system should process the code and its associated instruction
Context: A valid special handling code (VA, EV, or VS) is identified
GIVEN
A valid special handling code (VA, EV, or VS) is identified
Applied to: Extract Code and Instruction
WHEN
The system processes the code
THEN
The system should extract both the code and its instruction into working storage
Context: Special handling code and instruction have been extracted
GIVEN
Special handling code and instruction have been extracted
Applied to: First Special Handling Slot Empty?
WHEN
The first special handling slot is empty
THEN
The system should store the code and instruction in the first slot
Context: Special handling code and instruction have been extracted and the first slot is occupied
GIVEN
Special handling code and instruction have been extracted and the first slot is occupied
Applied to: Second Special Handling Slot Empty?
WHEN
The second special handling slot is empty
THEN
The system should store the code and instruction in the second slot
Context: Special handling code and instruction have been extracted and both first and second slots are occupied
GIVEN
Special handling code and instruction have been extracted and both first and second slots are occupied
Applied to: Store in Third Special Handling Slot
WHEN
The system needs to store the information
THEN
The system should store the code and instruction in the third slot
Context: The system is processing special handling codes
GIVEN
The system is processing special handling codes
Applied to: Counter <= 7?
WHEN
The counter is less than or equal to 7
THEN
The system should continue processing the next special handling code position
R-GCCCCADD-cbl-01128 (+10) File: GCCCCADD.cbl Multiple CCN Manifest Creation Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Multiple CCN Manifest Creation':
  • Context - an edi bol has been processed and ccn array data is available:
    For Check CCN Array from EDI BOL:
    When the system checks the ccn array table from gcwcbol, then the system determines if the ccn array contains valid data or is empty/low-values.
  • Context - the ccn array has been validated:
    For CCN Array Contains Data?:
    When the ccn array is spaces or low-values, then continue with normal processing without multiple ccn creation.
  • Context - the ccn array contains valid data:
    For Initialize CCN Index Counter:
    When multiple ccn processing is required, then initialize the ccn index counter to 1 for array iteration.
  • Context - ccn processing loop is active with current index position:
    For More CCNs to Process?:
    When the index is greater than 99 or the current ccn entry is spaces, then exit the ccn processing loop.
  • Context - a valid ccn index position within the array bounds:
    For Extract Current CCN from Array:
    When processing the current ccn entry, then extract the ccn value from gcwcbol-ccn array at the current index.
  • Context - a ccn is being processed for manifest creation:
    For Set Waybill Key for Spawn & Set Waybill Date for Spawn:
    When preparing the spawn message parameters, then set the spawn waybill key to the input waybill key from gcwccadd and set the spawn waybill date to the working storage waybill date.
  • Context - a ccn has been extracted from the array:
    For Set Current CCN for Spawn:
    When preparing the spawn message parameters, then set the spawn ccn to the current ccn from the array at the current index.
  • Context - a spawn message is being prepared for ccn processing:
    For Set Action Code to 'AM':
    When setting the action code parameter, then set the spawn action code to 'am' for manifest creation.
  • Context - all spawn message parameters are set:
    For Spawn GCT0111E Program:
    When invoking the manifest creation process, then call the z700-spawn-gct0111e procedure to execute the manifest creation program.
  • Context - a ccn has been processed successfully:
    For Increment CCN Index:
    When moving to the next ccn in the array, then increment the ccn index counter by 1.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL has been processed and CCN array data is available
GIVEN
An EDI BOL has been processed and CCN array data is available
Applied to: Check CCN Array from EDI BOL
WHEN
The system checks the CCN array table from GCWCBOL
THEN
The system determines if the CCN array contains valid data or is empty/low-values
Context: The CCN array has been validated
GIVEN
The CCN array has been validated
Applied to: CCN Array Contains Data?
WHEN
The CCN array is spaces or low-values
THEN
Continue with normal processing without multiple CCN creation
Context: The CCN array contains valid data
GIVEN
The CCN array contains valid data
Applied to: Initialize CCN Index Counter
WHEN
Multiple CCN processing is required
THEN
Initialize the CCN index counter to 1 for array iteration
Context: CCN processing loop is active with current index position
GIVEN
CCN processing loop is active with current index position
Applied to: More CCNs to Process?
WHEN
The index is greater than 99 or the current CCN entry is spaces
THEN
Exit the CCN processing loop
Context: A valid CCN index position within the array bounds
GIVEN
A valid CCN index position within the array bounds
Applied to: Extract Current CCN from Array
WHEN
Processing the current CCN entry
THEN
Extract the CCN value from GCWCBOL-CCN array at the current index
Context: A CCN is being processed for manifest creation
GIVEN
A CCN is being processed for manifest creation
Applied to: Set Waybill Key for Spawn & Set Waybill Date for Spawn
WHEN
Preparing the spawn message parameters
THEN
Set the spawn waybill key to the input waybill key from GCWCCADD AND Set the spawn waybill date to the working storage waybill date
Context: A CCN has been extracted from the array
GIVEN
A CCN has been extracted from the array
Applied to: Set Current CCN for Spawn
WHEN
Preparing the spawn message parameters
THEN
Set the spawn CCN to the current CCN from the array at the current index
Context: A spawn message is being prepared for CCN processing
GIVEN
A spawn message is being prepared for CCN processing
Applied to: Set Action Code to 'AM'
WHEN
Setting the action code parameter
THEN
Set the spawn action code to 'AM' for manifest creation
Context: All spawn message parameters are set
GIVEN
All spawn message parameters are set
Applied to: Spawn GCT0111E Program
WHEN
Invoking the manifest creation process
THEN
Call the Z700-SPAWN-GCT0111E procedure to execute the manifest creation program
Context: A CCN has been processed successfully
GIVEN
A CCN has been processed successfully
Applied to: Increment CCN Index
WHEN
Moving to the next CCN in the array
THEN
Increment the CCN index counter by 1
R-GCCCCADD-cbl-01139 (+7) File: GCCCCADD.cbl CSA Indicator Management with AU Data Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Indicator Management with AU Data':
  • Context - a shipment is being processed for customs manifest creation:
    For CSA Indicator Already On?:
    When the csa indicator is already set to on, then skip all csa indicator management processing and continue with normal manifest creation.
  • Context - a shipment is being processed and csa indicator is not already on:
    For AU Table Data Available?:
    When au table data is not available or accessible, then skip csa indicator management and continue with normal processing.
  • Context - a shipment is being processed with csa indicator off and au table data available:
    For Importer Data Present?:
    When importer data is already present in the manifest, then skip au table importer data retrieval and continue with normal processing.
  • Context - a shipment is being processed with no existing importer data and au table data is available:
    For Retrieve AU Table Importer Data:
    When the system needs to populate importer information, then retrieve importer name and business number from the au table using consignee chop and commodity code as lookup keys.
  • Context - importer data has been successfully retrieved from au table:
    For Set Importer Information from AU Table:
    When the system needs to populate importer information in the manifest, then set importer name from au table importer field and business number from au table business number field.
  • Context - importer information is being set from au table data:
    For Set Business Number Qualifier to M5:
    When the business number qualifier needs to be assigned, then set the business number qualifier to 'm5' to indicate the source is from authorized user table.
  • Context - importer information has been successfully set from au table data:
    For Turn CSA Indicator ON:
    When the csa indicator status needs to be updated, then set the csa indicator to on to indicate canada-us agreement processing is active.
  • Context - both au table importer data and edi bol importer data are found:
    For Turn CSA Indicator OFF:
    When the business number qualifier is 'bn' or blank, then turn the csa indicator off to deactivate canada-us agreement processing.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: CSA Indicator Already On?
WHEN
The CSA indicator is already set to ON
THEN
Skip all CSA indicator management processing and continue with normal manifest creation
Context: A shipment is being processed and CSA indicator is not already on
GIVEN
A shipment is being processed and CSA indicator is not already on
Applied to: AU Table Data Available?
WHEN
AU table data is not available or accessible
THEN
Skip CSA indicator management and continue with normal processing
Context: A shipment is being processed with CSA indicator off and AU table data available
GIVEN
A shipment is being processed with CSA indicator off and AU table data available
Applied to: Importer Data Present?
WHEN
Importer data is already present in the manifest
THEN
Skip AU table importer data retrieval and continue with normal processing
Context: A shipment is being processed with no existing importer data and AU table data is available
GIVEN
A shipment is being processed with no existing importer data and AU table data is available
Applied to: Retrieve AU Table Importer Data
WHEN
The system needs to populate importer information
THEN
Retrieve importer name and business number from the AU table using consignee chop and commodity code as lookup keys
Context: Importer data has been successfully retrieved from AU table
GIVEN
Importer data has been successfully retrieved from AU table
Applied to: Set Importer Information from AU Table
WHEN
The system needs to populate importer information in the manifest
THEN
Set importer name from AU table importer field and business number from AU table business number field
Context: Importer information is being set from AU table data
GIVEN
Importer information is being set from AU table data
Applied to: Set Business Number Qualifier to M5
WHEN
The business number qualifier needs to be assigned
THEN
Set the business number qualifier to 'M5' to indicate the source is from authorized user table
Context: Importer information has been successfully set from AU table data
GIVEN
Importer information has been successfully set from AU table data
Applied to: Turn CSA Indicator ON
WHEN
The CSA indicator status needs to be updated
THEN
Set the CSA indicator to ON to indicate Canada-US Agreement processing is active
Context: Both AU table importer data and EDI BOL importer data are found
GIVEN
Both AU table importer data and EDI BOL importer data are found
Applied to: Turn CSA Indicator OFF
WHEN
The business number qualifier is 'BN' or blank
THEN
Turn the CSA indicator OFF to deactivate Canada-US Agreement processing
R-GCCCCADD-cbl-01147 (+3) File: GCCCCADD.cbl Application Type and Transit Status Determination Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Application Type and Transit Status Determination':
  • Context - an origin station state code exists in the shipment data:
    For Get Origin Country Code from State Lookup:
    When the system performs a lookup in the state-country table using the origin station state code, then the corresponding country code is retrieved and assigned as the origin country, or spaces if no match is found.
  • Context - a destination station state code exists in the shipment data:
    For Get Destination Country Code from State Lookup:
    When the system performs a lookup in the state-country table using the destination station state code, then the corresponding country code is retrieved and assigned as the destination country, or spaces if no match is found.
  • Context - origin and destination country codes have been determined:
    For Search Application Type Table with Country Combinations:
    When the system searches the application type table using the country code combination, then if a matching combination is found, the corresponding application type and in-transit status are assigned; otherwise, both fields are set to spaces.
  • Context - the in-transit status is set to ocean and the ccn key starts with '6105e':
    For Is Ocean In-Transit and CCN starts with 6105E?:
    When the system evaluates the ocean in-transit status and ccn prefix combination, then the broker name is automatically set to 'not-req' without further broker processing.
👨‍💻 Technical ACs (Gherkin)
Context: An origin station state code exists in the shipment data
GIVEN
An origin station state code exists in the shipment data
Applied to: Get Origin Country Code from State Lookup
WHEN
The system performs a lookup in the state-country table using the origin station state code
THEN
The corresponding country code is retrieved and assigned as the origin country, or spaces if no match is found
Context: A destination station state code exists in the shipment data
GIVEN
A destination station state code exists in the shipment data
Applied to: Get Destination Country Code from State Lookup
WHEN
The system performs a lookup in the state-country table using the destination station state code
THEN
The corresponding country code is retrieved and assigned as the destination country, or spaces if no match is found
Context: Origin and destination country codes have been determined
GIVEN
Origin and destination country codes have been determined
Applied to: Search Application Type Table with Country Combinations
WHEN
The system searches the application type table using the country code combination
THEN
If a matching combination is found, the corresponding application type and in-transit status are assigned; otherwise, both fields are set to spaces
Context: The in-transit status is set to ocean and the CCN key starts with '6105E'
GIVEN
The in-transit status is set to ocean and the CCN key starts with '6105E'
Applied to: Is Ocean In-Transit and CCN starts with 6105E?
WHEN
The system evaluates the ocean in-transit status and CCN prefix combination
THEN
The broker name is automatically set to 'NOT-REQ' without further broker processing
R-GCCCCADD-cbl-01151 (+4) File: GCCCCADD.cbl Return Transit Origin Station Override Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Return Transit Origin Station Override':
  • Context - a shipment with an action code:
    For Check Action Code:
    When the action code is evaluated for return transit processing, then the system should identify rt action codes for special return transit handling.
  • Context - a shipment with action code rt:
    For Set In-Transit Status to Return:
    When the return transit processing is initiated, then the in-transit status should be set to return and application type should be set to 33.
  • Context - a return transit shipment with action code rt:
    For Clear Destination Station Numbers:
    When the return transit status is being configured, then the destination station number index and error/release status index should be cleared to spaces.
  • Context - a return transit shipment with a manifest from station name:
    For Search Port City State Table:
    When the system searches the gcsports port city state table, then the system should look for a port entry that matches the manifest from station name.
  • Context - a return transit shipment where the manifest from station name matches a port in the gcsports table:
    For Override Origin Station Name with Port City:
    When the port lookup is successful, then the origin station name should be overridden with the port city and the origin station state code should be overridden with the port state from the table.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an action code
GIVEN
A shipment with an action code
Applied to: Check Action Code
WHEN
The action code is evaluated for return transit processing
THEN
The system should identify RT action codes for special return transit handling
Context: A shipment with action code RT
GIVEN
A shipment with action code RT
Applied to: Set In-Transit Status to Return
WHEN
The return transit processing is initiated
THEN
The in-transit status should be set to RETURN and application type should be set to 33
Context: A return transit shipment with action code RT
GIVEN
A return transit shipment with action code RT
Applied to: Clear Destination Station Numbers
WHEN
The return transit status is being configured
THEN
The destination station number index and error/release status index should be cleared to spaces
Context: A return transit shipment with a manifest from station name
GIVEN
A return transit shipment with a manifest from station name
Applied to: Search Port City State Table
WHEN
The system searches the GCSPORTS port city state table
THEN
The system should look for a port entry that matches the manifest from station name
Context: A return transit shipment where the manifest from station name matches a port in the GCSPORTS table
GIVEN
A return transit shipment where the manifest from station name matches a port in the GCSPORTS table
Applied to: Override Origin Station Name with Port City
WHEN
The port lookup is successful
THEN
The origin station name should be overridden with the port city and the origin station state code should be overridden with the port state from the table
R-GCCCCADD-cbl-01156 (+2) File: GCCCCADD.cbl Transit Shipment CSA Indicator Reset Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Transit Shipment CSA Indicator Reset':
  • Context - a shipment is being processed for customs manifest creation:
    For Check Shipment Status:
    When the shipment has in-transit status of either transit or return and the csa indicator is currently on, then the system should reset the csa indicator to off, clear the importer name, clear the business number qualifier, clear the business number, and set the au importer flag to not found.
  • Context - a shipment has in-transit status of transit or return and csa indicator is on:
    For Clear Importer Name:
    When the system processes the importer data clearing logic, then the importer name field should be set to spaces, the business number qualifier should be set to spaces, and the business number should be set to spaces.
  • Context - a transit or return shipment with csa indicator on is being processed:
    For Set AU Importer Flag to Not Found:
    When the importer data clearing process is executed, then the au importer found flag should be set to not found status.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Check Shipment Status
WHEN
The shipment has in-transit status of either TRANSIT or RETURN and the CSA indicator is currently ON
THEN
The system should reset the CSA indicator to OFF, clear the importer name, clear the business number qualifier, clear the business number, and set the AU importer flag to not found
Context: A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is ON
GIVEN
A shipment has in-transit status of TRANSIT or RETURN and CSA indicator is ON
Applied to: Clear Importer Name
WHEN
The system processes the importer data clearing logic
THEN
The importer name field should be set to spaces, the business number qualifier should be set to spaces, and the business number should be set to spaces
Context: A transit or return shipment with CSA indicator ON is being processed
GIVEN
A transit or return shipment with CSA indicator ON is being processed
Applied to: Set AU Importer Flag to Not Found
WHEN
The importer data clearing process is executed
THEN
The AU importer found flag should be set to NOT FOUND status
R-GCCCCADD-cbl-01159 (+2) File: GCCCCADD.cbl Customer Bonded Indicator Reset for Transit Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customer Bonded Indicator Reset for Transit':
  • Context - a shipment has been processed and classified with an in-transit status:
    For Reset Customer Bonded Indicator to Spaces & Reset Sub-location Code to Spaces:
    When the shipment status is either in-transit or return movement, then the customer bonded indicator should be reset to spaces (cleared) and the sub-location code should be reset to spaces (cleared).
  • Context - a shipment is not classified as in-transit or return movement:
    For Keep Current Settings:
    When the sub-location error flag is set indicating an invalid sub-location code, then an error message for invalid destination station sub-location code should be added to the message list.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has been processed and classified with an in-transit status
GIVEN
A shipment has been processed and classified with an in-transit status
Applied to: Reset Customer Bonded Indicator to Spaces & Reset Sub-location Code to Spaces
WHEN
The shipment status is either in-transit or return movement
THEN
The customer bonded indicator should be reset to spaces (cleared) AND The sub-location code should be reset to spaces (cleared)
Context: A shipment is not classified as in-transit or return movement
GIVEN
A shipment is not classified as in-transit or return movement
Applied to: Keep Current Settings
WHEN
The sub-location error flag is set indicating an invalid sub-location code
THEN
An error message for invalid destination station sub-location code should be added to the message list
R-GCCCCADD-cbl-01511 (+14) File: GCCCCADD.cbl N1 Entity Segment Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1 Entity Segment Processing':
  • Context - an edi bol contains sf stuffer entity data with entity name pn type:
    For Build SF Stuffer Entity Segments:
    When processing sf entity segments from ebsnrsc data source, then extract entity name, address information from pa type, city/state/postal/country from pc type, and contact information from gp type, then create sf entity record with default 'na' address if address is blank.
  • Context - an edi bol contains uc ultimate consignee entity data with entity name un type:
    For Build UC Ultimate Consignee Segments:
    When processing uc entity segments from ebsnrsc data source, then extract entity name, address information from ua type, city/state/postal/country from uc type, and contact information from gp type, then create uc entity record with default 'na' address if address is blank.
  • Context - an edi bol contains bn beneficial owner entity data and tn transportation data exists:
    For Build BN Beneficial Owner Segments:
    When processing bn entity segments from ebsnrsc and ebsnrtd data sources, then extract entity name from bn type, address information from bt type, city/state/postal/country from by type, set consignee chop code, and create bn entity record with default 'na' address if address is blank.
  • Context - transportation data exists in ebsnrtd with c1 organization id or fastway consignee data code equals 'c':
    For Build C1 Carrier Entity Segments:
    When processing c1 entity segments from ebsnrtd or shiproot data sources, then if ebsnrtd data found, extract entity name from tn type, address from t2 type, city/state/postal/country from ta type, and contact from t3 type; otherwise use fastway consignee data with parsed address information and create c1 entity record.
  • Context - transportation data exists in ebsnrtd with n1 organization id:
    For Build N1 Notify Party Segments:
    When processing n1 entity segments from ebsnrtd data source, then extract entity name from tn type, address information from t2 type, city/state/postal/country from ta type, and contact information from t3 type, then create n1 entity record with default 'na' address if address is blank.
  • Context - mcoa data exists in ebsmcoa with organization id equals 'pf' or 'ss':
    For Build PF/SS MCOA Entity Segments:
    When processing pf/ss entity segments from ebsmcoa data source, then extract entity name, id code qualifier, and id code from ot type, address information from on type, city/state/postal/country from oc type, then create pf or ss entity record with default 'na' address if address is blank.
  • Context - transportation data exists in ebsnrtd with 11 organization id:
    For Build 11 Entity Segments:
    When processing 11 entity segments from ebsnrtd data source, then extract entity name from tn type, address information from t2 type, city/state/postal/country from ta type, and contact information from t3 type, then create 11 entity record with default 'na' address if address is blank.
  • Context - edi bol contains nn named entity data with valid entity id codes:
    For Build NN Entity Segments:
    When processing nn entity segments from ebsnrsc data source and entity id is valid, then extract entity name and consignee chop code, address information from gc type, city/state/postal/country from ga type, then create nn entity record with default 'na' address if address is blank.
  • Context - transportation data exists in ebsnrtd with mc organization id:
    For Build MC Entity Segments:
    When processing mc entity segments from ebsnrtd data source, then extract entity name from tn type, address information from t2 type, city/state/postal/country from ta type, and contact information from t3 type, then create mc entity record with default 'na' address if address is blank.
  • Context - transportation data exists in ebsnrtd with oo organization id:
    For Build OO Entity Segments:
    When processing oo entity segments from ebsnrtd data source, then extract entity name from tn type, address information from t2 type, city/state/postal/country from ta type, and contact information from t3 type, then create oo entity record with default 'na' address if address is blank.
  • Context - transportation data exists in ebsnrtd with fw organization id:
    For Build FW Entity Segments:
    When processing fw entity segments from ebsnrtd data source, then extract entity name from tn type, address information from t2 type, city/state/postal/country from ta type, and contact information from t3 type, then create fw entity record with default 'na' address if address is blank.
  • Context - edi bol contains im importer entity data or au table contains importer information and no existing importer record found in sequence 55:
    For Build IM Importer Segments:
    When processing im entity segments from ebsnrsc or au table data sources, then if edi data exists, extract importer name, business number qualifier, business number, address, and contact information; if only au table data exists, create importer record from au table with business number qualifier 'm5' and set csa indicator on; if both au and sequence 55 importer found with business number qualifier 'bn' or blank, turn csa indicator off.
  • Context - an entity record is being created and address information is blank or spaces:
    For Set Default Address Values:
    When processing any entity segment address data, then set address line 1 to 'na' if blank and leave address line 2 as spaces.
  • Context - an entity record contains state or province code information:
    For Assign Country Codes:
    When processing entity address information from fastway data, then search state-country lookup table to find matching state/province code and assign corresponding country code to entity record.
  • Context - an entity record is ready for insertion and current sequence index is within maximum sequence limit:
    For Insert Entity Record:
    When inserting entity record into sequence 55 array, then assign ccn key, record type '55', current sequence index to entity record, store in array, and increment sequence index by 1.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL contains SF stuffer entity data with entity name PN type
GIVEN
An EDI BOL contains SF stuffer entity data with entity name PN type
Applied to: Build SF Stuffer Entity Segments
WHEN
Processing SF entity segments from EBSNRSC data source
THEN
Extract entity name, address information from PA type, city/state/postal/country from PC type, and contact information from GP type, then create SF entity record with default 'NA' address if address is blank
Context: An EDI BOL contains UC ultimate consignee entity data with entity name UN type
GIVEN
An EDI BOL contains UC ultimate consignee entity data with entity name UN type
Applied to: Build UC Ultimate Consignee Segments
WHEN
Processing UC entity segments from EBSNRSC data source
THEN
Extract entity name, address information from UA type, city/state/postal/country from UC type, and contact information from GP type, then create UC entity record with default 'NA' address if address is blank
Context: An EDI BOL contains BN beneficial owner entity data and TN transportation data exists
GIVEN
An EDI BOL contains BN beneficial owner entity data and TN transportation data exists
Applied to: Build BN Beneficial Owner Segments
WHEN
Processing BN entity segments from EBSNRSC and EBSNRTD data sources
THEN
Extract entity name from BN type, address information from BT type, city/state/postal/country from BY type, set consignee chop code, and create BN entity record with default 'NA' address if address is blank
Context: Transportation data exists in EBSNRTD with C1 organization ID or Fastway consignee data code equals 'C'
GIVEN
Transportation data exists in EBSNRTD with C1 organization ID or Fastway consignee data code equals 'C'
Applied to: Build C1 Carrier Entity Segments
WHEN
Processing C1 entity segments from EBSNRTD or SHIPROOT data sources
THEN
If EBSNRTD data found, extract entity name from TN type, address from T2 type, city/state/postal/country from TA type, and contact from T3 type; otherwise use Fastway consignee data with parsed address information and create C1 entity record
Context: Transportation data exists in EBSNRTD with N1 organization ID
GIVEN
Transportation data exists in EBSNRTD with N1 organization ID
Applied to: Build N1 Notify Party Segments
WHEN
Processing N1 entity segments from EBSNRTD data source
THEN
Extract entity name from TN type, address information from T2 type, city/state/postal/country from TA type, and contact information from T3 type, then create N1 entity record with default 'NA' address if address is blank
Context: MCOA data exists in EBSMCOA with organization ID equals 'PF' or 'SS'
GIVEN
MCOA data exists in EBSMCOA with organization ID equals 'PF' or 'SS'
Applied to: Build PF/SS MCOA Entity Segments
WHEN
Processing PF/SS entity segments from EBSMCOA data source
THEN
Extract entity name, ID code qualifier, and ID code from OT type, address information from ON type, city/state/postal/country from OC type, then create PF or SS entity record with default 'NA' address if address is blank
Context: Transportation data exists in EBSNRTD with 11 organization ID
GIVEN
Transportation data exists in EBSNRTD with 11 organization ID
Applied to: Build 11 Entity Segments
WHEN
Processing 11 entity segments from EBSNRTD data source
THEN
Extract entity name from TN type, address information from T2 type, city/state/postal/country from TA type, and contact information from T3 type, then create 11 entity record with default 'NA' address if address is blank
Context: EDI BOL contains NN named entity data with valid entity ID codes
GIVEN
EDI BOL contains NN named entity data with valid entity ID codes
Applied to: Build NN Entity Segments
WHEN
Processing NN entity segments from EBSNRSC data source and entity ID is valid
THEN
Extract entity name and consignee chop code, address information from GC type, city/state/postal/country from GA type, then create NN entity record with default 'NA' address if address is blank
Context: Transportation data exists in EBSNRTD with MC organization ID
GIVEN
Transportation data exists in EBSNRTD with MC organization ID
Applied to: Build MC Entity Segments
WHEN
Processing MC entity segments from EBSNRTD data source
THEN
Extract entity name from TN type, address information from T2 type, city/state/postal/country from TA type, and contact information from T3 type, then create MC entity record with default 'NA' address if address is blank
Context: Transportation data exists in EBSNRTD with OO organization ID
GIVEN
Transportation data exists in EBSNRTD with OO organization ID
Applied to: Build OO Entity Segments
WHEN
Processing OO entity segments from EBSNRTD data source
THEN
Extract entity name from TN type, address information from T2 type, city/state/postal/country from TA type, and contact information from T3 type, then create OO entity record with default 'NA' address if address is blank
Context: Transportation data exists in EBSNRTD with FW organization ID
GIVEN
Transportation data exists in EBSNRTD with FW organization ID
Applied to: Build FW Entity Segments
WHEN
Processing FW entity segments from EBSNRTD data source
THEN
Extract entity name from TN type, address information from T2 type, city/state/postal/country from TA type, and contact information from T3 type, then create FW entity record with default 'NA' address if address is blank
Context: EDI BOL contains IM importer entity data or AU table contains importer information and no existing importer record found in sequence 55
GIVEN
EDI BOL contains IM importer entity data or AU table contains importer information and no existing importer record found in sequence 55
Applied to: Build IM Importer Segments
WHEN
Processing IM entity segments from EBSNRSC or AU table data sources
THEN
If EDI data exists, extract importer name, business number qualifier, business number, address, and contact information; if only AU table data exists, create importer record from AU table with business number qualifier 'M5' and set CSA indicator on; if both AU and sequence 55 importer found with business number qualifier 'BN' or blank, turn CSA indicator off
Context: An entity record is being created and address information is blank or spaces
GIVEN
An entity record is being created and address information is blank or spaces
Applied to: Set Default Address Values
WHEN
Processing any entity segment address data
THEN
Set address line 1 to 'NA' if blank and leave address line 2 as spaces
Context: An entity record contains state or province code information
GIVEN
An entity record contains state or province code information
Applied to: Assign Country Codes
WHEN
Processing entity address information from Fastway data
THEN
Search state-country lookup table to find matching state/province code and assign corresponding country code to entity record
Context: An entity record is ready for insertion and current sequence index is within maximum sequence limit
GIVEN
An entity record is ready for insertion and current sequence index is within maximum sequence limit
Applied to: Insert Entity Record
WHEN
Inserting entity record into sequence 55 array
THEN
Assign CCN key, record type '55', current sequence index to entity record, store in array, and increment sequence index by 1
R-GCCCCADD-cbl-01526 (+8) File: GCCCCADD.cbl Entity Data Population from EDI Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity Data Population from EDI':
  • Context - an edi bol key exists and entity type is specified:
    For Get EDI BOL Segment for Entity Type:
    When system attempts to retrieve entity segment data from ebsnrsc, then entity segment data is retrieved if found, otherwise segment is marked as not found.
  • Context - edi bol n1 segment data is available:
    For Extract Entity Name from N1 Segment:
    When system processes entity identification information, then entity id code, name, id code qualifier, and id code are extracted and populated.
  • Context - entity n1 segment has been processed and edi bol key exists:
    For Get Address Segment N3:
    When system attempts to retrieve address segment data from ebsnrsa, then address segment data is retrieved if found, otherwise address processing is skipped.
  • Context - edi bol n3 address segment data is available:
    For Extract Address Line 1:
    When system processes address information, then address line 1 and address line 2 are extracted and populated in entity record.
  • Context - entity address information has been processed and edi bol key exists:
    For Get City/State Segment N4:
    When system attempts to retrieve city/state segment data from ebsnrsa, then city/state segment data is retrieved if found, otherwise geographic processing is skipped.
  • Context - edi bol n4 city/state segment data is available:
    For Extract City Name:
    When system processes geographic information, then city name, state/province code, postal code, and country code are extracted and populated.
  • Context - entity geographic information has been processed and edi bol key exists:
    For Get Contact Segment PER:
    When system attempts to retrieve contact segment data from ebsnrsa or ebsnrtd, then contact segment data is retrieved if found, otherwise contact processing is skipped.
  • Context - edi bol per contact segment data is available:
    For Extract Contact Function Code:
    When system processes contact information, then contact function code, person name, communication number qualifier, and communication number are extracted and populated.
  • Context - entity address information is missing or empty spaces:
    For Set Default Address if Missing:
    When system validates address completeness, then address line 1 is set to 'na' as default value.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists and entity type is specified
GIVEN
An EDI BOL key exists and entity type is specified
Applied to: Get EDI BOL Segment for Entity Type
WHEN
System attempts to retrieve entity segment data from EBSNRSC
THEN
Entity segment data is retrieved if found, otherwise segment is marked as not found
Context: EDI BOL N1 segment data is available
GIVEN
EDI BOL N1 segment data is available
Applied to: Extract Entity Name from N1 Segment
WHEN
System processes entity identification information
THEN
Entity ID code, name, ID code qualifier, and ID code are extracted and populated
Context: Entity N1 segment has been processed and EDI BOL key exists
GIVEN
Entity N1 segment has been processed and EDI BOL key exists
Applied to: Get Address Segment N3
WHEN
System attempts to retrieve address segment data from EBSNRSA
THEN
Address segment data is retrieved if found, otherwise address processing is skipped
Context: EDI BOL N3 address segment data is available
GIVEN
EDI BOL N3 address segment data is available
Applied to: Extract Address Line 1
WHEN
System processes address information
THEN
Address line 1 and address line 2 are extracted and populated in entity record
Context: Entity address information has been processed and EDI BOL key exists
GIVEN
Entity address information has been processed and EDI BOL key exists
Applied to: Get City/State Segment N4
WHEN
System attempts to retrieve city/state segment data from EBSNRSA
THEN
City/state segment data is retrieved if found, otherwise geographic processing is skipped
Context: EDI BOL N4 city/state segment data is available
GIVEN
EDI BOL N4 city/state segment data is available
Applied to: Extract City Name
WHEN
System processes geographic information
THEN
City name, state/province code, postal code, and country code are extracted and populated
Context: Entity geographic information has been processed and EDI BOL key exists
GIVEN
Entity geographic information has been processed and EDI BOL key exists
Applied to: Get Contact Segment PER
WHEN
System attempts to retrieve contact segment data from EBSNRSA or EBSNRTD
THEN
Contact segment data is retrieved if found, otherwise contact processing is skipped
Context: EDI BOL PER contact segment data is available
GIVEN
EDI BOL PER contact segment data is available
Applied to: Extract Contact Function Code
WHEN
System processes contact information
THEN
Contact function code, person name, communication number qualifier, and communication number are extracted and populated
Context: Entity address information is missing or empty spaces
GIVEN
Entity address information is missing or empty spaces
Applied to: Set Default Address if Missing
WHEN
System validates address completeness
THEN
Address line 1 is set to 'NA' as default value
R-GCCCCADD-cbl-01535 (+7) File: GCCCCADD.cbl Entity Data Population from Fastway Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity Data Population from Fastway':
  • Context - edi bol data is not available for shipper entity and fastway shipment data exists:
    For Populate Shipper from Fastway:
    When building shipper record (sequence 0001) and shipper entity type is required, then set entity id to 'sh' and populate shipper chop code from shipment root and populate shipper name from shipment root and set default address values for missing fields.
  • Context - shipper address data from fastway shipment root is being processed:
    For Set Default Address Values:
    When shipper address field 1 is spaces or shipper address field 2 is spaces or has only first character with remaining spaces, then set shipper address field 1 to 'na' when spaces and set shipper address field 2 to 'na' for first 18 characters when spaces or incomplete and set shipper country code to 'us' when address field 2 is defaulted.
  • Context - edi bol data is not available for consignee entity and fastway shipment data exists:
    For Populate Consignee from Fastway:
    When building consignee record (sequence 0002) and consignee entity type is required, then set entity id to 'cn' and populate consignee chop code from shipment root and populate consignee name from shipment root consignee data field 1 and set default address values for missing fields.
  • Context - consignee address data from fastway shipment root is being processed:
    For Set Default Consignee Address:
    When consignee address field 3 is spaces or consignee address field 4 is spaces or has only first character with remaining spaces, then set consignee address field 1 to 'na' when field 3 is spaces and set consignee address field 2 to 'na' for first 18 characters when field 4 is spaces or incomplete and set consignee country code to 'ca' when address field 4 is defaulted.
  • Context - address data exists in fastway format and address parsing is required for entity:
    For Parse Address Components:
    When processing address field 2 for shipper or processing address field 4 for consignee or processing carrier address data, then parse address into city name, state/province code, and postal code components and lookup country code using state-country table based on state/province code and set country code from lookup result.
  • Context - state or province code exists from parsed address data and state-country lookup table is available:
    For Lookup Country Code:
    When country code determination is required for address validation, then search state-country table for matching state/province code and set country code from table entry when match found and set country code to spaces when no match found and add error message when country code cannot be determined.
  • Context - carrier entity type (c1) is required and edi bol data is not available and fastway shipment data exists:
    For Populate Carrier from Fastway:
    When building carrier record and consignee data code field 2 equals 'c', then set entity id to 'c1' and populate carrier name from consignee data field 2 and populate carrier address from consignee data field 3 and set carrier address to 'na' when field 3 is spaces and parse carrier address components for city, state, postal code, and country.
  • Context - entity record is being built for shipper or consignee:
    For Set Default NA for Missing Address:
    When shipper name is spaces or consignee name is spaces, then add error message for invalid shipper name when shipper name is missing and add error message for invalid consignee name when consignee name is missing.
👨‍💻 Technical ACs (Gherkin)
Context: EDI BOL data is not available for shipper entity AND Fastway shipment data exists
GIVEN
EDI BOL data is not available for shipper entity AND Fastway shipment data exists
Applied to: Populate Shipper from Fastway
WHEN
Building shipper record (sequence 0001) AND shipper entity type is required
THEN
Set entity ID to 'SH' AND populate shipper CHOP code from shipment root AND populate shipper name from shipment root AND set default address values for missing fields
Context: Shipper address data from Fastway shipment root is being processed
GIVEN
Shipper address data from Fastway shipment root is being processed
Applied to: Set Default Address Values
WHEN
Shipper address field 1 is spaces OR shipper address field 2 is spaces or has only first character with remaining spaces
THEN
Set shipper address field 1 to 'NA' when spaces AND set shipper address field 2 to 'NA' for first 18 characters when spaces or incomplete AND set shipper country code to 'US' when address field 2 is defaulted
Context: EDI BOL data is not available for consignee entity AND Fastway shipment data exists
GIVEN
EDI BOL data is not available for consignee entity AND Fastway shipment data exists
Applied to: Populate Consignee from Fastway
WHEN
Building consignee record (sequence 0002) AND consignee entity type is required
THEN
Set entity ID to 'CN' AND populate consignee CHOP code from shipment root AND populate consignee name from shipment root consignee data field 1 AND set default address values for missing fields
Context: Consignee address data from Fastway shipment root is being processed
GIVEN
Consignee address data from Fastway shipment root is being processed
Applied to: Set Default Consignee Address
WHEN
Consignee address field 3 is spaces OR consignee address field 4 is spaces or has only first character with remaining spaces
THEN
Set consignee address field 1 to 'NA' when field 3 is spaces AND set consignee address field 2 to 'NA' for first 18 characters when field 4 is spaces or incomplete AND set consignee country code to 'CA' when address field 4 is defaulted
Context: Address data exists in Fastway format AND address parsing is required for entity
GIVEN
Address data exists in Fastway format AND address parsing is required for entity
Applied to: Parse Address Components
WHEN
Processing address field 2 for shipper OR processing address field 4 for consignee OR processing carrier address data
THEN
Parse address into city name, state/province code, and postal code components AND lookup country code using state-country table based on state/province code AND set country code from lookup result
Context: State or province code exists from parsed address data AND state-country lookup table is available
GIVEN
State or province code exists from parsed address data AND state-country lookup table is available
Applied to: Lookup Country Code
WHEN
Country code determination is required for address validation
THEN
Search state-country table for matching state/province code AND set country code from table entry when match found AND set country code to spaces when no match found AND add error message when country code cannot be determined
Context: Carrier entity type (C1) is required AND EDI BOL data is not available AND Fastway shipment data exists
GIVEN
Carrier entity type (C1) is required AND EDI BOL data is not available AND Fastway shipment data exists
Applied to: Populate Carrier from Fastway
WHEN
Building carrier record AND consignee data code field 2 equals 'C'
THEN
Set entity ID to 'C1' AND populate carrier name from consignee data field 2 AND populate carrier address from consignee data field 3 AND set carrier address to 'NA' when field 3 is spaces AND parse carrier address components for city, state, postal code, and country
Context: Entity record is being built for shipper or consignee
GIVEN
Entity record is being built for shipper or consignee
Applied to: Set Default NA for Missing Address
WHEN
Shipper name is spaces OR consignee name is spaces
THEN
Add error message for invalid shipper name when shipper name is missing AND add error message for invalid consignee name when consignee name is missing
R-GCCCCADD-cbl-01543 (+5) File: GCCCCADD.cbl Entity Address Default Assignment Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity Address Default Assignment':
  • Context - a shipper record is being processed for customs manifest creation:
    For Set Shipper Address 1 to 'NA':
    When the shipper address line 1 field is empty or contains only spaces, then the system assigns 'na' as the default value for shipper address line 1.
    For Set Shipper Address 2 to 'NA':
    When the shipper address line 2 field is empty, contains only spaces, or has only the first character filled with remaining characters as spaces, then the system assigns 'na' as the default value for shipper address line 2 and sets country code to 'us'.
  • Context - a consignee record is being processed for customs manifest creation:
    For Set Consignee Address 1 to 'NA':
    When the consignee address line 1 field is empty or contains only spaces, then the system assigns 'na' as the default value for consignee address line 1.
    For Set Consignee Address 2 to 'NA':
    When the consignee address line 2 field is empty, contains only spaces, or has only the first character filled with remaining characters as spaces, then the system assigns 'na' as the default value for consignee address line 2 and sets country code to 'ca'.
  • Context - an entity record (sf, uc, bn, c1, n1, 11, mc, oo, fw) is being processed for customs manifest creation:
    For Set Entity N301 Address to 'NA':
    When the entity n301 address information field is empty or contains only spaces, then the system assigns 'na' as the default value for the entity n301 address information field.
  • Context - an importer record is being processed for customs manifest creation:
    For Set Importer Address to 'NA':
    When the importer address information field is empty, contains only spaces, or contains low-values, then the system assigns 'na' as the default value for the importer address information field.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper record is being processed for customs manifest creation
GIVEN
A shipper record is being processed for customs manifest creation
Applied to: Set Shipper Address 1 to 'NA'
WHEN
The shipper address line 1 field is empty or contains only spaces
THEN
The system assigns 'NA' as the default value for shipper address line 1
Applied to: Set Shipper Address 2 to 'NA'
WHEN
The shipper address line 2 field is empty, contains only spaces, or has only the first character filled with remaining characters as spaces
THEN
The system assigns 'NA' as the default value for shipper address line 2 and sets country code to 'US'
Context: A consignee record is being processed for customs manifest creation
GIVEN
A consignee record is being processed for customs manifest creation
Applied to: Set Consignee Address 1 to 'NA'
WHEN
The consignee address line 1 field is empty or contains only spaces
THEN
The system assigns 'NA' as the default value for consignee address line 1
Applied to: Set Consignee Address 2 to 'NA'
WHEN
The consignee address line 2 field is empty, contains only spaces, or has only the first character filled with remaining characters as spaces
THEN
The system assigns 'NA' as the default value for consignee address line 2 and sets country code to 'CA'
Context: An entity record (SF, UC, BN, C1, N1, 11, MC, OO, FW) is being processed for customs manifest creation
GIVEN
An entity record (SF, UC, BN, C1, N1, 11, MC, OO, FW) is being processed for customs manifest creation
Applied to: Set Entity N301 Address to 'NA'
WHEN
The entity N301 address information field is empty or contains only spaces
THEN
The system assigns 'NA' as the default value for the entity N301 address information field
Context: An importer record is being processed for customs manifest creation
GIVEN
An importer record is being processed for customs manifest creation
Applied to: Set Importer Address to 'NA'
WHEN
The importer address information field is empty, contains only spaces, or contains low-values
THEN
The system assigns 'NA' as the default value for the importer address information field
R-GCCCCADD-cbl-01549 (+6) File: GCCCCADD.cbl Entity Country Code Assignment Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity Country Code Assignment':
  • Context - an entity has a state or province code that needs country code assignment:
    For Entity has State/Province Code?:
    When the system processes the entity's location information, then the system should check if the entity has a valid state or province code before proceeding with country lookup.
  • Context - an entity has a state or province code requiring country assignment:
    For Initialize State Search Index to 1:
    When the system begins the lookup process, then the system should set the search index to position 1 to start searching from the beginning of the state-country table.
  • Context - the system is searching through the state-country lookup table:
    For State Code Matches Table Entry?:
    When the system compares the entity's state or province code with a table entry, then the system should determine if the state code exactly matches the current table entry.
  • Context - a matching state or province code is found in the state-country lookup table:
    For Assign Corresponding Country Code to Entity:
    When the system processes the matched entry, then the system should assign the corresponding country code from the table entry to the entity.
  • Context - the current table entry does not match the entity's state or province code:
    For More Table Entries to Check?:
    When the system evaluates the search progress, then the system should check if there are more entries remaining in the state-country lookup table to examine.
  • Context - there are more entries to check in the state-country lookup table:
    For Move to Next Table Entry:
    When the current entry does not match the entity's state or province code, then the system should increment the search index to move to the next table entry.
  • Context - the system has searched through all entries in the state-country lookup table:
    For No Country Code Found - Leave Blank:
    When no matching state or province code is found, then the system should leave the entity's country code field blank or unassigned.
👨‍💻 Technical ACs (Gherkin)
Context: An entity has a state or province code that needs country code assignment
GIVEN
An entity has a state or province code that needs country code assignment
Applied to: Entity has State/Province Code?
WHEN
The system processes the entity's location information
THEN
The system should check if the entity has a valid state or province code before proceeding with country lookup
Context: An entity has a state or province code requiring country assignment
GIVEN
An entity has a state or province code requiring country assignment
Applied to: Initialize State Search Index to 1
WHEN
The system begins the lookup process
THEN
The system should set the search index to position 1 to start searching from the beginning of the state-country table
Context: The system is searching through the state-country lookup table
GIVEN
The system is searching through the state-country lookup table
Applied to: State Code Matches Table Entry?
WHEN
The system compares the entity's state or province code with a table entry
THEN
The system should determine if the state code exactly matches the current table entry
Context: A matching state or province code is found in the state-country lookup table
GIVEN
A matching state or province code is found in the state-country lookup table
Applied to: Assign Corresponding Country Code to Entity
WHEN
The system processes the matched entry
THEN
The system should assign the corresponding country code from the table entry to the entity
Context: The current table entry does not match the entity's state or province code
GIVEN
The current table entry does not match the entity's state or province code
Applied to: More Table Entries to Check?
WHEN
The system evaluates the search progress
THEN
The system should check if there are more entries remaining in the state-country lookup table to examine
Context: There are more entries to check in the state-country lookup table
GIVEN
There are more entries to check in the state-country lookup table
Applied to: Move to Next Table Entry
WHEN
The current entry does not match the entity's state or province code
THEN
The system should increment the search index to move to the next table entry
Context: The system has searched through all entries in the state-country lookup table
GIVEN
The system has searched through all entries in the state-country lookup table
Applied to: No Country Code Found - Leave Blank
WHEN
No matching state or province code is found
THEN
The system should leave the entity's country code field blank or unassigned
R-GCCCCADD-cbl-01556 (+16) File: GCCCCADD.cbl N1 Segment Data Validation Merged 17 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'N1 Segment Data Validation':
  • Context - a record is identified as shipper (sequence 1) or consignee (sequence 2):
    For Are all core fields empty?:
    When all core fields (name, address, city/state/postal, contact) are empty, then generate required field errors for shipper name, consignee name, address, city, state, postal code, and country.
  • Context - a record has address data, city/state data, or contact data populated:
    For Entity ID or Name missing but other data present?:
    When entity id is missing or empty, then generate entity id required error message.
    For Entity ID or Name missing but other data present?:
    When name is missing or empty, then generate name required error message.
  • Context - a record has entity id populated:
    For Entity ID present but Name missing?:
    When name field is missing or empty, then generate name required error message.
    For Entity ID present but Address missing?:
    When address information is missing or empty, then generate address required error message.
  • Context - a record sequence number is greater than 2:
    For Entity ID invalid or restricted type?:
    When entity id is not in valid values list or is a restricted type (sh, cn, bn), then generate invalid entity id value error message.
  • Context - a record has city/state/postal data section populated:
    For City name missing?:
    When city name is missing or empty, then generate city name required error message.
  • Context - a record has city name populated:
    For City name too short?:
    When city name length is less than 2 characters, then generate minimum length requirement error message.
  • Context - a record has postal code populated:
    For Postal code too short?:
    When postal code length is less than 3 characters, then generate postal code minimum length requirement error message.
  • Context - a record has country code of ca, us, or mx:
    For State/Province missing?:
    When state or province code is missing or empty, then generate state/province required error message.
  • Context - a record has both state/province code and country code populated:
    For State/Country combination invalid?:
    When state/province code does not belong to the specified country based on lookup table, then generate invalid state/country combination error message.
  • Context - a record has state/province code populated but country code is missing:
    For Auto-assign Country from State:
    When state/province code lookup is performed, then assign corresponding country code from the state-country lookup table.
  • Context - a record has city/state/postal data populated:
    For Country code missing?:
    When country code is missing or empty after auto-assignment attempt, then generate country code required error message.
  • Context - a record has contact name populated:
    For Contact qualifier missing but name present?:
    When contact communication qualifier is missing or empty, then generate contact qualifier required error message.
  • Context - a record has contact communication number populated:
    For Contact qualifier missing but number present?:
    When contact communication qualifier is missing or empty, then generate contact qualifier required error message.
  • Context - a record has contact communication qualifier populated:
    For Contact qualifier invalid?:
    When contact qualifier is not spaces, 'fx', or 'te', then generate invalid contact qualifier value error message.
  • Context - a record has contact communication qualifier or contact name populated:
    For Contact number missing but qualifier/name present?:
    When contact communication number is missing or empty, then generate contact number required error message.
👨‍💻 Technical ACs (Gherkin)
Context: A record is identified as shipper (sequence 1) or consignee (sequence 2)
GIVEN
A record is identified as shipper (sequence 1) or consignee (sequence 2)
Applied to: Are all core fields empty?
WHEN
All core fields (name, address, city/state/postal, contact) are empty
THEN
Generate required field errors for shipper name, consignee name, address, city, state, postal code, and country
Context: A record has address data, city/state data, or contact data populated
GIVEN
A record has address data, city/state data, or contact data populated
Applied to: Entity ID or Name missing but other data present?
WHEN
Entity ID is missing or empty
THEN
Generate entity ID required error message
Applied to: Entity ID or Name missing but other data present?
WHEN
Name is missing or empty
THEN
Generate name required error message
Context: A record has entity ID populated
GIVEN
A record has entity ID populated
Applied to: Entity ID present but Name missing?
WHEN
Name field is missing or empty
THEN
Generate name required error message
Applied to: Entity ID present but Address missing?
WHEN
Address information is missing or empty
THEN
Generate address required error message
Context: A record sequence number is greater than 2
GIVEN
A record sequence number is greater than 2
Applied to: Entity ID invalid or restricted type?
WHEN
Entity ID is not in valid values list or is a restricted type (SH, CN, BN)
THEN
Generate invalid entity ID value error message
Context: A record has city/state/postal data section populated
GIVEN
A record has city/state/postal data section populated
Applied to: City name missing?
WHEN
City name is missing or empty
THEN
Generate city name required error message
Context: A record has city name populated
GIVEN
A record has city name populated
Applied to: City name too short?
WHEN
City name length is less than 2 characters
THEN
Generate minimum length requirement error message
Context: A record has postal code populated
GIVEN
A record has postal code populated
Applied to: Postal code too short?
WHEN
Postal code length is less than 3 characters
THEN
Generate postal code minimum length requirement error message
Context: A record has country code of CA, US, or MX
GIVEN
A record has country code of CA, US, or MX
Applied to: State/Province missing?
WHEN
State or province code is missing or empty
THEN
Generate state/province required error message
Context: A record has both state/province code and country code populated
GIVEN
A record has both state/province code and country code populated
Applied to: State/Country combination invalid?
WHEN
State/province code does not belong to the specified country based on lookup table
THEN
Generate invalid state/country combination error message
Context: A record has state/province code populated but country code is missing
GIVEN
A record has state/province code populated but country code is missing
Applied to: Auto-assign Country from State
WHEN
State/province code lookup is performed
THEN
Assign corresponding country code from the state-country lookup table
Context: A record has city/state/postal data populated
GIVEN
A record has city/state/postal data populated
Applied to: Country code missing?
WHEN
Country code is missing or empty after auto-assignment attempt
THEN
Generate country code required error message
Context: A record has contact name populated
GIVEN
A record has contact name populated
Applied to: Contact qualifier missing but name present?
WHEN
Contact communication qualifier is missing or empty
THEN
Generate contact qualifier required error message
Context: A record has contact communication number populated
GIVEN
A record has contact communication number populated
Applied to: Contact qualifier missing but number present?
WHEN
Contact communication qualifier is missing or empty
THEN
Generate contact qualifier required error message
Context: A record has contact communication qualifier populated
GIVEN
A record has contact communication qualifier populated
Applied to: Contact qualifier invalid?
WHEN
Contact qualifier is not spaces, 'FX', or 'TE'
THEN
Generate invalid contact qualifier value error message
Context: A record has contact communication qualifier or contact name populated
GIVEN
A record has contact communication qualifier or contact name populated
Applied to: Contact number missing but qualifier/name present?
WHEN
Contact communication number is missing or empty
THEN
Generate contact number required error message
R-GCCCCADD-cbl-01573 (+4) File: GCCCCADD.cbl Entity ID Value Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Entity ID Value Validation':
  • Context - a record segment contains address data, location data, or contact data:
    For Entity ID Code Present?:
    When the entity identification code field is empty or spaces, then generate a required entity id error message.
  • Context - an entity identification code is present in the record:
    For Entity ID Code Present?:
    When the entity name field is empty or spaces, then generate a required entity name error message.
  • Context - a record is being validated for entity type compliance:
    For Skip Validation for Basic Records:
    When the record sequence number is 1 (shipper) or 2 (consignee), then skip the entity id value validation and proceed to next validation step.
  • Context - a record sequence number is greater than 2 (extended entity record):
    For Entity ID in Allowed Values?:
    When the entity identification code is present but not in the list of valid entity types, then generate an invalid entity type error message.
  • Context - an extended record (sequence > 2) contains an entity identification code:
    For Entity ID is Shipper/Consignee/Broker?:
    When the entity type is shipper (sh), consignee (cn), or customs broker (cb), then generate an invalid entity type error message as these types are reserved for specific record positions.
👨‍💻 Technical ACs (Gherkin)
Context: A record segment contains address data, location data, or contact data
GIVEN
A record segment contains address data, location data, or contact data
Applied to: Entity ID Code Present?
WHEN
The entity identification code field is empty or spaces
THEN
Generate a required entity ID error message
Context: An entity identification code is present in the record
GIVEN
An entity identification code is present in the record
Applied to: Entity ID Code Present?
WHEN
The entity name field is empty or spaces
THEN
Generate a required entity name error message
Context: A record is being validated for entity type compliance
GIVEN
A record is being validated for entity type compliance
Applied to: Skip Validation for Basic Records
WHEN
The record sequence number is 1 (shipper) or 2 (consignee)
THEN
Skip the entity ID value validation and proceed to next validation step
Context: A record sequence number is greater than 2 (extended entity record)
GIVEN
A record sequence number is greater than 2 (extended entity record)
Applied to: Entity ID in Allowed Values?
WHEN
The entity identification code is present but not in the list of valid entity types
THEN
Generate an invalid entity type error message
Context: An extended record (sequence > 2) contains an entity identification code
GIVEN
An extended record (sequence > 2) contains an entity identification code
Applied to: Entity ID is Shipper/Consignee/Broker?
WHEN
The entity type is shipper (SH), consignee (CN), or customs broker (CB)
THEN
Generate an invalid entity type error message as these types are reserved for specific record positions
R-GCCCCADD-cbl-01578 File: GCCCCADD.cbl Address Information Requirement Validation
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Address Information Requirement Validation':
  • Context - an entity record is being processed with entity id and name fields:
    For Address Information Requirement Validation - Validate that address information is provided when entity ID and name are present:
    When the entity id is not spaces and the entity name is not spaces and the address line 1 is spaces, then the system generates an error message indicating that address information is required.
👨‍💻 Technical ACs (Gherkin)
Context: An entity record is being processed with entity ID and name fields
GIVEN
An entity record is being processed with entity ID and name fields
Applied to: Address Information Requirement Validation - Validate that address information is provided when entity ID and name are present
WHEN
The entity ID is not spaces AND the entity name is not spaces AND the address line 1 is spaces
THEN
The system generates an error message indicating that address information is required
R-GCCCCADD-cbl-01579 (+4) File: GCCCCADD.cbl City Name Length Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'City Name Length Validation':
  • Context - a city name field is provided in the address information:
    For City Name Length Validation - Validate city name has minimum 2 character length requirement:
    When the system validates the city name length, then if the city name has fewer than 2 characters, generate a minimum length requirement error message and add it to the error queue.
  • Context - an n4 segment with city name field is being processed:
    For City Name Present?:
    When the system checks for city name presence, then if city name is spaces, skip length validation and continue processing.
  • Context - a city name field with potential trailing spaces:
    For Get Actual String Length:
    When the system calculates the actual string length, then return the length excluding trailing spaces by iterating from the end until a non-space character is found.
  • Context - a city name that has fewer than 2 characters:
    For Generate Min Length Error Message:
    When the minimum length validation fails, then generate error message with code gccs-e-gen-min-len2-req indicating minimum 2 character length requirement.
  • Context - a validation error message has been generated:
    For Add Error to Message Queue:
    When the error needs to be recorded, then add the error message to the message queue if there are fewer than 10 messages already queued.
👨‍💻 Technical ACs (Gherkin)
Context: A city name field is provided in the address information
GIVEN
A city name field is provided in the address information
Applied to: City Name Length Validation - Validate city name has minimum 2 character length requirement
WHEN
The system validates the city name length
THEN
If the city name has fewer than 2 characters, generate a minimum length requirement error message and add it to the error queue
Context: An N4 segment with city name field is being processed
GIVEN
An N4 segment with city name field is being processed
Applied to: City Name Present?
WHEN
The system checks for city name presence
THEN
If city name is spaces, skip length validation and continue processing
Context: A city name field with potential trailing spaces
GIVEN
A city name field with potential trailing spaces
Applied to: Get Actual String Length
WHEN
The system calculates the actual string length
THEN
Return the length excluding trailing spaces by iterating from the end until a non-space character is found
Context: A city name that has fewer than 2 characters
GIVEN
A city name that has fewer than 2 characters
Applied to: Generate Min Length Error Message
WHEN
The minimum length validation fails
THEN
Generate error message with code GCCS-E-GEN-MIN-LEN2-REQ indicating minimum 2 character length requirement
Context: A validation error message has been generated
GIVEN
A validation error message has been generated
Applied to: Add Error to Message Queue
WHEN
The error needs to be recorded
THEN
Add the error message to the message queue if there are fewer than 10 messages already queued
R-GCCCCADD-cbl-01584 (+4) File: GCCCCADD.cbl Postal Code Length Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Postal Code Length Validation':
  • Context - a postal code field contains data:
    For Is Postal Code Present?:
    When the system validates the postal code, then the system should continue validation if postal code is not present.
  • Context - a postal code field contains data with potential trailing spaces:
    For Get Actual String Length Excluding Trailing Spaces:
    When the system needs to validate the postal code length, then the system should calculate the actual string length excluding trailing spaces.
  • Context - a postal code has been provided and its actual length calculated:
    For String Length >= 3?:
    When the actual string length is less than 3 characters, then the system should trigger a validation error for insufficient postal code length.
  • Context - a postal code has failed the minimum length validation:
    For Retrieve Error Message GCCS-E-GEN-MIN-LEN3-REQ:
    When the system needs to provide error feedback, then the system should retrieve the standard minimum length error message.
  • Context - a postal code validation error message has been retrieved:
    For Add Validation Error Message to Error Collection:
    When the system processes the validation failure, then the system should add the error message to the validation error collection.
👨‍💻 Technical ACs (Gherkin)
Context: A postal code field contains data
GIVEN
A postal code field contains data
Applied to: Is Postal Code Present?
WHEN
The system validates the postal code
THEN
The system should continue validation if postal code is not present
Context: A postal code field contains data with potential trailing spaces
GIVEN
A postal code field contains data with potential trailing spaces
Applied to: Get Actual String Length Excluding Trailing Spaces
WHEN
The system needs to validate the postal code length
THEN
The system should calculate the actual string length excluding trailing spaces
Context: A postal code has been provided and its actual length calculated
GIVEN
A postal code has been provided and its actual length calculated
Applied to: String Length >= 3?
WHEN
The actual string length is less than 3 characters
THEN
The system should trigger a validation error for insufficient postal code length
Context: A postal code has failed the minimum length validation
GIVEN
A postal code has failed the minimum length validation
Applied to: Retrieve Error Message GCCS-E-GEN-MIN-LEN3-REQ
WHEN
The system needs to provide error feedback
THEN
The system should retrieve the standard minimum length error message
Context: A postal code validation error message has been retrieved
GIVEN
A postal code validation error message has been retrieved
Applied to: Add Validation Error Message to Error Collection
WHEN
The system processes the validation failure
THEN
The system should add the error message to the validation error collection
R-GCCCCADD-cbl-01589 (+4) File: GCCCCADD.cbl State Province Requirement Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'State Province Requirement Validation':
  • Context - an n4 address segment is being processed for validation:
    For N4 Address Data Present?:
    When the n4 address data is completely empty or contains only spaces, then the system should skip all address validation and proceed to the next validation step.
  • Context - an address is being validated and the country code indicates canada, usa, or mexico:
    For State/Province Code Present?:
    When the state or province code field is empty or contains only spaces, then the system should generate a required state/province error message and add it to the validation error list.
  • Context - an address contains both a country code and a state/province code:
    For Valid State/Province for Country?:
    When the state/province code is validated against the country using the state-country lookup table, then if the state/province code is not valid for the specified country, the system should generate an invalid state/province error message.
  • Context - an address has a state/province code but no country code specified:
    For Set Country Code from State/Province Lookup:
    When the system looks up the state/province code in the state-country reference table, then the system should automatically set the country code based on the lookup result from the state-country table.
  • Context - an address is being validated and all other validation steps have been completed:
    For Continue Validation:
    When the country code field is empty or contains only spaces, then the system should generate a required country code error message and add it to the validation error list.
👨‍💻 Technical ACs (Gherkin)
Context: An N4 address segment is being processed for validation
GIVEN
An N4 address segment is being processed for validation
Applied to: N4 Address Data Present?
WHEN
The N4 address data is completely empty or contains only spaces
THEN
The system should skip all address validation and proceed to the next validation step
Context: An address is being validated and the country code indicates Canada, USA, or Mexico
GIVEN
An address is being validated and the country code indicates Canada, USA, or Mexico
Applied to: State/Province Code Present?
WHEN
The state or province code field is empty or contains only spaces
THEN
The system should generate a required state/province error message and add it to the validation error list
Context: An address contains both a country code and a state/province code
GIVEN
An address contains both a country code and a state/province code
Applied to: Valid State/Province for Country?
WHEN
The state/province code is validated against the country using the state-country lookup table
THEN
If the state/province code is not valid for the specified country, the system should generate an invalid state/province error message
Context: An address has a state/province code but no country code specified
GIVEN
An address has a state/province code but no country code specified
Applied to: Set Country Code from State/Province Lookup
WHEN
The system looks up the state/province code in the state-country reference table
THEN
The system should automatically set the country code based on the lookup result from the state-country table
Context: An address is being validated and all other validation steps have been completed
GIVEN
An address is being validated and all other validation steps have been completed
Applied to: Continue Validation
WHEN
The country code field is empty or contains only spaces
THEN
The system should generate a required country code error message and add it to the validation error list
R-GCCCCADD-cbl-01598 (+3) File: GCCCCADD.cbl Contact Information Validation Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Contact Information Validation':
  • Context - a contact record is being validated:
    For PER03 Qualifier Empty AND Contact Name NOT Empty?:
    When the communication number qualifier (per03) is empty and the contact person name (per02) is not empty, then generate an error message indicating that communication qualifier is required.
    For PER03 Qualifier Empty AND Communication Number NOT Empty?:
    When the communication number qualifier (per03) is empty and the communication number (per04) is not empty, then generate an error message indicating that communication qualifier is required.
    For Communication Qualifier NOT Empty OR Contact Name NOT Empty?:
    When the communication number qualifier (per03) is not empty or the contact person name (per02) is not empty and the communication number (per04) is empty, then generate an error message indicating that communication number is required.
  • Context - a contact record with a communication number qualifier is being validated:
    For PER03 Qualifier Valid? Blank, FX, or TE:
    When the communication number qualifier (per03) is not blank, 'fx', or 'te', then generate an error message indicating invalid qualifier value.
👨‍💻 Technical ACs (Gherkin)
Context: A contact record is being validated
GIVEN
A contact record is being validated
Applied to: PER03 Qualifier Empty AND Contact Name NOT Empty?
WHEN
The communication number qualifier (PER03) is empty AND the contact person name (PER02) is not empty
THEN
Generate an error message indicating that communication qualifier is required
Applied to: PER03 Qualifier Empty AND Communication Number NOT Empty?
WHEN
The communication number qualifier (PER03) is empty AND the communication number (PER04) is not empty
THEN
Generate an error message indicating that communication qualifier is required
Applied to: Communication Qualifier NOT Empty OR Contact Name NOT Empty?
WHEN
The communication number qualifier (PER03) is not empty OR the contact person name (PER02) is not empty AND the communication number (PER04) is empty
THEN
Generate an error message indicating that communication number is required
Context: A contact record with a communication number qualifier is being validated
GIVEN
A contact record with a communication number qualifier is being validated
Applied to: PER03 Qualifier Valid? Blank, FX, or TE
WHEN
The communication number qualifier (PER03) is not blank, 'FX', or 'TE'
THEN
Generate an error message indicating invalid qualifier value
R-GCCCCADD-cbl-01602 (+2) File: GCCCCADD.cbl Communication Qualifier Validation Merged 3 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Communication Qualifier Validation':
  • Context - a contact record is being validated:
    For Contact Name Present?:
    When contact name is not blank and communication qualifier is blank, then system generates required communication qualifier error message.
    For Communication Number Present?:
    When communication number is not blank and communication qualifier is blank, then system generates required communication qualifier error message.
  • Context - a contact record with communication qualifier is being validated:
    For Communication Qualifier Valid?:
    When communication qualifier is not blank and not 'fx' and not 'te', then system generates invalid communication qualifier value error message.
👨‍💻 Technical ACs (Gherkin)
Context: A contact record is being validated
GIVEN
A contact record is being validated
Applied to: Contact Name Present?
WHEN
Contact name is not blank AND communication qualifier is blank
THEN
System generates required communication qualifier error message
Applied to: Communication Number Present?
WHEN
Communication number is not blank AND communication qualifier is blank
THEN
System generates required communication qualifier error message
Context: A contact record with communication qualifier is being validated
GIVEN
A contact record with communication qualifier is being validated
Applied to: Communication Qualifier Valid?
WHEN
Communication qualifier is not blank AND not 'FX' AND not 'TE'
THEN
System generates invalid communication qualifier value error message
R-GCCCCADD-cbl-01605 (+10) File: GCCCCADD.cbl Bunch Bill Car Search Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bunch Bill Car Search Processing':
  • Context - a shipment with an action code:
    For Action Code = 'US' or 'RT'?:
    When the system checks if bunch bill car search is required, then processing continues to carload validation if action code is 'us' (transit) or 'rt' (return), otherwise skip bunch bill search.
  • Context - a shipment with us or rt action code:
    For Short Multiple Ship Carload?:
    When the system checks the shipment carload type, then proceed with bunch bill car search if shipment is marked as short multiple ship carload, otherwise use original shipment data.
  • Context - a qualified shipment requiring bunch bill car search:
    For Initialize Search Parameters:
    When the system initializes the search process, then clear search segments, set waybill key as search key, and prepare for equipment sequence iteration.
  • Context - an active equipment search process:
    For Car Sequence ≤ 200?:
    When the system checks the current search sequence number, then continue searching if sequence is 200 or less, otherwise terminate search as not found.
  • Context - a valid search sequence number within bounds:
    For Get Equipment Record by Sequence:
    When the system attempts to retrieve equipment record, then call equipment management system to get equipment data for the specified sequence.
  • Context - an equipment retrieval attempt:
    For Equipment Record Found?:
    When the system checks if equipment data was successfully retrieved, then proceed with equipment id comparison if record found, otherwise mark search as not found.
  • Context - a successfully retrieved equipment record and target car id:
    For Equipment ID = Target Car ID?:
    When the system compares equipment id with target car id, then mark as found and update shipment data if ids match, otherwise increment sequence and continue search.
  • Context - equipment id matches the target car id:
    For Set Car Found Flag:
    When the system processes the successful match, then set car found flag to true and prepare to update shipment data with found equipment information.
  • Context - a successfully matched equipment record:
    For Move Equipment Data to SHIPROOT:
    When the system updates shipment data, then replace original shipment root data with the found equipment data from bunch bill.
  • Context - equipment id does not match target car id:
    For Increment Car Sequence:
    When the system continues the search process, then increment the car sequence number by 1 and continue with boundary check.
  • Context - search sequence exceeds 200 or equipment record not found:
    For Set Car Not Found Flag:
    When the system terminates the search process, then set car not found flag and continue processing with original shipment data.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an action code
GIVEN
A shipment with an action code
Applied to: Action Code = 'US' or 'RT'?
WHEN
The system checks if bunch bill car search is required
THEN
Processing continues to carload validation if action code is 'US' (Transit) or 'RT' (Return), otherwise skip bunch bill search
Context: A shipment with US or RT action code
GIVEN
A shipment with US or RT action code
Applied to: Short Multiple Ship Carload?
WHEN
The system checks the shipment carload type
THEN
Proceed with bunch bill car search if shipment is marked as short multiple ship carload, otherwise use original shipment data
Context: A qualified shipment requiring bunch bill car search
GIVEN
A qualified shipment requiring bunch bill car search
Applied to: Initialize Search Parameters
WHEN
The system initializes the search process
THEN
Clear search segments, set waybill key as search key, and prepare for equipment sequence iteration
Context: An active equipment search process
GIVEN
An active equipment search process
Applied to: Car Sequence ≤ 200?
WHEN
The system checks the current search sequence number
THEN
Continue searching if sequence is 200 or less, otherwise terminate search as not found
Context: A valid search sequence number within bounds
GIVEN
A valid search sequence number within bounds
Applied to: Get Equipment Record by Sequence
WHEN
The system attempts to retrieve equipment record
THEN
Call equipment management system to get equipment data for the specified sequence
Context: An equipment retrieval attempt
GIVEN
An equipment retrieval attempt
Applied to: Equipment Record Found?
WHEN
The system checks if equipment data was successfully retrieved
THEN
Proceed with equipment ID comparison if record found, otherwise mark search as not found
Context: A successfully retrieved equipment record and target car ID
GIVEN
A successfully retrieved equipment record and target car ID
Applied to: Equipment ID = Target Car ID?
WHEN
The system compares equipment ID with target car ID
THEN
Mark as found and update shipment data if IDs match, otherwise increment sequence and continue search
Context: Equipment ID matches the target car ID
GIVEN
Equipment ID matches the target car ID
Applied to: Set Car Found Flag
WHEN
The system processes the successful match
THEN
Set car found flag to true and prepare to update shipment data with found equipment information
Context: A successfully matched equipment record
GIVEN
A successfully matched equipment record
Applied to: Move Equipment Data to SHIPROOT
WHEN
The system updates shipment data
THEN
Replace original shipment root data with the found equipment data from bunch bill
Context: Equipment ID does not match target car ID
GIVEN
Equipment ID does not match target car ID
Applied to: Increment Car Sequence
WHEN
The system continues the search process
THEN
Increment the car sequence number by 1 and continue with boundary check
Context: Search sequence exceeds 200 or equipment record not found
GIVEN
Search sequence exceeds 200 or equipment record not found
Applied to: Set Car Not Found Flag
WHEN
The system terminates the search process
THEN
Set car not found flag and continue processing with original shipment data
R-GCCCCADD-cbl-01616 (+1) File: GCCCCADD.cbl Manifest Port Override Processing Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manifest Port Override Processing':
  • Context - a shipment record exists with manifest port information:
    For Override Manifest From Port with Calling Program Value:
    When the calling program provides a manifest from port override value that is not spaces, then the shipment's manifest from port is updated with the calling program's provided value.
    For Override Manifest To Port with Calling Program Value:
    When the calling program provides a manifest to port override value that is not spaces, then the shipment's manifest to port is updated with the calling program's provided value.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record exists with manifest port information
GIVEN
A shipment record exists with manifest port information
Applied to: Override Manifest From Port with Calling Program Value
WHEN
The calling program provides a manifest from port override value that is not spaces
THEN
The shipment's manifest from port is updated with the calling program's provided value
Applied to: Override Manifest To Port with Calling Program Value
WHEN
The calling program provides a manifest to port override value that is not spaces
THEN
The shipment's manifest to port is updated with the calling program's provided value
R-GCCCCADD-cbl-01618 (+3) File: GCCCCADD.cbl String Length Calculation Utility Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'String Length Calculation Utility':
  • Context - a string field that may contain trailing spaces:
    For String Length Calculation Utility:
    When the system needs to determine the actual content length, then the system calculates length by counting from the end until a non-space character is found.
  • Context - a city name field in an address record:
    For Validate Field Length Requirements:
    When the actual string length of the city name is less than 2 characters, then the system generates a minimum length requirement error message.
  • Context - a postal code field in an address record:
    For Validate Field Length Requirements:
    When the actual string length of the postal code is less than 3 characters and postal code is not empty, then the system generates a minimum length requirement error message.
  • Context - a postal code field when called from gcx011 system and the postal code is not empty:
    For Check Postal Code Length:
    When the actual string length of the postal code is less than 5 characters, then the system pads the postal code with periods to make it exactly 5 characters long.
👨‍💻 Technical ACs (Gherkin)
Context: A string field that may contain trailing spaces
GIVEN
A string field that may contain trailing spaces
Applied to: String Length Calculation Utility
WHEN
The system needs to determine the actual content length
THEN
The system calculates length by counting from the end until a non-space character is found
Context: A city name field in an address record
GIVEN
A city name field in an address record
Applied to: Validate Field Length Requirements
WHEN
The actual string length of the city name is less than 2 characters
THEN
The system generates a minimum length requirement error message
Context: A postal code field in an address record
GIVEN
A postal code field in an address record
Applied to: Validate Field Length Requirements
WHEN
The actual string length of the postal code is less than 3 characters and postal code is not empty
THEN
The system generates a minimum length requirement error message
Context: A postal code field when called from GCX011 system and the postal code is not empty
GIVEN
A postal code field when called from GCX011 system and the postal code is not empty
Applied to: Check Postal Code Length
WHEN
The actual string length of the postal code is less than 5 characters
THEN
The system pads the postal code with periods to make it exactly 5 characters long
R-GCCCCADD-cbl-01622 (+3) File: GCCCCADD.cbl Communication Number Validation Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Communication Number Validation':
  • Context - a contact record with communication number qualifier populated and contact name not populated:
    For Communication Number Qualifier Present?:
    When the communication number field is empty, then generate error message indicating communication number is required.
  • Context - a contact record with contact name populated and communication number qualifier not populated:
    For Contact Name Present?:
    When the communication number field is empty, then generate error message indicating communication number is required.
  • Context - a contact record with communication number qualifier or contact name populated:
    For Communication Number Present?:
    When the communication number field contains a value, then communication number validation passes successfully.
  • Context - a contact record with no communication number qualifier and no contact name:
    For Validation Passed:
    When communication number validation is performed, then validation passes without requiring communication number.
👨‍💻 Technical ACs (Gherkin)
Context: A contact record with communication number qualifier populated and contact name not populated
GIVEN
A contact record with communication number qualifier populated and contact name not populated
Applied to: Communication Number Qualifier Present?
WHEN
The communication number field is empty
THEN
Generate error message indicating communication number is required
Context: A contact record with contact name populated and communication number qualifier not populated
GIVEN
A contact record with contact name populated and communication number qualifier not populated
Applied to: Contact Name Present?
WHEN
The communication number field is empty
THEN
Generate error message indicating communication number is required
Context: A contact record with communication number qualifier or contact name populated
GIVEN
A contact record with communication number qualifier or contact name populated
Applied to: Communication Number Present?
WHEN
The communication number field contains a value
THEN
Communication number validation passes successfully
Context: A contact record with no communication number qualifier and no contact name
GIVEN
A contact record with no communication number qualifier and no contact name
Applied to: Validation Passed
WHEN
Communication number validation is performed
THEN
Validation passes without requiring communication number
R-GCCCCADD-cbl-01642 (+14) File: GCCCCADD.cbl Automated Haulage Flag Setting Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Automated Haulage Flag Setting':
  • Context - a shipment with an ima (intermodal agreement) code:
    For Is IMA Code = 'HM'?:
    When the system checks if the ima code equals 'hm' (haulage mode), then the system should proceed with haulage processing if true, or clear haulage fields if false.
  • Context - a shipment in haulage mode (ima code = 'hm'):
    For Haulage Right Carrier Available?:
    When the system checks if haulage right carrier field is populated (not spaces), then the system should proceed with carrier lookup if available, or set unknown defaults if not available.
  • Context - a haulage mode shipment without a specified haulage rights carrier:
    For Set Unknown Haulage Rights SCAC:
    When the carrier field is spaces or empty, then the system should set haulage rights scac to 'unkn', clear automated flag, set bill owner to 'unkn', and set reject haulage status.
  • Context - a haulage mode shipment with a specified haulage rights carrier:
    For Lookup Carrier Code in CC Table:
    When the system looks up the carrier in the cc (carrier code) table, then the system should retrieve the ccra code if found, or proceed with unknown defaults if not found.
  • Context - a successful carrier code lookup in the cc table:
    For Set Haulage Rights SCAC from Table:
    When the carrier code is found and validated, then the system should set the haulage rights scac to the ccra code from the table.
  • Context - a validated haulage rights scac and canadian customs port code:
    For Build SS Table Key with Port Code and SCAC:
    When the system needs to lookup haulage agreement details, then the system should build the ss table key using 'c' prefix, 3-digit port code, and either the haulage scac or default '6105' if scac is spaces.
  • Context - a constructed ss table key with port code and carrier scac:
    For Lookup Haulage Agreement in SS Table:
    When the system looks up the haulage agreement in the ss table, then the system should retrieve agreement details if found, or proceed with default handling if not found.
  • Context - a successful ss table lookup for haulage agreement:
    For Get Automated Carrier Flag from SS Table:
    When the system processes the automated carrier flag from the agreement, then the system should set the haulage automated flag and determine bill owner (6105 if automated).
  • Context - a haulage agreement with automated carrier flag set to true:
    For Set Bill Owner to 6105:
    When the system processes automated haulage billing, then the system should set the bill owner to '6105' (standard railway code).
  • Context - a haulage agreement record from the ss table:
    For Haulage Agreement = 'Y'?:
    When the system checks if the haulage agreement field equals 'y', then the system should set accept haulage status if 'y', or reject haulage status if not 'y'.
  • Context - a haulage agreement with agreement field set to 'y':
    For Set Accept Haulage Status:
    When the system processes the acceptance decision, then the system should set the haulage status to 'accept'.
  • Context - a haulage agreement with agreement field not equal to 'y' or missing carrier information:
    For Set Reject Haulage Status:
    When the system processes the rejection decision, then the system should set the haulage status to 'reject'.
  • Context - a successful ss table lookup with haulage agreement details:
    For Set Bill As SCAC from SS Table:
    When the system determines billing arrangements, then the system should set bill as scac to haulage bill initial if haulage mode, or line bill initial if not haulage mode.
  • Context - a failed ss table lookup for haulage agreement:
    For Set Default Values for Missing SS Entry:
    When the system cannot find agreement details, then the system should set default values: clear automated flag and set reject status for haulage mode, or set bill owner and bill as scac to '6105' for non-haulage mode.
  • Context - a shipment with ima code not equal to 'hm':
    For Clear Haulage Fields for Non-Haulage:
    When the system processes non-haulage shipments, then the system should clear haulage rights scac, automated flag, and reject haulage indicator.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA (Intermodal Agreement) code
GIVEN
A shipment with an IMA (Intermodal Agreement) code
Applied to: Is IMA Code = 'HM'?
WHEN
The system checks if the IMA code equals 'HM' (Haulage Mode)
THEN
The system should proceed with haulage processing if true, or clear haulage fields if false
Context: A shipment in haulage mode (IMA code = 'HM')
GIVEN
A shipment in haulage mode (IMA code = 'HM')
Applied to: Haulage Right Carrier Available?
WHEN
The system checks if haulage right carrier field is populated (not spaces)
THEN
The system should proceed with carrier lookup if available, or set unknown defaults if not available
Context: A haulage mode shipment without a specified haulage rights carrier
GIVEN
A haulage mode shipment without a specified haulage rights carrier
Applied to: Set Unknown Haulage Rights SCAC
WHEN
The carrier field is spaces or empty
THEN
The system should set haulage rights SCAC to 'UNKN', clear automated flag, set bill owner to 'UNKN', and set reject haulage status
Context: A haulage mode shipment with a specified haulage rights carrier
GIVEN
A haulage mode shipment with a specified haulage rights carrier
Applied to: Lookup Carrier Code in CC Table
WHEN
The system looks up the carrier in the CC (Carrier Code) table
THEN
The system should retrieve the CCRA code if found, or proceed with unknown defaults if not found
Context: A successful carrier code lookup in the CC table
GIVEN
A successful carrier code lookup in the CC table
Applied to: Set Haulage Rights SCAC from Table
WHEN
The carrier code is found and validated
THEN
The system should set the haulage rights SCAC to the CCRA code from the table
Context: A validated haulage rights SCAC and Canadian customs port code
GIVEN
A validated haulage rights SCAC and Canadian customs port code
Applied to: Build SS Table Key with Port Code and SCAC
WHEN
The system needs to lookup haulage agreement details
THEN
The system should build the SS table key using 'C' prefix, 3-digit port code, and either the haulage SCAC or default '6105' if SCAC is spaces
Context: A constructed SS table key with port code and carrier SCAC
GIVEN
A constructed SS table key with port code and carrier SCAC
Applied to: Lookup Haulage Agreement in SS Table
WHEN
The system looks up the haulage agreement in the SS table
THEN
The system should retrieve agreement details if found, or proceed with default handling if not found
Context: A successful SS table lookup for haulage agreement
GIVEN
A successful SS table lookup for haulage agreement
Applied to: Get Automated Carrier Flag from SS Table
WHEN
The system processes the automated carrier flag from the agreement
THEN
The system should set the haulage automated flag and determine bill owner (6105 if automated)
Context: A haulage agreement with automated carrier flag set to true
GIVEN
A haulage agreement with automated carrier flag set to true
Applied to: Set Bill Owner to 6105
WHEN
The system processes automated haulage billing
THEN
The system should set the bill owner to '6105' (standard railway code)
Context: A haulage agreement record from the SS table
GIVEN
A haulage agreement record from the SS table
Applied to: Haulage Agreement = 'Y'?
WHEN
The system checks if the haulage agreement field equals 'Y'
THEN
The system should set accept haulage status if 'Y', or reject haulage status if not 'Y'
Context: A haulage agreement with agreement field set to 'Y'
GIVEN
A haulage agreement with agreement field set to 'Y'
Applied to: Set Accept Haulage Status
WHEN
The system processes the acceptance decision
THEN
The system should set the haulage status to 'ACCEPT'
Context: A haulage agreement with agreement field not equal to 'Y' or missing carrier information
GIVEN
A haulage agreement with agreement field not equal to 'Y' or missing carrier information
Applied to: Set Reject Haulage Status
WHEN
The system processes the rejection decision
THEN
The system should set the haulage status to 'REJECT'
Context: A successful SS table lookup with haulage agreement details
GIVEN
A successful SS table lookup with haulage agreement details
Applied to: Set Bill As SCAC from SS Table
WHEN
The system determines billing arrangements
THEN
The system should set bill as SCAC to haulage bill initial if haulage mode, or line bill initial if not haulage mode
Context: A failed SS table lookup for haulage agreement
GIVEN
A failed SS table lookup for haulage agreement
Applied to: Set Default Values for Missing SS Entry
WHEN
The system cannot find agreement details
THEN
The system should set default values: clear automated flag and set reject status for haulage mode, or set bill owner and bill as SCAC to '6105' for non-haulage mode
Context: A shipment with IMA code not equal to 'HM'
GIVEN
A shipment with IMA code not equal to 'HM'
Applied to: Clear Haulage Fields for Non-Haulage
WHEN
The system processes non-haulage shipments
THEN
The system should clear haulage rights SCAC, automated flag, and reject haulage indicator
R-GCCCCADD-cbl-01657 (+11) File: GCCCCADD.cbl Haulage Agreement Validation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Haulage Agreement Validation':
  • Context - a shipment with an ima code:
    For Is IMA Code = 'HM'?:
    When the system checks the ima code value, then if ima code equals 'hm' then haulage processing is required, otherwise skip haulage processing and set default billing information.
  • Context - a shipment requiring haulage processing:
    For Haulage Right Carrier exists?:
    When the system checks for haulage rights carrier, then if haulage rights carrier is spaces then set unknown scac code, clear automated flag, set bill owner to unknown, and reject haulage, otherwise proceed with carrier lookup.
  • Context - a valid haulage rights carrier code:
    For Lookup Carrier in CC Table:
    When the system looks up the carrier in cc table, then retrieve carrier information for further processing.
  • Context - a carrier code lookup result:
    For Carrier Found in CC Table?:
    When the system checks if carrier was found in cc table, then if carrier found then extract ccra code, otherwise set unknown scac code, clear automated flag, reject haulage, and set bill owner to unknown.
  • Context - a valid carrier record from cc table:
    For Get CCRA Code from CC Table:
    When the system processes the carrier information, then assign the ccra code to haulage rights scac.
  • Context - a canadian customs port code and scac code:
    For Build SS Table Key with Port Code and SCAC:
    When the system builds ss table lookup key, then construct key with 'c' prefix plus last 3 digits of port code and either haulage rights scac or default '6105' if scac is spaces.
  • Context - a constructed ss table key:
    For Lookup Haulage Agreement in SS Table:
    When the system looks up haulage agreement in ss table, then retrieve haulage agreement details for validation.
  • Context - haulage agreement data from ss table:
    For Haulage Agreement = 'Y'?:
    When the system checks the haulage agreement flag, then if haulage agreement equals 'y' then accept haulage, otherwise reject haulage.
  • Context - valid ss table data for haulage processing:
    For Set Automated Carrier Flag:
    When the system processes haulage automation settings, then set automated carrier flag from ss table and determine bill as scac based on haulage or line haul settings.
  • Context - haulage processing with automated carrier flag set:
    For Automated Haulage?:
    When the system determines bill ownership, then if automated haulage then set bill owner to '6105', otherwise use existing bill owner.
  • Context - a shipment that does not require haulage processing:
    For Set Default Billing Information:
    When the system sets billing information, then clear haulage rights scac, automated flag, and reject haulage indicator.
  • Context - a haulage shipment with missing or invalid carrier information:
    For Set Unknown SCAC and Reject Status:
    When the system processes the invalid carrier, then set haulage rights scac to 'unkn', clear automated flag, set bill owner to 'unkn', and reject haulage.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA code
GIVEN
A shipment with an IMA code
Applied to: Is IMA Code = 'HM'?
WHEN
The system checks the IMA code value
THEN
If IMA code equals 'HM' then haulage processing is required, otherwise skip haulage processing and set default billing information
Context: A shipment requiring haulage processing
GIVEN
A shipment requiring haulage processing
Applied to: Haulage Right Carrier exists?
WHEN
The system checks for haulage rights carrier
THEN
If haulage rights carrier is spaces then set unknown SCAC code, clear automated flag, set bill owner to unknown, and reject haulage, otherwise proceed with carrier lookup
Context: A valid haulage rights carrier code
GIVEN
A valid haulage rights carrier code
Applied to: Lookup Carrier in CC Table
WHEN
The system looks up the carrier in CC table
THEN
Retrieve carrier information for further processing
Context: A carrier code lookup result
GIVEN
A carrier code lookup result
Applied to: Carrier Found in CC Table?
WHEN
The system checks if carrier was found in CC table
THEN
If carrier found then extract CCRA code, otherwise set unknown SCAC code, clear automated flag, reject haulage, and set bill owner to unknown
Context: A valid carrier record from CC table
GIVEN
A valid carrier record from CC table
Applied to: Get CCRA Code from CC Table
WHEN
The system processes the carrier information
THEN
Assign the CCRA code to haulage rights SCAC
Context: A Canadian customs port code and SCAC code
GIVEN
A Canadian customs port code and SCAC code
Applied to: Build SS Table Key with Port Code and SCAC
WHEN
The system builds SS table lookup key
THEN
Construct key with 'C' prefix plus last 3 digits of port code and either haulage rights SCAC or default '6105' if SCAC is spaces
Context: A constructed SS table key
GIVEN
A constructed SS table key
Applied to: Lookup Haulage Agreement in SS Table
WHEN
The system looks up haulage agreement in SS table
THEN
Retrieve haulage agreement details for validation
Context: Haulage agreement data from SS table
GIVEN
Haulage agreement data from SS table
Applied to: Haulage Agreement = 'Y'?
WHEN
The system checks the haulage agreement flag
THEN
If haulage agreement equals 'Y' then accept haulage, otherwise reject haulage
Context: Valid SS table data for haulage processing
GIVEN
Valid SS table data for haulage processing
Applied to: Set Automated Carrier Flag
WHEN
The system processes haulage automation settings
THEN
Set automated carrier flag from SS table and determine bill as SCAC based on haulage or line haul settings
Context: Haulage processing with automated carrier flag set
GIVEN
Haulage processing with automated carrier flag set
Applied to: Automated Haulage?
WHEN
The system determines bill ownership
THEN
If automated haulage then set bill owner to '6105', otherwise use existing bill owner
Context: A shipment that does not require haulage processing
GIVEN
A shipment that does not require haulage processing
Applied to: Set Default Billing Information
WHEN
The system sets billing information
THEN
Clear haulage rights SCAC, automated flag, and reject haulage indicator
Context: A haulage shipment with missing or invalid carrier information
GIVEN
A haulage shipment with missing or invalid carrier information
Applied to: Set Unknown SCAC and Reject Status
WHEN
The system processes the invalid carrier
THEN
Set haulage rights SCAC to 'UNKN', clear automated flag, set bill owner to 'UNKN', and reject haulage
R-GCCCCADD-cbl-01669 (+12) File: GCCCCADD.cbl Bill Owner Assignment Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Bill Owner Assignment':
  • Context - a shipment with an ima code from the shipment root data:
    For Is IMA Code = 'HM' Haulage Movement?:
    When the system checks if the ima code equals 'hm', then the system identifies this as a haulage movement and proceeds with haulage-specific processing, otherwise skips haulage processing entirely.
  • Context - a haulage movement shipment:
    For Haulage Right Carrier Available?:
    When the system checks if the haulage right carrier field contains a value other than spaces, then if no carrier is specified, set bill owner to 'unkn', clear haulage automated flag, set bill owner to 'unkn', and set reject haulage status to true.
  • Context - a valid haulage right carrier code:
    For Lookup Carrier Code in CC Table:
    When the system performs a lookup in the cc table using the carrier code, then the system retrieves the corresponding ccra code for further processing.
  • Context - a carrier code lookup attempt in the cc table:
    For Carrier Code Found?:
    When the lookup operation completes, then if the carrier code is found, use the retrieved ccra code as haulage rights scac, otherwise set bill owner to 'unkn', clear haulage automated flag, set reject haulage status, and set bill owner to 'unkn'.
  • Context - a successful carrier code lookup in the cc table:
    For Set Haulage Rights SCAC from Carrier Code:
    When the system retrieves the ccra code from the lookup result, then the system assigns the ccra code to the haulage rights scac field.
  • Context - a canadian customs port code and either haulage rights scac or default '6105' carrier code:
    For Check SS Table for Haulage Agreement:
    When the system performs a lookup in the ss table using the constructed key, then the system retrieves haulage agreement details including automated carrier flag and haulage agreement status.
  • Context - a successful ss table lookup for haulage agreement:
    For Automated Haulage?:
    When the system checks the automated carrier flag from the ss table, then if automated haulage is indicated, set the haulage automated flag and assign bill owner to '6105'.
  • Context - a successful ss table lookup with haulage agreement details:
    For Haulage Agreement Accepted?:
    When the system checks if the haulage agreement field equals 'y', then if accepted, set accept haulage status and use haul bill initial as bill-as scac, otherwise set reject haulage status.
  • Context - a shipment where the ima code is not 'hm':
    For Clear Haulage Settings No Bill Owner Assignment:
    When the system processes the shipment, then clear all haulage-related fields including haulage rights scac, haulage automated flag, and reject haulage indicator.
  • Context - a haulage movement processed through gcx011 interface:
    For Called from GCX011 and CCN starts with '6105'?:
    When the system checks if the ccn key starts with '6105', then if true, proceed with ccn modification logic based on bill-as scac validation.
  • Context - a ccn that starts with '6105' processed through gcx011:
    For Bill-As SCAC Valid and Not Default?:
    When the system checks if bill-as scac is not 'unkn', not spaces, not low-values, and not '6105', then if valid, proceed with ccn key modification using the bill-as scac value.
  • Context - a valid bill-as scac and automated haulage flag set to true:
    For Set CCN Type to 'E' Set Bill Owner to '6105':
    When the system modifies the ccn key, then replace the first 4 characters of ccn with bill-as scac, set the 5th character to 'e', and assign bill owner to '6105'.
  • Context - a valid bill-as scac and automated haulage flag set to false:
    For Set CCN Type to 'P' Set Bill Owner to Bill-As SCAC:
    When the system modifies the ccn key, then replace the first 4 characters of ccn with bill-as scac, set the 5th character to 'p', and assign bill owner to the bill-as scac value.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA code from the shipment root data
GIVEN
A shipment with an IMA code from the shipment root data
Applied to: Is IMA Code = 'HM' Haulage Movement?
WHEN
The system checks if the IMA code equals 'HM'
THEN
The system identifies this as a haulage movement and proceeds with haulage-specific processing, otherwise skips haulage processing entirely
Context: A haulage movement shipment
GIVEN
A haulage movement shipment
Applied to: Haulage Right Carrier Available?
WHEN
The system checks if the haulage right carrier field contains a value other than spaces
THEN
If no carrier is specified, set bill owner to 'UNKN', clear haulage automated flag, set bill owner to 'UNKN', and set reject haulage status to true
Context: A valid haulage right carrier code
GIVEN
A valid haulage right carrier code
Applied to: Lookup Carrier Code in CC Table
WHEN
The system performs a lookup in the CC table using the carrier code
THEN
The system retrieves the corresponding CCRA code for further processing
Context: A carrier code lookup attempt in the CC table
GIVEN
A carrier code lookup attempt in the CC table
Applied to: Carrier Code Found?
WHEN
The lookup operation completes
THEN
If the carrier code is found, use the retrieved CCRA code as haulage rights SCAC, otherwise set bill owner to 'UNKN', clear haulage automated flag, set reject haulage status, and set bill owner to 'UNKN'
Context: A successful carrier code lookup in the CC table
GIVEN
A successful carrier code lookup in the CC table
Applied to: Set Haulage Rights SCAC from Carrier Code
WHEN
The system retrieves the CCRA code from the lookup result
THEN
The system assigns the CCRA code to the haulage rights SCAC field
Context: A Canadian customs port code and either haulage rights SCAC or default '6105' carrier code
GIVEN
A Canadian customs port code and either haulage rights SCAC or default '6105' carrier code
Applied to: Check SS Table for Haulage Agreement
WHEN
The system performs a lookup in the SS table using the constructed key
THEN
The system retrieves haulage agreement details including automated carrier flag and haulage agreement status
Context: A successful SS table lookup for haulage agreement
GIVEN
A successful SS table lookup for haulage agreement
Applied to: Automated Haulage?
WHEN
The system checks the automated carrier flag from the SS table
THEN
If automated haulage is indicated, set the haulage automated flag and assign bill owner to '6105'
Context: A successful SS table lookup with haulage agreement details
GIVEN
A successful SS table lookup with haulage agreement details
Applied to: Haulage Agreement Accepted?
WHEN
The system checks if the haulage agreement field equals 'Y'
THEN
If accepted, set accept haulage status and use haul bill initial as bill-as SCAC, otherwise set reject haulage status
Context: A shipment where the IMA code is not 'HM'
GIVEN
A shipment where the IMA code is not 'HM'
Applied to: Clear Haulage Settings No Bill Owner Assignment
WHEN
The system processes the shipment
THEN
Clear all haulage-related fields including haulage rights SCAC, haulage automated flag, and reject haulage indicator
Context: A haulage movement processed through GCX011 interface
GIVEN
A haulage movement processed through GCX011 interface
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The system checks if the CCN key starts with '6105'
THEN
If true, proceed with CCN modification logic based on bill-as SCAC validation
Context: A CCN that starts with '6105' processed through GCX011
GIVEN
A CCN that starts with '6105' processed through GCX011
Applied to: Bill-As SCAC Valid and Not Default?
WHEN
The system checks if bill-as SCAC is not 'UNKN', not spaces, not low-values, and not '6105'
THEN
If valid, proceed with CCN key modification using the bill-as SCAC value
Context: A valid bill-as SCAC and automated haulage flag set to true
GIVEN
A valid bill-as SCAC and automated haulage flag set to true
Applied to: Set CCN Type to 'E' Set Bill Owner to '6105'
WHEN
The system modifies the CCN key
THEN
Replace the first 4 characters of CCN with bill-as SCAC, set the 5th character to 'E', and assign bill owner to '6105'
Context: A valid bill-as SCAC and automated haulage flag set to false
GIVEN
A valid bill-as SCAC and automated haulage flag set to false
Applied to: Set CCN Type to 'P' Set Bill Owner to Bill-As SCAC
WHEN
The system modifies the CCN key
THEN
Replace the first 4 characters of CCN with bill-as SCAC, set the 5th character to 'P', and assign bill owner to the bill-as SCAC value
R-GCCCCADD-cbl-01682 (+5) File: GCCCCADD.cbl CCN Key Modification for Automated Haulage Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CCN Key Modification for Automated Haulage':
  • Context - a haulage shipment is being processed:
    For Called from GCX011?:
    When the process is not called from gcx011 program, then skip ccn key modification and continue with standard processing.
  • Context - a haulage shipment is called from gcx011 program:
    For CCN Key starts with '6105'?:
    When the ccn key does not start with '6105', then skip ccn key modification and continue with standard processing.
  • Context - a haulage shipment with ccn key starting with '6105' called from gcx011:
    For Bill-As SCAC is valid?:
    When the bill-as scac is 'unkn' or spaces or low-values or '6105', then skip ccn key modification and continue with standard processing.
  • Context - a haulage shipment with valid bill-as scac code:
    For Move Bill-As SCAC to CCN Key position 1-4:
    When the bill-as scac is not 'unkn', spaces, low-values, or '6105', then replace the first four characters of the ccn key with the bill-as scac code.
  • Context - a haulage shipment with valid bill-as scac and automated haulage flag set:
    For Set CCN Key position 5 to 'E':
    When the haulage is automated, then set the fifth position of ccn key to 'e' and set bill owner to '6105'.
  • Context - a haulage shipment with valid bill-as scac and automated haulage flag not set:
    For Set CCN Key position 5 to 'P':
    When the haulage is not automated, then set the fifth position of ccn key to 'p' and set bill owner to the bill-as scac code.
👨‍💻 Technical ACs (Gherkin)
Context: A haulage shipment is being processed
GIVEN
A haulage shipment is being processed
Applied to: Called from GCX011?
WHEN
The process is not called from GCX011 program
THEN
Skip CCN key modification and continue with standard processing
Context: A haulage shipment is called from GCX011 program
GIVEN
A haulage shipment is called from GCX011 program
Applied to: CCN Key starts with '6105'?
WHEN
The CCN key does not start with '6105'
THEN
Skip CCN key modification and continue with standard processing
Context: A haulage shipment with CCN key starting with '6105' called from GCX011
GIVEN
A haulage shipment with CCN key starting with '6105' called from GCX011
Applied to: Bill-As SCAC is valid?
WHEN
The Bill-As SCAC is 'UNKN' or spaces or low-values or '6105'
THEN
Skip CCN key modification and continue with standard processing
Context: A haulage shipment with valid Bill-As SCAC code
GIVEN
A haulage shipment with valid Bill-As SCAC code
Applied to: Move Bill-As SCAC to CCN Key position 1-4
WHEN
The Bill-As SCAC is not 'UNKN', spaces, low-values, or '6105'
THEN
Replace the first four characters of the CCN key with the Bill-As SCAC code
Context: A haulage shipment with valid Bill-As SCAC and automated haulage flag set
GIVEN
A haulage shipment with valid Bill-As SCAC and automated haulage flag set
Applied to: Set CCN Key position 5 to 'E'
WHEN
The haulage is automated
THEN
Set the fifth position of CCN key to 'E' and set Bill Owner to '6105'
Context: A haulage shipment with valid Bill-As SCAC and automated haulage flag not set
GIVEN
A haulage shipment with valid Bill-As SCAC and automated haulage flag not set
Applied to: Set CCN Key position 5 to 'P'
WHEN
The haulage is not automated
THEN
Set the fifth position of CCN key to 'P' and set Bill Owner to the Bill-As SCAC code
R-GCCCCADD-cbl-01688 (+10) File: GCCCCADD.cbl Error Message Text Retrieval Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Error Message Text Retrieval':
  • Context - a validation error has occurred and an error message number has been identified:
    For Error Message Text Retrieval - Retrieve error message text from MS table for validation failures:
    When the system needs to retrieve the corresponding error message text, then the system should lookup the message text from the ms table using the error number as key and return the english text for display.
  • Context - an error message retrieval request is initiated:
    For Initialize Table Access Parameters:
    When the system prepares to access the message repository, then all table access parameters should be cleared and initialized to ensure clean lookup operation.
  • Context - table access parameters are being configured for message retrieval:
    For Set Function Code to 'GU':
    When the system sets up the database operation type, then the function code should be set to 'gu' to perform a get unique operation.
  • Context - table access is being configured for message text retrieval:
    For Set Table ID to 'MS':
    When the system identifies which table to access, then the table id should be set to 'ms' to target the message repository table.
  • Context - a specific error message number has been identified for lookup:
    For Set Message Error Number as Key:
    When the system configures the search key for message retrieval, then the error message number should be assigned as the sequence id key for table lookup.
  • Context - all table access parameters have been properly configured:
    For Call Table I/O Service:
    When the system executes the message text retrieval operation, then the table i/o service should be called with the configured parameters to perform the lookup.
  • Context - a table lookup operation has been executed for message text retrieval:
    For Table Access Successful?:
    When the system evaluates the operation result, then if the return flag indicates 'successful', the message text should be processed, otherwise handle the failure case.
  • Context - message text has been successfully retrieved from the ms table:
    For Move Table Segment to MS Structure:
    When the system processes the retrieved table segment, then the table segment data should be moved to the ms structure for further processing.
  • Context - message data has been successfully loaded into the ms structure:
    For Extract English Text Message:
    When the system extracts the displayable message text, then the english text field from the ms structure should be extracted as the message content.
  • Context - english message text has been extracted from the ms structure:
    For Set Message Label for Display:
    When the system prepares the message for display, then the extracted english text should be assigned to the message label field for user presentation.
  • Context - message text retrieval from the ms table has failed:
    For Clear MS Structure - No Message Found:
    When the system handles the retrieval failure, then the ms structure should be cleared to spaces to ensure no invalid message text is displayed.
👨‍💻 Technical ACs (Gherkin)
Context: A validation error has occurred and an error message number has been identified
GIVEN
A validation error has occurred and an error message number has been identified
Applied to: Error Message Text Retrieval - Retrieve error message text from MS table for validation failures
WHEN
The system needs to retrieve the corresponding error message text
THEN
The system should lookup the message text from the MS table using the error number as key and return the English text for display
Context: An error message retrieval request is initiated
GIVEN
An error message retrieval request is initiated
Applied to: Initialize Table Access Parameters
WHEN
The system prepares to access the message repository
THEN
All table access parameters should be cleared and initialized to ensure clean lookup operation
Context: Table access parameters are being configured for message retrieval
GIVEN
Table access parameters are being configured for message retrieval
Applied to: Set Function Code to 'GU'
WHEN
The system sets up the database operation type
THEN
The function code should be set to 'GU' to perform a get unique operation
Context: Table access is being configured for message text retrieval
GIVEN
Table access is being configured for message text retrieval
Applied to: Set Table ID to 'MS'
WHEN
The system identifies which table to access
THEN
The table ID should be set to 'MS' to target the message repository table
Context: A specific error message number has been identified for lookup
GIVEN
A specific error message number has been identified for lookup
Applied to: Set Message Error Number as Key
WHEN
The system configures the search key for message retrieval
THEN
The error message number should be assigned as the sequence ID key for table lookup
Context: All table access parameters have been properly configured
GIVEN
All table access parameters have been properly configured
Applied to: Call Table I/O Service
WHEN
The system executes the message text retrieval operation
THEN
The table I/O service should be called with the configured parameters to perform the lookup
Context: A table lookup operation has been executed for message text retrieval
GIVEN
A table lookup operation has been executed for message text retrieval
Applied to: Table Access Successful?
WHEN
The system evaluates the operation result
THEN
If the return flag indicates 'SUCCESSFUL', the message text should be processed, otherwise handle the failure case
Context: Message text has been successfully retrieved from the MS table
GIVEN
Message text has been successfully retrieved from the MS table
Applied to: Move Table Segment to MS Structure
WHEN
The system processes the retrieved table segment
THEN
The table segment data should be moved to the MS structure for further processing
Context: Message data has been successfully loaded into the MS structure
GIVEN
Message data has been successfully loaded into the MS structure
Applied to: Extract English Text Message
WHEN
The system extracts the displayable message text
THEN
The English text field from the MS structure should be extracted as the message content
Context: English message text has been extracted from the MS structure
GIVEN
English message text has been extracted from the MS structure
Applied to: Set Message Label for Display
WHEN
The system prepares the message for display
THEN
The extracted English text should be assigned to the message label field for user presentation
Context: Message text retrieval from the MS table has failed
GIVEN
Message text retrieval from the MS table has failed
Applied to: Clear MS Structure - No Message Found
WHEN
The system handles the retrieval failure
THEN
The MS structure should be cleared to spaces to ensure no invalid message text is displayed
R-GCCCCADD-cbl-01699 (+3) File: GCCCCADD.cbl GCT0111E Spawning Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'GCT0111E Spawning':
  • Context - a ccn array table exists from bill of lading processing:
    For CCN Array Contains Data?:
    When the system checks for multiple ccn processing requirements, then processing continues only if the ccn array contains valid data, otherwise manifest creation is marked complete.
  • Context - a ccn array with multiple cargo control numbers and a current index position:
    For More CCNs in Array?:
    When the system processes each ccn in sequence, then continue processing the next ccn if the current index is within array bounds and the ccn value is not spaces, otherwise complete the manifest creation process.
  • Context - valid ccn array data requiring multiple manifest processing:
    For Initialize Spawn Parameters:
    When the system prepares to spawn the gct0111e program, then initialize spawn waybill key, waybill date, current ccn from array, and action code to 'am' for manifest processing.
  • Context - prepared spawn message with waybill and ccn information:
    For Call IMS to Change Message:
    When the system needs to process a cargo control number for manifest creation, then call ims with chng function to invoke gct0111e program, write the message to the processing queue, and purge the ims message.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN array table exists from bill of lading processing
GIVEN
A CCN array table exists from bill of lading processing
Applied to: CCN Array Contains Data?
WHEN
The system checks for multiple CCN processing requirements
THEN
Processing continues only if the CCN array contains valid data, otherwise manifest creation is marked complete
Context: A CCN array with multiple cargo control numbers and a current index position
GIVEN
A CCN array with multiple cargo control numbers and a current index position
Applied to: More CCNs in Array?
WHEN
The system processes each CCN in sequence
THEN
Continue processing the next CCN if the current index is within array bounds and the CCN value is not spaces, otherwise complete the manifest creation process
Context: Valid CCN array data requiring multiple manifest processing
GIVEN
Valid CCN array data requiring multiple manifest processing
Applied to: Initialize Spawn Parameters
WHEN
The system prepares to spawn the GCT0111E program
THEN
Initialize spawn waybill key, waybill date, current CCN from array, and action code to 'AM' for manifest processing
Context: Prepared spawn message with waybill and CCN information
GIVEN
Prepared spawn message with waybill and CCN information
Applied to: Call IMS to Change Message
WHEN
The system needs to process a cargo control number for manifest creation
THEN
Call IMS with CHNG function to invoke GCT0111E program, write the message to the processing queue, and purge the IMS message
R-GCCCCADD-cbl-01703 (+15) File: GCCCCADD.cbl Importer Segment Building from EDI Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Segment Building from EDI':
  • Context - an edi bol key exists for the shipment:
    For Get Importer N1 Segment from EDI BOL:
    When the system searches for importer n1 segment with entity type 'im', then the system retrieves importer name and identification details if found.
  • Context - an n1 segment has been retrieved from edi bol:
    For Check Entity ID is 'IM':
    When the system checks the entity id code, then processing continues only if entity id equals 'im' for importer.
  • Context - importer data exists in temporary backup storage and edi bol contains importer information:
    For Is Corrector EDI with Backup Data?:
    When the system processes a corrector edi transaction, then the system uses the backup importer data instead of processing new edi data.
  • Context - backup importer data exists in temporary storage:
    For Restore Backup Importer Data:
    When a corrector edi requires restoration of previous importer information, then the system restores importer name, business number, qualifier, address, and contact information from backup.
  • Context - a valid importer n1 segment exists in edi bol:
    For Extract Importer Information:
    When the system processes new importer information, then the system extracts importer name, business number qualifier, and business number for customs processing.
  • Context - an importer n1 segment has been processed:
    For Get Importer N3 Address Segment:
    When the system searches for corresponding n3 address segment, then the system retrieves address line information for the importer.
  • Context - importer n3 address segment data is available:
    For Process Address Information:
    When the system processes address line information, then the system sets address line 1 and 2, defaulting to 'na' if address line 1 is empty.
  • Context - an importer address has been processed:
    For Get Importer N4 City/State Segment:
    When the system searches for corresponding n4 city/state segment, then the system retrieves city, state, postal code, and country information for the importer.
  • Context - importer n4 city/state segment data is available:
    For Process City/State/Postal Information:
    When the system processes location information, then the system sets city name, state/province code, postal code, and country code for the importer.
  • Context - importer location information has been processed:
    For Clear Contact Information:
    When the system finalizes importer segment data, then the system clears all contact information fields for the importer record.
  • Context - importer segment data has been assembled:
    For Validate N1 Segment Data:
    When the system validates the n1 segment information, then the system ensures required fields are present and data meets customs requirements.
  • Context - importer segment data has been validated:
    For Insert Importer Record into Customs Database:
    When the system processes the importer record for storage, then the system inserts the importer record into the customs database with sequence number assignment.
  • Context - a corrector edi transaction does not contain importer information:
    For Handle Importer Data Deletion:
    When previous importer data existed for the shipment, then the system processes importer data deletion while preserving backup data if available.
  • Context - corrector edi removes importer data and backup importer data exists:
    For Retain Backup Data if Available:
    When the system processes importer data deletion, then the system retains and uses backup importer data instead of clearing all importer information.
  • Context - corrector edi removes importer data and no backup data exists:
    For Clear Importer Fields:
    When the system processes importer data deletion, then the system clears importer name and related fields from the customs record.
  • Context - au table contains importer data and edi bol contains importer data with business number qualifier 'bn' or spaces:
    For Reset CSA Indicator:
    When the system processes importer information from both sources, then the system turns off the csa indicator to prevent duplicate processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Get Importer N1 Segment from EDI BOL
WHEN
The system searches for importer N1 segment with entity type 'IM'
THEN
The system retrieves importer name and identification details if found
Context: An N1 segment has been retrieved from EDI BOL
GIVEN
An N1 segment has been retrieved from EDI BOL
Applied to: Check Entity ID is 'IM'
WHEN
The system checks the entity ID code
THEN
Processing continues only if entity ID equals 'IM' for importer
Context: Importer data exists in temporary backup storage and EDI BOL contains importer information
GIVEN
Importer data exists in temporary backup storage and EDI BOL contains importer information
Applied to: Is Corrector EDI with Backup Data?
WHEN
The system processes a corrector EDI transaction
THEN
The system uses the backup importer data instead of processing new EDI data
Context: Backup importer data exists in temporary storage
GIVEN
Backup importer data exists in temporary storage
Applied to: Restore Backup Importer Data
WHEN
A corrector EDI requires restoration of previous importer information
THEN
The system restores importer name, business number, qualifier, address, and contact information from backup
Context: A valid importer N1 segment exists in EDI BOL
GIVEN
A valid importer N1 segment exists in EDI BOL
Applied to: Extract Importer Information
WHEN
The system processes new importer information
THEN
The system extracts importer name, business number qualifier, and business number for customs processing
Context: An importer N1 segment has been processed
GIVEN
An importer N1 segment has been processed
Applied to: Get Importer N3 Address Segment
WHEN
The system searches for corresponding N3 address segment
THEN
The system retrieves address line information for the importer
Context: Importer N3 address segment data is available
GIVEN
Importer N3 address segment data is available
Applied to: Process Address Information
WHEN
The system processes address line information
THEN
The system sets address line 1 and 2, defaulting to 'NA' if address line 1 is empty
Context: An importer address has been processed
GIVEN
An importer address has been processed
Applied to: Get Importer N4 City/State Segment
WHEN
The system searches for corresponding N4 city/state segment
THEN
The system retrieves city, state, postal code, and country information for the importer
Context: Importer N4 city/state segment data is available
GIVEN
Importer N4 city/state segment data is available
Applied to: Process City/State/Postal Information
WHEN
The system processes location information
THEN
The system sets city name, state/province code, postal code, and country code for the importer
Context: Importer location information has been processed
GIVEN
Importer location information has been processed
Applied to: Clear Contact Information
WHEN
The system finalizes importer segment data
THEN
The system clears all contact information fields for the importer record
Context: Importer segment data has been assembled
GIVEN
Importer segment data has been assembled
Applied to: Validate N1 Segment Data
WHEN
The system validates the N1 segment information
THEN
The system ensures required fields are present and data meets customs requirements
Context: Importer segment data has been validated
GIVEN
Importer segment data has been validated
Applied to: Insert Importer Record into Customs Database
WHEN
The system processes the importer record for storage
THEN
The system inserts the importer record into the customs database with sequence number assignment
Context: A corrector EDI transaction does not contain importer information
GIVEN
A corrector EDI transaction does not contain importer information
Applied to: Handle Importer Data Deletion
WHEN
Previous importer data existed for the shipment
THEN
The system processes importer data deletion while preserving backup data if available
Context: Corrector EDI removes importer data and backup importer data exists
GIVEN
Corrector EDI removes importer data and backup importer data exists
Applied to: Retain Backup Data if Available
WHEN
The system processes importer data deletion
THEN
The system retains and uses backup importer data instead of clearing all importer information
Context: Corrector EDI removes importer data and no backup data exists
GIVEN
Corrector EDI removes importer data and no backup data exists
Applied to: Clear Importer Fields
WHEN
The system processes importer data deletion
THEN
The system clears importer name and related fields from the customs record
Context: AU table contains importer data and EDI BOL contains importer data with business number qualifier 'BN' or spaces
GIVEN
AU table contains importer data and EDI BOL contains importer data with business number qualifier 'BN' or spaces
Applied to: Reset CSA Indicator
WHEN
The system processes importer information from both sources
THEN
The system turns off the CSA indicator to prevent duplicate processing
R-GCCCCADD-cbl-01719 (+12) File: GCCCCADD.cbl Importer Data Backup for Corrector EDI Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Backup for Corrector EDI':
  • Context - a corrector edi transaction is being processed:
    For Corrector EDI with Importer Data?:
    When the system evaluates if importer data, business number, and business number qualifier are all present, then the system determines whether to proceed with importer data backup or skip the backup process.
  • Context - importer data backup is required and counter is initialized to 3:
    For Search Existing Importer Records:
    When the system searches customs records type 55 with sequence numbers from 3 to 24 until importer is found or maximum sequence is reached, then the system retrieves each record and checks if entity id equals 'im' to identify importer records.
  • Context - a customs record type 55 has been retrieved during the search process:
    For Importer Record Found?:
    When the system checks if the entity id code equals 'im' (importer), then the system determines if this is a valid importer record requiring backup processing.
  • Context - a valid importer record has been found in the customs database:
    For Extract Current Importer Information:
    When the system processes the importer record to extract all relevant data fields, then the system prepares to backup importer name, business identifiers, address, and contact information.
  • Context - current importer record contains name information:
    For Backup Importer Name:
    When the system backs up importer data before applying corrector edi changes, then the importer name is stored in temporary backup field ws-temp-im-name.
  • Context - current importer record contains business number and qualifier information:
    For Backup Business Number & Qualifier:
    When the system backs up business identification data before applying corrector edi changes, then the business number qualifier is stored in ws-temp-im-qual and business number is stored in ws-temp-im-cde.
  • Context - current importer record contains csa indicator information:
    For Backup CSA Indicator:
    When the system backs up csa status before applying corrector edi changes, then the csa indicator value is stored in temporary backup field ws-temp-csa-ind.
  • Context - current importer record contains address information:
    For Backup Address Information:
    When the system backs up address data before applying corrector edi changes, then address line 1 is stored in ws-temp-im-adr1 and address line 2 is stored in ws-temp-im-adr2.
  • Context - current importer record contains geographic location information:
    For Backup City/State/Postal Data:
    When the system backs up location data before applying corrector edi changes, then city name is stored in ws-temp-im-city, state/province code in ws-temp-im-prov, and postal code in ws-temp-im-postal.
  • Context - current importer record contains country code information:
    For Backup Country Code:
    When the system backs up country data before applying corrector edi changes, then the country code is stored in temporary backup field ws-temp-im-ctry.
  • Context - current importer record contains contact information:
    For Backup Contact Information:
    When the system backs up contact data before applying corrector edi changes, then contact function code is stored in ws-temp-im-cont-cde, person name in ws-temp-im-per-name, communication qualifier in ws-temp-im-com-qual, and communication number in ws-temp-im-com-num.
  • Context - all importer data fields have been successfully backed up to temporary storage:
    For Set Backup Complete Flag:
    When the backup process completes without errors, then the system sets ws-temp-imp-found flag to indicate successful backup completion.
  • Context - importer data has been successfully backed up and backup complete flag is set:
    For Clear Current Importer Fields:
    When the system prepares to process corrector edi changes, then the original importer, business number, and business number qualifier fields are cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Corrector EDI with Importer Data?
WHEN
The system evaluates if importer data, business number, and business number qualifier are all present
THEN
The system determines whether to proceed with importer data backup or skip the backup process
Context: Importer data backup is required and counter is initialized to 3
GIVEN
Importer data backup is required and counter is initialized to 3
Applied to: Search Existing Importer Records
WHEN
The system searches customs records type 55 with sequence numbers from 3 to 24 until importer is found or maximum sequence is reached
THEN
The system retrieves each record and checks if entity ID equals 'IM' to identify importer records
Context: A customs record type 55 has been retrieved during the search process
GIVEN
A customs record type 55 has been retrieved during the search process
Applied to: Importer Record Found?
WHEN
The system checks if the entity ID code equals 'IM' (Importer)
THEN
The system determines if this is a valid importer record requiring backup processing
Context: A valid importer record has been found in the customs database
GIVEN
A valid importer record has been found in the customs database
Applied to: Extract Current Importer Information
WHEN
The system processes the importer record to extract all relevant data fields
THEN
The system prepares to backup importer name, business identifiers, address, and contact information
Context: Current importer record contains name information
GIVEN
Current importer record contains name information
Applied to: Backup Importer Name
WHEN
The system backs up importer data before applying corrector EDI changes
THEN
The importer name is stored in temporary backup field WS-TEMP-IM-NAME
Context: Current importer record contains business number and qualifier information
GIVEN
Current importer record contains business number and qualifier information
Applied to: Backup Business Number & Qualifier
WHEN
The system backs up business identification data before applying corrector EDI changes
THEN
The business number qualifier is stored in WS-TEMP-IM-QUAL and business number is stored in WS-TEMP-IM-CDE
Context: Current importer record contains CSA indicator information
GIVEN
Current importer record contains CSA indicator information
Applied to: Backup CSA Indicator
WHEN
The system backs up CSA status before applying corrector EDI changes
THEN
The CSA indicator value is stored in temporary backup field WS-TEMP-CSA-IND
Context: Current importer record contains address information
GIVEN
Current importer record contains address information
Applied to: Backup Address Information
WHEN
The system backs up address data before applying corrector EDI changes
THEN
Address line 1 is stored in WS-TEMP-IM-ADR1 and address line 2 is stored in WS-TEMP-IM-ADR2
Context: Current importer record contains geographic location information
GIVEN
Current importer record contains geographic location information
Applied to: Backup City/State/Postal Data
WHEN
The system backs up location data before applying corrector EDI changes
THEN
City name is stored in WS-TEMP-IM-CITY, state/province code in WS-TEMP-IM-PROV, and postal code in WS-TEMP-IM-POSTAL
Context: Current importer record contains country code information
GIVEN
Current importer record contains country code information
Applied to: Backup Country Code
WHEN
The system backs up country data before applying corrector EDI changes
THEN
The country code is stored in temporary backup field WS-TEMP-IM-CTRY
Context: Current importer record contains contact information
GIVEN
Current importer record contains contact information
Applied to: Backup Contact Information
WHEN
The system backs up contact data before applying corrector EDI changes
THEN
Contact function code is stored in WS-TEMP-IM-CONT-CDE, person name in WS-TEMP-IM-PER-NAME, communication qualifier in WS-TEMP-IM-COM-QUAL, and communication number in WS-TEMP-IM-COM-NUM
Context: All importer data fields have been successfully backed up to temporary storage
GIVEN
All importer data fields have been successfully backed up to temporary storage
Applied to: Set Backup Complete Flag
WHEN
The backup process completes without errors
THEN
The system sets WS-TEMP-IMP-FOUND flag to indicate successful backup completion
Context: Importer data has been successfully backed up and backup complete flag is set
GIVEN
Importer data has been successfully backed up and backup complete flag is set
Applied to: Clear Current Importer Fields
WHEN
The system prepares to process corrector EDI changes
THEN
The original importer, business number, and business number qualifier fields are cleared to spaces
R-GCCCCADD-cbl-01732 (+8) File: GCCCCADD.cbl CSA Indicator Management for Importer Data Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Indicator Management for Importer Data':
  • Context - a shipment is being processed for customs manifest creation:
    For CSA Indicator Already On?:
    When the system checks the current csa indicator status, then if csa indicator is already on, maintain the current status, otherwise proceed to check data sources.
  • Context - csa indicator is not currently active and au table lookup is required:
    For AU Table Has Importer Data?:
    When the system searches au table using consignee chop code and commodity code, then if au table contains matching importer data, proceed to retrieve it, otherwise check edi data sources.
  • Context - csa indicator is not active and au table has no importer data:
    For EDI Has Importer Data?:
    When the system checks edi bol for importer n1 segments, then if edi contains importer data, proceed to validate business number qualifier, otherwise maintain current csa status.
  • Context - au table contains importer data for the consignee and commodity:
    For Get AU Importer Data:
    When the system retrieves au importer information, then set importer name and business number from au table data, set business number qualifier to 'm5', and activate csa indicator.
  • Context - edi contains importer data with business number qualifier:
    For Business Number Qualifier BN or Blank?:
    When the system checks if business number qualifier is 'bn' or blank, then if qualifier is 'bn' or blank, turn off csa indicator, otherwise maintain current status.
    For Turn CSA Indicator Off:
    When business number qualifier is 'bn' or blank spaces, then turn off csa indicator to prevent automatic csa processing.
  • Context - a shipment has been processed for csa indicator management:
    For Transit or Return Shipment?:
    When the shipment is identified as transit (in-transit status) or return movement, then turn off csa indicator and clear all importer data fields.
  • Context - au table contains valid importer data for the shipment:
    For Set CSA Indicator On:
    When importer information is successfully retrieved from au table, then set csa indicator to active status and populate importer fields with au data.
  • Context - a shipment is identified as transit or return movement:
    For Clear Importer Data:
    When csa indicator override is applied, then clear importer name, business number, and business number qualifier fields.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: CSA Indicator Already On?
WHEN
The system checks the current CSA indicator status
THEN
If CSA indicator is already on, maintain the current status, otherwise proceed to check data sources
Context: CSA indicator is not currently active and AU table lookup is required
GIVEN
CSA indicator is not currently active and AU table lookup is required
Applied to: AU Table Has Importer Data?
WHEN
The system searches AU table using consignee CHOP code and commodity code
THEN
If AU table contains matching importer data, proceed to retrieve it, otherwise check EDI data sources
Context: CSA indicator is not active and AU table has no importer data
GIVEN
CSA indicator is not active and AU table has no importer data
Applied to: EDI Has Importer Data?
WHEN
The system checks EDI BOL for importer N1 segments
THEN
If EDI contains importer data, proceed to validate business number qualifier, otherwise maintain current CSA status
Context: AU table contains importer data for the consignee and commodity
GIVEN
AU table contains importer data for the consignee and commodity
Applied to: Get AU Importer Data
WHEN
The system retrieves AU importer information
THEN
Set importer name and business number from AU table data, set business number qualifier to 'M5', and activate CSA indicator
Context: EDI contains importer data with business number qualifier
GIVEN
EDI contains importer data with business number qualifier
Applied to: Business Number Qualifier BN or Blank?
WHEN
The system checks if business number qualifier is 'BN' or blank
THEN
If qualifier is 'BN' or blank, turn off CSA indicator, otherwise maintain current status
Applied to: Turn CSA Indicator Off
WHEN
Business number qualifier is 'BN' or blank spaces
THEN
Turn off CSA indicator to prevent automatic CSA processing
Context: A shipment has been processed for CSA indicator management
GIVEN
A shipment has been processed for CSA indicator management
Applied to: Transit or Return Shipment?
WHEN
The shipment is identified as transit (in-transit status) or return movement
THEN
Turn off CSA indicator and clear all importer data fields
Context: AU table contains valid importer data for the shipment
GIVEN
AU table contains valid importer data for the shipment
Applied to: Set CSA Indicator On
WHEN
Importer information is successfully retrieved from AU table
THEN
Set CSA indicator to active status and populate importer fields with AU data
Context: A shipment is identified as transit or return movement
GIVEN
A shipment is identified as transit or return movement
Applied to: Clear Importer Data
WHEN
CSA indicator override is applied
THEN
Clear importer name, business number, and business number qualifier fields
R-GCCCCADD-cbl-01741 (+8) File: GCCCCADD.cbl Importer Business Number Processing Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Business Number Processing':
  • Context - an edi bill of lading key exists for the shipment:
    For Retrieve EDI N1 Importer Segment:
    When the system needs to process importer business number information, then the system retrieves the n1 importer segment from the edi data using the bill of lading key.
  • Context - the system has attempted to retrieve the n1 importer segment:
    For N1 Importer Segment Found?:
    When the retrieval operation completes, then if the segment is found, proceed with business number extraction, otherwise skip business number processing.
  • Context - a valid n1 importer segment exists in the edi data:
    For Extract Business Number Qualifier from N1-ID-CODE-QUAL:
    When the system processes the importer identification information, then the business number qualifier is extracted from the n1-id-code-qual field.
    For Set Importer Name from N1-NAME:
    When the system processes importer identification information, then the importer name is extracted from n1-name and stored in the customs record.
  • Context - a valid n1 importer segment exists with business number qualifier:
    For Extract Business Number from N1-ID-CODE:
    When the system processes the importer identification information, then the business number is extracted from the n1-id-code field.
  • Context - a business number qualifier has been extracted from the edi n1 segment:
    For Store Business Number Qualifier in GCCC-BUSINESS-NBR-QUAL:
    When the system updates the customs record, then the qualifier is stored in the gccc-business-nbr-qual field.
  • Context - a business number has been extracted from the edi n1 segment:
    For Store Business Number in GCCC-BUSINESS-NBR:
    When the system updates the customs record, then the business number is stored in the gccc-business-nbr field.
  • Context - business number and qualifier have been extracted from the edi n1 segment:
    For Update Customs Record with Business Number Data:
    When the system processes the importer information, then the customs record is updated with both the business number and qualifier in the appropriate fields.
  • Context - importer business number information has been successfully extracted and stored:
    For Mark Importer Data as Found:
    When the processing of the n1 importer segment completes, then the system sets the importer found flag to indicate successful processing.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI bill of lading key exists for the shipment
GIVEN
An EDI bill of lading key exists for the shipment
Applied to: Retrieve EDI N1 Importer Segment
WHEN
The system needs to process importer business number information
THEN
The system retrieves the N1 importer segment from the EDI data using the bill of lading key
Context: The system has attempted to retrieve the N1 importer segment
GIVEN
The system has attempted to retrieve the N1 importer segment
Applied to: N1 Importer Segment Found?
WHEN
The retrieval operation completes
THEN
If the segment is found, proceed with business number extraction, otherwise skip business number processing
Context: A valid N1 importer segment exists in the EDI data
GIVEN
A valid N1 importer segment exists in the EDI data
Applied to: Extract Business Number Qualifier from N1-ID-CODE-QUAL
WHEN
The system processes the importer identification information
THEN
The business number qualifier is extracted from the N1-ID-CODE-QUAL field
Applied to: Set Importer Name from N1-NAME
WHEN
The system processes importer identification information
THEN
The importer name is extracted from N1-NAME and stored in the customs record
Context: A valid N1 importer segment exists with business number qualifier
GIVEN
A valid N1 importer segment exists with business number qualifier
Applied to: Extract Business Number from N1-ID-CODE
WHEN
The system processes the importer identification information
THEN
The business number is extracted from the N1-ID-CODE field
Context: A business number qualifier has been extracted from the EDI N1 segment
GIVEN
A business number qualifier has been extracted from the EDI N1 segment
Applied to: Store Business Number Qualifier in GCCC-BUSINESS-NBR-QUAL
WHEN
The system updates the customs record
THEN
The qualifier is stored in the GCCC-BUSINESS-NBR-QUAL field
Context: A business number has been extracted from the EDI N1 segment
GIVEN
A business number has been extracted from the EDI N1 segment
Applied to: Store Business Number in GCCC-BUSINESS-NBR
WHEN
The system updates the customs record
THEN
The business number is stored in the GCCC-BUSINESS-NBR field
Context: Business number and qualifier have been extracted from the EDI N1 segment
GIVEN
Business number and qualifier have been extracted from the EDI N1 segment
Applied to: Update Customs Record with Business Number Data
WHEN
The system processes the importer information
THEN
The customs record is updated with both the business number and qualifier in the appropriate fields
Context: Importer business number information has been successfully extracted and stored
GIVEN
Importer business number information has been successfully extracted and stored
Applied to: Mark Importer Data as Found
WHEN
The processing of the N1 importer segment completes
THEN
The system sets the importer found flag to indicate successful processing
R-GCCCCADD-cbl-01750 (+14) File: GCCCCADD.cbl Importer Address Data Processing Merged 15 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Address Data Processing':
  • Context - an edi bill of lading exists with importer entity type 'im':
    For Get Importer N3 Segment from EDI BOL:
    When the system processes importer address information, then the system retrieves the n3 segment containing address line 1 and address line 2 from the edi bol.
    For Get Importer N4 Segment from EDI BOL:
    When the system processes importer geographic information, then the system retrieves the n4 segment containing city, state, postal code, and country data.
  • Context - the system is processing importer address information:
    For N3 Segment Found?:
    When the n3 segment retrieval is attempted from edi bol, then if n3 segment is found, extract address details; if not found, set default address values.
  • Context - an n3 segment exists in the edi bol for the importer:
    For Extract Address Line 1 from N3:
    When the system processes the n3 segment, then the system extracts the first address line from field d2-addl-name-addr-1.
  • Context - address line 1 has been extracted from the n3 segment:
    For Address Line 1 Empty?:
    When the system validates the address completeness, then if address line 1 is empty or contains only spaces/low-values, set it to 'na'; otherwise use the extracted value.
  • Context - the primary address line is empty, spaces, or low-values:
    For Set Address Line 1 to 'NA':
    When the system processes address validation, then the system sets address line 1 to 'na' as the default value.
  • Context - an n3 segment exists and address line 1 has been processed:
    For Extract Address Line 2 from N3:
    When the system continues n3 segment processing, then the system extracts address line 2 from field d2-addl-name-addr-2.
  • Context - no n3 segment is found in the edi bol:
    For Set Default Address Line 1 to 'NA':
    When the system processes importer address information, then the system sets address line 1 to 'na' and clears address line 2.
    For Clear Address Line 2:
    When the system sets default address values, then the system clears address line 2 field.
  • Context - the system is processing importer geographic information:
    For N4 Segment Found?:
    When the n4 segment retrieval is attempted from edi bol, then if n4 segment is found, extract geographic details; if not found, clear all geographic fields.
  • Context - an n4 segment exists in the edi bol for the importer:
    For Extract City Name from N4:
    When the system processes the n4 segment, then the system extracts the city name from field d4-city-name.
  • Context - an n4 segment exists and city name has been extracted:
    For Extract State/Province Code from N4:
    When the system continues n4 segment processing, then the system extracts the state/province code from field d4-state-prov-code.
  • Context - an n4 segment exists and state/province has been extracted:
    For Extract Postal Code from N4:
    When the system continues n4 segment processing, then the system extracts the postal code from field d4-postal-code.
  • Context - an n4 segment exists and postal code has been extracted:
    For Extract Country Code from N4:
    When the system completes n4 segment processing, then the system extracts the country code from field d4-country-code.
  • Context - no n4 segment is found in the edi bol:
    For Clear All N4 Address Fields:
    When the system processes importer geographic information, then the system clears all n4 address fields including city, state, postal code, and country.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI Bill of Lading exists with importer entity type 'IM'
GIVEN
An EDI Bill of Lading exists with importer entity type 'IM'
Applied to: Get Importer N3 Segment from EDI BOL
WHEN
The system processes importer address information
THEN
The system retrieves the N3 segment containing address line 1 and address line 2 from the EDI BOL
Applied to: Get Importer N4 Segment from EDI BOL
WHEN
The system processes importer geographic information
THEN
The system retrieves the N4 segment containing city, state, postal code, and country data
Context: The system is processing importer address information
GIVEN
The system is processing importer address information
Applied to: N3 Segment Found?
WHEN
The N3 segment retrieval is attempted from EDI BOL
THEN
If N3 segment is found, extract address details; if not found, set default address values
Context: An N3 segment exists in the EDI BOL for the importer
GIVEN
An N3 segment exists in the EDI BOL for the importer
Applied to: Extract Address Line 1 from N3
WHEN
The system processes the N3 segment
THEN
The system extracts the first address line from field D2-ADDL-NAME-ADDR-1
Context: Address Line 1 has been extracted from the N3 segment
GIVEN
Address Line 1 has been extracted from the N3 segment
Applied to: Address Line 1 Empty?
WHEN
The system validates the address completeness
THEN
If Address Line 1 is empty or contains only spaces/low-values, set it to 'NA'; otherwise use the extracted value
Context: The primary address line is empty, spaces, or low-values
GIVEN
The primary address line is empty, spaces, or low-values
Applied to: Set Address Line 1 to 'NA'
WHEN
The system processes address validation
THEN
The system sets Address Line 1 to 'NA' as the default value
Context: An N3 segment exists and Address Line 1 has been processed
GIVEN
An N3 segment exists and Address Line 1 has been processed
Applied to: Extract Address Line 2 from N3
WHEN
The system continues N3 segment processing
THEN
The system extracts Address Line 2 from field D2-ADDL-NAME-ADDR-2
Context: No N3 segment is found in the EDI BOL
GIVEN
No N3 segment is found in the EDI BOL
Applied to: Set Default Address Line 1 to 'NA'
WHEN
The system processes importer address information
THEN
The system sets Address Line 1 to 'NA' and clears Address Line 2
Applied to: Clear Address Line 2
WHEN
The system sets default address values
THEN
The system clears Address Line 2 field
Context: The system is processing importer geographic information
GIVEN
The system is processing importer geographic information
Applied to: N4 Segment Found?
WHEN
The N4 segment retrieval is attempted from EDI BOL
THEN
If N4 segment is found, extract geographic details; if not found, clear all geographic fields
Context: An N4 segment exists in the EDI BOL for the importer
GIVEN
An N4 segment exists in the EDI BOL for the importer
Applied to: Extract City Name from N4
WHEN
The system processes the N4 segment
THEN
The system extracts the city name from field D4-CITY-NAME
Context: An N4 segment exists and city name has been extracted
GIVEN
An N4 segment exists and city name has been extracted
Applied to: Extract State/Province Code from N4
WHEN
The system continues N4 segment processing
THEN
The system extracts the state/province code from field D4-STATE-PROV-CODE
Context: An N4 segment exists and state/province has been extracted
GIVEN
An N4 segment exists and state/province has been extracted
Applied to: Extract Postal Code from N4
WHEN
The system continues N4 segment processing
THEN
The system extracts the postal code from field D4-POSTAL-CODE
Context: An N4 segment exists and postal code has been extracted
GIVEN
An N4 segment exists and postal code has been extracted
Applied to: Extract Country Code from N4
WHEN
The system completes N4 segment processing
THEN
The system extracts the country code from field D4-COUNTRY-CODE
Context: No N4 segment is found in the EDI BOL
GIVEN
No N4 segment is found in the EDI BOL
Applied to: Clear All N4 Address Fields
WHEN
The system processes importer geographic information
THEN
The system clears all N4 address fields including city, state, postal code, and country
R-GCCCCADD-cbl-01765 (+10) File: GCCCCADD.cbl Importer Contact Information Processing Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Contact Information Processing':
  • Context - importer contact information processing is starting:
    For Initialize Contact Information Fields:
    When contact information fields need to be initialized, then all contact function code, person name, communication qualifier, and communication number fields are cleared to spaces.
  • Context - importer contact information processing is required:
    For Check if EDI BOL Data Available:
    When system checks for edi bol data availability using the edi bol key, then system determines if valid edi bol data exists for contact information extraction.
  • Context - edi bol data is available for the shipment:
    For Retrieve Importer PER Segment from EDI:
    When system retrieves importer per segment using entity type 'im' and sequence '01' and segment type 'gp', then importer contact person segment is retrieved from edi bol data or marked as not found.
  • Context - importer per segment is successfully retrieved from edi bol:
    For Extract Contact Function Code:
    When system processes the per segment contact function code field, then contact function code is extracted and stored in the customs record contact function code field.
    For Extract Contact Person Name:
    When system processes the per segment contact name field, then contact person name is extracted and stored in the customs record contact name field.
    For Extract Communication Number Qualifier:
    When system processes the per segment communication number qualifier field, then communication number qualifier is extracted and stored in the customs record communication qualifier field.
    For Extract Communication Number:
    When system processes the per segment communication number field, then communication number is extracted and stored in the customs record communication number field.
  • Context - contact information has been extracted from edi per segment:
    For Store Contact Information in Customs Record:
    When all contact fields (function code, person name, communication qualifier, communication number) are populated, then contact information is stored in the customs record type 55 per segment fields.
  • Context - edi bol data is not available or importer per segment is not found:
    For Clear Contact Information Fields:
    When contact information cannot be extracted from edi sources, then all contact information fields are cleared to spaces in the customs record.
  • Context - contact information has been processed from available sources:
    For Validate Contact Information Requirements:
    When system validates contact data completeness and format requirements, then contact information is validated for required fields and proper format according to customs requirements.
  • Context - contact information validation has failed:
    For Generate Validation Error Messages:
    When required contact fields are missing or invalid, then appropriate validation error messages are generated and added to the error message collection.
👨‍💻 Technical ACs (Gherkin)
Context: Importer contact information processing is starting
GIVEN
Importer contact information processing is starting
Applied to: Initialize Contact Information Fields
WHEN
Contact information fields need to be initialized
THEN
All contact function code, person name, communication qualifier, and communication number fields are cleared to spaces
Context: Importer contact information processing is required
GIVEN
Importer contact information processing is required
Applied to: Check if EDI BOL Data Available
WHEN
System checks for EDI BOL data availability using the EDI BOL key
THEN
System determines if valid EDI BOL data exists for contact information extraction
Context: EDI BOL data is available for the shipment
GIVEN
EDI BOL data is available for the shipment
Applied to: Retrieve Importer PER Segment from EDI
WHEN
System retrieves importer PER segment using entity type 'IM' and sequence '01' and segment type 'GP'
THEN
Importer contact person segment is retrieved from EDI BOL data or marked as not found
Context: Importer PER segment is successfully retrieved from EDI BOL
GIVEN
Importer PER segment is successfully retrieved from EDI BOL
Applied to: Extract Contact Function Code
WHEN
System processes the PER segment contact function code field
THEN
Contact function code is extracted and stored in the customs record contact function code field
Applied to: Extract Contact Person Name
WHEN
System processes the PER segment contact name field
THEN
Contact person name is extracted and stored in the customs record contact name field
Applied to: Extract Communication Number Qualifier
WHEN
System processes the PER segment communication number qualifier field
THEN
Communication number qualifier is extracted and stored in the customs record communication qualifier field
Applied to: Extract Communication Number
WHEN
System processes the PER segment communication number field
THEN
Communication number is extracted and stored in the customs record communication number field
Context: Contact information has been extracted from EDI PER segment
GIVEN
Contact information has been extracted from EDI PER segment
Applied to: Store Contact Information in Customs Record
WHEN
All contact fields (function code, person name, communication qualifier, communication number) are populated
THEN
Contact information is stored in the customs record type 55 PER segment fields
Context: EDI BOL data is not available or importer PER segment is not found
GIVEN
EDI BOL data is not available or importer PER segment is not found
Applied to: Clear Contact Information Fields
WHEN
Contact information cannot be extracted from EDI sources
THEN
All contact information fields are cleared to spaces in the customs record
Context: Contact information has been processed from available sources
GIVEN
Contact information has been processed from available sources
Applied to: Validate Contact Information Requirements
WHEN
System validates contact data completeness and format requirements
THEN
Contact information is validated for required fields and proper format according to customs requirements
Context: Contact information validation has failed
GIVEN
Contact information validation has failed
Applied to: Generate Validation Error Messages
WHEN
Required contact fields are missing or invalid
THEN
Appropriate validation error messages are generated and added to the error message collection
R-GCCCCADD-cbl-01776 (+4) File: GCCCCADD.cbl Importer Data Deletion by Corrector Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Deletion by Corrector':
  • Context - importer data exists from previous record 55 processing with entity id 'im' and importer name is present:
    For Backup Original Importer Data:
    When the system processes corrector edi that may modify or delete importer information, then all original importer data is backed up including chop code, name, business number qualifier, business number, csa indicator, address information, city/state/postal data, and contact information, and backup found flag is set to true.
  • Context - corrector edi processing is active and importer entity data is being evaluated:
    For Corrector EDI Deletes Importer?:
    When the corrector edi deletes importer information from the current transaction, then if backup importer data is available, restore from backup data; otherwise clear importer entity id and set importer not found status.
  • Context - corrector edi has deleted current importer data and backup importer data is available from previous processing:
    For Restore from Backup Data:
    When the system needs to restore importer information, then all backed up importer data is restored including chop code as sc301, entity id as 'im', name as n102, business number qualifier as n103, business number as n104, csa indicator, address information as n301/n302, city/state/postal as n401/n402/n403/n404, and contact information as per01/per02/per03/per04, and importer found flag is set.
  • Context - corrector edi has deleted current importer data and no backup importer data is available:
    For Clear Importer Entity ID:
    When the system processes the importer data deletion, then importer entity id is cleared to spaces and if record 55 importer not found flag is set, clear the importer name field.
  • Context - au table importer data is found and record 55 importer data is found and business number qualifier is 'bn' or spaces:
    For Set Backup Found Flag:
    When the system processes importer data from multiple sources, then csa indicator is set to off to prevent conflicting importer data processing.
👨‍💻 Technical ACs (Gherkin)
Context: Importer data exists from previous record 55 processing with entity ID 'IM' and importer name is present
GIVEN
Importer data exists from previous record 55 processing with entity ID 'IM' and importer name is present
Applied to: Backup Original Importer Data
WHEN
The system processes corrector EDI that may modify or delete importer information
THEN
All original importer data is backed up including CHOP code, name, business number qualifier, business number, CSA indicator, address information, city/state/postal data, and contact information, and backup found flag is set to true
Context: Corrector EDI processing is active and importer entity data is being evaluated
GIVEN
Corrector EDI processing is active and importer entity data is being evaluated
Applied to: Corrector EDI Deletes Importer?
WHEN
The corrector EDI deletes importer information from the current transaction
THEN
If backup importer data is available, restore from backup data; otherwise clear importer entity ID and set importer not found status
Context: Corrector EDI has deleted current importer data and backup importer data is available from previous processing
GIVEN
Corrector EDI has deleted current importer data and backup importer data is available from previous processing
Applied to: Restore from Backup Data
WHEN
The system needs to restore importer information
THEN
All backed up importer data is restored including CHOP code as SC301, entity ID as 'IM', name as N102, business number qualifier as N103, business number as N104, CSA indicator, address information as N301/N302, city/state/postal as N401/N402/N403/N404, and contact information as PER01/PER02/PER03/PER04, and importer found flag is set
Context: Corrector EDI has deleted current importer data and no backup importer data is available
GIVEN
Corrector EDI has deleted current importer data and no backup importer data is available
Applied to: Clear Importer Entity ID
WHEN
The system processes the importer data deletion
THEN
Importer entity ID is cleared to spaces and if record 55 importer not found flag is set, clear the importer name field
Context: AU table importer data is found and record 55 importer data is found and business number qualifier is 'BN' or spaces
GIVEN
AU table importer data is found and record 55 importer data is found and business number qualifier is 'BN' or spaces
Applied to: Set Backup Found Flag
WHEN
The system processes importer data from multiple sources
THEN
CSA indicator is set to off to prevent conflicting importer data processing
R-GCCCCADD-cbl-01781 (+11) File: GCCCCADD.cbl EDI BOL GA Segment Retrieval Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI BOL GA Segment Retrieval':
  • Context - a request to retrieve geographic address information from edi bol data:
    For Initialize EDI BOL Request Parameters:
    When the system initializes the edi bol request parameters, then the address segment structure is cleared and ready for data retrieval.
  • Context - an edi bol request is being prepared for geographic address retrieval:
    For Set Segment Type to EBSNRSA:
    When the system configures the segment type, then the segment type is set to ebsnrsa to target address segments.
    For Set Function Code to GU - Get Unique:
    When the system sets the function code, then the function code is set to gu to retrieve a unique segment.
  • Context - a geographic address segment retrieval is requested for record 55 processing:
    For Set EDI BOL Key for Record 55:
    When the system assigns the edi bol key, then the edi bol key for record 55 is set as the root key for the request.
  • Context - a geographic address retrieval is requested for notify party information:
    For Set Type-1 to NN - Notify Party:
    When the system configures the primary entity type, then type-1 is set to nn to identify notify party segments.
  • Context - a specific notify party occurrence needs to be identified for geographic address retrieval:
    For Set Sequence Number from NN Counter:
    When the system assigns the sequence number, then the sequence number is set from the nn counter to target the correct notify party occurrence.
  • Context - geographic address information is needed for a notify party:
    For Set Type-2 to GA - Geographic Address:
    When the system configures the secondary segment type, then type-2 is set to ga to identify geographic address segments.
  • Context - a specific geographic address occurrence needs to be identified within notify party data:
    For Set Geographic Address Sequence:
    When the system assigns the geographic address sequence, then the sequence number is set to identify the correct geographic address occurrence.
  • Context - an edi bol segment retrieval requires exact matching criteria:
    For Set Operator to Equals:
    When the system configures the search operator, then the operator is set to equals for exact segment matching.
  • Context - all edi bol request parameters are configured for geographic address retrieval:
    For Call EDI BOL I/O Service:
    When the system calls the edi bol i/o service, then the service is invoked to retrieve the geographic address segment from edi bol data.
  • Context - the edi bol i/o service has been called to retrieve a geographic address segment:
    For Set GA Found Flag:
    When the geographic address segment is successfully found and retrieved, then the ga found flag is set to indicate successful retrieval.
    For Set GA Not Found Flag:
    When the geographic address segment is not found in the edi bol data, then the ga not found flag is set to indicate unsuccessful retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve geographic address information from EDI BOL data
GIVEN
A request to retrieve geographic address information from EDI BOL data
Applied to: Initialize EDI BOL Request Parameters
WHEN
The system initializes the EDI BOL request parameters
THEN
The address segment structure is cleared and ready for data retrieval
Context: An EDI BOL request is being prepared for geographic address retrieval
GIVEN
An EDI BOL request is being prepared for geographic address retrieval
Applied to: Set Segment Type to EBSNRSA
WHEN
The system configures the segment type
THEN
The segment type is set to EBSNRSA to target address segments
Applied to: Set Function Code to GU - Get Unique
WHEN
The system sets the function code
THEN
The function code is set to GU to retrieve a unique segment
Context: A geographic address segment retrieval is requested for record 55 processing
GIVEN
A geographic address segment retrieval is requested for record 55 processing
Applied to: Set EDI BOL Key for Record 55
WHEN
The system assigns the EDI BOL key
THEN
The EDI BOL key for record 55 is set as the root key for the request
Context: A geographic address retrieval is requested for notify party information
GIVEN
A geographic address retrieval is requested for notify party information
Applied to: Set Type-1 to NN - Notify Party
WHEN
The system configures the primary entity type
THEN
Type-1 is set to NN to identify notify party segments
Context: A specific notify party occurrence needs to be identified for geographic address retrieval
GIVEN
A specific notify party occurrence needs to be identified for geographic address retrieval
Applied to: Set Sequence Number from NN Counter
WHEN
The system assigns the sequence number
THEN
The sequence number is set from the NN counter to target the correct notify party occurrence
Context: Geographic address information is needed for a notify party
GIVEN
Geographic address information is needed for a notify party
Applied to: Set Type-2 to GA - Geographic Address
WHEN
The system configures the secondary segment type
THEN
Type-2 is set to GA to identify geographic address segments
Context: A specific geographic address occurrence needs to be identified within notify party data
GIVEN
A specific geographic address occurrence needs to be identified within notify party data
Applied to: Set Geographic Address Sequence
WHEN
The system assigns the geographic address sequence
THEN
The sequence number is set to identify the correct geographic address occurrence
Context: An EDI BOL segment retrieval requires exact matching criteria
GIVEN
An EDI BOL segment retrieval requires exact matching criteria
Applied to: Set Operator to Equals
WHEN
The system configures the search operator
THEN
The operator is set to equals for exact segment matching
Context: All EDI BOL request parameters are configured for geographic address retrieval
GIVEN
All EDI BOL request parameters are configured for geographic address retrieval
Applied to: Call EDI BOL I/O Service
WHEN
The system calls the EDI BOL I/O service
THEN
The service is invoked to retrieve the geographic address segment from EDI BOL data
Context: The EDI BOL I/O service has been called to retrieve a geographic address segment
GIVEN
The EDI BOL I/O service has been called to retrieve a geographic address segment
Applied to: Set GA Found Flag
WHEN
The geographic address segment is successfully found and retrieved
THEN
The GA found flag is set to indicate successful retrieval
Applied to: Set GA Not Found Flag
WHEN
The geographic address segment is not found in the EDI BOL data
THEN
The GA not found flag is set to indicate unsuccessful retrieval
R-GCCCCADD-cbl-01793 (+10) File: GCCCCADD.cbl Consolidated Load Indicator Retrieval from CNS Segment Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Consolidated Load Indicator Retrieval from CNS Segment':
  • Context - a consolidated load indicator search process is initiated:
    For Initialize CNS Search Variables:
    When the system begins to search for cns segments, then the cns indicator flag is set to not found and sequence counter is initialized to 1.
  • Context - the consolidated load search process is starting:
    For Set CNS Indicator Not Found:
    When initial search parameters are being set, then the cns indicator flag is set to not found state.
  • Context - a search for consolidated load indicators is beginning:
    For Set Sequence Counter to 1:
    When the system initializes search parameters, then the sequence counter is set to 1 to start searching from the first segment.
  • Context - a sequence number for cns segment search:
    For Retrieve EBSBCKS Segment:
    When the system retrieves ebsbcks segment data using the current sequence number, then the segment data is loaded for consolidated load indicator evaluation.
  • Context - an attempt to retrieve ebsbcks segment data:
    For EBSBCKS Segment Found?:
    When the system checks if the segment was successfully retrieved, then the process continues to check special handling code if segment found, otherwise moves to termination check.
  • Context - a successfully retrieved ebsbcks segment:
    For Special Handling Code = 'CNS'?:
    When the system examines the special handling code field, then if the code equals 'cns', the consolidated indicator is found; otherwise, continue searching next sequence.
  • Context - a segment with special handling code 'cns' is found:
    For Set CNS Indicator Found:
    When the system processes the consolidated load identification, then the cns indicator flag is set to found state.
  • Context - a segment that does not contain 'cns' special handling code:
    For Increment Sequence Counter:
    When the system continues searching for consolidated load indicators, then the sequence counter is incremented by 1 to check the next segment.
  • Context - an ongoing search for consolidated load indicators:
    For Counter > 98 OR CNS Found?:
    When the system evaluates continuation criteria, then if sequence counter exceeds 98 or cns indicator is found, terminate search; otherwise continue with next segment.
  • Context - a cns special handling code has been found in the segment data:
    For Set Consolidated Flag to 'Y':
    When the system finalizes the consolidated load determination, then the consolidated flag is set to 'y' to indicate this is a consolidated shipment.
  • Context - all available segments have been searched and no cns special handling code was found:
    For Set Consolidated Flag to Space:
    When the system finalizes the consolidated load determination, then the consolidated flag is set to space to indicate this is not a consolidated shipment.
👨‍💻 Technical ACs (Gherkin)
Context: A consolidated load indicator search process is initiated
GIVEN
A consolidated load indicator search process is initiated
Applied to: Initialize CNS Search Variables
WHEN
The system begins to search for CNS segments
THEN
The CNS indicator flag is set to not found and sequence counter is initialized to 1
Context: The consolidated load search process is starting
GIVEN
The consolidated load search process is starting
Applied to: Set CNS Indicator Not Found
WHEN
Initial search parameters are being set
THEN
The CNS indicator flag is set to not found state
Context: A search for consolidated load indicators is beginning
GIVEN
A search for consolidated load indicators is beginning
Applied to: Set Sequence Counter to 1
WHEN
The system initializes search parameters
THEN
The sequence counter is set to 1 to start searching from the first segment
Context: A sequence number for CNS segment search
GIVEN
A sequence number for CNS segment search
Applied to: Retrieve EBSBCKS Segment
WHEN
The system retrieves EBSBCKS segment data using the current sequence number
THEN
The segment data is loaded for consolidated load indicator evaluation
Context: An attempt to retrieve EBSBCKS segment data
GIVEN
An attempt to retrieve EBSBCKS segment data
Applied to: EBSBCKS Segment Found?
WHEN
The system checks if the segment was successfully retrieved
THEN
The process continues to check special handling code if segment found, otherwise moves to termination check
Context: A successfully retrieved EBSBCKS segment
GIVEN
A successfully retrieved EBSBCKS segment
Applied to: Special Handling Code = 'CNS'?
WHEN
The system examines the special handling code field
THEN
If the code equals 'CNS', the consolidated indicator is found; otherwise, continue searching next sequence
Context: A segment with special handling code 'CNS' is found
GIVEN
A segment with special handling code 'CNS' is found
Applied to: Set CNS Indicator Found
WHEN
The system processes the consolidated load identification
THEN
The CNS indicator flag is set to found state
Context: A segment that does not contain 'CNS' special handling code
GIVEN
A segment that does not contain 'CNS' special handling code
Applied to: Increment Sequence Counter
WHEN
The system continues searching for consolidated load indicators
THEN
The sequence counter is incremented by 1 to check the next segment
Context: An ongoing search for consolidated load indicators
GIVEN
An ongoing search for consolidated load indicators
Applied to: Counter > 98 OR CNS Found?
WHEN
The system evaluates continuation criteria
THEN
If sequence counter exceeds 98 or CNS indicator is found, terminate search; otherwise continue with next segment
Context: A CNS special handling code has been found in the segment data
GIVEN
A CNS special handling code has been found in the segment data
Applied to: Set Consolidated Flag to 'Y'
WHEN
The system finalizes the consolidated load determination
THEN
The consolidated flag is set to 'Y' to indicate this is a consolidated shipment
Context: All available segments have been searched and no CNS special handling code was found
GIVEN
All available segments have been searched and no CNS special handling code was found
Applied to: Set Consolidated Flag to Space
WHEN
The system finalizes the consolidated load determination
THEN
The consolidated flag is set to space to indicate this is not a consolidated shipment
R-GCCCCADD-cbl-01804 (+15) File: GCCCCADD.cbl Customs Record 55 Sequential Processing Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Customs Record 55 Sequential Processing':
  • Context - customs record 55 processing is starting:
    For Initialize Record 55 Index to 3:
    When the system initializes the record processing sequence, then the record index is set to 3 to allow for shipper (position 1) and consignee (position 2) records.
  • Context - record 55 processing is being initialized:
    For Clear Record 55 Array:
    When the system prepares to store new customs records, then the record 55 array is cleared of any previous data.
  • Context - shipper information is available from shipment data:
    For Build Shipper Record - Sequence 0001:
    When the system builds the shipper record for customs, then a record 55 with entity id 'sh' and sequence '0001' is created with shipper details and stored in array position 1.
  • Context - consignee information is available from shipment data:
    For Build Consignee Record - Sequence 0002:
    When the system builds the consignee record for customs, then a record 55 with entity id 'cn' and sequence '0002' is created with consignee details and stored in array position 2.
  • Context - a new customs record needs to be added to the array:
    For Check Available Index Slots:
    When the system checks the current index position against maximum capacity, then the system determines if there is available space in the record array.
  • Context - the current record index position is being evaluated:
    For Index Within Max Limit?:
    When the system checks if the index is less than or equal to the maximum sequence limit, then processing continues if within limit, otherwise the record is skipped.
  • Context - a customs record is being prepared for storage:
    For Set CCN Key and Record Type 55:
    When the system sets the record identification fields, then the ccn key is assigned to the record key field and record type is set to '55'.
  • Context - a customs record is being processed with a valid index position:
    For Set Sequential Number from Index:
    When the system assigns the sequential number to the record, then the current index value is used as the sequential number for the record key.
  • Context - a customs record has been built and validated:
    For Move Record to Array Position:
    When the system stores the record in the array, then the record is moved to the array position corresponding to the current index.
  • Context - a customs record has been successfully stored in the array:
    For Increment Index Counter:
    When the system prepares for the next record, then the index counter is incremented by 1.
  • Context - the current entity record has been processed:
    For More Entities to Process?:
    When the system evaluates if more entities need processing, then processing continues with next entity if more exist, otherwise moves to finalization.
  • Context - the record array has reached maximum capacity:
    For Skip Record - Array Full:
    When an additional record needs to be processed, then the record is skipped and processing continues with remaining entities.
  • Context - all other entity records have been processed:
    For Finalize Importer Record Processing:
    When the system finalizes importer record handling, then importer data from au table is processed if importer was found in au table but not in record 55 data.
  • Context - importer record needs to be added and au importer data was found:
    For 24 N1 Records Found?:
    When the system checks if 24 n1 data records were found, then the 24th record is replaced if found, otherwise a new importer record is inserted.
  • Context - 24 n1 data records were found and importer data exists in au table:
    For Replace 24th Record with Importer:
    When the system needs to add importer record, then the existing 24th record is replaced with importer data using repl function.
  • Context - au importer data exists and 24 n1 records were not found:
    For Insert New Importer Record:
    When the system adds the importer record, then a new importer record is inserted with entity id 'im' and au table data.
👨‍💻 Technical ACs (Gherkin)
Context: Customs record 55 processing is starting
GIVEN
Customs record 55 processing is starting
Applied to: Initialize Record 55 Index to 3
WHEN
The system initializes the record processing sequence
THEN
The record index is set to 3 to allow for shipper (position 1) and consignee (position 2) records
Context: Record 55 processing is being initialized
GIVEN
Record 55 processing is being initialized
Applied to: Clear Record 55 Array
WHEN
The system prepares to store new customs records
THEN
The record 55 array is cleared of any previous data
Context: Shipper information is available from shipment data
GIVEN
Shipper information is available from shipment data
Applied to: Build Shipper Record - Sequence 0001
WHEN
The system builds the shipper record for customs
THEN
A record 55 with entity ID 'SH' and sequence '0001' is created with shipper details and stored in array position 1
Context: Consignee information is available from shipment data
GIVEN
Consignee information is available from shipment data
Applied to: Build Consignee Record - Sequence 0002
WHEN
The system builds the consignee record for customs
THEN
A record 55 with entity ID 'CN' and sequence '0002' is created with consignee details and stored in array position 2
Context: A new customs record needs to be added to the array
GIVEN
A new customs record needs to be added to the array
Applied to: Check Available Index Slots
WHEN
The system checks the current index position against maximum capacity
THEN
The system determines if there is available space in the record array
Context: The current record index position is being evaluated
GIVEN
The current record index position is being evaluated
Applied to: Index Within Max Limit?
WHEN
The system checks if the index is less than or equal to the maximum sequence limit
THEN
Processing continues if within limit, otherwise the record is skipped
Context: A customs record is being prepared for storage
GIVEN
A customs record is being prepared for storage
Applied to: Set CCN Key and Record Type 55
WHEN
The system sets the record identification fields
THEN
The CCN key is assigned to the record key field and record type is set to '55'
Context: A customs record is being processed with a valid index position
GIVEN
A customs record is being processed with a valid index position
Applied to: Set Sequential Number from Index
WHEN
The system assigns the sequential number to the record
THEN
The current index value is used as the sequential number for the record key
Context: A customs record has been built and validated
GIVEN
A customs record has been built and validated
Applied to: Move Record to Array Position
WHEN
The system stores the record in the array
THEN
The record is moved to the array position corresponding to the current index
Context: A customs record has been successfully stored in the array
GIVEN
A customs record has been successfully stored in the array
Applied to: Increment Index Counter
WHEN
The system prepares for the next record
THEN
The index counter is incremented by 1
Context: The current entity record has been processed
GIVEN
The current entity record has been processed
Applied to: More Entities to Process?
WHEN
The system evaluates if more entities need processing
THEN
Processing continues with next entity if more exist, otherwise moves to finalization
Context: The record array has reached maximum capacity
GIVEN
The record array has reached maximum capacity
Applied to: Skip Record - Array Full
WHEN
An additional record needs to be processed
THEN
The record is skipped and processing continues with remaining entities
Context: All other entity records have been processed
GIVEN
All other entity records have been processed
Applied to: Finalize Importer Record Processing
WHEN
The system finalizes importer record handling
THEN
Importer data from AU table is processed if importer was found in AU table but not in record 55 data
Context: Importer record needs to be added and AU importer data was found
GIVEN
Importer record needs to be added and AU importer data was found
Applied to: 24 N1 Records Found?
WHEN
The system checks if 24 N1 data records were found
THEN
The 24th record is replaced if found, otherwise a new importer record is inserted
Context: 24 N1 data records were found and importer data exists in AU table
GIVEN
24 N1 data records were found and importer data exists in AU table
Applied to: Replace 24th Record with Importer
WHEN
The system needs to add importer record
THEN
The existing 24th record is replaced with importer data using REPL function
Context: AU importer data exists and 24 N1 records were not found
GIVEN
AU importer data exists and 24 N1 records were not found
Applied to: Insert New Importer Record
WHEN
The system adds the importer record
THEN
A new importer record is inserted with entity ID 'IM' and AU table data
R-GCCCCADD-cbl-01820 (+26) File: GCCCCADD.cbl Importer Data Processing from EDI BOL Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Processing from EDI BOL':
  • Context - the system needs to process importer information:
    For Initialize Importer Segment:
    When starting importer data processing, then the customs record segment gcsccs55 should be cleared to spaces.
  • Context - an edi bol key exists for the shipment:
    For Get EDI BOL Importer N1 Segment:
    When retrieving importer n1 segment with entity type 'im' and sequence '01', then the system should call edi bol interface to get importer entity data.
  • Context - a request has been made to retrieve importer n1 segment:
    For N1 Segment Found?:
    When the edi bol interface returns a status code, then if status code is spaces then n1 segment is found, otherwise n1 segment is not found.
  • Context - an n1 segment has been retrieved from edi bol:
    For Check Entity ID Code:
    When checking the entity id code in the n1 segment, then the entity id code should be extracted for validation.
  • Context - an entity id code has been extracted from n1 segment:
    For Entity ID = 'IM'?:
    When the entity id code is compared against importer designation, then if entity id equals 'im' then it is a valid importer entity, otherwise it is not an importer.
  • Context - a valid importer n1 segment with entity id 'im':
    For Extract Importer Name:
    When processing the importer entity data, then the importer name should be extracted from n1-name field and stored in both customs record and importer field.
  • Context - a valid importer n1 segment:
    For Extract Business Number Qualifier & Extract Business Number:
    When processing importer identification data, then the business number qualifier should be extracted from n1-id-code-qualifier and stored in both customs record and business number qualifier field and the business number should be extracted from n1-id-code and stored in both customs record and business number field.
  • Context - importer business number has been extracted:
    For Extract Business Number:
    When completing importer identification processing, then the system should set the importer found flag to true.
  • Context - importer entity data is being processed:
    For Set Consignee CHOP Code:
    When setting up importer record relationships, then the consignee chop code should be assigned to the importer customs record.
  • Context - importer n1 segment has been processed:
    For Get Importer N3 Address Segment:
    When retrieving importer address data with entity type 'im', sequence '01', and address type 'ic', then the system should call edi bol interface to get importer address segment.
  • Context - a request has been made to retrieve importer n3 address segment:
    For N3 Address Found?:
    When the edi bol interface returns a status code, then if status code is spaces then address segment is found, otherwise address segment is not found.
  • Context - importer n3 address segment is available:
    For Extract Address Line 1:
    When processing address information, then address line 1 should be extracted from d2-addl-name-addr-1 field and stored in customs record, or set to 'na' if blank or low-values.
  • Context - importer n3 address segment is available and address line 1 has been processed:
    For Extract Address Line 2:
    When processing additional address information, then address line 2 should be extracted from d2-addl-name-addr-2 field and stored in customs record.
  • Context - importer n3 address segment is not found:
    For Set Default 'NA' Address:
    When address information is required for customs record, then address line 1 should be set to 'na' and n3 data section should be cleared.
  • Context - importer address processing is in progress:
    For Get Importer N4 City/State Segment:
    When retrieving importer city/state data with entity type 'im', sequence '01', and city type 'ia', then the system should call edi bol interface to get importer city/state segment.
  • Context - a request has been made to retrieve importer n4 city/state segment:
    For N4 Segment Found?:
    When the edi bol interface returns a status code, then if status code is spaces then city/state segment is found, otherwise city/state segment is not found.
  • Context - importer n4 city/state segment is available:
    For Extract City Name:
    When processing city information, then city name should be extracted from d4-city-name field and stored in customs record.
    For Extract State/Province Code:
    When processing state/province information, then state/province code should be extracted from d4-state-prov-code field and stored in customs record.
    For Extract Postal Code:
    When processing postal information, then postal code should be extracted from d4-postal-code field and stored in customs record.
    For Extract Country Code:
    When processing country information, then country code should be extracted from d4-country-code field and stored in customs record.
  • Context - importer n4 city/state segment is not found:
    For Clear N4 Data:
    When city/state information processing is required, then the n4 data section in customs record should be cleared to spaces.
  • Context - importer address processing is complete:
    For Clear Contact Information:
    When finalizing importer record setup, then all contact information fields in customs record should be cleared to spaces.
  • Context - importer record has been populated with available data:
    For Validate N1 Segment Data:
    When validating the importer record for customs compliance, then the system should perform n1 segment validation to ensure data integrity.
  • Context - importer record has been validated successfully:
    For Insert Customs Record 55:
    When storing importer information for customs processing, then the system should insert the customs record type 55 for the importer.
  • Context - importer record has been processed:
    For Update CSA Indicator Logic:
    When evaluating csa indicator requirements, then the system should check if both au table data and edi data are found for csa determination.
  • Context - au table importer data is found and edi importer data is found and business number qualifier is 'bn' or spaces:
    For Reset CSA Indicator:
    When processing csa indicator logic, then the csa indicator should be set to off.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process importer information
GIVEN
The system needs to process importer information
Applied to: Initialize Importer Segment
WHEN
Starting importer data processing
THEN
The customs record segment GCSCCS55 should be cleared to spaces
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Get EDI BOL Importer N1 Segment
WHEN
Retrieving importer N1 segment with entity type 'IM' and sequence '01'
THEN
The system should call EDI BOL interface to get importer entity data
Context: A request has been made to retrieve importer N1 segment
GIVEN
A request has been made to retrieve importer N1 segment
Applied to: N1 Segment Found?
WHEN
The EDI BOL interface returns a status code
THEN
If status code is spaces then N1 segment is found, otherwise N1 segment is not found
Context: An N1 segment has been retrieved from EDI BOL
GIVEN
An N1 segment has been retrieved from EDI BOL
Applied to: Check Entity ID Code
WHEN
Checking the entity ID code in the N1 segment
THEN
The entity ID code should be extracted for validation
Context: An entity ID code has been extracted from N1 segment
GIVEN
An entity ID code has been extracted from N1 segment
Applied to: Entity ID = 'IM'?
WHEN
The entity ID code is compared against importer designation
THEN
If entity ID equals 'IM' then it is a valid importer entity, otherwise it is not an importer
Context: A valid importer N1 segment with entity ID 'IM'
GIVEN
A valid importer N1 segment with entity ID 'IM'
Applied to: Extract Importer Name
WHEN
Processing the importer entity data
THEN
The importer name should be extracted from N1-NAME field and stored in both customs record and importer field
Context: A valid importer N1 segment
GIVEN
A valid importer N1 segment
Applied to: Extract Business Number Qualifier & Extract Business Number
WHEN
Processing importer identification data
THEN
The business number qualifier should be extracted from N1-ID-CODE-QUALIFIER and stored in both customs record and business number qualifier field AND The business number should be extracted from N1-ID-CODE and stored in both customs record and business number field
Context: Importer business number has been extracted
GIVEN
Importer business number has been extracted
Applied to: Extract Business Number
WHEN
Completing importer identification processing
THEN
The system should set the importer found flag to true
Context: Importer entity data is being processed
GIVEN
Importer entity data is being processed
Applied to: Set Consignee CHOP Code
WHEN
Setting up importer record relationships
THEN
The consignee CHOP code should be assigned to the importer customs record
Context: Importer N1 segment has been processed
GIVEN
Importer N1 segment has been processed
Applied to: Get Importer N3 Address Segment
WHEN
Retrieving importer address data with entity type 'IM', sequence '01', and address type 'IC'
THEN
The system should call EDI BOL interface to get importer address segment
Context: A request has been made to retrieve importer N3 address segment
GIVEN
A request has been made to retrieve importer N3 address segment
Applied to: N3 Address Found?
WHEN
The EDI BOL interface returns a status code
THEN
If status code is spaces then address segment is found, otherwise address segment is not found
Context: Importer N3 address segment is available
GIVEN
Importer N3 address segment is available
Applied to: Extract Address Line 1
WHEN
Processing address information
THEN
Address line 1 should be extracted from D2-ADDL-NAME-ADDR-1 field and stored in customs record, or set to 'NA' if blank or low-values
Context: Importer N3 address segment is available and address line 1 has been processed
GIVEN
Importer N3 address segment is available and address line 1 has been processed
Applied to: Extract Address Line 2
WHEN
Processing additional address information
THEN
Address line 2 should be extracted from D2-ADDL-NAME-ADDR-2 field and stored in customs record
Context: Importer N3 address segment is not found
GIVEN
Importer N3 address segment is not found
Applied to: Set Default 'NA' Address
WHEN
Address information is required for customs record
THEN
Address line 1 should be set to 'NA' and N3 data section should be cleared
Context: Importer address processing is in progress
GIVEN
Importer address processing is in progress
Applied to: Get Importer N4 City/State Segment
WHEN
Retrieving importer city/state data with entity type 'IM', sequence '01', and city type 'IA'
THEN
The system should call EDI BOL interface to get importer city/state segment
Context: A request has been made to retrieve importer N4 city/state segment
GIVEN
A request has been made to retrieve importer N4 city/state segment
Applied to: N4 Segment Found?
WHEN
The EDI BOL interface returns a status code
THEN
If status code is spaces then city/state segment is found, otherwise city/state segment is not found
Context: Importer N4 city/state segment is available
GIVEN
Importer N4 city/state segment is available
Applied to: Extract City Name
WHEN
Processing city information
THEN
City name should be extracted from D4-CITY-NAME field and stored in customs record
Applied to: Extract State/Province Code
WHEN
Processing state/province information
THEN
State/province code should be extracted from D4-STATE-PROV-CODE field and stored in customs record
Applied to: Extract Postal Code
WHEN
Processing postal information
THEN
Postal code should be extracted from D4-POSTAL-CODE field and stored in customs record
Applied to: Extract Country Code
WHEN
Processing country information
THEN
Country code should be extracted from D4-COUNTRY-CODE field and stored in customs record
Context: Importer N4 city/state segment is not found
GIVEN
Importer N4 city/state segment is not found
Applied to: Clear N4 Data
WHEN
City/state information processing is required
THEN
The N4 data section in customs record should be cleared to spaces
Context: Importer address processing is complete
GIVEN
Importer address processing is complete
Applied to: Clear Contact Information
WHEN
Finalizing importer record setup
THEN
All contact information fields in customs record should be cleared to spaces
Context: Importer record has been populated with available data
GIVEN
Importer record has been populated with available data
Applied to: Validate N1 Segment Data
WHEN
Validating the importer record for customs compliance
THEN
The system should perform N1 segment validation to ensure data integrity
Context: Importer record has been validated successfully
GIVEN
Importer record has been validated successfully
Applied to: Insert Customs Record 55
WHEN
Storing importer information for customs processing
THEN
The system should insert the customs record type 55 for the importer
Context: Importer record has been processed
GIVEN
Importer record has been processed
Applied to: Update CSA Indicator Logic
WHEN
Evaluating CSA indicator requirements
THEN
The system should check if both AU table data and EDI data are found for CSA determination
Context: AU table importer data is found AND EDI importer data is found AND business number qualifier is 'BN' or spaces
GIVEN
AU table importer data is found AND EDI importer data is found AND business number qualifier is 'BN' or spaces
Applied to: Reset CSA Indicator
WHEN
Processing CSA indicator logic
THEN
The CSA indicator should be set to off
R-GCCCCADD-cbl-01847 (+26) File: GCCCCADD.cbl Corrector EDI Importer Data Backup Merged 27 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Corrector EDI Importer Data Backup':
  • Context - a corrector edi transaction is being processed:
    For Importer Data Present?:
    When the system checks for importer data in the input, then processing continues only if importer data is present, otherwise the backup process is skipped.
  • Context - importer data is present in the corrector edi:
    For Business Number Present?:
    When the system validates the business number field, then processing continues only if business number is not spaces, otherwise backup process is terminated.
  • Context - importer data and business number are present:
    For Business Number Qualifier Present?:
    When the system checks the business number qualifier field, then processing continues only if business number qualifier is not spaces, otherwise backup process ends.
  • Context - all importer validation checks have passed:
    For Initialize Counter to 3:
    When the system begins searching for existing importer records, then the search counter is set to 3 and the importer found flag is set to false.
  • Context - search counter is initialized and importer data validation passed:
    For Search Existing Records:
    When the system searches customs records using ccn key, record type 55, and current sequence number, then a customs record is retrieved if it exists for the specified sequence.
  • Context - a search for customs records has been executed:
    For Record Found?:
    When the system checks the database call status, then if status is spaces the record is found, otherwise increment counter and continue searching.
  • Context - a customs record has been successfully retrieved:
    For Is Importer Record?:
    When the system checks the entity id code in the record, then if entity id code equals 'im' then it is an importer record, otherwise increment counter and continue searching.
  • Context - an importer record has been found in the customs database:
    For Store CHOP Code:
    When the system begins backing up importer data, then the chop code from the customs record is stored in temporary importer chop field.
  • Context - importer chop code has been backed up:
    For Store Importer Name:
    When the system continues the backup process, then the importer name from the customs record is stored in temporary importer name field.
  • Context - importer name has been backed up:
    For Store Business Number Qualifier:
    When the system continues preserving importer data, then the business number qualifier from the customs record is stored in temporary qualifier field.
  • Context - business number qualifier has been backed up:
    For Store Business Number:
    When the system continues the backup process, then the business number from the customs record is stored in temporary business number field.
  • Context - business number has been backed up:
    For Store CSA Indicator:
    When the system continues preserving importer data, then the csa indicator from the input data is stored in temporary csa indicator field.
  • Context - csa indicator has been backed up:
    For Store Address Line 1:
    When the system continues backing up address information, then the first address line from the customs record is stored in temporary address field 1.
  • Context - primary address line has been backed up:
    For Store Address Line 2:
    When the system continues preserving address data, then the second address line from the customs record is stored in temporary address field 2.
  • Context - secondary address line has been backed up:
    For Store City Name:
    When the system continues backing up location data, then the city name from the customs record is stored in temporary city field.
  • Context - city name has been backed up:
    For Store Province/State Code:
    When the system continues preserving location information, then the province/state code from the customs record is stored in temporary province field.
  • Context - province/state code has been backed up:
    For Store Postal Code:
    When the system continues backing up address details, then the postal code from the customs record is stored in temporary postal code field.
  • Context - postal code has been backed up:
    For Store Country Code:
    When the system continues preserving location data, then the country code from the customs record is stored in temporary country field.
  • Context - country code has been backed up:
    For Store Contact Function Code:
    When the system continues backing up contact information, then the contact function code from the customs record is stored in temporary contact function field.
  • Context - contact function code has been backed up:
    For Store Contact Person Name:
    When the system continues preserving contact details, then the contact person name from the customs record is stored in temporary contact name field.
  • Context - contact person name has been backed up:
    For Store Communication Qualifier:
    When the system continues backing up communication data, then the communication number qualifier from the customs record is stored in temporary communication qualifier field.
  • Context - communication qualifier has been backed up:
    For Store Communication Number:
    When the system completes backing up contact information, then the communication number from the customs record is stored in temporary communication number field.
  • Context - all importer data fields have been backed up:
    For Set Backup Found Flag:
    When the system completes the backup process, then the importer found flag is set to true indicating successful backup completion.
  • Context - importer backup completion flag has been set:
    For Clear Current Importer Data:
    When the system finalizes the backup process, then the current importer, business number, and business number qualifier fields are cleared to spaces.
  • Context - current record is not an importer record or no record was found:
    For Increment Counter:
    When the system needs to continue searching, then the search counter is incremented by 1 to check the next sequence number.
  • Context - search counter has been incremented:
    For Counter > 24?:
    When the system checks if more searching is allowed, then if counter is greater than 24 then end the search process, otherwise continue searching for importer records.
  • Context - either importer data has been successfully backed up or search limit has been reached or validation failed:
    For End Backup Process:
    When the backup process reaches completion, then control returns to the calling process with appropriate flags set indicating backup status.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Importer Data Present?
WHEN
The system checks for importer data in the input
THEN
Processing continues only if importer data is present, otherwise the backup process is skipped
Context: Importer data is present in the corrector EDI
GIVEN
Importer data is present in the corrector EDI
Applied to: Business Number Present?
WHEN
The system validates the business number field
THEN
Processing continues only if business number is not spaces, otherwise backup process is terminated
Context: Importer data and business number are present
GIVEN
Importer data and business number are present
Applied to: Business Number Qualifier Present?
WHEN
The system checks the business number qualifier field
THEN
Processing continues only if business number qualifier is not spaces, otherwise backup process ends
Context: All importer validation checks have passed
GIVEN
All importer validation checks have passed
Applied to: Initialize Counter to 3
WHEN
The system begins searching for existing importer records
THEN
The search counter is set to 3 and the importer found flag is set to false
Context: Search counter is initialized and importer data validation passed
GIVEN
Search counter is initialized and importer data validation passed
Applied to: Search Existing Records
WHEN
The system searches customs records using CCN key, record type 55, and current sequence number
THEN
A customs record is retrieved if it exists for the specified sequence
Context: A search for customs records has been executed
GIVEN
A search for customs records has been executed
Applied to: Record Found?
WHEN
The system checks the database call status
THEN
If status is spaces the record is found, otherwise increment counter and continue searching
Context: A customs record has been successfully retrieved
GIVEN
A customs record has been successfully retrieved
Applied to: Is Importer Record?
WHEN
The system checks the entity ID code in the record
THEN
If entity ID code equals 'IM' then it is an importer record, otherwise increment counter and continue searching
Context: An importer record has been found in the customs database
GIVEN
An importer record has been found in the customs database
Applied to: Store CHOP Code
WHEN
The system begins backing up importer data
THEN
The CHOP code from the customs record is stored in temporary importer CHOP field
Context: Importer CHOP code has been backed up
GIVEN
Importer CHOP code has been backed up
Applied to: Store Importer Name
WHEN
The system continues the backup process
THEN
The importer name from the customs record is stored in temporary importer name field
Context: Importer name has been backed up
GIVEN
Importer name has been backed up
Applied to: Store Business Number Qualifier
WHEN
The system continues preserving importer data
THEN
The business number qualifier from the customs record is stored in temporary qualifier field
Context: Business number qualifier has been backed up
GIVEN
Business number qualifier has been backed up
Applied to: Store Business Number
WHEN
The system continues the backup process
THEN
The business number from the customs record is stored in temporary business number field
Context: Business number has been backed up
GIVEN
Business number has been backed up
Applied to: Store CSA Indicator
WHEN
The system continues preserving importer data
THEN
The CSA indicator from the input data is stored in temporary CSA indicator field
Context: CSA indicator has been backed up
GIVEN
CSA indicator has been backed up
Applied to: Store Address Line 1
WHEN
The system continues backing up address information
THEN
The first address line from the customs record is stored in temporary address field 1
Context: Primary address line has been backed up
GIVEN
Primary address line has been backed up
Applied to: Store Address Line 2
WHEN
The system continues preserving address data
THEN
The second address line from the customs record is stored in temporary address field 2
Context: Secondary address line has been backed up
GIVEN
Secondary address line has been backed up
Applied to: Store City Name
WHEN
The system continues backing up location data
THEN
The city name from the customs record is stored in temporary city field
Context: City name has been backed up
GIVEN
City name has been backed up
Applied to: Store Province/State Code
WHEN
The system continues preserving location information
THEN
The province/state code from the customs record is stored in temporary province field
Context: Province/state code has been backed up
GIVEN
Province/state code has been backed up
Applied to: Store Postal Code
WHEN
The system continues backing up address details
THEN
The postal code from the customs record is stored in temporary postal code field
Context: Postal code has been backed up
GIVEN
Postal code has been backed up
Applied to: Store Country Code
WHEN
The system continues preserving location data
THEN
The country code from the customs record is stored in temporary country field
Context: Country code has been backed up
GIVEN
Country code has been backed up
Applied to: Store Contact Function Code
WHEN
The system continues backing up contact information
THEN
The contact function code from the customs record is stored in temporary contact function field
Context: Contact function code has been backed up
GIVEN
Contact function code has been backed up
Applied to: Store Contact Person Name
WHEN
The system continues preserving contact details
THEN
The contact person name from the customs record is stored in temporary contact name field
Context: Contact person name has been backed up
GIVEN
Contact person name has been backed up
Applied to: Store Communication Qualifier
WHEN
The system continues backing up communication data
THEN
The communication number qualifier from the customs record is stored in temporary communication qualifier field
Context: Communication qualifier has been backed up
GIVEN
Communication qualifier has been backed up
Applied to: Store Communication Number
WHEN
The system completes backing up contact information
THEN
The communication number from the customs record is stored in temporary communication number field
Context: All importer data fields have been backed up
GIVEN
All importer data fields have been backed up
Applied to: Set Backup Found Flag
WHEN
The system completes the backup process
THEN
The importer found flag is set to true indicating successful backup completion
Context: Importer backup completion flag has been set
GIVEN
Importer backup completion flag has been set
Applied to: Clear Current Importer Data
WHEN
The system finalizes the backup process
THEN
The current importer, business number, and business number qualifier fields are cleared to spaces
Context: Current record is not an importer record or no record was found
GIVEN
Current record is not an importer record or no record was found
Applied to: Increment Counter
WHEN
The system needs to continue searching
THEN
The search counter is incremented by 1 to check the next sequence number
Context: Search counter has been incremented
GIVEN
Search counter has been incremented
Applied to: Counter > 24?
WHEN
The system checks if more searching is allowed
THEN
If counter is greater than 24 then end the search process, otherwise continue searching for importer records
Context: Either importer data has been successfully backed up or search limit has been reached or validation failed
GIVEN
Either importer data has been successfully backed up or search limit has been reached or validation failed
Applied to: End Backup Process
WHEN
The backup process reaches completion
THEN
Control returns to the calling process with appropriate flags set indicating backup status
R-GCCCCADD-cbl-01874 (+1) File: GCCCCADD.cbl CSA Indicator Reset for EDI Importer Data Merged 2 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'CSA Indicator Reset for EDI Importer Data':
  • Context - au table importer data has been found and edi bol importer data has been found:
    For Reset CSA Indicator to OFF:
    When the business number qualifier is 'bn' or the business number qualifier is blank/spaces, then the csa indicator is set to off.
  • Context - processing csa indicator logic for importer data:
    For Keep CSA Indicator Current State:
    When au table importer data is not found or edi bol importer data is not found or business number qualifier is neither 'bn' nor blank, then the csa indicator maintains its current state without modification.
👨‍💻 Technical ACs (Gherkin)
Context: AU table importer data has been found AND EDI BOL importer data has been found
GIVEN
AU table importer data has been found AND EDI BOL importer data has been found
Applied to: Reset CSA Indicator to OFF
WHEN
The business number qualifier is 'BN' OR the business number qualifier is blank/spaces
THEN
The CSA indicator is set to OFF
Context: Processing CSA indicator logic for importer data
GIVEN
Processing CSA indicator logic for importer data
Applied to: Keep CSA Indicator Current State
WHEN
AU table importer data is not found OR EDI BOL importer data is not found OR business number qualifier is neither 'BN' nor blank
THEN
The CSA indicator maintains its current state without modification
R-GCCCCADD-cbl-01876 (+7) File: GCCCCADD.cbl Importer Address Default Assignment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Address Default Assignment':
  • Context - an importer record is being processed for address information:
    For EDI BOL N3 Segment Found?:
    When the system checks for edi bol n3 segment availability, then the system should identify whether address data is available from edi source or requires fallback processing.
  • Context - edi bol n3 segment is available with address information:
    For Address Line 1 Empty or Low Values?:
    When the first address line is empty or contains low values, then the system should flag the address line as requiring default value assignment.
  • Context - edi address line 1 is empty or contains low values:
    For Set Address Line 1 to 'NA':
    When the system processes the importer address information, then the system should set address line 1 to 'na' as the default value.
  • Context - edi bol n3 segment contains valid address line 1 data:
    For Use EDI Address Line 1:
    When the address line 1 is not empty and does not contain low values, then the system should use the edi address line 1 value directly for the importer record.
  • Context - edi bol n3 segment is available and address line 1 has been processed:
    For Set Address Line 2 from EDI:
    When the system processes address line 2 information, then the system should assign address line 2 from the edi data to the importer record.
  • Context - an importer record requires address information:
    For No EDI N3 Segment Available?:
    When no edi bol n3 segment is available, then the system should initiate fallback address processing procedures.
  • Context - no edi bol n3 segment is available for address information:
    For Clear All N3 Address Data:
    When the system processes importer address data, then the system should clear all n3 address data fields to ensure clean initialization.
  • Context - no edi address segment is available and address data has been cleared:
    For Set Address Line 1 to 'NA':
    When the system requires a value for address line 1, then the system should set address line 1 to 'na' as the fallback default value.
👨‍💻 Technical ACs (Gherkin)
Context: An importer record is being processed for address information
GIVEN
An importer record is being processed for address information
Applied to: EDI BOL N3 Segment Found?
WHEN
The system checks for EDI BOL N3 segment availability
THEN
The system should identify whether address data is available from EDI source or requires fallback processing
Context: EDI BOL N3 segment is available with address information
GIVEN
EDI BOL N3 segment is available with address information
Applied to: Address Line 1 Empty or Low Values?
WHEN
The first address line is empty or contains low values
THEN
The system should flag the address line as requiring default value assignment
Context: EDI address line 1 is empty or contains low values
GIVEN
EDI address line 1 is empty or contains low values
Applied to: Set Address Line 1 to 'NA'
WHEN
The system processes the importer address information
THEN
The system should set address line 1 to 'NA' as the default value
Context: EDI BOL N3 segment contains valid address line 1 data
GIVEN
EDI BOL N3 segment contains valid address line 1 data
Applied to: Use EDI Address Line 1
WHEN
The address line 1 is not empty and does not contain low values
THEN
The system should use the EDI address line 1 value directly for the importer record
Context: EDI BOL N3 segment is available and address line 1 has been processed
GIVEN
EDI BOL N3 segment is available and address line 1 has been processed
Applied to: Set Address Line 2 from EDI
WHEN
The system processes address line 2 information
THEN
The system should assign address line 2 from the EDI data to the importer record
Context: An importer record requires address information
GIVEN
An importer record requires address information
Applied to: No EDI N3 Segment Available?
WHEN
No EDI BOL N3 segment is available
THEN
The system should initiate fallback address processing procedures
Context: No EDI BOL N3 segment is available for address information
GIVEN
No EDI BOL N3 segment is available for address information
Applied to: Clear All N3 Address Data
WHEN
The system processes importer address data
THEN
The system should clear all N3 address data fields to ensure clean initialization
Context: No EDI address segment is available and address data has been cleared
GIVEN
No EDI address segment is available and address data has been cleared
Applied to: Set Address Line 1 to 'NA'
WHEN
The system requires a value for address line 1
THEN
The system should set address line 1 to 'NA' as the fallback default value
R-GCCCCADD-cbl-01884 (+4) File: GCCCCADD.cbl Importer Contact Information Clearing Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Contact Information Clearing':
  • Context - an importer record is being processed and contact information needs to be cleared:
    For Clear All PER Segment Data:
    When the system processes the importer contact clearing operation, then all per segment contact fields are set to spaces including contact function code, contact name, communication number qualifier, and communication number.
  • Context - importer contact information is being cleared:
    For Set Contact Function Code to Spaces:
    When the contact function code field is processed, then the contact function code is set to spaces.
    For Set Contact Name to Spaces:
    When the contact name field is processed, then the contact name is set to spaces.
    For Set Communication Number Qualifier to Spaces:
    When the communication number qualifier field is processed, then the communication number qualifier is set to spaces.
    For Set Communication Number to Spaces:
    When the communication number field is processed, then the communication number is set to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: An importer record is being processed and contact information needs to be cleared
GIVEN
An importer record is being processed and contact information needs to be cleared
Applied to: Clear All PER Segment Data
WHEN
The system processes the importer contact clearing operation
THEN
All PER segment contact fields are set to spaces including contact function code, contact name, communication number qualifier, and communication number
Context: Importer contact information is being cleared
GIVEN
Importer contact information is being cleared
Applied to: Set Contact Function Code to Spaces
WHEN
The contact function code field is processed
THEN
The contact function code is set to spaces
Applied to: Set Contact Name to Spaces
WHEN
The contact name field is processed
THEN
The contact name is set to spaces
Applied to: Set Communication Number Qualifier to Spaces
WHEN
The communication number qualifier field is processed
THEN
The communication number qualifier is set to spaces
Applied to: Set Communication Number to Spaces
WHEN
The communication number field is processed
THEN
The communication number is set to spaces
R-GCCCCADD-cbl-01889 (+4) File: GCCCCADD.cbl Importer Data Deletion Handling by Corrector Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Importer Data Deletion Handling by Corrector':
  • Context - an importer record exists in the system with complete business information including name, business number, qualifier, csa indicator, address details, and contact information:
    For Backup Original Importer Data:
    When the system processes an importer data correction request, then the system creates a backup of all original importer data including chop code, name, business number qualifier, business number, csa indicator, address lines, city, province, postal code, country, contact function code, person name, communication qualifier, and communication number.
  • Context - the system is processing importer data corrections:
    For EDI BOL Importer Segment Found?:
    When the system checks for the presence of an importer segment in the edi bol data, then if the importer segment is found, continue with normal processing, otherwise proceed with deletion handling logic.
  • Context - an edi deletion request is processed and backup importer data is available in temporary storage:
    For Restore from Backup Data:
    When the system needs to handle the deletion while preserving original data, then the system restores all importer information from backup including chop code, entity id, name, business number qualifier, business number, csa indicator, address information, city, province, postal code, country, and contact details, and sets the importer found flag to true.
  • Context - an edi deletion request is processed and no backup importer data is available:
    For Clear Current Importer Data:
    When the system processes the deletion request, then if the importer was not found in record 55, the system clears the importer name field and sets the entity id code to spaces.
  • Context - importer data exists in record 55 and backup importer data is available from previous processing:
    For Check for Existing Importer Data:
    When the system processes importer information, then the system uses the backup importer data and sets the csa indicator to off if both au importer and record 55 importer are found and the business number qualifier is 'bn' or spaces.
👨‍💻 Technical ACs (Gherkin)
Context: An importer record exists in the system with complete business information including name, business number, qualifier, CSA indicator, address details, and contact information
GIVEN
An importer record exists in the system with complete business information including name, business number, qualifier, CSA indicator, address details, and contact information
Applied to: Backup Original Importer Data
WHEN
The system processes an importer data correction request
THEN
The system creates a backup of all original importer data including chop code, name, business number qualifier, business number, CSA indicator, address lines, city, province, postal code, country, contact function code, person name, communication qualifier, and communication number
Context: The system is processing importer data corrections
GIVEN
The system is processing importer data corrections
Applied to: EDI BOL Importer Segment Found?
WHEN
The system checks for the presence of an importer segment in the EDI BOL data
THEN
If the importer segment is found, continue with normal processing, otherwise proceed with deletion handling logic
Context: An EDI deletion request is processed and backup importer data is available in temporary storage
GIVEN
An EDI deletion request is processed and backup importer data is available in temporary storage
Applied to: Restore from Backup Data
WHEN
The system needs to handle the deletion while preserving original data
THEN
The system restores all importer information from backup including chop code, entity ID, name, business number qualifier, business number, CSA indicator, address information, city, province, postal code, country, and contact details, and sets the importer found flag to true
Context: An EDI deletion request is processed and no backup importer data is available
GIVEN
An EDI deletion request is processed and no backup importer data is available
Applied to: Clear Current Importer Data
WHEN
The system processes the deletion request
THEN
If the importer was not found in record 55, the system clears the importer name field and sets the entity ID code to spaces
Context: Importer data exists in record 55 and backup importer data is available from previous processing
GIVEN
Importer data exists in record 55 and backup importer data is available from previous processing
Applied to: Check for Existing Importer Data
WHEN
The system processes importer information
THEN
The system uses the backup importer data and sets the CSA indicator to off if both AU importer and record 55 importer are found and the business number qualifier is 'BN' or spaces
R-GCCCCADD-cbl-01894 (+2) File: GCCCCADD.cbl EDI BOL Segment Type Initialization Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'EDI BOL Segment Type Initialization':
  • Context - edi bol segment retrieval is required for ebsnrsc type:
    For Initialize EBSNRSC Parameters:
    When system initializes ebsnrsc segment parameters, then ebwlgio structure is cleared, segment type is set to 'ebsnrsc', function code is set to 'gu', operator is set to '=', sequence number is set to '01', and accept status is set to 'ge'.
  • Context - edi bol segment retrieval is required for ebsnrsa type:
    For Initialize EBSNRSA Parameters:
    When system initializes ebsnrsa segment parameters, then ebwlgio structure is cleared, segment type is set to 'ebsnrsa', function code is set to 'gu', operator is set to '=', edi bol key is assigned to root key, sequence numbers are set to '01', and accept status is set to 'ge'.
  • Context - ebwlgio parameters are properly initialized for segment retrieval:
    For Parameters Ready for Segment Retrieval:
    When system calls ebclgio to retrieve edi bol segment data, then edi bol segment data is retrieved and stored in the working storage segment structure.
👨‍💻 Technical ACs (Gherkin)
Context: EDI BOL segment retrieval is required for EBSNRSC type
GIVEN
EDI BOL segment retrieval is required for EBSNRSC type
Applied to: Initialize EBSNRSC Parameters
WHEN
System initializes EBSNRSC segment parameters
THEN
EBWLGIO structure is cleared, segment type is set to 'EBSNRSC', function code is set to 'GU', operator is set to '=', sequence number is set to '01', and accept status is set to 'GE'
Context: EDI BOL segment retrieval is required for EBSNRSA type
GIVEN
EDI BOL segment retrieval is required for EBSNRSA type
Applied to: Initialize EBSNRSA Parameters
WHEN
System initializes EBSNRSA segment parameters
THEN
EBWLGIO structure is cleared, segment type is set to 'EBSNRSA', function code is set to 'GU', operator is set to '=', EDI BOL key is assigned to root key, sequence numbers are set to '01', and accept status is set to 'GE'
Context: EBWLGIO parameters are properly initialized for segment retrieval
GIVEN
EBWLGIO parameters are properly initialized for segment retrieval
Applied to: Parameters Ready for Segment Retrieval
WHEN
System calls EBCLGIO to retrieve EDI BOL segment data
THEN
EDI BOL segment data is retrieved and stored in the working storage segment structure
R-GCCCCADD-cbl-01897 (+2) File: GCCCCADD.cbl System Timestamp Capture Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'System Timestamp Capture':
  • Context - the system is ready to begin processing:
    For Accept Current Date from System:
    When processing initialization starts, then the current system date is captured and stored in ts-system-date field.
    For Accept Current Time from System:
    When processing initialization starts after date capture, then the current system time is captured and stored in ts-system-time field.
  • Context - system date and time have been captured and key business identifiers are available:
    For Display Timestamp with Process Info:
    When the initialization process displays status information, then a formatted message is displayed to system error output containing the date, time, process name, and key business identifiers including ccn key, equipment id, importer, business number, and business number qualifier.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to begin processing
GIVEN
The system is ready to begin processing
Applied to: Accept Current Date from System
WHEN
Processing initialization starts
THEN
The current system date is captured and stored in TS-SYSTEM-DATE field
Applied to: Accept Current Time from System
WHEN
Processing initialization starts after date capture
THEN
The current system time is captured and stored in TS-SYSTEM-TIME field
Context: System date and time have been captured and key business identifiers are available
GIVEN
System date and time have been captured and key business identifiers are available
Applied to: Display Timestamp with Process Info
WHEN
The initialization process displays status information
THEN
A formatted message is displayed to system error output containing the date, time, process name, and key business identifiers including CCN key, equipment ID, importer, business number, and business number qualifier
R-GCCCCADD-cbl-01900 (+10) File: GCCCCADD.cbl Lookup manifest Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup manifest':
  • Context - a shipment is being processed with action code iis-a6 or multi-manifest indicator is 'y':
    For Set Default Manifest-From Port to 'IIS-A6':
    When the manifest-from port in the shipment root is empty or spaces, then the manifest-from port should be automatically set to 'iis-a6'.
  • Context - a manifest-from port value is available from the shipment root:
    For Lookup Manifest-From Port in MC Table:
    When the system needs to validate and get details for the manifest-from port, then the system should lookup the port in the mc table using the port code as the search key.
  • Context - the mc table lookup was successful and returned a canadian customs code:
    For Is Canadian Customs Code '00000'?:
    When the canadian customs code equals '00000', then the system should clear the mc table data and generate an error message for invalid canadian customs code.
  • Context - a manifest-from port code is provided for lookup:
    For Generate MC Table Not Found Error:
    When the mc table lookup fails to find a matching record, then the system should clear mc table data and generate an error message indicating the manifest port was not found in mc table.
  • Context - the mc table lookup was successful and returned a valid canadian customs code (not '00000'):
    For Set Manifest-From Station Code:
    When the system processes the mc table record, then the manifest-from station code should be set to the canadian customs code and the us port of exit code should be set from the mc record.
  • Context - a shipment is being processed with either iis-a6 action code or multi-manifest indicator set to 'y':
    For Set Default IIS-A6 for Multi-Manifest:
    When the manifest-to port (mani-upon-port) in the shipment root is empty or spaces, then the system should automatically set the manifest-to port to 'iis-a6'.
  • Context - a shipment is being processed for customs manifest creation:
    For Manifest-To Port from Shiproot Empty?:
    When the manifest-to port (mani-upon-port) from shipment root is empty or spaces, then the system should set error flag 1 to indicate missing manifest-to port.
  • Context - a manifest-to port value is available from the shipment root:
    For Lookup Manifest-To Port in MC Table:
    When the system needs to validate and get details for the manifest-to port, then the system should lookup the port in the mc table using table id 'mc' and the port name as the sequence id.
  • Context - a manifest-to port lookup is attempted in the mc reference table:
    For Generate MC Table Not Found Error:
    When the mc table lookup is not successful (port not found), then the system should clear the mc table data, set error flag 3, save the port name for error messaging, and continue processing.
  • Context - a successful mc table lookup has returned manifest code details:
    For Canadian Customs Code = '00000'?:
    When the canadian customs code from the mc record equals '00000', then the system should treat this as invalid, clear the mc table data, set error flag 2, and save the port name for error messaging.
  • Context - a successful mc table lookup with a valid canadian customs code (not '00000'):
    For Set Manifest-To Station Code:
    When the manifest-to port validation is complete, then the system should set the manifest-to station code from the canadian customs code, set the destination station number from the mc station number, and set the batch print call letters from the mc call letters.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed with action code IIS-A6 or multi-manifest indicator is 'Y'
GIVEN
A shipment is being processed with action code IIS-A6 or multi-manifest indicator is 'Y'
Applied to: Set Default Manifest-From Port to 'IIS-A6'
WHEN
The manifest-from port in the shipment root is empty or spaces
THEN
The manifest-from port should be automatically set to 'IIS-A6'
Context: A manifest-from port value is available from the shipment root
GIVEN
A manifest-from port value is available from the shipment root
Applied to: Lookup Manifest-From Port in MC Table
WHEN
The system needs to validate and get details for the manifest-from port
THEN
The system should lookup the port in the MC table using the port code as the search key
Context: The MC table lookup was successful and returned a Canadian customs code
GIVEN
The MC table lookup was successful and returned a Canadian customs code
Applied to: Is Canadian Customs Code '00000'?
WHEN
The Canadian customs code equals '00000'
THEN
The system should clear the MC table data and generate an error message for invalid Canadian customs code
Context: A manifest-from port code is provided for lookup
GIVEN
A manifest-from port code is provided for lookup
Applied to: Generate MC Table Not Found Error
WHEN
The MC table lookup fails to find a matching record
THEN
The system should clear MC table data and generate an error message indicating the manifest port was not found in MC table
Context: The MC table lookup was successful and returned a valid Canadian customs code (not '00000')
GIVEN
The MC table lookup was successful and returned a valid Canadian customs code (not '00000')
Applied to: Set Manifest-From Station Code
WHEN
The system processes the MC table record
THEN
The manifest-from station code should be set to the Canadian customs code and the US port of exit code should be set from the MC record
Context: A shipment is being processed with either IIS-A6 action code or multi-manifest indicator set to 'Y'
GIVEN
A shipment is being processed with either IIS-A6 action code or multi-manifest indicator set to 'Y'
Applied to: Set Default IIS-A6 for Multi-Manifest
WHEN
The manifest-to port (MANI-UPON-PORT) in the shipment root is empty or spaces
THEN
The system should automatically set the manifest-to port to 'IIS-A6'
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Manifest-To Port from Shiproot Empty?
WHEN
The manifest-to port (MANI-UPON-PORT) from shipment root is empty or spaces
THEN
The system should set error flag 1 to indicate missing manifest-to port
Context: A manifest-to port value is available from the shipment root
GIVEN
A manifest-to port value is available from the shipment root
Applied to: Lookup Manifest-To Port in MC Table
WHEN
The system needs to validate and get details for the manifest-to port
THEN
The system should lookup the port in the MC table using table ID 'MC' and the port name as the sequence ID
Context: A manifest-to port lookup is attempted in the MC reference table
GIVEN
A manifest-to port lookup is attempted in the MC reference table
Applied to: Generate MC Table Not Found Error
WHEN
The MC table lookup is not successful (port not found)
THEN
The system should clear the MC table data, set error flag 3, save the port name for error messaging, and continue processing
Context: A successful MC table lookup has returned manifest code details
GIVEN
A successful MC table lookup has returned manifest code details
Applied to: Canadian Customs Code = '00000'?
WHEN
The Canadian customs code from the MC record equals '00000'
THEN
The system should treat this as invalid, clear the MC table data, set error flag 2, and save the port name for error messaging
Context: A successful MC table lookup with a valid Canadian customs code (not '00000')
GIVEN
A successful MC table lookup with a valid Canadian customs code (not '00000')
Applied to: Set Manifest-To Station Code
WHEN
The manifest-to port validation is complete
THEN
The system should set the manifest-to station code from the Canadian customs code, set the destination station number from the MC station number, and set the batch print call letters from the MC call letters
R-GCCCCADD-cbl-01911 (+4) File: GCCCCADD.cbl Apply special CCN type 9 manifest port override rules Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply special CCN type 9 manifest port override rules':
  • Context - a cargo control number is being processed:
    For Check CCN Type and Port Conditions:
    When the ccn type is '9', then the system evaluates port conditions for potential override.
    For Continue with Original Ports:
    When the ccn type is not '9' or the port conditions for override are not met, then the original manifest from and to station names are preserved without override.
  • Context - a ccn type is '9':
    For Are Port Conditions Met?:
    When the us station exit code is not '00000' or the manifest from station name is not 'iis-a6' or the manifest to station name is not 'iis-a6' or the manifest to station name does not equal the manifest from station name, then the port conditions are considered met for override application.
  • Context - a ccn type is '9' and port conditions are met for override:
    For Set Manifest From Port to IIS-A6 & Set Manifest To Port to IIS-A6:
    When the override rules are applied, then the manifest from station name is set to 'iis-a6' and the manifest to station name is set to 'iis-a6'.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo control number is being processed
GIVEN
A cargo control number is being processed
Applied to: Check CCN Type and Port Conditions
WHEN
The CCN type is '9'
THEN
The system evaluates port conditions for potential override
Applied to: Continue with Original Ports
WHEN
The CCN type is not '9' OR the port conditions for override are not met
THEN
The original manifest from and to station names are preserved without override
Context: A CCN type is '9'
GIVEN
A CCN type is '9'
Applied to: Are Port Conditions Met?
WHEN
The US station exit code is not '00000' OR the manifest from station name is not 'IIS-A6' OR the manifest to station name is not 'IIS-A6' OR the manifest to station name does not equal the manifest from station name
THEN
The port conditions are considered met for override application
Context: A CCN type is '9' and port conditions are met for override
GIVEN
A CCN type is '9' and port conditions are met for override
Applied to: Set Manifest From Port to IIS-A6 & Set Manifest To Port to IIS-A6
WHEN
The override rules are applied
THEN
The manifest from station name is set to 'IIS-A6' AND The manifest to station name is set to 'IIS-A6'
R-GCCCCADD-cbl-01916 (+8) File: GCCCCADD.cbl Validate Canadian customs code from MC table lookup Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Canadian customs code from MC table lookup':
  • Context - a shipment with manifest from port data:
    For Manifest From Port Available?:
    When the system validates canadian customs code requirements, then the system should proceed with mc table lookup if manifest from port is available, otherwise generate manifest port not found error.
  • Context - a valid manifest from port identifier:
    For Lookup MC Table with Manifest From Port:
    When the system needs to validate canadian customs requirements, then the system should lookup the mc table to retrieve canadian customs code and us port exit code.
  • Context - an mc table lookup operation has been performed:
    For MC Table Lookup Successful?:
    When the system evaluates the lookup result, then the system should proceed with customs code validation if successful, otherwise generate manifest port not found error.
  • Context - a canadian customs code retrieved from mc table lookup:
    For Canadian Customs Code = '00000'?:
    When the system validates the customs code value, then the system should accept the code if it is not '00000', otherwise generate invalid canadian customs code error and clear mc table data.
  • Context - a valid canadian customs code that is not '00000':
    For Set Canadian Customs Code to Manifest From Station Code:
    When the system processes manifest from station information, then the system should assign the canadian customs code to the manifest from station code field.
  • Context - a canadian customs code equal to '00000' from mc table lookup:
    For Generate Invalid Canadian Customs Code Error Message:
    When the system validates customs code requirements, then the system should generate an error message indicating invalid canadian customs code for the manifest port.
  • Context - a manifest from port that is either missing or not found in mc table:
    For Generate Manifest Port Not Found Error Message:
    When the system attempts to validate manifest port information, then the system should generate an error message indicating the manifest port was not found in the manifest code table.
  • Context - an error condition in canadian customs code validation or mc table lookup failure:
    For Clear MC Table Data:
    When the system encounters validation errors, then the system should clear all mc table data to ensure invalid information is not used.
  • Context - valid mc table data with us port exit information:
    For Set US Port of Exit Code from MC Table:
    When the system processes customs border crossing requirements, then the system should assign the us port of exit code from mc table to the customs record.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with manifest from port data
GIVEN
A shipment with manifest from port data
Applied to: Manifest From Port Available?
WHEN
The system validates Canadian customs code requirements
THEN
The system should proceed with MC table lookup if manifest from port is available, otherwise generate manifest port not found error
Context: A valid manifest from port identifier
GIVEN
A valid manifest from port identifier
Applied to: Lookup MC Table with Manifest From Port
WHEN
The system needs to validate Canadian customs requirements
THEN
The system should lookup the MC table to retrieve Canadian customs code and US port exit code
Context: An MC table lookup operation has been performed
GIVEN
An MC table lookup operation has been performed
Applied to: MC Table Lookup Successful?
WHEN
The system evaluates the lookup result
THEN
The system should proceed with customs code validation if successful, otherwise generate manifest port not found error
Context: A Canadian customs code retrieved from MC table lookup
GIVEN
A Canadian customs code retrieved from MC table lookup
Applied to: Canadian Customs Code = '00000'?
WHEN
The system validates the customs code value
THEN
The system should accept the code if it is not '00000', otherwise generate invalid Canadian customs code error and clear MC table data
Context: A valid Canadian customs code that is not '00000'
GIVEN
A valid Canadian customs code that is not '00000'
Applied to: Set Canadian Customs Code to Manifest From Station Code
WHEN
The system processes manifest from station information
THEN
The system should assign the Canadian customs code to the manifest from station code field
Context: A Canadian customs code equal to '00000' from MC table lookup
GIVEN
A Canadian customs code equal to '00000' from MC table lookup
Applied to: Generate Invalid Canadian Customs Code Error Message
WHEN
The system validates customs code requirements
THEN
The system should generate an error message indicating invalid Canadian customs code for the manifest port
Context: A manifest from port that is either missing or not found in MC table
GIVEN
A manifest from port that is either missing or not found in MC table
Applied to: Generate Manifest Port Not Found Error Message
WHEN
The system attempts to validate manifest port information
THEN
The system should generate an error message indicating the manifest port was not found in the manifest code table
Context: An error condition in Canadian customs code validation or MC table lookup failure
GIVEN
An error condition in Canadian customs code validation or MC table lookup failure
Applied to: Clear MC Table Data
WHEN
The system encounters validation errors
THEN
The system should clear all MC table data to ensure invalid information is not used
Context: Valid MC table data with US port exit information
GIVEN
Valid MC table data with US port exit information
Applied to: Set US Port of Exit Code from MC Table
WHEN
The system processes customs border crossing requirements
THEN
The system should assign the US port of exit code from MC table to the customs record
R-GCCCCADD-cbl-01925 (+3) File: GCCCCADD.cbl Validate US port of exit code from MC table lookup Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate US port of exit code from MC table lookup':
  • Context - a manifest from port exists in the shipment root data and the mc table lookup was successful and the mc table contains port configuration data:
    For Extract US Port Exit Code from MC Table:
    When the system processes the mc table lookup results, then the us port of exit code from the mc table is extracted and assigned to the customs record us port of exit code field.
  • Context - the us port of exit code has been successfully extracted from the mc table and the customs record structure is available for update:
    For Set US Port Exit Code in Customs Record:
    When the system assigns port exit information to the customs record, then the us port of exit code is set in the customs cargo manifest record us port of exit code field.
  • Context - a manifest from port lookup has been attempted in the mc table:
    For MC Table Lookup Successful?:
    When the system evaluates the lookup result status, then if the lookup was successful, proceed to extract us port exit code, otherwise handle the lookup failure.
  • Context - the mc table lookup for manifest from port has failed and the customs record requires a us port of exit code value:
    For Set Empty US Port Exit Code:
    When the system handles the failed lookup scenario, then an empty or default us port of exit code is assigned to the customs record.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest from port exists in the shipment root data AND the MC table lookup was successful AND the MC table contains port configuration data
GIVEN
A manifest from port exists in the shipment root data AND the MC table lookup was successful AND the MC table contains port configuration data
Applied to: Extract US Port Exit Code from MC Table
WHEN
The system processes the MC table lookup results
THEN
The US port of exit code from the MC table is extracted and assigned to the customs record US port of exit code field
Context: The US port of exit code has been successfully extracted from the MC table AND the customs record structure is available for update
GIVEN
The US port of exit code has been successfully extracted from the MC table AND the customs record structure is available for update
Applied to: Set US Port Exit Code in Customs Record
WHEN
The system assigns port exit information to the customs record
THEN
The US port of exit code is set in the customs cargo manifest record US port of exit code field
Context: A manifest from port lookup has been attempted in the MC table
GIVEN
A manifest from port lookup has been attempted in the MC table
Applied to: MC Table Lookup Successful?
WHEN
The system evaluates the lookup result status
THEN
If the lookup was successful, proceed to extract US port exit code, otherwise handle the lookup failure
Context: The MC table lookup for manifest from port has failed AND the customs record requires a US port of exit code value
GIVEN
The MC table lookup for manifest from port has failed AND the customs record requires a US port of exit code value
Applied to: Set Empty US Port Exit Code
WHEN
The system handles the failed lookup scenario
THEN
An empty or default US port of exit code is assigned to the customs record
R-GCCCCADD-cbl-01929 (+5) File: GCCCCADD.cbl Determine sub Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine sub':
  • Context - a manifest is being processed with manifest-to-station-name and destination country information available:
    For Check if IIS-A6 Manifest and Non-US Destination:
    When the manifest-to-station-name equals 'iis-a6' and the destination is not in the united states, then the system should initiate sub-location code determination process.
  • Context - the manifest qualifies for sub-location code determination and destination station number is available from shipment root:
    For Lookup Destination Station in CM Table:
    When the system performs a lookup in the cm table using the destination station number, then the system should attempt to retrieve the corresponding cm table record.
  • Context - a successful cm table lookup has been performed for the destination station:
    For Get Port Manifest Upon from CM Table:
    When the cm table record is retrieved successfully, then the system should extract the port-manifest-upon field from the cm table record.
  • Context - port manifest upon information has been extracted from the cm table record:
    For Lookup Port in MC Table:
    When the system performs a lookup in the mc table using the port manifest upon value, then the system should attempt to retrieve the corresponding mc table record.
  • Context - a successful mc table lookup has been performed using the port manifest upon value:
    For Set Sub-location Code from MC Table:
    When the mc table record is retrieved successfully, then the system should set the sub-location code from the mc table sub-location-code field.
  • Context - sub-location code determination process has been initiated:
    For Set Sub-location Code to Spaces:
    When either the cm table lookup fails or the mc table lookup fails, then the system should set the sub-location code to spaces (empty).
👨‍💻 Technical ACs (Gherkin)
Context: A manifest is being processed with manifest-to-station-name and destination country information available
GIVEN
A manifest is being processed with manifest-to-station-name and destination country information available
Applied to: Check if IIS-A6 Manifest and Non-US Destination
WHEN
The manifest-to-station-name equals 'IIS-A6' AND the destination is not in the United States
THEN
The system should initiate sub-location code determination process
Context: The manifest qualifies for sub-location code determination and destination station number is available from shipment root
GIVEN
The manifest qualifies for sub-location code determination and destination station number is available from shipment root
Applied to: Lookup Destination Station in CM Table
WHEN
The system performs a lookup in the CM table using the destination station number
THEN
The system should attempt to retrieve the corresponding CM table record
Context: A successful CM table lookup has been performed for the destination station
GIVEN
A successful CM table lookup has been performed for the destination station
Applied to: Get Port Manifest Upon from CM Table
WHEN
The CM table record is retrieved successfully
THEN
The system should extract the port-manifest-upon field from the CM table record
Context: Port manifest upon information has been extracted from the CM table record
GIVEN
Port manifest upon information has been extracted from the CM table record
Applied to: Lookup Port in MC Table
WHEN
The system performs a lookup in the MC table using the port manifest upon value
THEN
The system should attempt to retrieve the corresponding MC table record
Context: A successful MC table lookup has been performed using the port manifest upon value
GIVEN
A successful MC table lookup has been performed using the port manifest upon value
Applied to: Set Sub-location Code from MC Table
WHEN
The MC table record is retrieved successfully
THEN
The system should set the sub-location code from the MC table sub-location-code field
Context: Sub-location code determination process has been initiated
GIVEN
Sub-location code determination process has been initiated
Applied to: Set Sub-location Code to Spaces
WHEN
Either the CM table lookup fails OR the MC table lookup fails
THEN
The system should set the sub-location code to spaces (empty)
R-GCCCCADD-cbl-01935 (+6) File: GCCCCADD.cbl Apply complex sub Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply complex sub':
  • Context - a customs control record is being processed for sub-location code requirements:
    For Sub-location Code Already Set?:
    When the sub-location code field contains a value (not spaces), then the system should continue processing without setting any error flags.
  • Context - a customs control record has no sub-location code set:
    For CSA Indicator On?:
    When the csa indicator is turned on, then the system should waive the sub-location code requirement and continue processing.
  • Context - a customs control record has no sub-location code set and csa indicator is off:
    For Manifest From/To Stations Same AND Not IIS-A6?:
    When the manifest from station name equals the manifest to station name and the manifest to station name is not 'iis-a6', then the system should waive the sub-location code requirement and continue processing.
  • Context - a customs control record has no sub-location code set, csa indicator is off, and manifest stations are different or one is iis-a6:
    For Destination is US?:
    When the destination state code corresponds to a us state in the state-country lookup table, then the system should waive the sub-location code requirement and continue processing.
  • Context - a customs control record has no sub-location code set, csa indicator is off, manifest stations don't qualify for exemption, and destination is not us:
    For Arrival Indicator = 'Y'?:
    When the arrival indicator equals 'y', then the system should waive the sub-location code requirement and continue processing.
  • Context - a customs control record has no sub-location code set, csa indicator is off, manifest stations don't qualify for exemption, destination is not us, and arrival indicator is not 'y':
    For Set Sub-location Error Flag:
    When all exemption conditions fail to be met, then the system should set the sub-location error flag to indicate a validation failure.
  • Context - the sub-location error flag has been set due to missing sub-location code:
    For Generate Error Message: Invalid Destination Station Sub-location Code:
    When the system processes the error condition, then the system should generate an error message indicating invalid destination station sub-location code and add it to the message collection.
👨‍💻 Technical ACs (Gherkin)
Context: A customs control record is being processed for sub-location code requirements
GIVEN
A customs control record is being processed for sub-location code requirements
Applied to: Sub-location Code Already Set?
WHEN
The sub-location code field contains a value (not spaces)
THEN
The system should continue processing without setting any error flags
Context: A customs control record has no sub-location code set
GIVEN
A customs control record has no sub-location code set
Applied to: CSA Indicator On?
WHEN
The CSA indicator is turned on
THEN
The system should waive the sub-location code requirement and continue processing
Context: A customs control record has no sub-location code set and CSA indicator is off
GIVEN
A customs control record has no sub-location code set and CSA indicator is off
Applied to: Manifest From/To Stations Same AND Not IIS-A6?
WHEN
The manifest from station name equals the manifest to station name AND the manifest to station name is not 'IIS-A6'
THEN
The system should waive the sub-location code requirement and continue processing
Context: A customs control record has no sub-location code set, CSA indicator is off, and manifest stations are different or one is IIS-A6
GIVEN
A customs control record has no sub-location code set, CSA indicator is off, and manifest stations are different or one is IIS-A6
Applied to: Destination is US?
WHEN
The destination state code corresponds to a US state in the state-country lookup table
THEN
The system should waive the sub-location code requirement and continue processing
Context: A customs control record has no sub-location code set, CSA indicator is off, manifest stations don't qualify for exemption, and destination is not US
GIVEN
A customs control record has no sub-location code set, CSA indicator is off, manifest stations don't qualify for exemption, and destination is not US
Applied to: Arrival Indicator = 'Y'?
WHEN
The arrival indicator equals 'Y'
THEN
The system should waive the sub-location code requirement and continue processing
Context: A customs control record has no sub-location code set, CSA indicator is off, manifest stations don't qualify for exemption, destination is not US, and arrival indicator is not 'Y'
GIVEN
A customs control record has no sub-location code set, CSA indicator is off, manifest stations don't qualify for exemption, destination is not US, and arrival indicator is not 'Y'
Applied to: Set Sub-location Error Flag
WHEN
All exemption conditions fail to be met
THEN
The system should set the sub-location error flag to indicate a validation failure
Context: The sub-location error flag has been set due to missing sub-location code
GIVEN
The sub-location error flag has been set due to missing sub-location code
Applied to: Generate Error Message: Invalid Destination Station Sub-location Code
WHEN
The system processes the error condition
THEN
The system should generate an error message indicating invalid destination station sub-location code and add it to the message collection
R-GCCCCADD-cbl-01942 (+19) File: GCCCCADD.cbl Process EDI BOL commodity segments for weight and quantity extraction Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process EDI BOL commodity segments for weight and quantity extraction':
  • Context - a waybill key is provided for processing:
    For Check for Valid EDI BOL:
    When the system checks for edi bol availability by verifying origin road number is not zero and retrieving shipmin segment with type 'e' and number '1', then if edi bol data is found, set valid edi bol flag and extract edi bol key, otherwise set invalid edi bol flag.
  • Context - valid edi bol data is available:
    For Initialize Weight and Quantity Counters:
    When starting weight and quantity processing, then set commodity weight counter to zero and number of units counter to zero.
  • Context - valid edi bol key and commodity sequence number:
    For Get EBSBCCM Commodity Segment:
    When retrieving ebsbccm segment with type 'cm' and current sequence number, then if invalid edi bol flag is set, mark segment as not found, otherwise call ebclgio and set found flag based on status.
  • Context - a commodity segment is found with lading quantity data:
    For Add Lading Quantity to Total:
    When processing the commodity segment, then add the lading quantity from the segment to the total number of units counter.
  • Context - processing the first commodity segment (sequence = 1):
    For Get EBSBCCR Weight Segment:
    When retrieving ebsbccr weight segment with type 'cr' and dependent key 'cr001', then if invalid edi bol flag is set, mark weight segment as not found, otherwise call ebclgio and set found flag based on status.
  • Context - weight segment is found for the first commodity:
    For Extract Total Weight:
    When processing weight information, then move the n7 weight value to the commodity weight counter.
  • Context - weight segment is not found for the first commodity:
    For Set Weight to Zero:
    When processing weight information, then set commodity weight counter to zero.
  • Context - weight has been processed for the first commodity segment:
    For Determine Weight Unit from Metric Indicator:
    When determining weight unit from shipment root metric indicator, then if metric indicator is 'm' or 'l', set weight unit to kilograms, otherwise set weight unit to pounds.
  • Context - processing the first commodity segment with lading quantity qualifier:
    For Set Quantity Qualifier from Segment:
    When setting quantity qualifier for the shipment, then move the lading quantity qualifier from the commodity segment to the customs quantity qualifier.
  • Context - both commodity weight and number of units are zero after edi processing:
    For Fall Back to Fastway SHIPCOMM Data:
    When falling back to fastway data processing, then set shipcomm found flag and set get function to 'gu' for first segment retrieval.
  • Context - fallback to fastway data is required:
    For Get First SHIPCOMM Segment:
    When retrieving shipcomm segment with 'gu' function, then call fwcwbio with shipment root key and shipcomm segment type, set found flag based on status.
  • Context - shipcomm segment is found:
    For Add SHIPCOMM Quantities and Weights:
    When processing fastway commodity data, then add number of units from shipcomm to total units, and if metric indicator is 'm' or 'l', add metric weight and set unit to kilograms, otherwise add standard weight and set unit to pounds.
  • Context - processing fastway shipcomm data:
    For Set Quantity Qualifier to PCS:
    When setting quantity qualifier, then set quantity qualifier to 'pcs' (pieces).
  • Context - first shipcomm segment has been processed:
    For Get Next SHIPCOMM Segments:
    When retrieving additional shipcomm segments, then set get function to 'gn' and continue processing until no more segments are found.
  • Context - additional shipcomm segments are found:
    For Add Additional SHIPCOMM Data:
    When processing additional fastway data, then add number of units to total, set quantity qualifier to 'pcs', and add appropriate weight based on metric indicator.
  • Context - final number of units is greater than zero:
    For Use Calculated Quantity:
    When finalizing quantity assignment, then move the calculated number of units to the customs lading quantity.
  • Context - final number of units is zero or less:
    For Set Default Quantity to 1:
    When finalizing quantity assignment, then set number of units to 1 and move to customs lading quantity.
  • Context - final commodity weight is greater than zero:
    For Use Calculated Weight:
    When finalizing weight assignment, then move the calculated commodity weight to the customs weight field.
  • Context - final commodity weight is zero or less:
    For Set Default Weight to 1:
    When finalizing weight assignment, then set customs weight to '00000001'.
  • Context - quantity qualifier is empty after all processing:
    For Set Default Qualifier to PCS:
    When finalizing quantity qualifier assignment, then set quantity qualifier to 'pcs' (pieces).
👨‍💻 Technical ACs (Gherkin)
Context: A waybill key is provided for processing
GIVEN
A waybill key is provided for processing
Applied to: Check for Valid EDI BOL
WHEN
The system checks for EDI BOL availability by verifying origin road number is not zero and retrieving SHIPMIN segment with type 'E' and number '1'
THEN
If EDI BOL data is found, set valid EDI BOL flag and extract EDI BOL key, otherwise set invalid EDI BOL flag
Context: Valid EDI BOL data is available
GIVEN
Valid EDI BOL data is available
Applied to: Initialize Weight and Quantity Counters
WHEN
Starting weight and quantity processing
THEN
Set commodity weight counter to zero and number of units counter to zero
Context: Valid EDI BOL key and commodity sequence number
GIVEN
Valid EDI BOL key and commodity sequence number
Applied to: Get EBSBCCM Commodity Segment
WHEN
Retrieving EBSBCCM segment with type 'CM' and current sequence number
THEN
If invalid EDI BOL flag is set, mark segment as not found, otherwise call EBCLGIO and set found flag based on status
Context: A commodity segment is found with lading quantity data
GIVEN
A commodity segment is found with lading quantity data
Applied to: Add Lading Quantity to Total
WHEN
Processing the commodity segment
THEN
Add the lading quantity from the segment to the total number of units counter
Context: Processing the first commodity segment (sequence = 1)
GIVEN
Processing the first commodity segment (sequence = 1)
Applied to: Get EBSBCCR Weight Segment
WHEN
Retrieving EBSBCCR weight segment with type 'CR' and dependent key 'CR001'
THEN
If invalid EDI BOL flag is set, mark weight segment as not found, otherwise call EBCLGIO and set found flag based on status
Context: Weight segment is found for the first commodity
GIVEN
Weight segment is found for the first commodity
Applied to: Extract Total Weight
WHEN
Processing weight information
THEN
Move the N7 weight value to the commodity weight counter
Context: Weight segment is not found for the first commodity
GIVEN
Weight segment is not found for the first commodity
Applied to: Set Weight to Zero
WHEN
Processing weight information
THEN
Set commodity weight counter to zero
Context: Weight has been processed for the first commodity segment
GIVEN
Weight has been processed for the first commodity segment
Applied to: Determine Weight Unit from Metric Indicator
WHEN
Determining weight unit from shipment root metric indicator
THEN
If metric indicator is 'M' or 'L', set weight unit to kilograms, otherwise set weight unit to pounds
Context: Processing the first commodity segment with lading quantity qualifier
GIVEN
Processing the first commodity segment with lading quantity qualifier
Applied to: Set Quantity Qualifier from Segment
WHEN
Setting quantity qualifier for the shipment
THEN
Move the lading quantity qualifier from the commodity segment to the customs quantity qualifier
Context: Both commodity weight and number of units are zero after EDI processing
GIVEN
Both commodity weight and number of units are zero after EDI processing
Applied to: Fall Back to Fastway SHIPCOMM Data
WHEN
Falling back to Fastway data processing
THEN
Set SHIPCOMM found flag and set get function to 'GU' for first segment retrieval
Context: Fallback to Fastway data is required
GIVEN
Fallback to Fastway data is required
Applied to: Get First SHIPCOMM Segment
WHEN
Retrieving SHIPCOMM segment with 'GU' function
THEN
Call FWCWBIO with shipment root key and SHIPCOMM segment type, set found flag based on status
Context: SHIPCOMM segment is found
GIVEN
SHIPCOMM segment is found
Applied to: Add SHIPCOMM Quantities and Weights
WHEN
Processing Fastway commodity data
THEN
Add number of units from SHIPCOMM to total units, and if metric indicator is 'M' or 'L', add metric weight and set unit to kilograms, otherwise add standard weight and set unit to pounds
Context: Processing Fastway SHIPCOMM data
GIVEN
Processing Fastway SHIPCOMM data
Applied to: Set Quantity Qualifier to PCS
WHEN
Setting quantity qualifier
THEN
Set quantity qualifier to 'PCS' (pieces)
Context: First SHIPCOMM segment has been processed
GIVEN
First SHIPCOMM segment has been processed
Applied to: Get Next SHIPCOMM Segments
WHEN
Retrieving additional SHIPCOMM segments
THEN
Set get function to 'GN' and continue processing until no more segments are found
Context: Additional SHIPCOMM segments are found
GIVEN
Additional SHIPCOMM segments are found
Applied to: Add Additional SHIPCOMM Data
WHEN
Processing additional Fastway data
THEN
Add number of units to total, set quantity qualifier to 'PCS', and add appropriate weight based on metric indicator
Context: Final number of units is greater than zero
GIVEN
Final number of units is greater than zero
Applied to: Use Calculated Quantity
WHEN
Finalizing quantity assignment
THEN
Move the calculated number of units to the customs lading quantity
Context: Final number of units is zero or less
GIVEN
Final number of units is zero or less
Applied to: Set Default Quantity to 1
WHEN
Finalizing quantity assignment
THEN
Set number of units to 1 and move to customs lading quantity
Context: Final commodity weight is greater than zero
GIVEN
Final commodity weight is greater than zero
Applied to: Use Calculated Weight
WHEN
Finalizing weight assignment
THEN
Move the calculated commodity weight to the customs weight field
Context: Final commodity weight is zero or less
GIVEN
Final commodity weight is zero or less
Applied to: Set Default Weight to 1
WHEN
Finalizing weight assignment
THEN
Set customs weight to '00000001'
Context: Quantity qualifier is empty after all processing
GIVEN
Quantity qualifier is empty after all processing
Applied to: Set Default Qualifier to PCS
WHEN
Finalizing quantity qualifier assignment
THEN
Set quantity qualifier to 'PCS' (pieces)
R-GCCCCADD-cbl-01962 (+5) File: GCCCCADD.cbl Fall back to Fastway SHIPCOMM data when EDI BOL unavailable Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fall back to Fastway SHIPCOMM data when EDI BOL unavailable':
  • Context - a waybill processing request is initiated:
    For Check for Valid EDI BOL:
    When the system checks for edi bol availability by verifying origin road number is not zero, then the system sets edi bol availability flag and extracts edi bol key if valid data exists.
  • Context - edi bol data is available and valid:
    For Process EBSBCCM Commodity Segments:
    When the system processes commodity segments from sequence 1 to 98 until no more segments found, then the system accumulates lading quantity from each segment and captures quantity qualifier from first segment.
  • Context - edi bol commodity segments are being processed and first sequence is identified:
    For Process EBSBCCR Weight Segments:
    When the system retrieves weight segment for the first commodity sequence, then the system captures weight value and sets weight unit based on metric indicator from shipment root.
  • Context - edi bol data is not available or weight and quantity values are zero after edi processing:
    For Fall Back to Fastway SHIPCOMM Data:
    When the system retrieves first shipcomm record and processes all subsequent shipcomm records, then the system accumulates units and weight from all shipcomm records and sets quantity qualifier to 'pcs'.
  • Context - weight data has been processed from either edi bol or fastway shipcomm:
    For Set Weight Units Based on Metric Indicator:
    When the system checks the metric indicator from shipment root data, then the system sets weight unit to kilograms if metric indicator is 'm' or 'l', otherwise sets to pounds.
  • Context - weight and quantity processing is complete from all available data sources:
    For Set Default Values if Zero:
    When the system finds quantity is zero or weight is zero, then the system sets quantity to 1 if zero and weight to '00000001' if zero, and ensures quantity qualifier is set to 'pcs' if blank.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing request is initiated
GIVEN
A waybill processing request is initiated
Applied to: Check for Valid EDI BOL
WHEN
The system checks for EDI BOL availability by verifying origin road number is not zero
THEN
The system sets EDI BOL availability flag and extracts EDI BOL key if valid data exists
Context: EDI BOL data is available and valid
GIVEN
EDI BOL data is available and valid
Applied to: Process EBSBCCM Commodity Segments
WHEN
The system processes commodity segments from sequence 1 to 98 until no more segments found
THEN
The system accumulates lading quantity from each segment and captures quantity qualifier from first segment
Context: EDI BOL commodity segments are being processed and first sequence is identified
GIVEN
EDI BOL commodity segments are being processed and first sequence is identified
Applied to: Process EBSBCCR Weight Segments
WHEN
The system retrieves weight segment for the first commodity sequence
THEN
The system captures weight value and sets weight unit based on metric indicator from shipment root
Context: EDI BOL data is not available or weight and quantity values are zero after EDI processing
GIVEN
EDI BOL data is not available or weight and quantity values are zero after EDI processing
Applied to: Fall Back to Fastway SHIPCOMM Data
WHEN
The system retrieves first SHIPCOMM record and processes all subsequent SHIPCOMM records
THEN
The system accumulates units and weight from all SHIPCOMM records and sets quantity qualifier to 'PCS'
Context: Weight data has been processed from either EDI BOL or Fastway SHIPCOMM
GIVEN
Weight data has been processed from either EDI BOL or Fastway SHIPCOMM
Applied to: Set Weight Units Based on Metric Indicator
WHEN
The system checks the metric indicator from shipment root data
THEN
The system sets weight unit to kilograms if metric indicator is 'M' or 'L', otherwise sets to pounds
Context: Weight and quantity processing is complete from all available data sources
GIVEN
Weight and quantity processing is complete from all available data sources
Applied to: Set Default Values if Zero
WHEN
The system finds quantity is zero or weight is zero
THEN
The system sets quantity to 1 if zero and weight to '00000001' if zero, and ensures quantity qualifier is set to 'PCS' if blank
R-GCCCCADD-cbl-01968 (+10) File: GCCCCADD.cbl Validate and set final weight and quantity values with defaults Merged 11 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate and set final weight and quantity values with defaults':
  • Context - a waybill processing request with origin road number:
    For Check for Valid EDI BOL Data:
    When the system checks for valid edi bol data by verifying origin road number is not zero and retrieving shipment mining data, then the system sets edi bol availability flag and extracts edi bol key if data is found.
  • Context - weight and quantity processing is starting:
    For Initialize Weight and Quantity Counters:
    When the system begins commodity data processing, then weight and quantity counters are initialized to zero.
  • Context - valid edi bol data is available with commodity segments:
    For Process EDI BOL Commodity Segments:
    When the system processes each commodity segment sequentially from 1 to 98, then each found commodity segment contributes its quantity to the total and the first segment provides weight and unit information.
  • Context - the first edi bol commodity segment is being processed:
    For Get Weight from EDI BOL:
    When weight data is extracted from the commodity segment, then the weight value is set from the segment and weight unit is determined as kilograms if metric indicator is m or l, otherwise pounds.
  • Context - edi bol data is not available or both weight and quantity are zero after edi processing:
    For Fall Back to Fastway SHIPCOMM Data:
    When the system retrieves fastway shipcomm data using gu and gn functions, then weight and quantity are accumulated from all shipcomm records with quantity qualifier set to pcs and weight unit determined by metric indicator.
  • Context - weight and quantity processing has completed from all data sources:
    For Set Default Quantity to 1:
    When the final quantity value is zero or not greater than zero, then the system sets the default quantity to 1.
  • Context - weight processing has completed from all data sources:
    For Set Default Weight to 1:
    When the final weight value is zero or not greater than zero, then the system sets the default weight to 00000001.
  • Context - weight and quantity processing is finalizing:
    For Set Default Qualifier to PCS:
    When the quantity qualifier field is empty or spaces, then the system sets the default quantity qualifier to pcs (pieces).
  • Context - a quantity qualifier has been determined for the shipment:
    For Validate Quantity Qualifier:
    When the system validates the qualifier against the mu (measurement unit) table, then if the qualifier is not found in the table, an error message is generated for invalid measurement unit.
  • Context - a shipment with load/empty status indicator:
    For Set Quantity Qualifier to UNT:
    When the equipment load/empty status is e (empty), then the system overrides the quantity qualifier to unt (units) regardless of previous qualifier.
  • Context - a non-empty shipment with a quantity qualifier:
    For Change Qualifier to PCS:
    When the quantity qualifier is c/l, cld, cl, or space-cl (carload indicators), then the system changes the quantity qualifier to pcs (pieces).
👨‍💻 Technical ACs (Gherkin)
Context: A waybill processing request with origin road number
GIVEN
A waybill processing request with origin road number
Applied to: Check for Valid EDI BOL Data
WHEN
The system checks for valid EDI BOL data by verifying origin road number is not zero and retrieving shipment mining data
THEN
The system sets EDI BOL availability flag and extracts EDI BOL key if data is found
Context: Weight and quantity processing is starting
GIVEN
Weight and quantity processing is starting
Applied to: Initialize Weight and Quantity Counters
WHEN
The system begins commodity data processing
THEN
Weight and quantity counters are initialized to zero
Context: Valid EDI BOL data is available with commodity segments
GIVEN
Valid EDI BOL data is available with commodity segments
Applied to: Process EDI BOL Commodity Segments
WHEN
The system processes each commodity segment sequentially from 1 to 98
THEN
Each found commodity segment contributes its quantity to the total and the first segment provides weight and unit information
Context: The first EDI BOL commodity segment is being processed
GIVEN
The first EDI BOL commodity segment is being processed
Applied to: Get Weight from EDI BOL
WHEN
Weight data is extracted from the commodity segment
THEN
The weight value is set from the segment and weight unit is determined as kilograms if metric indicator is M or L, otherwise pounds
Context: EDI BOL data is not available or both weight and quantity are zero after EDI processing
GIVEN
EDI BOL data is not available or both weight and quantity are zero after EDI processing
Applied to: Fall Back to Fastway SHIPCOMM Data
WHEN
The system retrieves Fastway SHIPCOMM data using GU and GN functions
THEN
Weight and quantity are accumulated from all SHIPCOMM records with quantity qualifier set to PCS and weight unit determined by metric indicator
Context: Weight and quantity processing has completed from all data sources
GIVEN
Weight and quantity processing has completed from all data sources
Applied to: Set Default Quantity to 1
WHEN
The final quantity value is zero or not greater than zero
THEN
The system sets the default quantity to 1
Context: Weight processing has completed from all data sources
GIVEN
Weight processing has completed from all data sources
Applied to: Set Default Weight to 1
WHEN
The final weight value is zero or not greater than zero
THEN
The system sets the default weight to 00000001
Context: Weight and quantity processing is finalizing
GIVEN
Weight and quantity processing is finalizing
Applied to: Set Default Qualifier to PCS
WHEN
The quantity qualifier field is empty or spaces
THEN
The system sets the default quantity qualifier to PCS (pieces)
Context: A quantity qualifier has been determined for the shipment
GIVEN
A quantity qualifier has been determined for the shipment
Applied to: Validate Quantity Qualifier
WHEN
The system validates the qualifier against the MU (Measurement Unit) table
THEN
If the qualifier is not found in the table, an error message is generated for invalid measurement unit
Context: A shipment with load/empty status indicator
GIVEN
A shipment with load/empty status indicator
Applied to: Set Quantity Qualifier to UNT
WHEN
The equipment load/empty status is E (Empty)
THEN
The system overrides the quantity qualifier to UNT (units) regardless of previous qualifier
Context: A non-empty shipment with a quantity qualifier
GIVEN
A non-empty shipment with a quantity qualifier
Applied to: Change Qualifier to PCS
WHEN
The quantity qualifier is C/L, CLD, CL, or space-CL (carload indicators)
THEN
The system changes the quantity qualifier to PCS (pieces)
R-GCCCCADD-cbl-01979 (+10) File: GCCCCADD.cbl Build commodity description from multiple data sources Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build commodity description from multiple data sources':
  • Context - the system needs to build commodity descriptions:
    For Initialize Description Work Areas:
    When description building process starts, then all description work areas are cleared and initialized to spaces.
  • Context - shipcomm contains commodity description data in fields 01-10:
    For Extract Commodity Descriptions from SHIPCOMM:
    When building commodity descriptions, then all 10 commodity description fields from shipcomm are copied to description work areas.
  • Context - shiproot contains free form description data in fields 1-2:
    For Extract Free Form Descriptions from SHIPROOT:
    When building commodity descriptions, then both free form description fields from shiproot are copied to description work areas.
  • Context - special handling codes exist in the shipment data:
    For Process Special Handling Codes:
    When processing special handling codes from counter 1 to 7, then each special handling code and instruction is evaluated for inclusion in descriptions.
  • Context - a special handling code is being processed:
    For Special Handling Code = VA, EV, or VS?:
    When the special handling code equals 'va' or 'ev' or 'vs', then the code is identified as relevant for description enhancement.
  • Context - a special handling code is identified as relevant (va, ev, or vs):
    For Add Special Handling Description:
    When adding the special handling information to descriptions, then the code and instruction are added to the first available special handling description slot (1, 2, or 3).
  • Context - description data has been collected from shipcomm, shiproot, and special handling sources:
    For Combine All Description Sources:
    When combining all description sources, then all description components are merged into a single comprehensive description work area.
  • Context - combined description data is ready for processing:
    For Prepare Description for Compression:
    When preparing for compression, then description length is set to 45000 characters and secondary length to 22500 characters for compression processing.
  • Context - description data is prepared with proper length parameters:
    For Call GCCCOMP Utility for Compression:
    When calling gcccomp utility, then the utility compresses the description data using cccom, source description, target description, and length parameters.
  • Context - description data has been compressed by gcccomp utility:
    For Store Compressed Description in GCCC-LADING-DESCRIPTION:
    When storing the final description, then the compressed description is moved to gccc-lading-description field.
  • Context - compressed description data is available in work areas:
    For Distribute Description Data to GCSCCS53 Array:
    When distributing description data to array structure, then all 46 description segments are moved from work area to gcsccs53 cargo data array.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to build commodity descriptions
GIVEN
The system needs to build commodity descriptions
Applied to: Initialize Description Work Areas
WHEN
Description building process starts
THEN
All description work areas are cleared and initialized to spaces
Context: SHIPCOMM contains commodity description data in fields 01-10
GIVEN
SHIPCOMM contains commodity description data in fields 01-10
Applied to: Extract Commodity Descriptions from SHIPCOMM
WHEN
Building commodity descriptions
THEN
All 10 commodity description fields from SHIPCOMM are copied to description work areas
Context: SHIPROOT contains free form description data in fields 1-2
GIVEN
SHIPROOT contains free form description data in fields 1-2
Applied to: Extract Free Form Descriptions from SHIPROOT
WHEN
Building commodity descriptions
THEN
Both free form description fields from SHIPROOT are copied to description work areas
Context: Special handling codes exist in the shipment data
GIVEN
Special handling codes exist in the shipment data
Applied to: Process Special Handling Codes
WHEN
Processing special handling codes from counter 1 to 7
THEN
Each special handling code and instruction is evaluated for inclusion in descriptions
Context: A special handling code is being processed
GIVEN
A special handling code is being processed
Applied to: Special Handling Code = VA, EV, or VS?
WHEN
The special handling code equals 'VA' or 'EV' or 'VS'
THEN
The code is identified as relevant for description enhancement
Context: A special handling code is identified as relevant (VA, EV, or VS)
GIVEN
A special handling code is identified as relevant (VA, EV, or VS)
Applied to: Add Special Handling Description
WHEN
Adding the special handling information to descriptions
THEN
The code and instruction are added to the first available special handling description slot (1, 2, or 3)
Context: Description data has been collected from SHIPCOMM, SHIPROOT, and special handling sources
GIVEN
Description data has been collected from SHIPCOMM, SHIPROOT, and special handling sources
Applied to: Combine All Description Sources
WHEN
Combining all description sources
THEN
All description components are merged into a single comprehensive description work area
Context: Combined description data is ready for processing
GIVEN
Combined description data is ready for processing
Applied to: Prepare Description for Compression
WHEN
Preparing for compression
THEN
Description length is set to 45000 characters and secondary length to 22500 characters for compression processing
Context: Description data is prepared with proper length parameters
GIVEN
Description data is prepared with proper length parameters
Applied to: Call GCCCOMP Utility for Compression
WHEN
Calling GCCCOMP utility
THEN
The utility compresses the description data using CCCOM, source description, target description, and length parameters
Context: Description data has been compressed by GCCCOMP utility
GIVEN
Description data has been compressed by GCCCOMP utility
Applied to: Store Compressed Description in GCCC-LADING-DESCRIPTION
WHEN
Storing the final description
THEN
The compressed description is moved to GCCC-LADING-DESCRIPTION field
Context: Compressed description data is available in work areas
GIVEN
Compressed description data is available in work areas
Applied to: Distribute Description Data to GCSCCS53 Array
WHEN
Distributing description data to array structure
THEN
All 46 description segments are moved from work area to GCSCCS53 cargo data array
R-GCCCCADD-cbl-01990 (+5) File: GCCCCADD.cbl Process special handling codes and instructions Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process special handling codes and instructions':
  • Context - a shipment has special handling codes and instructions in up to 7 positions:
    For Loop Through 7 Special Handling Code Positions:
    When the system processes special handling codes, then the system should iterate through all 7 special handling code positions to identify valid codes.
  • Context - a special handling code exists at a specific position:
    For Special Handling Code = 'VA', 'EV', or 'VS'?:
    When the special handling code is 'va' or 'ev' or 'vs', then the system should process this code and its associated instruction.
  • Context - a valid special handling code ('va', 'ev', or 'vs') is found:
    For Extract Special Handling Code:
    When the system processes the special handling entry, then the system should extract both the special handling code and its associated instruction into work fields.
  • Context - special handling description information needs to be stored:
    For First Special Handling Slot Available?:
    When the first special handling description slot is empty, then the system should store the description information in the first slot.
  • Context - special handling description information needs to be stored and the first slot is occupied:
    For Second Special Handling Slot Available?:
    When the second special handling description slot is empty, then the system should store the description information in the second slot.
  • Context - special handling description information needs to be stored and both first and second slots are occupied:
    For Store in Third Special Handling Description Slot:
    When the system needs to store additional special handling information, then the system should store the description information in the third slot.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has special handling codes and instructions in up to 7 positions
GIVEN
A shipment has special handling codes and instructions in up to 7 positions
Applied to: Loop Through 7 Special Handling Code Positions
WHEN
The system processes special handling codes
THEN
The system should iterate through all 7 special handling code positions to identify valid codes
Context: A special handling code exists at a specific position
GIVEN
A special handling code exists at a specific position
Applied to: Special Handling Code = 'VA', 'EV', or 'VS'?
WHEN
The special handling code is 'VA' or 'EV' or 'VS'
THEN
The system should process this code and its associated instruction
Context: A valid special handling code ('VA', 'EV', or 'VS') is found
GIVEN
A valid special handling code ('VA', 'EV', or 'VS') is found
Applied to: Extract Special Handling Code
WHEN
The system processes the special handling entry
THEN
The system should extract both the special handling code and its associated instruction into work fields
Context: Special handling description information needs to be stored
GIVEN
Special handling description information needs to be stored
Applied to: First Special Handling Slot Available?
WHEN
The first special handling description slot is empty
THEN
The system should store the description information in the first slot
Context: Special handling description information needs to be stored and the first slot is occupied
GIVEN
Special handling description information needs to be stored and the first slot is occupied
Applied to: Second Special Handling Slot Available?
WHEN
The second special handling description slot is empty
THEN
The system should store the description information in the second slot
Context: Special handling description information needs to be stored and both first and second slots are occupied
GIVEN
Special handling description information needs to be stored and both first and second slots are occupied
Applied to: Store in Third Special Handling Description Slot
WHEN
The system needs to store additional special handling information
THEN
The system should store the description information in the third slot
R-GCCCCADD-cbl-01996 (+9) File: GCCCCADD.cbl Extract hazmat information from EDI BOL segments Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract hazmat information from EDI BOL segments':
  • Context - a cargo manifest requires hazmat information processing:
    For Start Hazmat EDI Extraction:
    When the hazmat extraction process begins, then the commodity description danger field and un number field are cleared, and hazmat not found flag is set.
  • Context - hazmat processing is being initialized:
    For Initialize Hazmat Sequence Counter:
    When the system prepares to read hazmat segments, then the hazmat sequence counter is set to 1.
  • Context - a hazmat sequence counter is set and edi bol data exists:
    For Get Next EBSBCCM-CH Segment:
    When the system attempts to retrieve a hazmat segment, then the ebsbccm ch segment is retrieved using the current sequence number, and hazmat found flag is updated based on retrieval success.
  • Context - a hazmat segment has been retrieved from edi bol:
    For Check UN Number Format:
    When the system examines the un/na identification code, then if the first two characters are 'un', the identifier is considered a valid un number format.
  • Context - a hazmat segment contains a valid un number format:
    For Extract UN Number from LH1 Segment:
    When the un/na identification code starts with 'un', then the complete un/na identification code is extracted and stored as the commodity un number, and hazmat found flag is set to true.
  • Context - a valid un number has been extracted from hazmat data:
    For Initialize Hazmat Sequence Counter:
    When the system prepares to retrieve proper shipping name details, then the chi hs sequence counter is set to 1.
  • Context - a valid un number exists and proper shipping name sequence is initialized:
    For Retrieve LH3 Proper Shipping Name:
    When the system attempts to retrieve hazmat shipping details, then the ebsbchi hs segment is retrieved using the current sequence number.
  • Context - a hazmat detail segment has been successfully retrieved:
    For Extract Proper Shipping Name:
    When the ebsbchi hs segment contains proper shipping name data, then the proper shipping name is extracted and stored as the commodity description danger field.
  • Context - a hazmat segment has been processed:
    For More Hazmat Segments?:
    When the system evaluates continuation criteria, then if hazmat has not been found and sequence counter is 98 or less, increment the counter and continue processing, otherwise end the extraction.
  • Context - current hazmat segment does not contain valid un number and more segments may exist:
    For Increment Sequence Counter:
    When the sequence counter is less than or equal to 98 and hazmat is not found, then the hazmat sequence counter is incremented by 1.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest requires hazmat information processing
GIVEN
A cargo manifest requires hazmat information processing
Applied to: Start Hazmat EDI Extraction
WHEN
The hazmat extraction process begins
THEN
The commodity description danger field and UN number field are cleared, and hazmat not found flag is set
Context: Hazmat processing is being initialized
GIVEN
Hazmat processing is being initialized
Applied to: Initialize Hazmat Sequence Counter
WHEN
The system prepares to read hazmat segments
THEN
The hazmat sequence counter is set to 1
Context: A hazmat sequence counter is set and EDI BOL data exists
GIVEN
A hazmat sequence counter is set and EDI BOL data exists
Applied to: Get Next EBSBCCM-CH Segment
WHEN
The system attempts to retrieve a hazmat segment
THEN
The EBSBCCM CH segment is retrieved using the current sequence number, and hazmat found flag is updated based on retrieval success
Context: A hazmat segment has been retrieved from EDI BOL
GIVEN
A hazmat segment has been retrieved from EDI BOL
Applied to: Check UN Number Format
WHEN
The system examines the UN/NA identification code
THEN
If the first two characters are 'UN', the identifier is considered a valid UN number format
Context: A hazmat segment contains a valid UN number format
GIVEN
A hazmat segment contains a valid UN number format
Applied to: Extract UN Number from LH1 Segment
WHEN
The UN/NA identification code starts with 'UN'
THEN
The complete UN/NA identification code is extracted and stored as the commodity UN number, and hazmat found flag is set to true
Context: A valid UN number has been extracted from hazmat data
GIVEN
A valid UN number has been extracted from hazmat data
Applied to: Initialize Hazmat Sequence Counter
WHEN
The system prepares to retrieve proper shipping name details
THEN
The CHI HS sequence counter is set to 1
Context: A valid UN number exists and proper shipping name sequence is initialized
GIVEN
A valid UN number exists and proper shipping name sequence is initialized
Applied to: Retrieve LH3 Proper Shipping Name
WHEN
The system attempts to retrieve hazmat shipping details
THEN
The EBSBCHI HS segment is retrieved using the current sequence number
Context: A hazmat detail segment has been successfully retrieved
GIVEN
A hazmat detail segment has been successfully retrieved
Applied to: Extract Proper Shipping Name
WHEN
The EBSBCHI HS segment contains proper shipping name data
THEN
The proper shipping name is extracted and stored as the commodity description danger field
Context: A hazmat segment has been processed
GIVEN
A hazmat segment has been processed
Applied to: More Hazmat Segments?
WHEN
The system evaluates continuation criteria
THEN
If hazmat has not been found and sequence counter is 98 or less, increment the counter and continue processing, otherwise end the extraction
Context: Current hazmat segment does not contain valid UN number and more segments may exist
GIVEN
Current hazmat segment does not contain valid UN number and more segments may exist
Applied to: Increment Sequence Counter
WHEN
The sequence counter is less than or equal to 98 and hazmat is not found
THEN
The hazmat sequence counter is incremented by 1
R-GCCCCADD-cbl-02006 (+7) File: GCCCCADD.cbl Fall back to Fastway hazmat data when EDI unavailable Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fall back to Fastway hazmat data when EDI unavailable':
  • Context - hazmat processing is initiated for a shipment:
    For EDI Hazmat Data Found?:
    When the system searches for hazmat data sources, then edi hazmat data is checked first and used if available, otherwise system falls back to fastway data sources.
  • Context - edi hazmat data is not found for the shipment:
    For SHIPCOMM Data Available?:
    When system attempts to access fastway shipcomm data, then if shipcomm data is found, proceed to shiperp segment access, otherwise mark no fastway hazmat data available.
  • Context - shipcomm data is available in fastway system:
    For SHIPERP Data Found?:
    When system accesses shiperp segment for emergency response data, then if shiperp data is found, validate un code format, otherwise mark no fastway hazmat data available.
  • Context - shiperp emergency response data is found:
    For UN Code Format Valid?:
    When system validates the un code format in erp-un-na-code field, then if the first two characters equal 'un', proceed to extract un number, otherwise mark no fastway hazmat data available.
  • Context - un code format is validated as correct in shiperp data:
    For Extract UN Number from SHIPERP:
    When system extracts the un number, then the erp-un-na-code value is moved to gccc-un-number field and hazmat found flag is set.
  • Context - un number has been extracted from shiperp data:
    For SHIPERPD Description Found?:
    When system accesses shiperpd segment for hazmat description, then if shiperpd data is found, use the hazmat description, otherwise proceed with hazmat found flag set.
  • Context - shiperpd description data is found:
    For Use SHIPERPD Hazmat Description:
    When system processes the hazmat description, then the first 15 characters of erpd-haz-desc are moved to gccc-comodity-desc-danger field.
  • Context - hazmat processing from edi or fastway sources is completed:
    For Continue to Commodity Table Lookup:
    When system has processed all available hazmat data sources, then system continues to commodity table lookup for additional hazmat information if needed.
👨‍💻 Technical ACs (Gherkin)
Context: Hazmat processing is initiated for a shipment
GIVEN
Hazmat processing is initiated for a shipment
Applied to: EDI Hazmat Data Found?
WHEN
The system searches for hazmat data sources
THEN
EDI hazmat data is checked first and used if available, otherwise system falls back to Fastway data sources
Context: EDI hazmat data is not found for the shipment
GIVEN
EDI hazmat data is not found for the shipment
Applied to: SHIPCOMM Data Available?
WHEN
System attempts to access Fastway SHIPCOMM data
THEN
If SHIPCOMM data is found, proceed to SHIPERP segment access, otherwise mark no Fastway hazmat data available
Context: SHIPCOMM data is available in Fastway system
GIVEN
SHIPCOMM data is available in Fastway system
Applied to: SHIPERP Data Found?
WHEN
System accesses SHIPERP segment for emergency response data
THEN
If SHIPERP data is found, validate UN code format, otherwise mark no Fastway hazmat data available
Context: SHIPERP emergency response data is found
GIVEN
SHIPERP emergency response data is found
Applied to: UN Code Format Valid?
WHEN
System validates the UN code format in ERP-UN-NA-CODE field
THEN
If the first two characters equal 'UN', proceed to extract UN number, otherwise mark no Fastway hazmat data available
Context: UN code format is validated as correct in SHIPERP data
GIVEN
UN code format is validated as correct in SHIPERP data
Applied to: Extract UN Number from SHIPERP
WHEN
System extracts the UN number
THEN
The ERP-UN-NA-CODE value is moved to GCCC-UN-NUMBER field and hazmat found flag is set
Context: UN number has been extracted from SHIPERP data
GIVEN
UN number has been extracted from SHIPERP data
Applied to: SHIPERPD Description Found?
WHEN
System accesses SHIPERPD segment for hazmat description
THEN
If SHIPERPD data is found, use the hazmat description, otherwise proceed with hazmat found flag set
Context: SHIPERPD description data is found
GIVEN
SHIPERPD description data is found
Applied to: Use SHIPERPD Hazmat Description
WHEN
System processes the hazmat description
THEN
The first 15 characters of ERPD-HAZ-DESC are moved to GCCC-COMODITY-DESC-DANGER field
Context: Hazmat processing from EDI or Fastway sources is completed
GIVEN
Hazmat processing from EDI or Fastway sources is completed
Applied to: Continue to Commodity Table Lookup
WHEN
System has processed all available hazmat data sources
THEN
System continues to commodity table lookup for additional hazmat information if needed
R-GCCCCADD-cbl-02014 (+8) File: GCCCCADD.cbl Use commodity table for hazmat description and UN numbers Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Use commodity table for hazmat description and UN numbers':
  • Context - a shipment record exists with commodity information:
    For Get Commodity Code from Shipment:
    When the system needs to process hazmat information, then the commodity code is extracted from the shipment commodity data.
  • Context - a valid commodity stcc code is available:
    For Access Commodity Table with STCC Code:
    When the system accesses the commodity table, then the commodity record is retrieved using the stcc code as the lookup key.
  • Context - a commodity table lookup has been performed:
    For Commodity Record Found?:
    When the system checks the lookup result status, then the system determines whether a valid commodity record was found or not.
  • Context - a valid commodity record has been found in the commodity table:
    For Extract Commodity Description:
    When the system processes the commodity record, then the commodity description is extracted and assigned to the hazmat commodity description field.
  • Context - a valid commodity record exists and commodity description has been extracted:
    For Access ISSCD Table for UN Numbers:
    When the system needs to find un number information, then the isscd table is accessed to lookup un number data for the commodity.
  • Context - an isscd table lookup has been performed for the commodity:
    For UN Number Found in ISSCD?:
    When the system checks the isscd lookup result, then the system determines whether a valid un number record was found in isscd.
  • Context - a valid un number record has been found in the isscd table:
    For Set UN Number from CMDOTID:
    When the system processes the isscd record, then the cmdotid value is assigned to the un number field for hazmat information.
  • Context - a valid un number has been found and assigned from isscd table:
    For Set Hazmat Description from Commodity:
    When the system completes hazmat information processing, then the commodity description is assigned to the hazmat commodity description field.
  • Context - no valid un number record was found in the isscd table:
    For Clear UN Number and Description:
    When the system processes the failed isscd lookup, then both the un number field and hazmat commodity description field are cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record exists with commodity information
GIVEN
A shipment record exists with commodity information
Applied to: Get Commodity Code from Shipment
WHEN
The system needs to process hazmat information
THEN
The commodity code is extracted from the shipment commodity data
Context: A valid commodity STCC code is available
GIVEN
A valid commodity STCC code is available
Applied to: Access Commodity Table with STCC Code
WHEN
The system accesses the commodity table
THEN
The commodity record is retrieved using the STCC code as the lookup key
Context: A commodity table lookup has been performed
GIVEN
A commodity table lookup has been performed
Applied to: Commodity Record Found?
WHEN
The system checks the lookup result status
THEN
The system determines whether a valid commodity record was found or not
Context: A valid commodity record has been found in the commodity table
GIVEN
A valid commodity record has been found in the commodity table
Applied to: Extract Commodity Description
WHEN
The system processes the commodity record
THEN
The commodity description is extracted and assigned to the hazmat commodity description field
Context: A valid commodity record exists and commodity description has been extracted
GIVEN
A valid commodity record exists and commodity description has been extracted
Applied to: Access ISSCD Table for UN Numbers
WHEN
The system needs to find UN number information
THEN
The ISSCD table is accessed to lookup UN number data for the commodity
Context: An ISSCD table lookup has been performed for the commodity
GIVEN
An ISSCD table lookup has been performed for the commodity
Applied to: UN Number Found in ISSCD?
WHEN
The system checks the ISSCD lookup result
THEN
The system determines whether a valid UN number record was found in ISSCD
Context: A valid UN number record has been found in the ISSCD table
GIVEN
A valid UN number record has been found in the ISSCD table
Applied to: Set UN Number from CMDOTID
WHEN
The system processes the ISSCD record
THEN
The CMDOTID value is assigned to the UN number field for hazmat information
Context: A valid UN number has been found and assigned from ISSCD table
GIVEN
A valid UN number has been found and assigned from ISSCD table
Applied to: Set Hazmat Description from Commodity
WHEN
The system completes hazmat information processing
THEN
The commodity description is assigned to the hazmat commodity description field
Context: No valid UN number record was found in the ISSCD table
GIVEN
No valid UN number record was found in the ISSCD table
Applied to: Clear UN Number and Description
WHEN
The system processes the failed ISSCD lookup
THEN
Both the UN number field and hazmat commodity description field are cleared to spaces
R-GCCCCADD-cbl-02023 (+22) File: GCCCCADD.cbl Process EDI BOL segments for entity and address information Merged 23 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process EDI BOL segments for entity and address information':
  • Context - the system needs to process entity records for customs database creation:
    For Initialize Record 55 Processing:
    When record 55 processing is initiated, then the sequence index is set to 3 and the working storage array for record 55 data is cleared.
  • Context - an edi bol exists with shipper data in hn segment:
    For Extract Shipper Name and CHOP from HN Segment:
    When the system processes shipper record building, then the entity id is set to 'sh', shipper name is extracted from consignor name field, and chop code is extracted from shipper chop field.
  • Context - edi bol contains shipper address data in ha segment:
    For Get Shipper Address from HA Segment:
    When the system processes shipper address information, then address line 1 and address line 2 are populated from additional name/address fields, with 'na' as default if address line 1 is blank.
  • Context - edi bol contains shipper location data in hc segment:
    For Get Shipper City/State/Postal from HC Segment:
    When the system processes shipper location information, then city name, state/province code, postal code, and country code are extracted from the corresponding hc segment fields.
  • Context - edi bol contains shipper contact data in gp segment:
    For Get Shipper Contact Info from GP Segment:
    When the system processes shipper contact information, then contact function code, contact name, communication number qualifier, and communication number are extracted from the gp segment.
  • Context - edi bol shipper data is not available:
    For Use Fastway Shipper Data as Fallback:
    When the system builds shipper record, then shipper chop, entity id 'sh', and shipper name are populated from fastway shipment root data, with address defaulting to 'na' if blank.
  • Context - an edi bol exists with consignee data in cn segment:
    For Extract Consignee Name and CHOP from CN Segment:
    When the system processes consignee record building, then the entity id is set to 'cn', consignee name is extracted from shipper name field, and chop code is extracted from consignee chop field.
  • Context - edi bol contains consignee address data in ca segment:
    For Get Consignee Address from CA Segment:
    When the system processes consignee address information, then address line 1 and address line 2 are populated from additional name/address fields, with 'na' as default if address line 1 is blank.
  • Context - edi bol contains consignee location data in cc segment:
    For Get Consignee City/State/Postal from CC Segment:
    When the system processes consignee location information, then city name, state/province code, postal code, and country code are extracted from the corresponding cc segment fields.
  • Context - edi bol consignee data is not available:
    For Use Fastway Consignee Data as Fallback:
    When the system builds consignee record, then consignee chop, entity id 'cn', and consignee name are populated from fastway shipment root data, with address defaulting to 'na' if blank and country lookup from state/province table.
  • Context - edi bol contains stuffer data in pn segment:
    For Build Stuffer Entity from PN Segment:
    When the system processes stuffer entity building, then entity id is set to 'sf', name is extracted from pn segment, and associated address information is retrieved from pa and pc segments with 'na' default for missing address.
  • Context - edi bol contains ultimate consignee data in un segment:
    For Build Ultimate Consignee from UN Segment:
    When the system processes ultimate consignee entity building, then entity id is set to 'uc', name is extracted from un segment, and associated address information is retrieved from ua and uc segments with 'na' default for missing address.
  • Context - edi bol contains beneficial owner data in bn segment:
    For Build Beneficial Owner from BN Segment:
    When the system processes beneficial owner entity building, then entity id is set to 'bn', name and chop are extracted from bn segment, and associated address information is retrieved from bt and by segments with 'na' default for missing address.
  • Context - edi bol contains transportation data in tn segment with specific organization id:
    For Build Carrier Entity from TN Segment:
    When the system processes transportation entity building for organization ids c1, n1, 11, mc, oo, or fw, then entity record is created with the organization id as entity type, name extracted from tn segment, and associated address information retrieved from t2 and ta segments.
  • Context - edi bol contains mcoa data in ot segment with organization id 'pf' or 'ss':
    For Build MCOA Entities from OT Segments:
    When the system processes mcoa entity building, then entity record is created with pf or ss as entity type, name and id codes extracted from ot segment, and associated address information retrieved from on and oc segments with 'na' default for missing address.
  • Context - edi bol contains named entity data in nn segments:
    For Process NN Segments for Various Entity Types:
    When the system processes nn segments sequentially, then for each valid entity id found, entity name and chop are extracted, and associated address information is retrieved from gc and ga segments.
  • Context - an entity id is extracted from nn segment:
    For Valid Entity ID Found?:
    When the system validates the entity id, then if the entity id matches valid entity id values, processing continues; otherwise, the entity id is cleared and processing moves to next entity.
  • Context - edi bol contains entity address data in gc segment for a named entity:
    For Get Entity Address from GC Segment:
    When the system processes entity address information, then address line 1 and address line 2 are populated from additional name/address fields, with 'na' as default if address line 1 is blank.
  • Context - edi bol contains entity location data in ga segment for a named entity:
    For Get Entity City/State/Postal from GA Segment:
    When the system processes entity location information, then city name, state/province code, postal code, and country code are extracted from the corresponding ga segment fields.
  • Context - an entity record has been populated with data from edi bol or fastway:
    For Validate Entity Data Requirements:
    When the system validates entity data requirements, then required fields are checked including entity id, name, address line 1, city, state/province, postal code, and country code with appropriate error messages for missing data.
  • Context - a validated entity record exists with all required data:
    For Store Entity Record in Customs Database:
    When the system stores the entity record, then the record is added to the working storage array at the current sequence index, ccn key and record type '55' are set, and the sequence index is incremented.
  • Context - the system needs to process importer entity information:
    For Build Additional Entities:
    When importer data is found in edi bol im segment, then entity id is set to 'im', importer name and business number details are extracted, csa indicator is managed, and address information is populated from associated segments.
  • Context - edi bol importer data is not available but backup importer data exists from earlier processing:
    For Build Additional Entities:
    When the system builds importer record, then importer information is populated from backup data including chop, name, business number qualifier, business number, csa indicator, address, city, state, postal code, country, and contact information.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process entity records for customs database creation
GIVEN
The system needs to process entity records for customs database creation
Applied to: Initialize Record 55 Processing
WHEN
Record 55 processing is initiated
THEN
The sequence index is set to 3 and the working storage array for Record 55 data is cleared
Context: An EDI BOL exists with shipper data in HN segment
GIVEN
An EDI BOL exists with shipper data in HN segment
Applied to: Extract Shipper Name and CHOP from HN Segment
WHEN
The system processes shipper record building
THEN
The entity ID is set to 'SH', shipper name is extracted from consignor name field, and CHOP code is extracted from shipper CHOP field
Context: EDI BOL contains shipper address data in HA segment
GIVEN
EDI BOL contains shipper address data in HA segment
Applied to: Get Shipper Address from HA Segment
WHEN
The system processes shipper address information
THEN
Address line 1 and address line 2 are populated from additional name/address fields, with 'NA' as default if address line 1 is blank
Context: EDI BOL contains shipper location data in HC segment
GIVEN
EDI BOL contains shipper location data in HC segment
Applied to: Get Shipper City/State/Postal from HC Segment
WHEN
The system processes shipper location information
THEN
City name, state/province code, postal code, and country code are extracted from the corresponding HC segment fields
Context: EDI BOL contains shipper contact data in GP segment
GIVEN
EDI BOL contains shipper contact data in GP segment
Applied to: Get Shipper Contact Info from GP Segment
WHEN
The system processes shipper contact information
THEN
Contact function code, contact name, communication number qualifier, and communication number are extracted from the GP segment
Context: EDI BOL shipper data is not available
GIVEN
EDI BOL shipper data is not available
Applied to: Use Fastway Shipper Data as Fallback
WHEN
The system builds shipper record
THEN
Shipper CHOP, entity ID 'SH', and shipper name are populated from Fastway shipment root data, with address defaulting to 'NA' if blank
Context: An EDI BOL exists with consignee data in CN segment
GIVEN
An EDI BOL exists with consignee data in CN segment
Applied to: Extract Consignee Name and CHOP from CN Segment
WHEN
The system processes consignee record building
THEN
The entity ID is set to 'CN', consignee name is extracted from shipper name field, and CHOP code is extracted from consignee CHOP field
Context: EDI BOL contains consignee address data in CA segment
GIVEN
EDI BOL contains consignee address data in CA segment
Applied to: Get Consignee Address from CA Segment
WHEN
The system processes consignee address information
THEN
Address line 1 and address line 2 are populated from additional name/address fields, with 'NA' as default if address line 1 is blank
Context: EDI BOL contains consignee location data in CC segment
GIVEN
EDI BOL contains consignee location data in CC segment
Applied to: Get Consignee City/State/Postal from CC Segment
WHEN
The system processes consignee location information
THEN
City name, state/province code, postal code, and country code are extracted from the corresponding CC segment fields
Context: EDI BOL consignee data is not available
GIVEN
EDI BOL consignee data is not available
Applied to: Use Fastway Consignee Data as Fallback
WHEN
The system builds consignee record
THEN
Consignee CHOP, entity ID 'CN', and consignee name are populated from Fastway shipment root data, with address defaulting to 'NA' if blank and country lookup from state/province table
Context: EDI BOL contains stuffer data in PN segment
GIVEN
EDI BOL contains stuffer data in PN segment
Applied to: Build Stuffer Entity from PN Segment
WHEN
The system processes stuffer entity building
THEN
Entity ID is set to 'SF', name is extracted from PN segment, and associated address information is retrieved from PA and PC segments with 'NA' default for missing address
Context: EDI BOL contains ultimate consignee data in UN segment
GIVEN
EDI BOL contains ultimate consignee data in UN segment
Applied to: Build Ultimate Consignee from UN Segment
WHEN
The system processes ultimate consignee entity building
THEN
Entity ID is set to 'UC', name is extracted from UN segment, and associated address information is retrieved from UA and UC segments with 'NA' default for missing address
Context: EDI BOL contains beneficial owner data in BN segment
GIVEN
EDI BOL contains beneficial owner data in BN segment
Applied to: Build Beneficial Owner from BN Segment
WHEN
The system processes beneficial owner entity building
THEN
Entity ID is set to 'BN', name and CHOP are extracted from BN segment, and associated address information is retrieved from BT and BY segments with 'NA' default for missing address
Context: EDI BOL contains transportation data in TN segment with specific organization ID
GIVEN
EDI BOL contains transportation data in TN segment with specific organization ID
Applied to: Build Carrier Entity from TN Segment
WHEN
The system processes transportation entity building for organization IDs C1, N1, 11, MC, OO, or FW
THEN
Entity record is created with the organization ID as entity type, name extracted from TN segment, and associated address information retrieved from T2 and TA segments
Context: EDI BOL contains MCOA data in OT segment with organization ID 'PF' or 'SS'
GIVEN
EDI BOL contains MCOA data in OT segment with organization ID 'PF' or 'SS'
Applied to: Build MCOA Entities from OT Segments
WHEN
The system processes MCOA entity building
THEN
Entity record is created with PF or SS as entity type, name and ID codes extracted from OT segment, and associated address information retrieved from ON and OC segments with 'NA' default for missing address
Context: EDI BOL contains named entity data in NN segments
GIVEN
EDI BOL contains named entity data in NN segments
Applied to: Process NN Segments for Various Entity Types
WHEN
The system processes NN segments sequentially
THEN
For each valid entity ID found, entity name and CHOP are extracted, and associated address information is retrieved from GC and GA segments
Context: An entity ID is extracted from NN segment
GIVEN
An entity ID is extracted from NN segment
Applied to: Valid Entity ID Found?
WHEN
The system validates the entity ID
THEN
If the entity ID matches valid entity ID values, processing continues; otherwise, the entity ID is cleared and processing moves to next entity
Context: EDI BOL contains entity address data in GC segment for a named entity
GIVEN
EDI BOL contains entity address data in GC segment for a named entity
Applied to: Get Entity Address from GC Segment
WHEN
The system processes entity address information
THEN
Address line 1 and address line 2 are populated from additional name/address fields, with 'NA' as default if address line 1 is blank
Context: EDI BOL contains entity location data in GA segment for a named entity
GIVEN
EDI BOL contains entity location data in GA segment for a named entity
Applied to: Get Entity City/State/Postal from GA Segment
WHEN
The system processes entity location information
THEN
City name, state/province code, postal code, and country code are extracted from the corresponding GA segment fields
Context: An entity record has been populated with data from EDI BOL or Fastway
GIVEN
An entity record has been populated with data from EDI BOL or Fastway
Applied to: Validate Entity Data Requirements
WHEN
The system validates entity data requirements
THEN
Required fields are checked including entity ID, name, address line 1, city, state/province, postal code, and country code with appropriate error messages for missing data
Context: A validated entity record exists with all required data
GIVEN
A validated entity record exists with all required data
Applied to: Store Entity Record in Customs Database
WHEN
The system stores the entity record
THEN
The record is added to the working storage array at the current sequence index, CCN key and record type '55' are set, and the sequence index is incremented
Context: The system needs to process importer entity information
GIVEN
The system needs to process importer entity information
Applied to: Build Additional Entities
WHEN
Importer data is found in EDI BOL IM segment
THEN
Entity ID is set to 'IM', importer name and business number details are extracted, CSA indicator is managed, and address information is populated from associated segments
Context: EDI BOL importer data is not available but backup importer data exists from earlier processing
GIVEN
EDI BOL importer data is not available but backup importer data exists from earlier processing
Applied to: Build Additional Entities
WHEN
The system builds importer record
THEN
Importer information is populated from backup data including CHOP, name, business number qualifier, business number, CSA indicator, address, city, state, postal code, country, and contact information
R-GCCCCADD-cbl-02046 (+10) File: GCCCCADD.cbl Extract multiple CCN array and spawn related manifest creation Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract multiple CCN array and spawn related manifest creation':
  • Context - a ccn array is retrieved from edi bol processing:
    For Check CCN Array from EDI BOL:
    When the system checks if the ccn array contains data, then the system determines whether to proceed with ccn processing or continue with normal processing.
  • Context - the ccn array has been checked for data content:
    For CCN Array Contains Data?:
    When the ccn array is not spaces and not low-values, then initialize ccn processing loop, otherwise continue with normal processing.
  • Context - the ccn array contains valid data for processing:
    For Initialize CCN Index Counter:
    When ccn processing is initiated, then initialize the ccn index counter to 1 for array iteration.
  • Context - ccn processing loop is active with current index position:
    For More CCNs Available?:
    When the ccn index is less than or equal to 99 and the current ccn entry is not spaces, then continue processing the current ccn entry, otherwise end ccn processing.
  • Context - a valid ccn exists at the current array index position:
    For Extract Current CCN:
    When the system processes the current ccn array element, then extract the ccn value from the array position for spawn processing.
  • Context - a ccn has been extracted from the array for processing:
    For Set Waybill Key for Spawn:
    When setting up spawn parameters for manifest creation, then assign the original waybill key to the spawn waybill field.
  • Context - spawn waybill key has been set for the current ccn:
    For Set Waybill Date for Spawn:
    When continuing spawn parameter setup, then assign the waybill date to the spawn waybill date field.
  • Context - spawn waybill parameters have been set:
    For Set CCN for Spawn:
    When finalizing spawn message parameters, then assign the current ccn from the array to the spawn ccn field.
  • Context - all spawn parameters have been assigned for the current ccn:
    For Set Action Code to 'AM':
    When preparing the final spawn message, then set the spawn action code to 'am' for automated manifest processing.
  • Context - all spawn parameters are properly set including waybill key, date, ccn, and action code:
    For Spawn GCT0111E for Manifest Creation:
    When the spawn message is ready for execution, then call the spawn process gct0111e to create a separate manifest for the current ccn.
  • Context - the current ccn has been processed and spawn executed:
    For Increment CCN Index:
    When continuing the ccn array iteration, then increment the ccn index counter by 1 to move to the next array position.
👨‍💻 Technical ACs (Gherkin)
Context: A CCN array is retrieved from EDI BOL processing
GIVEN
A CCN array is retrieved from EDI BOL processing
Applied to: Check CCN Array from EDI BOL
WHEN
The system checks if the CCN array contains data
THEN
The system determines whether to proceed with CCN processing or continue with normal processing
Context: The CCN array has been checked for data content
GIVEN
The CCN array has been checked for data content
Applied to: CCN Array Contains Data?
WHEN
The CCN array is not spaces and not low-values
THEN
Initialize CCN processing loop, otherwise continue with normal processing
Context: The CCN array contains valid data for processing
GIVEN
The CCN array contains valid data for processing
Applied to: Initialize CCN Index Counter
WHEN
CCN processing is initiated
THEN
Initialize the CCN index counter to 1 for array iteration
Context: CCN processing loop is active with current index position
GIVEN
CCN processing loop is active with current index position
Applied to: More CCNs Available?
WHEN
The CCN index is less than or equal to 99 and the current CCN entry is not spaces
THEN
Continue processing the current CCN entry, otherwise end CCN processing
Context: A valid CCN exists at the current array index position
GIVEN
A valid CCN exists at the current array index position
Applied to: Extract Current CCN
WHEN
The system processes the current CCN array element
THEN
Extract the CCN value from the array position for spawn processing
Context: A CCN has been extracted from the array for processing
GIVEN
A CCN has been extracted from the array for processing
Applied to: Set Waybill Key for Spawn
WHEN
Setting up spawn parameters for manifest creation
THEN
Assign the original waybill key to the spawn waybill field
Context: Spawn waybill key has been set for the current CCN
GIVEN
Spawn waybill key has been set for the current CCN
Applied to: Set Waybill Date for Spawn
WHEN
Continuing spawn parameter setup
THEN
Assign the waybill date to the spawn waybill date field
Context: Spawn waybill parameters have been set
GIVEN
Spawn waybill parameters have been set
Applied to: Set CCN for Spawn
WHEN
Finalizing spawn message parameters
THEN
Assign the current CCN from the array to the spawn CCN field
Context: All spawn parameters have been assigned for the current CCN
GIVEN
All spawn parameters have been assigned for the current CCN
Applied to: Set Action Code to 'AM'
WHEN
Preparing the final spawn message
THEN
Set the spawn action code to 'AM' for automated manifest processing
Context: All spawn parameters are properly set including waybill key, date, CCN, and action code
GIVEN
All spawn parameters are properly set including waybill key, date, CCN, and action code
Applied to: Spawn GCT0111E for Manifest Creation
WHEN
The spawn message is ready for execution
THEN
Call the spawn process GCT0111E to create a separate manifest for the current CCN
Context: The current CCN has been processed and spawn executed
GIVEN
The current CCN has been processed and spawn executed
Applied to: Increment CCN Index
WHEN
Continuing the CCN array iteration
THEN
Increment the CCN index counter by 1 to move to the next array position
R-GCCCCADD-cbl-02057 (+6) File: GCCCCADD.cbl Lookup AU table for importer data and set CSA indicator Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup AU table for importer data and set CSA indicator':
  • Context - a shipment is being processed for customs manifest creation:
    For Check CSA Indicator and Importer Status:
    When the csa indicator is already on or the au table is empty or an importer is already set in the system, then the system skips the au table lookup process and continues with existing data.
  • Context - csa indicator is off and au table has data and no importer is currently set:
    For Lookup AU Table with Consignee CHOP and Commodity Code:
    When the system performs au table lookup using consignee chop code and commodity code, then the system retrieves authorized user record if it exists in the au table.
  • Context - an au table lookup has been performed:
    For Clear AU Table Data:
    When no matching authorized user record is found in the au table, then the system clears all au table data fields to spaces.
  • Context - a valid au table record has been found:
    For Extract Importer Name from AU Table:
    When the system processes the au table data, then the system extracts importer name and business number from the au table record.
  • Context - importer data has been extracted from au table:
    For Set Business Number Qualifier to 'M5':
    When the system processes the importer business number, then the system sets the business number qualifier to 'm5' and activates csa indicator.
  • Context - au importer data has been found and no existing s55 importer record exists:
    For Create Importer Record from AU Data:
    When the system needs to create importer customs record, then the system creates a new customs record with importer name, business number, qualifier 'm5', default address 'na', and activates csa indicator.
  • Context - a new importer customs record is being created from au table data:
    For Set Default Address as 'NA':
    When address information is not available in au table, then the system sets the address field to 'na' and clears all city, state, postal, and contact data fields.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed for customs manifest creation
GIVEN
A shipment is being processed for customs manifest creation
Applied to: Check CSA Indicator and Importer Status
WHEN
The CSA indicator is already ON OR the AU table is empty OR an importer is already set in the system
THEN
The system skips the AU table lookup process and continues with existing data
Context: CSA indicator is OFF AND AU table has data AND no importer is currently set
GIVEN
CSA indicator is OFF AND AU table has data AND no importer is currently set
Applied to: Lookup AU Table with Consignee CHOP and Commodity Code
WHEN
The system performs AU table lookup using consignee CHOP code and commodity code
THEN
The system retrieves authorized user record if it exists in the AU table
Context: An AU table lookup has been performed
GIVEN
An AU table lookup has been performed
Applied to: Clear AU Table Data
WHEN
No matching authorized user record is found in the AU table
THEN
The system clears all AU table data fields to spaces
Context: A valid AU table record has been found
GIVEN
A valid AU table record has been found
Applied to: Extract Importer Name from AU Table
WHEN
The system processes the AU table data
THEN
The system extracts importer name and business number from the AU table record
Context: Importer data has been extracted from AU table
GIVEN
Importer data has been extracted from AU table
Applied to: Set Business Number Qualifier to 'M5'
WHEN
The system processes the importer business number
THEN
The system sets the business number qualifier to 'M5' and activates CSA indicator
Context: AU importer data has been found AND no existing S55 importer record exists
GIVEN
AU importer data has been found AND no existing S55 importer record exists
Applied to: Create Importer Record from AU Data
WHEN
The system needs to create importer customs record
THEN
The system creates a new customs record with importer name, business number, qualifier 'M5', default address 'NA', and activates CSA indicator
Context: A new importer customs record is being created from AU table data
GIVEN
A new importer customs record is being created from AU table data
Applied to: Set Default Address as 'NA'
WHEN
Address information is not available in AU table
THEN
The system sets the address field to 'NA' and clears all city, state, postal, and contact data fields
R-GCCCCADD-cbl-02064 (+6) File: GCCCCADD.cbl Manage CSA indicator based on multiple data sources Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Manage CSA indicator based on multiple data sources':
  • Context - a shipment record exists with csa indicator already set to on:
    For Check if CSA Indicator Already On?:
    When the system processes csa indicator management, then the csa indicator should remain on and no further csa processing should occur.
  • Context - a shipment with consignee chop code and commodity code:
    For Check if AU Table Data Available?:
    When the system checks au table availability using consignee chop and commodity code as lookup keys, then the system should determine if au table data is available for further csa processing.
  • Context - input parameters containing importer name, business number, and business number qualifier fields:
    For Check if Importer Data from Input?:
    When the system validates importer data presence, then the system should confirm if all required importer fields (name, business number, and qualifier) contain valid data.
  • Context - au table contains importer name and business number for the consignee and commodity combination:
    For Check if AU Table Has Importer Data?:
    When the system finds valid importer data in au table, then the system should extract importer name and business number, set csa indicator to on, and mark au importer as found.
  • Context - a shipment with in-transit status set to transit or return and csa indicator currently on:
    For Check Transit/Return Status?:
    When the system processes csa indicator for transit/return shipments, then the system should set csa indicator to off, clear importer name, business number qualifier, and business number fields, and reset au importer found flag.
  • Context - au table contains importer data and edi bol contains importer segment data:
    For Check AU and EDI BOL Importer Data?:
    When the system finds both au importer data and edi bol importer data are present, then the system should proceed to validate business number qualifier for csa indicator adjustment.
  • Context - both au table importer data and edi bol importer data are found with business number qualifier:
    For Check Business Number Qualifier?:
    When the business number qualifier is 'bn' or contains spaces, then the system should set csa indicator to off.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record exists with CSA indicator already set to ON
GIVEN
A shipment record exists with CSA indicator already set to ON
Applied to: Check if CSA Indicator Already On?
WHEN
The system processes CSA indicator management
THEN
The CSA indicator should remain ON and no further CSA processing should occur
Context: A shipment with consignee CHOP code and commodity code
GIVEN
A shipment with consignee CHOP code and commodity code
Applied to: Check if AU Table Data Available?
WHEN
The system checks AU table availability using consignee CHOP and commodity code as lookup keys
THEN
The system should determine if AU table data is available for further CSA processing
Context: Input parameters containing importer name, business number, and business number qualifier fields
GIVEN
Input parameters containing importer name, business number, and business number qualifier fields
Applied to: Check if Importer Data from Input?
WHEN
The system validates importer data presence
THEN
The system should confirm if all required importer fields (name, business number, and qualifier) contain valid data
Context: AU table contains importer name and business number for the consignee and commodity combination
GIVEN
AU table contains importer name and business number for the consignee and commodity combination
Applied to: Check if AU Table Has Importer Data?
WHEN
The system finds valid importer data in AU table
THEN
The system should extract importer name and business number, set CSA indicator to ON, and mark AU importer as found
Context: A shipment with in-transit status set to TRANSIT or RETURN and CSA indicator currently ON
GIVEN
A shipment with in-transit status set to TRANSIT or RETURN and CSA indicator currently ON
Applied to: Check Transit/Return Status?
WHEN
The system processes CSA indicator for transit/return shipments
THEN
The system should set CSA indicator to OFF, clear importer name, business number qualifier, and business number fields, and reset AU importer found flag
Context: AU table contains importer data and EDI BOL contains importer segment data
GIVEN
AU table contains importer data and EDI BOL contains importer segment data
Applied to: Check AU and EDI BOL Importer Data?
WHEN
The system finds both AU importer data and EDI BOL importer data are present
THEN
The system should proceed to validate business number qualifier for CSA indicator adjustment
Context: Both AU table importer data and EDI BOL importer data are found with business number qualifier
GIVEN
Both AU table importer data and EDI BOL importer data are found with business number qualifier
Applied to: Check Business Number Qualifier?
WHEN
The business number qualifier is 'BN' or contains spaces
THEN
The system should set CSA indicator to OFF
R-GCCCCADD-cbl-02071 (+6) File: GCCCCADD.cbl Execute multiple broker search attempts with different criteria Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute multiple broker search attempts with different criteria':
  • Context - a shipment has shipper chop, consignee chop, origin station number, destination station number, and commodity code available:
    For Search 1: Full Criteria Match:
    When the system performs the first broker search attempt with all available criteria, then the system searches the crossing table using shipper chop, consignee chop, origin station, destination splc (road + road number), and commodity code as search parameters.
  • Context - the first broker search with full criteria has been executed:
    For Broker Data Found?:
    When the crossing table lookup returns a result status, then if broker data is found, mark search as complete, otherwise proceed to second search attempt.
  • Context - the first broker search with full criteria did not find matching broker data:
    For Search 2: Consignee + Station + Commodity:
    When the system performs the second broker search attempt, then the system searches using wildcard for shipper chop, wildcard for origin station, original consignee chop, destination splc, and commodity code.
  • Context - the second broker search with reduced criteria has been executed:
    For Broker Data Found?:
    When the crossing table lookup returns a result status, then if broker data is found, mark search as complete, otherwise proceed to third search attempt.
  • Context - the second broker search with reduced criteria did not find matching broker data:
    For Search 3: Wildcard + Commodity Only:
    When the system performs the third broker search attempt, then the system searches using wildcard for shipper chop, wildcard for consignee chop, wildcard for origin station, original destination splc, and wildcard for commodity code.
  • Context - the third broker search with minimal criteria has been executed:
    For Broker Data Found?:
    When the crossing table lookup returns a result status, then if broker data is found, mark search as complete, otherwise mark search as unsuccessful with no broker found.
  • Context - shipment root data and commodity data are available for processing:
    For Set Initial Search Criteria:
    When the broker search process is initiated, then the system extracts shipper chop, consignee chop, origin station number, destination station number, destination road number, and commodity code from the shipment data.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has shipper CHOP, consignee CHOP, origin station number, destination station number, and commodity code available
GIVEN
A shipment has shipper CHOP, consignee CHOP, origin station number, destination station number, and commodity code available
Applied to: Search 1: Full Criteria Match
WHEN
The system performs the first broker search attempt with all available criteria
THEN
The system searches the crossing table using shipper CHOP, consignee CHOP, origin station, destination SPLC (ROAD + road number), and commodity code as search parameters
Context: The first broker search with full criteria has been executed
GIVEN
The first broker search with full criteria has been executed
Applied to: Broker Data Found?
WHEN
The crossing table lookup returns a result status
THEN
If broker data is found, mark search as complete, otherwise proceed to second search attempt
Context: The first broker search with full criteria did not find matching broker data
GIVEN
The first broker search with full criteria did not find matching broker data
Applied to: Search 2: Consignee + Station + Commodity
WHEN
The system performs the second broker search attempt
THEN
The system searches using wildcard for shipper CHOP, wildcard for origin station, original consignee CHOP, destination SPLC, and commodity code
Context: The second broker search with reduced criteria has been executed
GIVEN
The second broker search with reduced criteria has been executed
Applied to: Broker Data Found?
WHEN
The crossing table lookup returns a result status
THEN
If broker data is found, mark search as complete, otherwise proceed to third search attempt
Context: The second broker search with reduced criteria did not find matching broker data
GIVEN
The second broker search with reduced criteria did not find matching broker data
Applied to: Search 3: Wildcard + Commodity Only
WHEN
The system performs the third broker search attempt
THEN
The system searches using wildcard for shipper CHOP, wildcard for consignee CHOP, wildcard for origin station, original destination SPLC, and wildcard for commodity code
Context: The third broker search with minimal criteria has been executed
GIVEN
The third broker search with minimal criteria has been executed
Applied to: Broker Data Found?
WHEN
The crossing table lookup returns a result status
THEN
If broker data is found, mark search as complete, otherwise mark search as unsuccessful with no broker found
Context: Shipment root data and commodity data are available for processing
GIVEN
Shipment root data and commodity data are available for processing
Applied to: Set Initial Search Criteria
WHEN
The broker search process is initiated
THEN
The system extracts shipper CHOP, consignee CHOP, origin station number, destination station number, destination road number, and commodity code from the shipment data
R-GCCCCADD-cbl-02078 (+11) File: GCCCCADD.cbl Validate and override broker data based on crossing table flags Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate and override broker data based on crossing table flags':
  • Context - a crossing table lookup has been performed for broker information:
    For Crossing Table Data Found?:
    When the system checks if crossing table data was found, then if crossing table data is found, proceed with broker validation process, otherwise skip broker override processing.
  • Context - crossing table data is available with an override flag:
    For Override Flag = 'Y'?:
    When the override flag equals 'y', then move broker name from crossing table regardless of current broker status.
  • Context - crossing table data is available and override flag is not 'y':
    For Current Broker Name is Empty, UNKNOWN, or NOT-REQ?:
    When current broker name is spaces, 'unknown', or 'not-req', then move broker name from crossing table, otherwise keep existing broker name.
  • Context - crossing table contains broker information and override conditions are satisfied:
    For Move Broker Name from Crossing Table:
    When broker name assignment is required, then set broker name to the value from crossing table.
  • Context - broker data has been processed from crossing table:
    For Manifest-To Station Provided in Crossing Table?:
    When crossing table contains manifest-to station information (cdn-manifest-to is not spaces), then proceed with manifest-to station validation and update process.
  • Context - crossing table provides manifest-to station information:
    For Validate Manifest-To Station in MC Table:
    When manifest-to station validation is required, then perform gu function call to mc table using manifest-to station as key.
  • Context - mc table lookup has been performed for manifest-to station:
    For MC Table Lookup Successful?:
    When the lookup operation completes, then if lookup is successful, validate canadian customs code, otherwise set error flag 3 for invalid manifest port.
  • Context - mc table lookup was successful for manifest-to station:
    For Canadian Customs Code = '00000'?:
    When canadian customs code equals '00000', then set error flag 2 for invalid canadian customs code, otherwise proceed with station code update.
  • Context - manifest-to station lookup was successful but canadian customs code is '00000':
    For Set Error Flag 2 - Invalid Canadian Customs Code:
    When invalid canadian customs code is detected, then set error flag 2 and save station name for error reporting.
  • Context - manifest-to station validation was attempted in mc table:
    For Set Error Flag 3 - Invalid Manifest Port:
    When mc table lookup fails, then set error flag 3 and save station name for error reporting.
  • Context - mc table lookup was successful and canadian customs code is valid:
    For Update Manifest-To Station Code:
    When manifest-to station code update is required, then set manifest-to station code to canadian customs code from mc table.
  • Context - manifest-to station code has been successfully updated:
    For Update Station Number and Call Letters:
    When additional station information update is required, then set destination station number for index and batch print call letters from mc table station data.
👨‍💻 Technical ACs (Gherkin)
Context: A crossing table lookup has been performed for broker information
GIVEN
A crossing table lookup has been performed for broker information
Applied to: Crossing Table Data Found?
WHEN
The system checks if crossing table data was found
THEN
If crossing table data is found, proceed with broker validation process, otherwise skip broker override processing
Context: Crossing table data is available with an override flag
GIVEN
Crossing table data is available with an override flag
Applied to: Override Flag = 'Y'?
WHEN
The override flag equals 'Y'
THEN
Move broker name from crossing table regardless of current broker status
Context: Crossing table data is available and override flag is not 'Y'
GIVEN
Crossing table data is available and override flag is not 'Y'
Applied to: Current Broker Name is Empty, UNKNOWN, or NOT-REQ?
WHEN
Current broker name is spaces, 'UNKNOWN', or 'NOT-REQ'
THEN
Move broker name from crossing table, otherwise keep existing broker name
Context: Crossing table contains broker information and override conditions are satisfied
GIVEN
Crossing table contains broker information and override conditions are satisfied
Applied to: Move Broker Name from Crossing Table
WHEN
Broker name assignment is required
THEN
Set broker name to the value from crossing table
Context: Broker data has been processed from crossing table
GIVEN
Broker data has been processed from crossing table
Applied to: Manifest-To Station Provided in Crossing Table?
WHEN
Crossing table contains manifest-to station information (CDN-MANIFEST-TO is not spaces)
THEN
Proceed with manifest-to station validation and update process
Context: Crossing table provides manifest-to station information
GIVEN
Crossing table provides manifest-to station information
Applied to: Validate Manifest-To Station in MC Table
WHEN
Manifest-to station validation is required
THEN
Perform GU function call to MC table using manifest-to station as key
Context: MC table lookup has been performed for manifest-to station
GIVEN
MC table lookup has been performed for manifest-to station
Applied to: MC Table Lookup Successful?
WHEN
The lookup operation completes
THEN
If lookup is successful, validate Canadian customs code, otherwise set error flag 3 for invalid manifest port
Context: MC table lookup was successful for manifest-to station
GIVEN
MC table lookup was successful for manifest-to station
Applied to: Canadian Customs Code = '00000'?
WHEN
Canadian customs code equals '00000'
THEN
Set error flag 2 for invalid Canadian customs code, otherwise proceed with station code update
Context: Manifest-to station lookup was successful but Canadian customs code is '00000'
GIVEN
Manifest-to station lookup was successful but Canadian customs code is '00000'
Applied to: Set Error Flag 2 - Invalid Canadian Customs Code
WHEN
Invalid Canadian customs code is detected
THEN
Set error flag 2 and save station name for error reporting
Context: Manifest-to station validation was attempted in MC table
GIVEN
Manifest-to station validation was attempted in MC table
Applied to: Set Error Flag 3 - Invalid Manifest Port
WHEN
MC table lookup fails
THEN
Set error flag 3 and save station name for error reporting
Context: MC table lookup was successful and Canadian customs code is valid
GIVEN
MC table lookup was successful and Canadian customs code is valid
Applied to: Update Manifest-To Station Code
WHEN
Manifest-to station code update is required
THEN
Set manifest-to station code to Canadian customs code from MC table
Context: Manifest-to station code has been successfully updated
GIVEN
Manifest-to station code has been successfully updated
Applied to: Update Station Number and Call Letters
WHEN
Additional station information update is required
THEN
Set destination station number for index and batch print call letters from MC table station data
R-GCCCCADD-cbl-02090 (+14) File: GCCCCADD.cbl Build entity segments from EDI BOL data with address validation Merged 15 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build entity segments from EDI BOL data with address validation':
  • Context - an edi bol with potential pn segment data for stuffer entity:
    For Build SF - Stuffer Entity:
    When the system processes the pn segment for stuffer information, then if pn segment is found, extract stuffer name and create sf entity record with address from pa and pc segments and contact from gp segment.
  • Context - an edi bol with potential un segment data for ultimate consignee entity:
    For Build UC - Ultimate Consignee:
    When the system processes the un segment for ultimate consignee information, then if un segment is found, extract ultimate consignee name and create uc entity record with address from ua and uc segments and contact from gp segment.
  • Context - an edi bol with potential bn segment data for beneficial owner entity:
    For Build BN - Beneficial Owner:
    When the system processes the bn segment for beneficial owner information, then if bn segment is found, extract beneficial owner name and create bn entity record with address from bt and by segments.
  • Context - an edi bol with potential tn segment containing c1 organization id or fastway shipment data with consignee code c:
    For Build C1 - Carrier Entity:
    When the system processes carrier entity information, then if tn segment with c1 is found, extract carrier information with address from t2 and ta segments and contact from t3 segment, otherwise if consignee data code is c, use fastway consignee data.
  • Context - an edi bol with potential tn segment containing n1 organization id:
    For Build N1 - Notify Party:
    When the system processes the tn segment for notify party information, then if tn segment with n1 is found, extract notify party information and create n1 entity record.
  • Context - an edi bol with potential mcoa segment data for payment entities:
    For Build PF/SS - Payment/Service:
    When the system processes mcoa segment with organization id pf or ss, then if mcoa segment is found with pf or ss organization id, extract entity information with address from on and oc segments.
  • Context - an edi bol with tn segments containing organization ids 11, mc, oo, or fw:
    For Build Additional Entities:
    When the system processes tn segments for these entity types, then extract entity information and create corresponding entity records with address and contact details.
  • Context - an edi bol with nn segments containing various entity ids:
    For Build NN Entity Segments:
    When the system processes nn segments for named entities, then if nn segment is found with valid entity id, extract entity information with address from gc and ga segments, otherwise reset variables if not found.
  • Context - an entity record with sequence number greater than 2 and entity id code:
    For Entity ID Valid?:
    When the system validates the entity id code, then if entity id is not empty and not in valid values list or is shipper, consignee, or customs broker, add invalid entity id error message.
  • Context - an entity record with entity id code specified:
    For Name Required?:
    When the system validates the entity name field, then if entity id is not empty and name is empty, add required name field error message.
  • Context - an entity record with entity id specified:
    For Set Default Address to NA:
    When the system validates the address field, then if entity id is not empty and address line 1 is empty, add required address error message and set default address to na if address is empty.
  • Context - an entity record with city name provided:
    For Validate City Length >= 2:
    When the system validates the city name length, then if city name is empty, add required city error message, otherwise if city name length is less than 2 characters, add minimum length error message.
  • Context - an entity record with postal code provided:
    For Validate Postal Code Length >= 3:
    When the system validates the postal code length, then if postal code is not empty and length is less than 3 characters, add minimum length error message.
  • Context - an entity record with country code canada, usa, or mexico and state/province code:
    For Validate State/Country Combination:
    When the system validates the state/country combination, then if country is canada, usa, or mexico and state/province is empty, add required state error message, otherwise if state/province does not match country in lookup table, add invalid state error message, and if country is empty, derive country from state lookup.
  • Context - an entity record with contact information including communication qualifier and number:
    For Validate Entity Data:
    When the system validates the communication data, then if communication qualifier is empty and contact name or communication number is provided, add required qualifier error message, and if qualifier is not empty, fx, or te, add invalid qualifier error message, and if qualifier or contact name is provided but communication number is empty, add required communication number error message.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL with potential PN segment data for stuffer entity
GIVEN
An EDI BOL with potential PN segment data for stuffer entity
Applied to: Build SF - Stuffer Entity
WHEN
The system processes the PN segment for stuffer information
THEN
If PN segment is found, extract stuffer name and create SF entity record with address from PA and PC segments and contact from GP segment
Context: An EDI BOL with potential UN segment data for ultimate consignee entity
GIVEN
An EDI BOL with potential UN segment data for ultimate consignee entity
Applied to: Build UC - Ultimate Consignee
WHEN
The system processes the UN segment for ultimate consignee information
THEN
If UN segment is found, extract ultimate consignee name and create UC entity record with address from UA and UC segments and contact from GP segment
Context: An EDI BOL with potential BN segment data for beneficial owner entity
GIVEN
An EDI BOL with potential BN segment data for beneficial owner entity
Applied to: Build BN - Beneficial Owner
WHEN
The system processes the BN segment for beneficial owner information
THEN
If BN segment is found, extract beneficial owner name and create BN entity record with address from BT and BY segments
Context: An EDI BOL with potential TN segment containing C1 organization ID or Fastway shipment data with consignee code C
GIVEN
An EDI BOL with potential TN segment containing C1 organization ID or Fastway shipment data with consignee code C
Applied to: Build C1 - Carrier Entity
WHEN
The system processes carrier entity information
THEN
If TN segment with C1 is found, extract carrier information with address from T2 and TA segments and contact from T3 segment, otherwise if consignee data code is C, use Fastway consignee data
Context: An EDI BOL with potential TN segment containing N1 organization ID
GIVEN
An EDI BOL with potential TN segment containing N1 organization ID
Applied to: Build N1 - Notify Party
WHEN
The system processes the TN segment for notify party information
THEN
If TN segment with N1 is found, extract notify party information and create N1 entity record
Context: An EDI BOL with potential MCOA segment data for payment entities
GIVEN
An EDI BOL with potential MCOA segment data for payment entities
Applied to: Build PF/SS - Payment/Service
WHEN
The system processes MCOA segment with organization ID PF or SS
THEN
If MCOA segment is found with PF or SS organization ID, extract entity information with address from ON and OC segments
Context: An EDI BOL with TN segments containing organization IDs 11, MC, OO, or FW
GIVEN
An EDI BOL with TN segments containing organization IDs 11, MC, OO, or FW
Applied to: Build Additional Entities
WHEN
The system processes TN segments for these entity types
THEN
Extract entity information and create corresponding entity records with address and contact details
Context: An EDI BOL with NN segments containing various entity IDs
GIVEN
An EDI BOL with NN segments containing various entity IDs
Applied to: Build NN Entity Segments
WHEN
The system processes NN segments for named entities
THEN
If NN segment is found with valid entity ID, extract entity information with address from GC and GA segments, otherwise reset variables if not found
Context: An entity record with sequence number greater than 2 and entity ID code
GIVEN
An entity record with sequence number greater than 2 and entity ID code
Applied to: Entity ID Valid?
WHEN
The system validates the entity ID code
THEN
If entity ID is not empty and not in valid values list or is shipper, consignee, or customs broker, add invalid entity ID error message
Context: An entity record with entity ID code specified
GIVEN
An entity record with entity ID code specified
Applied to: Name Required?
WHEN
The system validates the entity name field
THEN
If entity ID is not empty and name is empty, add required name field error message
Context: An entity record with entity ID specified
GIVEN
An entity record with entity ID specified
Applied to: Set Default Address to NA
WHEN
The system validates the address field
THEN
If entity ID is not empty and address line 1 is empty, add required address error message and set default address to NA if address is empty
Context: An entity record with city name provided
GIVEN
An entity record with city name provided
Applied to: Validate City Length >= 2
WHEN
The system validates the city name length
THEN
If city name is empty, add required city error message, otherwise if city name length is less than 2 characters, add minimum length error message
Context: An entity record with postal code provided
GIVEN
An entity record with postal code provided
Applied to: Validate Postal Code Length >= 3
WHEN
The system validates the postal code length
THEN
If postal code is not empty and length is less than 3 characters, add minimum length error message
Context: An entity record with country code Canada, USA, or Mexico and state/province code
GIVEN
An entity record with country code Canada, USA, or Mexico and state/province code
Applied to: Validate State/Country Combination
WHEN
The system validates the state/country combination
THEN
If country is Canada, USA, or Mexico and state/province is empty, add required state error message, otherwise if state/province does not match country in lookup table, add invalid state error message, and if country is empty, derive country from state lookup
Context: An entity record with contact information including communication qualifier and number
GIVEN
An entity record with contact information including communication qualifier and number
Applied to: Validate Entity Data
WHEN
The system validates the communication data
THEN
If communication qualifier is empty and contact name or communication number is provided, add required qualifier error message, and if qualifier is not empty, FX, or TE, add invalid qualifier error message, and if qualifier or contact name is provided but communication number is empty, add required communication number error message
R-GCCCCADD-cbl-02105 (+7) File: GCCCCADD.cbl Fall back to Fastway data when EDI BOL entities unavailable Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Fall back to Fastway data when EDI BOL entities unavailable':
  • Context - a shipment requires shipper information for customs manifest creation:
    For EDI BOL Shipper Data Available?:
    When the system checks for edi bol shipper data in hn segment, then if edi bol shipper data is found, extract shipper name and chop code from hn segment, otherwise extract shipper name and chop code from fastway shiproot.
  • Context - a shipment requires consignee information for customs manifest creation:
    For EDI BOL Consignee Data Available?:
    When the system checks for edi bol consignee data in cn segment, then if edi bol consignee data is found, extract consignee name and chop code from cn segment, otherwise extract consignee name and chop code from fastway shiproot.
  • Context - a shipment requires address information for shipper or consignee:
    For EDI BOL Address Data Available?:
    When the system checks for edi bol address data in ha/ca segments, then if edi bol address data is found, extract address lines from ha/ca segments, otherwise extract address from fastway shiproot address fields and set default 'na' if address is blank.
  • Context - a shipment requires city and state information for address completion:
    For EDI BOL City/State Data Available?:
    When the system checks for edi bol city/state data in hc/cc segments, then if edi bol city/state data is found, extract city, state, postal code and country from hc/cc segments, otherwise parse city, state and postal code from fastway address field and lookup country code from state-country table.
  • Context - a shipment may have contact information for shipper or consignee:
    For EDI BOL Contact Data Available?:
    When the system checks for edi bol contact data in gp segment, then if edi bol contact data is found, extract contact function code, name, communication number qualifier and communication number from gp segment, otherwise set all contact fields to spaces.
  • Context - a shipment requires carrier or entity information for customs processing:
    For EDI BOL Carrier Data Available?:
    When the system checks for edi bol carrier data in tn segment, then if edi bol carrier data is found, extract organization id and name from tn segment, otherwise extract entity information from fastway cons-data fields.
  • Context - address information is being extracted from fastway shiproot:
    For Extract Address from Fastway SHIPROOT:
    When the address field is blank or spaces, then set the address field to 'na' to ensure required address information is present.
  • Context - address information is being parsed from fastway address field:
    For Parse City/State from Fastway Address Field:
    When state or province code is available, then search the state-country table to find matching country code for the state or province code, and set country code to the found value or spaces if not found.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires shipper information for customs manifest creation
GIVEN
A shipment requires shipper information for customs manifest creation
Applied to: EDI BOL Shipper Data Available?
WHEN
The system checks for EDI BOL shipper data in HN segment
THEN
If EDI BOL shipper data is found, extract shipper name and CHOP code from HN segment, otherwise extract shipper name and CHOP code from Fastway SHIPROOT
Context: A shipment requires consignee information for customs manifest creation
GIVEN
A shipment requires consignee information for customs manifest creation
Applied to: EDI BOL Consignee Data Available?
WHEN
The system checks for EDI BOL consignee data in CN segment
THEN
If EDI BOL consignee data is found, extract consignee name and CHOP code from CN segment, otherwise extract consignee name and CHOP code from Fastway SHIPROOT
Context: A shipment requires address information for shipper or consignee
GIVEN
A shipment requires address information for shipper or consignee
Applied to: EDI BOL Address Data Available?
WHEN
The system checks for EDI BOL address data in HA/CA segments
THEN
If EDI BOL address data is found, extract address lines from HA/CA segments, otherwise extract address from Fastway SHIPROOT address fields and set default 'NA' if address is blank
Context: A shipment requires city and state information for address completion
GIVEN
A shipment requires city and state information for address completion
Applied to: EDI BOL City/State Data Available?
WHEN
The system checks for EDI BOL city/state data in HC/CC segments
THEN
If EDI BOL city/state data is found, extract city, state, postal code and country from HC/CC segments, otherwise parse city, state and postal code from Fastway address field and lookup country code from state-country table
Context: A shipment may have contact information for shipper or consignee
GIVEN
A shipment may have contact information for shipper or consignee
Applied to: EDI BOL Contact Data Available?
WHEN
The system checks for EDI BOL contact data in GP segment
THEN
If EDI BOL contact data is found, extract contact function code, name, communication number qualifier and communication number from GP segment, otherwise set all contact fields to spaces
Context: A shipment requires carrier or entity information for customs processing
GIVEN
A shipment requires carrier or entity information for customs processing
Applied to: EDI BOL Carrier Data Available?
WHEN
The system checks for EDI BOL carrier data in TN segment
THEN
If EDI BOL carrier data is found, extract organization ID and name from TN segment, otherwise extract entity information from Fastway CONS-DATA fields
Context: Address information is being extracted from Fastway SHIPROOT
GIVEN
Address information is being extracted from Fastway SHIPROOT
Applied to: Extract Address from Fastway SHIPROOT
WHEN
The address field is blank or spaces
THEN
Set the address field to 'NA' to ensure required address information is present
Context: Address information is being parsed from Fastway address field
GIVEN
Address information is being parsed from Fastway address field
Applied to: Parse City/State from Fastway Address Field
WHEN
State or province code is available
THEN
Search the state-country table to find matching country code for the state or province code, and set country code to the found value or spaces if not found
R-GCCCCADD-cbl-02113 (+5) File: GCCCCADD.cbl Validate entity ID, name, and address requirements Merged 6 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate entity ID, name, and address requirements':
  • Context - a party record contains address data (n3), location data (n4), or contact data (per) but the entity id is missing or blank:
    For Generate Entity ID Required Error:
    When the system validates the party information, then generate an error message indicating that entity id is required when address information is present.
  • Context - a party record contains address data (n3), location data (n4), or contact data (per) but the party name is missing or blank:
    For Generate Name Required Error:
    When the system validates the party information, then generate an error message indicating that name is required when address information is present.
  • Context - a party record has an entity id specified but the name field is missing or blank:
    For Generate Name Required Error Message:
    When the system validates the party information, then generate an error message indicating that name is required when entity id is present.
  • Context - a party record has sequence number greater than 2 and the entity id is 'sh' (shipper), 'cn' (consignee), or 'cb' (customs broker):
    For Generate Invalid Entity ID Error:
    When the system validates the entity id, then generate an error message indicating that the entity id value is invalid for this party position.
  • Context - a party record has an entity id specified but the address information is missing or blank:
    For Generate Address Required Error:
    When the system validates the party information, then generate an error message indicating that address is required when entity id is present.
  • Context - a party record is for sequence 1 (shipper) or sequence 2 (consignee) and contains address, location, or contact data:
    For Is Entity ID or Name Missing?:
    When the system validates required party information, then both entity id and name must be present, and all required address fields must be populated with appropriate error messages for missing data.
👨‍💻 Technical ACs (Gherkin)
Context: A party record contains address data (N3), location data (N4), or contact data (PER) but the entity ID is missing or blank
GIVEN
A party record contains address data (N3), location data (N4), or contact data (PER) but the entity ID is missing or blank
Applied to: Generate Entity ID Required Error
WHEN
The system validates the party information
THEN
Generate an error message indicating that entity ID is required when address information is present
Context: A party record contains address data (N3), location data (N4), or contact data (PER) but the party name is missing or blank
GIVEN
A party record contains address data (N3), location data (N4), or contact data (PER) but the party name is missing or blank
Applied to: Generate Name Required Error
WHEN
The system validates the party information
THEN
Generate an error message indicating that name is required when address information is present
Context: A party record has an entity ID specified but the name field is missing or blank
GIVEN
A party record has an entity ID specified but the name field is missing or blank
Applied to: Generate Name Required Error Message
WHEN
The system validates the party information
THEN
Generate an error message indicating that name is required when entity ID is present
Context: A party record has sequence number greater than 2 and the entity ID is 'SH' (Shipper), 'CN' (Consignee), or 'CB' (Customs Broker)
GIVEN
A party record has sequence number greater than 2 and the entity ID is 'SH' (Shipper), 'CN' (Consignee), or 'CB' (Customs Broker)
Applied to: Generate Invalid Entity ID Error
WHEN
The system validates the entity ID
THEN
Generate an error message indicating that the entity ID value is invalid for this party position
Context: A party record has an entity ID specified but the address information is missing or blank
GIVEN
A party record has an entity ID specified but the address information is missing or blank
Applied to: Generate Address Required Error
WHEN
The system validates the party information
THEN
Generate an error message indicating that address is required when entity ID is present
Context: A party record is for sequence 1 (shipper) or sequence 2 (consignee) and contains address, location, or contact data
GIVEN
A party record is for sequence 1 (shipper) or sequence 2 (consignee) and contains address, location, or contact data
Applied to: Is Entity ID or Name Missing?
WHEN
The system validates required party information
THEN
Both entity ID and name must be present, and all required address fields must be populated with appropriate error messages for missing data
R-GCCCCADD-cbl-02119 (+7) File: GCCCCADD.cbl Validate city, state, postal code, and country requirements Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate city, state, postal code, and country requirements':
  • Context - an n4 address segment is being processed for validation:
    For N4 Address Data Present?:
    When the system checks if the n4 address data fields contain any information, then if n4 address data is empty, skip all address validations and complete processing, otherwise proceed with address field validations.
  • Context - n4 address data is present and being validated:
    For City Name Empty?:
    When the city name field is empty or contains only spaces, then generate a required field error message for city name (gccs-e-gen-required-n401).
  • Context - a city name is provided in the address data:
    For City Length < 2 Characters?:
    When the city name contains fewer than 2 non-space characters, then generate a minimum length error message requiring at least 2 characters (gccs-e-gen-min-len2-req).
  • Context - a postal code is provided in the address data:
    For Postal Code Length < 3 Characters?:
    When the postal code contains fewer than 3 non-space characters, then generate a minimum length error message requiring at least 3 characters (gccs-e-gen-min-len3-req).
  • Context - the country code indicates canada, usa, or mexico:
    For State/Province Code Empty?:
    When the state or province code field is empty or contains only spaces, then generate a required field error message for state/province code (gccs-e-gen-required-n402).
  • Context - both state/province code and country code are provided for canada, usa, or mexico:
    For Valid State-Country Match?:
    When the state/province code does not exist in the state-country lookup table for the specified country, then generate an invalid state/province code error message (gccs-e-invalid-n402).
  • Context - a state/province code is provided but country code is empty:
    For Auto-Assign Country from State:
    When the state/province code exists in the state-country lookup table, then automatically assign the corresponding country code from the lookup table to the country field.
  • Context - address validation is being performed:
    For Country Code Empty?:
    When the country code field is empty and cannot be auto-assigned from state/province code, then generate a required field error message for country code (gccs-e-gen-required-n404).
👨‍💻 Technical ACs (Gherkin)
Context: An N4 address segment is being processed for validation
GIVEN
An N4 address segment is being processed for validation
Applied to: N4 Address Data Present?
WHEN
The system checks if the N4 address data fields contain any information
THEN
If N4 address data is empty, skip all address validations and complete processing, otherwise proceed with address field validations
Context: N4 address data is present and being validated
GIVEN
N4 address data is present and being validated
Applied to: City Name Empty?
WHEN
The city name field is empty or contains only spaces
THEN
Generate a required field error message for city name (GCCS-E-GEN-REQUIRED-N401)
Context: A city name is provided in the address data
GIVEN
A city name is provided in the address data
Applied to: City Length < 2 Characters?
WHEN
The city name contains fewer than 2 non-space characters
THEN
Generate a minimum length error message requiring at least 2 characters (GCCS-E-GEN-MIN-LEN2-REQ)
Context: A postal code is provided in the address data
GIVEN
A postal code is provided in the address data
Applied to: Postal Code Length < 3 Characters?
WHEN
The postal code contains fewer than 3 non-space characters
THEN
Generate a minimum length error message requiring at least 3 characters (GCCS-E-GEN-MIN-LEN3-REQ)
Context: The country code indicates Canada, USA, or Mexico
GIVEN
The country code indicates Canada, USA, or Mexico
Applied to: State/Province Code Empty?
WHEN
The state or province code field is empty or contains only spaces
THEN
Generate a required field error message for state/province code (GCCS-E-GEN-REQUIRED-N402)
Context: Both state/province code and country code are provided for Canada, USA, or Mexico
GIVEN
Both state/province code and country code are provided for Canada, USA, or Mexico
Applied to: Valid State-Country Match?
WHEN
The state/province code does not exist in the state-country lookup table for the specified country
THEN
Generate an invalid state/province code error message (GCCS-E-INVALID-N402)
Context: A state/province code is provided but country code is empty
GIVEN
A state/province code is provided but country code is empty
Applied to: Auto-Assign Country from State
WHEN
The state/province code exists in the state-country lookup table
THEN
Automatically assign the corresponding country code from the lookup table to the country field
Context: Address validation is being performed
GIVEN
Address validation is being performed
Applied to: Country Code Empty?
WHEN
The country code field is empty and cannot be auto-assigned from state/province code
THEN
Generate a required field error message for country code (GCCS-E-GEN-REQUIRED-N404)
R-GCCCCADD-cbl-02127 (+3) File: GCCCCADD.cbl Validate contact information and communication requirements Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate contact information and communication requirements':
  • Context - a contact record with communication number qualifier is being processed:
    For Validate Communication Number Qualifier:
    When the communication number qualifier is provided and is not blank, 'fx' (fax), or 'te' (telephone), then generate an error message indicating invalid communication qualifier value.
  • Context - a contact record is being processed with a contact name provided:
    For Generate Error: Communication Qualifier Required:
    When the communication number qualifier is blank or spaces, then generate an error message requiring communication qualifier.
  • Context - a contact record is being processed with a communication number provided:
    For Generate Error: Communication Qualifier Required:
    When the communication number qualifier is blank or spaces, then generate an error message requiring communication qualifier.
  • Context - a contact record is being processed with either communication number qualifier or contact name provided:
    For Generate Error: Communication Number Required:
    When the communication number is blank or spaces, then generate an error message requiring communication number.
👨‍💻 Technical ACs (Gherkin)
Context: A contact record with communication number qualifier is being processed
GIVEN
A contact record with communication number qualifier is being processed
Applied to: Validate Communication Number Qualifier
WHEN
The communication number qualifier is provided and is not blank, 'FX' (fax), or 'TE' (telephone)
THEN
Generate an error message indicating invalid communication qualifier value
Context: A contact record is being processed with a contact name provided
GIVEN
A contact record is being processed with a contact name provided
Applied to: Generate Error: Communication Qualifier Required
WHEN
The communication number qualifier is blank or spaces
THEN
Generate an error message requiring communication qualifier
Context: A contact record is being processed with a communication number provided
GIVEN
A contact record is being processed with a communication number provided
Applied to: Generate Error: Communication Qualifier Required
WHEN
The communication number qualifier is blank or spaces
THEN
Generate an error message requiring communication qualifier
Context: A contact record is being processed with either communication number qualifier or contact name provided
GIVEN
A contact record is being processed with either communication number qualifier or contact name provided
Applied to: Generate Error: Communication Number Required
WHEN
The communication number is blank or spaces
THEN
Generate an error message requiring communication number
R-GCCCCADD-cbl-02131 (+29) File: GCCCCADD.cbl Build and validate shipper and consignee records Merged 30 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build and validate shipper and consignee records':
  • Context - a new shipper record needs to be created:
    For Initialize Shipper Record:
    When the system initializes the shipper record, then the record is cleared, ccn key is set, record type is set to '55', and sequence is set to '0001'.
  • Context - a shipment requires shipper information:
    For EDI BOL Shipper Data Available?:
    When the system checks for edi bol shipper data availability, then if hn segment is found in edi bol, use edi data; otherwise use fastway data.
  • Context - edi bol shipper data is available:
    For Extract Shipper Name from EDI BOL:
    When the system extracts shipper information from edi bol, then entity id is set to 'sh', shipper name is extracted from f1-consignor-name, and chop code is extracted from f1-shpr-chop.
  • Context - edi bol shipper data is not available:
    For Use Fastway Shipper Data:
    When the system needs shipper information, then entity id is set to 'sh', shipper name is extracted from shpr-nm, and chop code is extracted from shpr-chop.
  • Context - shipper record requires address information:
    For EDI BOL Address Available?:
    When the system checks for edi bol address data, then if ha segment is found, extract address from edi bol; otherwise use fastway address data.
  • Context - edi bol address data is available:
    For Extract Address from EDI BOL:
    When the system extracts address information, then address line 1 is set from f2-addl-name-addr-1 and address line 2 is set from f2-addl-name-addr-2.
  • Context - edi bol address data is not available:
    For Use Fastway Address Data:
    When the system needs address information, then address line 1 is set from shpr-addr(1) and address line 2 is cleared.
  • Context - address line 1 is missing or blank:
    For Set Default Address to 'NA' if Missing:
    When the system processes address information, then address line 1 is set to 'na'.
  • Context - shipper record requires city and state information:
    For EDI BOL City/State Available?:
    When the system checks for edi bol city/state data, then if hc segment is found, extract city/state from edi bol; otherwise parse from fastway data.
  • Context - edi bol city/state data is available:
    For Extract City/State from EDI BOL:
    When the system extracts location information, then city is set from f4-city-name, state from f4-state-prov-code, postal code from f4-postal-code, and country from f4-country-code.
  • Context - edi bol city/state data is not available:
    For Parse City/State from Fastway Data:
    When the system needs location information, then address line 2 is parsed to extract city name, state/province code, and postal code.
  • Context - a state or province code is available:
    For Lookup Country Code from State:
    When the system needs to determine the country, then the state-country lookup table is searched to find the corresponding country code.
  • Context - shipper record may include contact information:
    For EDI BOL Contact Available?:
    When the system checks for edi bol contact data, then if gp segment is found, extract contact information; otherwise skip contact processing.
  • Context - edi bol contact data is available:
    For Extract Contact Information:
    When the system extracts contact information, then contact function code, name, communication number qualifier, and communication number are extracted from the gp segment.
  • Context - a shipper record has been populated with data:
    For Validate Shipper Record:
    When the system validates the shipper record, then all required fields are checked and validation errors are generated for missing or invalid data.
  • Context - a validated shipper record is ready for storage:
    For Store Shipper Record:
    When the system stores the shipper record, then the record is moved to the first position in the record array.
  • Context - a new consignee record needs to be created:
    For Initialize Consignee Record:
    When the system initializes the consignee record, then the record is cleared, ccn key is set, record type is set to '55', and sequence is set to '0002'.
  • Context - a shipment requires consignee information:
    For EDI BOL Consignee Data Available?:
    When the system checks for edi bol consignee data availability, then if cn segment is found in edi bol, use edi data; otherwise use fastway data.
  • Context - edi bol consignee data is available:
    For Extract Consignee Name from EDI BOL:
    When the system extracts consignee information from edi bol, then entity id is set to 'cn', consignee name is extracted from d1-shipper-name, and chop code is extracted from d1-cons-chop.
  • Context - edi bol consignee data is not available:
    For Use Fastway Consignee Data:
    When the system needs consignee information, then entity id is set to 'cn', consignee name is extracted from cons-data(1), and chop code is extracted from cons-chop.
  • Context - a consignee record has been populated with data:
    For Validate Consignee Record:
    When the system validates the consignee record, then all required fields are checked and validation errors are generated for missing or invalid data.
  • Context - a validated consignee record is ready for storage:
    For Store Consignee Record:
    When the system stores the consignee record, then the record is moved to the second position in the record array.
  • Context - a record contains address, city/state, or contact information:
    For Validate Entity ID and Name Required:
    When the system validates the record structure, then if entity id is missing, generate required entity id error; if name is missing, generate required name error.
  • Context - a record has entity id and name populated:
    For Validate Address Information Required:
    When the system validates address requirements, then if address line 1 is missing, generate required address error.
  • Context - a record contains city information:
    For Validate City Name Minimum Length:
    When the system validates city name length, then if city name is present but less than 2 characters, generate minimum length error.
  • Context - a record contains postal code information:
    For Validate Postal Code Minimum Length:
    When the system validates postal code length, then if postal code is present but less than 3 characters, generate minimum length error.
  • Context - a record has country code of ca, us, or mx:
    For Validate State/Province for US/CA/MX:
    When the system validates geographic information, then if state/province code is missing, generate required state/province error.
  • Context - a record has both state/province code and country code:
    For Validate State/Country Combination:
    When the system validates the geographic combination, then if the state/province code does not belong to the specified country, generate invalid state/province error.
  • Context - a record contains contact information:
    For Validate Contact Information Format:
    When the system validates contact format, then if communication qualifier is provided without communication number, or if invalid qualifier is used, generate appropriate validation errors.
  • Context - validation errors have been identified:
    For Generate Validation Error Messages:
    When the system processes validation results, then error messages are retrieved from the message table and added to the error collection.
👨‍💻 Technical ACs (Gherkin)
Context: A new shipper record needs to be created
GIVEN
A new shipper record needs to be created
Applied to: Initialize Shipper Record
WHEN
The system initializes the shipper record
THEN
The record is cleared, CCN key is set, record type is set to '55', and sequence is set to '0001'
Context: A shipment requires shipper information
GIVEN
A shipment requires shipper information
Applied to: EDI BOL Shipper Data Available?
WHEN
The system checks for EDI BOL shipper data availability
THEN
If HN segment is found in EDI BOL, use EDI data; otherwise use Fastway data
Context: EDI BOL shipper data is available
GIVEN
EDI BOL shipper data is available
Applied to: Extract Shipper Name from EDI BOL
WHEN
The system extracts shipper information from EDI BOL
THEN
Entity ID is set to 'SH', shipper name is extracted from F1-CONSIGNOR-NAME, and CHOP code is extracted from F1-SHPR-CHOP
Context: EDI BOL shipper data is not available
GIVEN
EDI BOL shipper data is not available
Applied to: Use Fastway Shipper Data
WHEN
The system needs shipper information
THEN
Entity ID is set to 'SH', shipper name is extracted from SHPR-NM, and CHOP code is extracted from SHPR-CHOP
Context: Shipper record requires address information
GIVEN
Shipper record requires address information
Applied to: EDI BOL Address Available?
WHEN
The system checks for EDI BOL address data
THEN
If HA segment is found, extract address from EDI BOL; otherwise use Fastway address data
Context: EDI BOL address data is available
GIVEN
EDI BOL address data is available
Applied to: Extract Address from EDI BOL
WHEN
The system extracts address information
THEN
Address line 1 is set from F2-ADDL-NAME-ADDR-1 and address line 2 is set from F2-ADDL-NAME-ADDR-2
Context: EDI BOL address data is not available
GIVEN
EDI BOL address data is not available
Applied to: Use Fastway Address Data
WHEN
The system needs address information
THEN
Address line 1 is set from SHPR-ADDR(1) and address line 2 is cleared
Context: Address line 1 is missing or blank
GIVEN
Address line 1 is missing or blank
Applied to: Set Default Address to 'NA' if Missing
WHEN
The system processes address information
THEN
Address line 1 is set to 'NA'
Context: Shipper record requires city and state information
GIVEN
Shipper record requires city and state information
Applied to: EDI BOL City/State Available?
WHEN
The system checks for EDI BOL city/state data
THEN
If HC segment is found, extract city/state from EDI BOL; otherwise parse from Fastway data
Context: EDI BOL city/state data is available
GIVEN
EDI BOL city/state data is available
Applied to: Extract City/State from EDI BOL
WHEN
The system extracts location information
THEN
City is set from F4-CITY-NAME, state from F4-STATE-PROV-CODE, postal code from F4-POSTAL-CODE, and country from F4-COUNTRY-CODE
Context: EDI BOL city/state data is not available
GIVEN
EDI BOL city/state data is not available
Applied to: Parse City/State from Fastway Data
WHEN
The system needs location information
THEN
Address line 2 is parsed to extract city name, state/province code, and postal code
Context: A state or province code is available
GIVEN
A state or province code is available
Applied to: Lookup Country Code from State
WHEN
The system needs to determine the country
THEN
The state-country lookup table is searched to find the corresponding country code
Context: Shipper record may include contact information
GIVEN
Shipper record may include contact information
Applied to: EDI BOL Contact Available?
WHEN
The system checks for EDI BOL contact data
THEN
If GP segment is found, extract contact information; otherwise skip contact processing
Context: EDI BOL contact data is available
GIVEN
EDI BOL contact data is available
Applied to: Extract Contact Information
WHEN
The system extracts contact information
THEN
Contact function code, name, communication number qualifier, and communication number are extracted from the GP segment
Context: A shipper record has been populated with data
GIVEN
A shipper record has been populated with data
Applied to: Validate Shipper Record
WHEN
The system validates the shipper record
THEN
All required fields are checked and validation errors are generated for missing or invalid data
Context: A validated shipper record is ready for storage
GIVEN
A validated shipper record is ready for storage
Applied to: Store Shipper Record
WHEN
The system stores the shipper record
THEN
The record is moved to the first position in the record array
Context: A new consignee record needs to be created
GIVEN
A new consignee record needs to be created
Applied to: Initialize Consignee Record
WHEN
The system initializes the consignee record
THEN
The record is cleared, CCN key is set, record type is set to '55', and sequence is set to '0002'
Context: A shipment requires consignee information
GIVEN
A shipment requires consignee information
Applied to: EDI BOL Consignee Data Available?
WHEN
The system checks for EDI BOL consignee data availability
THEN
If CN segment is found in EDI BOL, use EDI data; otherwise use Fastway data
Context: EDI BOL consignee data is available
GIVEN
EDI BOL consignee data is available
Applied to: Extract Consignee Name from EDI BOL
WHEN
The system extracts consignee information from EDI BOL
THEN
Entity ID is set to 'CN', consignee name is extracted from D1-SHIPPER-NAME, and CHOP code is extracted from D1-CONS-CHOP
Context: EDI BOL consignee data is not available
GIVEN
EDI BOL consignee data is not available
Applied to: Use Fastway Consignee Data
WHEN
The system needs consignee information
THEN
Entity ID is set to 'CN', consignee name is extracted from CONS-DATA(1), and CHOP code is extracted from CONS-CHOP
Context: A consignee record has been populated with data
GIVEN
A consignee record has been populated with data
Applied to: Validate Consignee Record
WHEN
The system validates the consignee record
THEN
All required fields are checked and validation errors are generated for missing or invalid data
Context: A validated consignee record is ready for storage
GIVEN
A validated consignee record is ready for storage
Applied to: Store Consignee Record
WHEN
The system stores the consignee record
THEN
The record is moved to the second position in the record array
Context: A record contains address, city/state, or contact information
GIVEN
A record contains address, city/state, or contact information
Applied to: Validate Entity ID and Name Required
WHEN
The system validates the record structure
THEN
If entity ID is missing, generate required entity ID error; if name is missing, generate required name error
Context: A record has entity ID and name populated
GIVEN
A record has entity ID and name populated
Applied to: Validate Address Information Required
WHEN
The system validates address requirements
THEN
If address line 1 is missing, generate required address error
Context: A record contains city information
GIVEN
A record contains city information
Applied to: Validate City Name Minimum Length
WHEN
The system validates city name length
THEN
If city name is present but less than 2 characters, generate minimum length error
Context: A record contains postal code information
GIVEN
A record contains postal code information
Applied to: Validate Postal Code Minimum Length
WHEN
The system validates postal code length
THEN
If postal code is present but less than 3 characters, generate minimum length error
Context: A record has country code of CA, US, or MX
GIVEN
A record has country code of CA, US, or MX
Applied to: Validate State/Province for US/CA/MX
WHEN
The system validates geographic information
THEN
If state/province code is missing, generate required state/province error
Context: A record has both state/province code and country code
GIVEN
A record has both state/province code and country code
Applied to: Validate State/Country Combination
WHEN
The system validates the geographic combination
THEN
If the state/province code does not belong to the specified country, generate invalid state/province error
Context: A record contains contact information
GIVEN
A record contains contact information
Applied to: Validate Contact Information Format
WHEN
The system validates contact format
THEN
If communication qualifier is provided without communication number, or if invalid qualifier is used, generate appropriate validation errors
Context: Validation errors have been identified
GIVEN
Validation errors have been identified
Applied to: Generate Validation Error Messages
WHEN
The system processes validation results
THEN
Error messages are retrieved from the message table and added to the error collection
R-GCCCCADD-cbl-02161 (+14) File: GCCCCADD.cbl Build additional entity records with address and contact validation Merged 15 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build additional entity records with address and contact validation':
  • Context - an edi bill of lading exists with sf entity data:
    For Build SF - Stuffer Entity:
    When building sf entity record and sf entity is found in edi data, then extract sf entity name, set entity id to 'sf', clear id code qualifier and id code, and retrieve address information from edi segments.
  • Context - an edi bill of lading exists with uc entity data:
    For Build UC - Ultimate Consignee Entity:
    When building uc entity record and uc entity is found in edi data, then extract uc entity name, set entity id to 'uc', clear id code qualifier and id code, and retrieve address information from edi segments.
  • Context - an edi bill of lading exists with bn entity data:
    For Build BN - Beneficial Owner Entity:
    When building bn entity record and bn entity is found in edi data, then extract bn entity name, set entity id to 'bn', clear id code qualifier and id code, set consignee chop code, and retrieve address information from edi segments.
  • Context - transportation data exists in either edi or fastway system:
    For Build C1 - Carrier Entity:
    When building c1 entity record and c1 entity is found in edi transportation data, then extract c1 organization id, name, and address information from edi transportation segments.
  • Context - c1 entity is not found in edi transportation data and fastway system contains carrier data:
    For Use Fastway Carrier Data:
    When building c1 entity record and consignee data code equals 'c', then extract carrier information from fastway consignee data and build c1 entity record with name and address.
  • Context - an edi bill of lading exists with n1 entity transportation data:
    For Build N1 - Notify Party Entity:
    When building n1 entity record and n1 entity is found in edi transportation data, then extract n1 organization id, name, and address information from edi transportation segments.
  • Context - edi bill of lading contains mcoa segments with pf or ss entity data:
    For Build PF/SS - Payment/Service Entities:
    When building pf/ss entity records and mcoa segments are found with organization id of 'pf' or 'ss', then extract entity id, name, id code qualifier, id code, and address information from mcoa segments.
  • Context - edi bill of lading contains transportation data for additional entity types:
    For Build Additional Entities - 11, NN, MC, OO, FW:
    When building additional entity records and entities with ids '11', 'nn', 'mc', 'oo', or 'fw' are found, then extract organization id, name, and address information for each additional entity type from edi transportation segments.
  • Context - a business entity record is being processed with sequence number greater than 2:
    For Entity ID Valid?:
    When validating entity id and entity id is not empty and is not a shipper, consignee, or customs broker entity, then generate validation error for invalid entity id value.
  • Context - a business entity record has a valid entity id:
    For Name Required?:
    When validating entity name and entity id is not empty but entity name is empty, then generate validation error for required entity name.
    For Address Required?:
    When validating address and entity id is not empty but primary address line is empty, then generate validation error for required address information.
  • Context - a business entity record requires address information:
    For Set Default Address to 'NA':
    When validating address and primary address line is empty or spaces, then set primary address line to 'na' as default value.
  • Context - a business entity record has both state/province code and country code specified:
    For Validate State/Country Combination:
    When validating address and state/province code does not match the country code in the state-country lookup table, then generate validation error for invalid state/province code.
  • Context - a business entity record contains contact information:
    For Contact Info Valid?:
    When validating contact information and communication number qualifier is not empty, 'fx', or 'te', then generate validation error for invalid communication number qualifier value.
  • Context - a business entity record has passed all validation checks:
    For Store Entity Record:
    When storing entity record and all validation criteria are met, then insert the entity record into the customs database with sequence number within maximum allowed range.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI bill of lading exists with SF entity data
GIVEN
An EDI bill of lading exists with SF entity data
Applied to: Build SF - Stuffer Entity
WHEN
Building SF entity record and SF entity is found in EDI data
THEN
Extract SF entity name, set entity ID to 'SF', clear ID code qualifier and ID code, and retrieve address information from EDI segments
Context: An EDI bill of lading exists with UC entity data
GIVEN
An EDI bill of lading exists with UC entity data
Applied to: Build UC - Ultimate Consignee Entity
WHEN
Building UC entity record and UC entity is found in EDI data
THEN
Extract UC entity name, set entity ID to 'UC', clear ID code qualifier and ID code, and retrieve address information from EDI segments
Context: An EDI bill of lading exists with BN entity data
GIVEN
An EDI bill of lading exists with BN entity data
Applied to: Build BN - Beneficial Owner Entity
WHEN
Building BN entity record and BN entity is found in EDI data
THEN
Extract BN entity name, set entity ID to 'BN', clear ID code qualifier and ID code, set consignee chop code, and retrieve address information from EDI segments
Context: Transportation data exists in either EDI or FastWay system
GIVEN
Transportation data exists in either EDI or FastWay system
Applied to: Build C1 - Carrier Entity
WHEN
Building C1 entity record and C1 entity is found in EDI transportation data
THEN
Extract C1 organization ID, name, and address information from EDI transportation segments
Context: C1 entity is not found in EDI transportation data and FastWay system contains carrier data
GIVEN
C1 entity is not found in EDI transportation data and FastWay system contains carrier data
Applied to: Use Fastway Carrier Data
WHEN
Building C1 entity record and consignee data code equals 'C'
THEN
Extract carrier information from FastWay consignee data and build C1 entity record with name and address
Context: An EDI bill of lading exists with N1 entity transportation data
GIVEN
An EDI bill of lading exists with N1 entity transportation data
Applied to: Build N1 - Notify Party Entity
WHEN
Building N1 entity record and N1 entity is found in EDI transportation data
THEN
Extract N1 organization ID, name, and address information from EDI transportation segments
Context: EDI bill of lading contains MCOA segments with PF or SS entity data
GIVEN
EDI bill of lading contains MCOA segments with PF or SS entity data
Applied to: Build PF/SS - Payment/Service Entities
WHEN
Building PF/SS entity records and MCOA segments are found with organization ID of 'PF' or 'SS'
THEN
Extract entity ID, name, ID code qualifier, ID code, and address information from MCOA segments
Context: EDI bill of lading contains transportation data for additional entity types
GIVEN
EDI bill of lading contains transportation data for additional entity types
Applied to: Build Additional Entities - 11, NN, MC, OO, FW
WHEN
Building additional entity records and entities with IDs '11', 'NN', 'MC', 'OO', or 'FW' are found
THEN
Extract organization ID, name, and address information for each additional entity type from EDI transportation segments
Context: A business entity record is being processed with sequence number greater than 2
GIVEN
A business entity record is being processed with sequence number greater than 2
Applied to: Entity ID Valid?
WHEN
Validating entity ID and entity ID is not empty and is not a shipper, consignee, or customs broker entity
THEN
Generate validation error for invalid entity ID value
Context: A business entity record has a valid entity ID
GIVEN
A business entity record has a valid entity ID
Applied to: Name Required?
WHEN
Validating entity name and entity ID is not empty but entity name is empty
THEN
Generate validation error for required entity name
Applied to: Address Required?
WHEN
Validating address and entity ID is not empty but primary address line is empty
THEN
Generate validation error for required address information
Context: A business entity record requires address information
GIVEN
A business entity record requires address information
Applied to: Set Default Address to 'NA'
WHEN
Validating address and primary address line is empty or spaces
THEN
Set primary address line to 'NA' as default value
Context: A business entity record has both state/province code and country code specified
GIVEN
A business entity record has both state/province code and country code specified
Applied to: Validate State/Country Combination
WHEN
Validating address and state/province code does not match the country code in the state-country lookup table
THEN
Generate validation error for invalid state/province code
Context: A business entity record contains contact information
GIVEN
A business entity record contains contact information
Applied to: Contact Info Valid?
WHEN
Validating contact information and communication number qualifier is not empty, 'FX', or 'TE'
THEN
Generate validation error for invalid communication number qualifier value
Context: A business entity record has passed all validation checks
GIVEN
A business entity record has passed all validation checks
Applied to: Store Entity Record
WHEN
Storing entity record and all validation criteria are met
THEN
Insert the entity record into the customs database with sequence number within maximum allowed range
R-GCCCCADD-cbl-02176 (+8) File: GCCCCADD.cbl Process importer records with backup and deletion handling Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process importer records with backup and deletion handling':
  • Context - a corrector edi transaction is being processed and the temporary importer name contains data from previous processing:
    For Backup Original Importer Data:
    When the system detects existing importer data in temporary variables, then the system backs up all original importer details including name, business number, qualifier, address, city, province, postal code, country, and contact information to temporary storage variables.
  • Context - an edi bill of lading is being processed for customs manifest creation:
    For EDI BOL has Importer Segment?:
    When the system searches for importer segment data in the edi bol, then the system determines if an importer segment with entity id 'im' exists and sets the appropriate processing flag.
  • Context - edi bol contains an importer segment with entity id 'im':
    For Process EDI BOL Importer Data:
    When the system processes the importer segment data, then the system extracts importer name, sets it as the customs importer, extracts business number qualifier and business number, sets importer found flag to true, and creates customs record with all importer details including address and contact information.
  • Context - edi bol does not contain importer segment data and au table lookup is performed using consignee chop and commodity code:
    For AU Table has Importer Data?:
    When the system queries the au table for matching importer records, then the system determines if au table contains valid importer data and sets the au importer found flag accordingly.
  • Context - au table contains valid importer data for the consignee and commodity combination:
    For Use AU Table Importer Data:
    When the system processes au table importer information, then the system sets importer name from au table, sets business number from au table, sets business number qualifier to 'm5', sets csa indicator to on, and marks au importer as found.
  • Context - a corrector edi transaction is being processed and backed up importer data exists in temporary variables and current processing has not found importer data in edi bol:
    For Corrector EDI Deletes Importer?:
    When the system evaluates whether to restore backed up importer data, then if backed up importer data exists and current processing found no importer data, the system restores the backed up importer information; otherwise it clears the importer data.
  • Context - corrector edi has deleted importer data and backed up importer data exists in temporary variables:
    For Restore Backed Up Importer Data:
    When the system restores importer information, then the system restores all backed up importer details including chop code, entity id, name, business number qualifier, business number, csa indicator, address lines, city, province, postal code, country, and contact information from temporary storage.
  • Context - both au table importer data and edi bol importer data have been found and processed:
    For Both AU and EDI Importer Found?:
    When the system evaluates csa indicator settings for dual importer sources, then if edi business number qualifier is 'bn' or spaces, the system turns off csa indicator to prevent conflicts; otherwise csa indicator remains as set by the respective data source.
  • Context - all importer data processing is complete including edi bol processing, au table lookup, and corrector edi handling:
    For Create Final Importer Record:
    When the system creates the final importer record, then the system validates all importer segment data, creates customs record type 55 with entity id 'im', includes all importer details, and prepares the record for insertion into customs database.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed AND the temporary importer name contains data from previous processing
GIVEN
A corrector EDI transaction is being processed AND the temporary importer name contains data from previous processing
Applied to: Backup Original Importer Data
WHEN
The system detects existing importer data in temporary variables
THEN
The system backs up all original importer details including name, business number, qualifier, address, city, province, postal code, country, and contact information to temporary storage variables
Context: An EDI Bill of Lading is being processed for customs manifest creation
GIVEN
An EDI Bill of Lading is being processed for customs manifest creation
Applied to: EDI BOL has Importer Segment?
WHEN
The system searches for importer segment data in the EDI BOL
THEN
The system determines if an importer segment with entity ID 'IM' exists and sets the appropriate processing flag
Context: EDI BOL contains an importer segment with entity ID 'IM'
GIVEN
EDI BOL contains an importer segment with entity ID 'IM'
Applied to: Process EDI BOL Importer Data
WHEN
The system processes the importer segment data
THEN
The system extracts importer name, sets it as the customs importer, extracts business number qualifier and business number, sets importer found flag to true, and creates customs record with all importer details including address and contact information
Context: EDI BOL does not contain importer segment data AND AU table lookup is performed using consignee chop and commodity code
GIVEN
EDI BOL does not contain importer segment data AND AU table lookup is performed using consignee chop and commodity code
Applied to: AU Table has Importer Data?
WHEN
The system queries the AU table for matching importer records
THEN
The system determines if AU table contains valid importer data and sets the AU importer found flag accordingly
Context: AU table contains valid importer data for the consignee and commodity combination
GIVEN
AU table contains valid importer data for the consignee and commodity combination
Applied to: Use AU Table Importer Data
WHEN
The system processes AU table importer information
THEN
The system sets importer name from AU table, sets business number from AU table, sets business number qualifier to 'M5', sets CSA indicator to ON, and marks AU importer as found
Context: A corrector EDI transaction is being processed AND backed up importer data exists in temporary variables AND current processing has not found importer data in EDI BOL
GIVEN
A corrector EDI transaction is being processed AND backed up importer data exists in temporary variables AND current processing has not found importer data in EDI BOL
Applied to: Corrector EDI Deletes Importer?
WHEN
The system evaluates whether to restore backed up importer data
THEN
If backed up importer data exists and current processing found no importer data, the system restores the backed up importer information; otherwise it clears the importer data
Context: Corrector EDI has deleted importer data AND backed up importer data exists in temporary variables
GIVEN
Corrector EDI has deleted importer data AND backed up importer data exists in temporary variables
Applied to: Restore Backed Up Importer Data
WHEN
The system restores importer information
THEN
The system restores all backed up importer details including chop code, entity ID, name, business number qualifier, business number, CSA indicator, address lines, city, province, postal code, country, and contact information from temporary storage
Context: Both AU table importer data and EDI BOL importer data have been found AND processed
GIVEN
Both AU table importer data and EDI BOL importer data have been found AND processed
Applied to: Both AU and EDI Importer Found?
WHEN
The system evaluates CSA indicator settings for dual importer sources
THEN
If EDI business number qualifier is 'BN' or spaces, the system turns off CSA indicator to prevent conflicts; otherwise CSA indicator remains as set by the respective data source
Context: All importer data processing is complete including EDI BOL processing, AU table lookup, and corrector EDI handling
GIVEN
All importer data processing is complete including EDI BOL processing, AU table lookup, and corrector EDI handling
Applied to: Create Final Importer Record
WHEN
The system creates the final importer record
THEN
The system validates all importer segment data, creates customs record type 55 with entity ID 'IM', includes all importer details, and prepares the record for insertion into customs database
R-GCCCCADD-cbl-02185 (+10) File: GCCCCADD.cbl Process importer data from EDI BOL with corrector handling Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process importer data from EDI BOL with corrector handling':
  • Context - an edi bol key exists for the shipment:
    For Get Importer N1 Segment from EDI BOL:
    When the system searches for importer n1 segment data in the edi bol, then the system retrieves the importer entity information if available.
  • Context - importer data is found in edi bol and backup importer data exists from previous processing:
    For Is Corrector EDI with Backup Data?:
    When the system evaluates if this is a corrector edi transaction with existing backup data, then the system chooses to restore backup data if corrector edi with backup exists, otherwise processes new importer data.
  • Context - a corrector edi transaction is being processed and backup importer data exists:
    For Restore Backup Importer Data:
    When the system needs to preserve original importer information, then the system restores all backup importer data including name, business number, qualifier, address, city, state, postal code, country, and contact information.
  • Context - valid importer n1 segment data is available from edi bol:
    For Extract Importer Business Information:
    When the system processes the importer entity information, then the system assigns importer name to customs importer field, business number qualifier to customs business number qualifier field, and business number to customs business number field.
  • Context - importer address information is being processed:
    For Set Default 'NA' Address:
    When the address field is spaces or contains low values, then the system sets the address field to 'na' as the default value.
  • Context - importer n3 address segment data is available from edi bol:
    For Process Address Information:
    When the system processes the address information, then the system assigns address line 1 and address line 2 to customs manifest fields, setting address line 1 to 'na' if it is spaces or low values.
  • Context - importer n4 city/state segment data is available from edi bol:
    For Process City/State/Postal Information:
    When the system processes the geographic information, then the system assigns city name, state/province code, postal code, and country code to customs manifest fields.
  • Context - importer data exists in au table and edi bol importer data is found and processed:
    For Reset CSA Indicator if AU and EDI Both Found:
    When the business number qualifier is 'bn' or spaces, then the system turns off the csa indicator.
  • Context - no importer data is found in the current edi bol transaction:
    For Corrector EDI Deleting Importer?:
    When the system evaluates if this represents an importer deletion in a corrector edi, then the system checks for backup data to restore or clears importer information if no backup exists.
  • Context - no importer data found in current edi bol but backup importer data exists:
    For Restore Backup and Mark as Found:
    When the system processes a corrector edi transaction, then the system restores the backup importer data and marks importer as found.
  • Context - no importer data is found in edi bol and no backup importer data exists:
    For Clear Importer Information:
    When the system processes the importer information, then the system clears the importer field from customs manifest.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Get Importer N1 Segment from EDI BOL
WHEN
The system searches for importer N1 segment data in the EDI BOL
THEN
The system retrieves the importer entity information if available
Context: Importer data is found in EDI BOL and backup importer data exists from previous processing
GIVEN
Importer data is found in EDI BOL and backup importer data exists from previous processing
Applied to: Is Corrector EDI with Backup Data?
WHEN
The system evaluates if this is a corrector EDI transaction with existing backup data
THEN
The system chooses to restore backup data if corrector EDI with backup exists, otherwise processes new importer data
Context: A corrector EDI transaction is being processed and backup importer data exists
GIVEN
A corrector EDI transaction is being processed and backup importer data exists
Applied to: Restore Backup Importer Data
WHEN
The system needs to preserve original importer information
THEN
The system restores all backup importer data including name, business number, qualifier, address, city, state, postal code, country, and contact information
Context: Valid importer N1 segment data is available from EDI BOL
GIVEN
Valid importer N1 segment data is available from EDI BOL
Applied to: Extract Importer Business Information
WHEN
The system processes the importer entity information
THEN
The system assigns importer name to customs importer field, business number qualifier to customs business number qualifier field, and business number to customs business number field
Context: Importer address information is being processed
GIVEN
Importer address information is being processed
Applied to: Set Default 'NA' Address
WHEN
The address field is spaces or contains low values
THEN
The system sets the address field to 'NA' as the default value
Context: Importer N3 address segment data is available from EDI BOL
GIVEN
Importer N3 address segment data is available from EDI BOL
Applied to: Process Address Information
WHEN
The system processes the address information
THEN
The system assigns address line 1 and address line 2 to customs manifest fields, setting address line 1 to 'NA' if it is spaces or low values
Context: Importer N4 city/state segment data is available from EDI BOL
GIVEN
Importer N4 city/state segment data is available from EDI BOL
Applied to: Process City/State/Postal Information
WHEN
The system processes the geographic information
THEN
The system assigns city name, state/province code, postal code, and country code to customs manifest fields
Context: Importer data exists in AU table and EDI BOL importer data is found and processed
GIVEN
Importer data exists in AU table and EDI BOL importer data is found and processed
Applied to: Reset CSA Indicator if AU and EDI Both Found
WHEN
The business number qualifier is 'BN' or spaces
THEN
The system turns off the CSA indicator
Context: No importer data is found in the current EDI BOL transaction
GIVEN
No importer data is found in the current EDI BOL transaction
Applied to: Corrector EDI Deleting Importer?
WHEN
The system evaluates if this represents an importer deletion in a corrector EDI
THEN
The system checks for backup data to restore or clears importer information if no backup exists
Context: No importer data found in current EDI BOL but backup importer data exists
GIVEN
No importer data found in current EDI BOL but backup importer data exists
Applied to: Restore Backup and Mark as Found
WHEN
The system processes a corrector EDI transaction
THEN
The system restores the backup importer data and marks importer as found
Context: No importer data is found in EDI BOL and no backup importer data exists
GIVEN
No importer data is found in EDI BOL and no backup importer data exists
Applied to: Clear Importer Information
WHEN
The system processes the importer information
THEN
The system clears the importer field from customs manifest
R-GCCCCADD-cbl-02196 (+10) File: GCCCCADD.cbl Backup and restore importer data for corrector EDI transactions Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Backup and restore importer data for corrector EDI transactions':
  • Context - a corrector edi transaction is being processed:
    For Importer Data Exists in Input Parameters?:
    When the system checks input parameters for importer data, then if importer name, business number, and business number qualifier are all present, proceed to search existing records, otherwise skip backup processing.
  • Context - importer data exists in input parameters:
    For Search Existing Customs Records:
    When the system searches customs records from sequence 3 to 24 for entity id 'im', then continue searching until an importer record is found or all sequences are exhausted.
  • Context - a search has been performed through customs records:
    For Found Existing Importer Record?:
    When the system evaluates if a record with entity id 'im' was found, then if found, proceed to backup the data, otherwise end the backup process.
  • Context - an existing importer record has been found in the customs database:
    For Backup Original Importer Data:
    When the system backs up the importer data, then store all importer details including name, business number, qualifier, address, city, province, postal code, country, and contact information in backup variables.
  • Context - original importer data needs to be backed up:
    For Store Backup Values: Name, Business Number, Qualifier, Address, Contact Info:
    When the system stores the backup values, then move importer name, business number, qualifier, addresses, city, province, postal code, country, contact code, person name, communication qualifier, and communication number to corresponding backup variables.
  • Context - importer data has been stored in backup variables:
    For Set Backup Found Flag:
    When the backup process completes successfully, then set the temporary importer found flag to true.
  • Context - original importer data has been backed up successfully:
    For Clear Input Importer Parameters:
    When the system clears input parameters, then set importer name, business number, and business number qualifier to spaces in the input structure.
  • Context - a corrector edi transaction has been processed and backup data exists:
    For Corrector EDI Deletes Importer Data?:
    When the system checks if importer data was deleted by the corrector, then if backup data exists and no new importer data was found in edi, restore the original data, otherwise process new importer data.
  • Context - corrector edi has deleted importer data and backup exists:
    For Restore Original Importer Data:
    When the system restores original importer data, then move all backed up values including name, business number, qualifier, address, contact information, and csa indicator back to the active importer record.
  • Context - original importer data needs to be restored:
    For Rebuild Importer Record from Backup:
    When the system rebuilds the importer record, then create a complete importer record with entity id 'im', restore name, business number, qualifier, all address fields, and contact information from backup variables.
  • Context - importer record is being restored from backup:
    For Preserve CSA Indicator from Backup:
    When the system preserves the csa indicator, then set the csa indicator to the value stored in the backup variables.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Importer Data Exists in Input Parameters?
WHEN
The system checks input parameters for importer data
THEN
If importer name, business number, and business number qualifier are all present, proceed to search existing records, otherwise skip backup processing
Context: Importer data exists in input parameters
GIVEN
Importer data exists in input parameters
Applied to: Search Existing Customs Records
WHEN
The system searches customs records from sequence 3 to 24 for entity ID 'IM'
THEN
Continue searching until an importer record is found or all sequences are exhausted
Context: A search has been performed through customs records
GIVEN
A search has been performed through customs records
Applied to: Found Existing Importer Record?
WHEN
The system evaluates if a record with entity ID 'IM' was found
THEN
If found, proceed to backup the data, otherwise end the backup process
Context: An existing importer record has been found in the customs database
GIVEN
An existing importer record has been found in the customs database
Applied to: Backup Original Importer Data
WHEN
The system backs up the importer data
THEN
Store all importer details including name, business number, qualifier, address, city, province, postal code, country, and contact information in backup variables
Context: Original importer data needs to be backed up
GIVEN
Original importer data needs to be backed up
Applied to: Store Backup Values: Name, Business Number, Qualifier, Address, Contact Info
WHEN
The system stores the backup values
THEN
Move importer name, business number, qualifier, addresses, city, province, postal code, country, contact code, person name, communication qualifier, and communication number to corresponding backup variables
Context: Importer data has been stored in backup variables
GIVEN
Importer data has been stored in backup variables
Applied to: Set Backup Found Flag
WHEN
The backup process completes successfully
THEN
Set the temporary importer found flag to true
Context: Original importer data has been backed up successfully
GIVEN
Original importer data has been backed up successfully
Applied to: Clear Input Importer Parameters
WHEN
The system clears input parameters
THEN
Set importer name, business number, and business number qualifier to spaces in the input structure
Context: A corrector EDI transaction has been processed and backup data exists
GIVEN
A corrector EDI transaction has been processed and backup data exists
Applied to: Corrector EDI Deletes Importer Data?
WHEN
The system checks if importer data was deleted by the corrector
THEN
If backup data exists and no new importer data was found in EDI, restore the original data, otherwise process new importer data
Context: Corrector EDI has deleted importer data and backup exists
GIVEN
Corrector EDI has deleted importer data and backup exists
Applied to: Restore Original Importer Data
WHEN
The system restores original importer data
THEN
Move all backed up values including name, business number, qualifier, address, contact information, and CSA indicator back to the active importer record
Context: Original importer data needs to be restored
GIVEN
Original importer data needs to be restored
Applied to: Rebuild Importer Record from Backup
WHEN
The system rebuilds the importer record
THEN
Create a complete importer record with entity ID 'IM', restore name, business number, qualifier, all address fields, and contact information from backup variables
Context: Importer record is being restored from backup
GIVEN
Importer record is being restored from backup
Applied to: Preserve CSA Indicator from Backup
WHEN
The system preserves the CSA indicator
THEN
Set the CSA indicator to the value stored in the backup variables
R-GCCCCADD-cbl-02207 (+20) File: GCCCCADD.cbl Apply sub Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply sub':
  • Context - a cargo manifest is being processed with a manifest-to station name:
    For Is Manifest-To Station IIS-A6?:
    When the system evaluates the manifest-to station name, then if manifest-to station equals 'iis-a6', proceed with iis-a6 specific processing, otherwise proceed with standard rf table lookup.
  • Context - a manifest-to station is 'iis-a6' and destination state code is available:
    For Is Destination NOT US?:
    When the system searches the state-country table for the destination state code, then if the destination country is not 'us', proceed with cm table lookup, otherwise proceed with rf table lookup.
  • Context - manifest-to station is 'iis-a6' and destination is not us:
    For Lookup CM Table with Destination Station:
    When the system calls table lookup with table id 'cm' and destination station number as key, then the system attempts to retrieve cm table data for the destination station.
  • Context - a cm table lookup has been performed with destination station number:
    For CM Table Lookup Successful?:
    When the system evaluates the table lookup return flag, then if return flag equals 'successful', proceed with mc table lookup using cm port data, otherwise clear sub-location code.
  • Context - cm table lookup was successful and returned port manifest information:
    For Lookup MC Table with CM Port:
    When the system calls table lookup with table id 'mc' and cm port manifest data as key, then the system attempts to retrieve mc table data for the port.
  • Context - an mc table lookup has been performed with cm port information:
    For MC Table Lookup Successful?:
    When the system evaluates the table lookup return flag, then if return flag equals 'successful', set sub-location code from mc table data, otherwise clear sub-location code.
  • Context - mc table lookup was successful and returned valid port data:
    For Set Sub-location Code from MC Table:
    When the system processes the mc table segment data, then the sub-location code is set to the mc sub-location code value from the table.
  • Context - either cm table lookup or mc table lookup has failed:
    For Clear Sub-location Code:
    When the system processes the failed lookup result, then the sub-location code is cleared to spaces.
  • Context - consignee chop code and destination station number are available:
    For Lookup RF Table with Consignee CHOP and Station:
    When the system calls table lookup with table id 'rf', consignee chop, and destination station as keys, then the system attempts to retrieve rf table data for bonded customer determination.
  • Context - an rf table lookup has been performed with consignee and station information:
    For RF Table Lookup Successful?:
    When the system evaluates the table lookup return flag, then if return flag equals 'successful', set sub-location code from rf data and mark customer as bonded, otherwise mark customer as not bonded.
  • Context - rf table lookup was successful and returned valid bonded customer data:
    For Set Sub-location Code from RF Table:
    When the system processes the rf table segment data, then the sub-location code is set to rf sub-location code value and customer bonded indicator is set to true.
  • Context - rf table lookup found valid bonded customer data:
    For Set Customer Bonded Indicator ON:
    When the system processes the successful rf lookup result, then the customer bonded indicator is set to true.
  • Context - rf table lookup failed to find bonded customer data:
    For Set Customer Bonded Indicator OFF:
    When the system processes the failed rf lookup result, then the customer bonded indicator is set to false.
  • Context - sub-location code processing has been completed through table lookups:
    For Sub-location Code Present?:
    When the system evaluates the current sub-location code value, then if sub-location code is not spaces, requirements are met, otherwise check additional exemption conditions.
  • Context - sub-location code is spaces and additional exemption checks are needed:
    For CSA Indicator ON?:
    When the system evaluates the csa indicator status, then if csa indicator is on, sub-location requirements are met, otherwise check manifest station equality.
  • Context - sub-location code is spaces and csa indicator is off:
    For Manifest From equals Manifest To AND NOT IIS-A6?:
    When the system compares manifest from station name with manifest to station name, then if both stations are equal and manifest to station is not 'iis-a6', sub-location requirements are met, otherwise check destination country.
  • Context - sub-location code is spaces, csa indicator is off, and manifest stations are not equal or are iis-a6:
    For Destination is US?:
    When the system evaluates the destination country from state-country table lookup, then if destination country is 'us', sub-location requirements are met, otherwise check arrival indicator.
  • Context - sub-location code is spaces, csa indicator is off, manifest stations don't qualify for exemption, and destination is not us:
    For Arrival Indicator is Y?:
    When the system evaluates the arrival indicator value, then if arrival indicator equals 'y', sub-location requirements are met, otherwise set sub-location error flag.
  • Context - either sub-location code is present or valid exemption conditions are met:
    For Sub-location Code Requirements Met:
    When the system completes sub-location validation processing, then sub-location code requirements are considered satisfied and processing continues normally.
  • Context - sub-location code is spaces and no exemption conditions are met:
    For Set Sub-location Error Flag:
    When the system completes all sub-location validation checks, then the sub-location error flag is set to indicate requirement violation.
  • Context - sub-location error flag has been set due to requirement violation:
    For Generate Sub-location Error Message:
    When the system processes the error condition, then an error message for invalid destination station sub-location code is retrieved and added to the message list.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed with a manifest-to station name
GIVEN
A cargo manifest is being processed with a manifest-to station name
Applied to: Is Manifest-To Station IIS-A6?
WHEN
The system evaluates the manifest-to station name
THEN
If manifest-to station equals 'IIS-A6', proceed with IIS-A6 specific processing, otherwise proceed with standard RF table lookup
Context: A manifest-to station is 'IIS-A6' and destination state code is available
GIVEN
A manifest-to station is 'IIS-A6' and destination state code is available
Applied to: Is Destination NOT US?
WHEN
The system searches the state-country table for the destination state code
THEN
If the destination country is not 'US', proceed with CM table lookup, otherwise proceed with RF table lookup
Context: Manifest-to station is 'IIS-A6' and destination is not US
GIVEN
Manifest-to station is 'IIS-A6' and destination is not US
Applied to: Lookup CM Table with Destination Station
WHEN
The system calls table lookup with table ID 'CM' and destination station number as key
THEN
The system attempts to retrieve CM table data for the destination station
Context: A CM table lookup has been performed with destination station number
GIVEN
A CM table lookup has been performed with destination station number
Applied to: CM Table Lookup Successful?
WHEN
The system evaluates the table lookup return flag
THEN
If return flag equals 'SUCCESSFUL', proceed with MC table lookup using CM port data, otherwise clear sub-location code
Context: CM table lookup was successful and returned port manifest information
GIVEN
CM table lookup was successful and returned port manifest information
Applied to: Lookup MC Table with CM Port
WHEN
The system calls table lookup with table ID 'MC' and CM port manifest data as key
THEN
The system attempts to retrieve MC table data for the port
Context: An MC table lookup has been performed with CM port information
GIVEN
An MC table lookup has been performed with CM port information
Applied to: MC Table Lookup Successful?
WHEN
The system evaluates the table lookup return flag
THEN
If return flag equals 'SUCCESSFUL', set sub-location code from MC table data, otherwise clear sub-location code
Context: MC table lookup was successful and returned valid port data
GIVEN
MC table lookup was successful and returned valid port data
Applied to: Set Sub-location Code from MC Table
WHEN
The system processes the MC table segment data
THEN
The sub-location code is set to the MC sub-location code value from the table
Context: Either CM table lookup or MC table lookup has failed
GIVEN
Either CM table lookup or MC table lookup has failed
Applied to: Clear Sub-location Code
WHEN
The system processes the failed lookup result
THEN
The sub-location code is cleared to spaces
Context: Consignee CHOP code and destination station number are available
GIVEN
Consignee CHOP code and destination station number are available
Applied to: Lookup RF Table with Consignee CHOP and Station
WHEN
The system calls table lookup with table ID 'RF', consignee CHOP, and destination station as keys
THEN
The system attempts to retrieve RF table data for bonded customer determination
Context: An RF table lookup has been performed with consignee and station information
GIVEN
An RF table lookup has been performed with consignee and station information
Applied to: RF Table Lookup Successful?
WHEN
The system evaluates the table lookup return flag
THEN
If return flag equals 'SUCCESSFUL', set sub-location code from RF data and mark customer as bonded, otherwise mark customer as not bonded
Context: RF table lookup was successful and returned valid bonded customer data
GIVEN
RF table lookup was successful and returned valid bonded customer data
Applied to: Set Sub-location Code from RF Table
WHEN
The system processes the RF table segment data
THEN
The sub-location code is set to RF sub-location code value and customer bonded indicator is set to TRUE
Context: RF table lookup found valid bonded customer data
GIVEN
RF table lookup found valid bonded customer data
Applied to: Set Customer Bonded Indicator ON
WHEN
The system processes the successful RF lookup result
THEN
The customer bonded indicator is set to TRUE
Context: RF table lookup failed to find bonded customer data
GIVEN
RF table lookup failed to find bonded customer data
Applied to: Set Customer Bonded Indicator OFF
WHEN
The system processes the failed RF lookup result
THEN
The customer bonded indicator is set to FALSE
Context: Sub-location code processing has been completed through table lookups
GIVEN
Sub-location code processing has been completed through table lookups
Applied to: Sub-location Code Present?
WHEN
The system evaluates the current sub-location code value
THEN
If sub-location code is not spaces, requirements are met, otherwise check additional exemption conditions
Context: Sub-location code is spaces and additional exemption checks are needed
GIVEN
Sub-location code is spaces and additional exemption checks are needed
Applied to: CSA Indicator ON?
WHEN
The system evaluates the CSA indicator status
THEN
If CSA indicator is ON, sub-location requirements are met, otherwise check manifest station equality
Context: Sub-location code is spaces and CSA indicator is OFF
GIVEN
Sub-location code is spaces and CSA indicator is OFF
Applied to: Manifest From equals Manifest To AND NOT IIS-A6?
WHEN
The system compares manifest from station name with manifest to station name
THEN
If both stations are equal and manifest to station is not 'IIS-A6', sub-location requirements are met, otherwise check destination country
Context: Sub-location code is spaces, CSA indicator is OFF, and manifest stations are not equal or are IIS-A6
GIVEN
Sub-location code is spaces, CSA indicator is OFF, and manifest stations are not equal or are IIS-A6
Applied to: Destination is US?
WHEN
The system evaluates the destination country from state-country table lookup
THEN
If destination country is 'US', sub-location requirements are met, otherwise check arrival indicator
Context: Sub-location code is spaces, CSA indicator is OFF, manifest stations don't qualify for exemption, and destination is not US
GIVEN
Sub-location code is spaces, CSA indicator is OFF, manifest stations don't qualify for exemption, and destination is not US
Applied to: Arrival Indicator is Y?
WHEN
The system evaluates the arrival indicator value
THEN
If arrival indicator equals 'Y', sub-location requirements are met, otherwise set sub-location error flag
Context: Either sub-location code is present or valid exemption conditions are met
GIVEN
Either sub-location code is present or valid exemption conditions are met
Applied to: Sub-location Code Requirements Met
WHEN
The system completes sub-location validation processing
THEN
Sub-location code requirements are considered satisfied and processing continues normally
Context: Sub-location code is spaces and no exemption conditions are met
GIVEN
Sub-location code is spaces and no exemption conditions are met
Applied to: Set Sub-location Error Flag
WHEN
The system completes all sub-location validation checks
THEN
The sub-location error flag is set to indicate requirement violation
Context: Sub-location error flag has been set due to requirement violation
GIVEN
Sub-location error flag has been set due to requirement violation
Applied to: Generate Sub-location Error Message
WHEN
The system processes the error condition
THEN
An error message for invalid destination station sub-location code is retrieved and added to the message list
R-GCCCCADD-cbl-02228 (+19) File: GCCCCADD.cbl Process haulage rights validation and carrier lookup Merged 20 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process haulage rights validation and carrier lookup':
  • Context - a shipment with an ima code:
    For IMA Code = 'HM'?:
    When the ima code is evaluated, then if ima code equals 'hm' then haulage processing is required, otherwise haulage fields are cleared.
  • Context - a shipment in haulage mode:
    For Haulage Right Carrier exists?:
    When the haulage right carrier field is checked, then if haulage right carrier is spaces then set unknown haulage rights scac, reject haulage status, and unknown bill owner, otherwise lookup carrier code.
  • Context - a valid haulage right carrier code:
    For Lookup Carrier Code in CC Table:
    When cc table lookup is performed, then carrier code information is retrieved from cc table for further processing.
  • Context - a cc table lookup has been performed:
    For Carrier Code Found?:
    When the lookup result is evaluated, then if lookup successful then set haulage rights scac from cc table, otherwise set unknown haulage rights scac, reject haulage status, and unknown bill owner.
  • Context - a haulage mode shipment with carrier information:
    For Called from GCX011 and CCN starts with '6105'?:
    When the calling program and ccn key are evaluated, then if called from gcx011 and ccn key starts with '6105' then check bill-as scac validity, otherwise proceed to ss table processing.
  • Context - a gcx011 call with ccn starting with '6105':
    For Bill-As SCAC is valid?:
    When the bill-as scac is evaluated, then if bill-as scac is not 'unkn', not spaces, not low-values, and not '6105' then update ccn key with bill-as scac, otherwise proceed to ss table processing.
  • Context - a valid bill-as scac for ccn update:
    For Automated Haulage?:
    When the automated haulage flag is checked, then if automated haulage then set ccn key suffix to 'e' and bill owner to '6105', otherwise set ccn key suffix to 'p' and bill owner to bill-as scac.
  • Context - a shipment with ima code not equal to 'hm':
    For Clear Haulage Rights SCAC:
    When haulage processing is performed, then clear haulage rights scac, haulage automated flag, and reject haulage indicator.
  • Context - a shipment requiring ss table lookup:
    For Build SS Table Key with Port Code:
    When ss table key is constructed, then build key with 'c' prefix plus 3-digit canadian customs code from manifest station, and determine scac code for lookup.
  • Context - an ss table lookup key being constructed:
    For Haulage Rights SCAC exists?:
    When the haulage rights scac is evaluated, then if haulage rights scac is spaces then use '6105' as scac code, otherwise use haulage rights scac.
  • Context - a constructed ss table key:
    For Lookup SS Table Entry:
    When ss table lookup is performed, then service schedule information is retrieved for haulage agreement validation.
  • Context - an ss table lookup has been performed:
    For SS Table Entry Found?:
    When the lookup result is evaluated, then if lookup successful then process haulage mode logic, otherwise handle lookup failure based on haulage mode.
  • Context - a successful ss table lookup:
    For Haulage Mode?:
    When the shipment mode is evaluated, then if haulage mode then set automated carrier flag, check haulage agreement, and set haulage bill scac, otherwise set line bill scac.
  • Context - a haulage mode shipment with successful ss table lookup:
    For Set Automated Carrier Flag:
    When automated carrier processing is performed, then set haulage automated flag from ss table automated carrier field.
  • Context - a haulage shipment with automated haulage flag set:
    For Set Bill Owner to '6105':
    When bill owner is determined, then set bill owner to '6105' for automated haulage.
  • Context - a haulage shipment with ss table data:
    For Haulage Agreement = 'Y'?:
    When haulage agreement status is checked, then if haulage agreement equals 'y' then accept haulage, otherwise reject haulage.
    For Set Bill-As SCAC from Haulage Bill Init:
    When bill-as scac is assigned, then set bill-as scac from ss table haulage bill initial field.
  • Context - a non-haulage shipment with ss table data:
    For Set Bill-As SCAC from Line Bill Init:
    When bill-as scac is assigned, then set bill-as scac from ss table line bill initial field.
  • Context - a failed ss table lookup:
    For Haulage Mode?:
    When the shipment mode is evaluated, then if haulage mode then clear haulage automated flag, set reject haulage status, set unknown bill owner and bill-as scac, otherwise set default bill owner and bill-as scac to '6105'.
  • Context - a non-haulage shipment with failed ss table lookup:
    For Set Bill Owner to '6105':
    When bill owner is assigned, then set bill owner to '6105' as default.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA code
GIVEN
A shipment with an IMA code
Applied to: IMA Code = 'HM'?
WHEN
The IMA code is evaluated
THEN
If IMA code equals 'HM' then haulage processing is required, otherwise haulage fields are cleared
Context: A shipment in haulage mode
GIVEN
A shipment in haulage mode
Applied to: Haulage Right Carrier exists?
WHEN
The haulage right carrier field is checked
THEN
If haulage right carrier is spaces then set unknown haulage rights SCAC, reject haulage status, and unknown bill owner, otherwise lookup carrier code
Context: A valid haulage right carrier code
GIVEN
A valid haulage right carrier code
Applied to: Lookup Carrier Code in CC Table
WHEN
CC table lookup is performed
THEN
Carrier code information is retrieved from CC table for further processing
Context: A CC table lookup has been performed
GIVEN
A CC table lookup has been performed
Applied to: Carrier Code Found?
WHEN
The lookup result is evaluated
THEN
If lookup successful then set haulage rights SCAC from CC table, otherwise set unknown haulage rights SCAC, reject haulage status, and unknown bill owner
Context: A haulage mode shipment with carrier information
GIVEN
A haulage mode shipment with carrier information
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The calling program and CCN key are evaluated
THEN
If called from GCX011 and CCN key starts with '6105' then check bill-as SCAC validity, otherwise proceed to SS table processing
Context: A GCX011 call with CCN starting with '6105'
GIVEN
A GCX011 call with CCN starting with '6105'
Applied to: Bill-As SCAC is valid?
WHEN
The bill-as SCAC is evaluated
THEN
If bill-as SCAC is not 'UNKN', not spaces, not low-values, and not '6105' then update CCN key with bill-as SCAC, otherwise proceed to SS table processing
Context: A valid bill-as SCAC for CCN update
GIVEN
A valid bill-as SCAC for CCN update
Applied to: Automated Haulage?
WHEN
The automated haulage flag is checked
THEN
If automated haulage then set CCN key suffix to 'E' and bill owner to '6105', otherwise set CCN key suffix to 'P' and bill owner to bill-as SCAC
Context: A shipment with IMA code not equal to 'HM'
GIVEN
A shipment with IMA code not equal to 'HM'
Applied to: Clear Haulage Rights SCAC
WHEN
Haulage processing is performed
THEN
Clear haulage rights SCAC, haulage automated flag, and reject haulage indicator
Context: A shipment requiring SS table lookup
GIVEN
A shipment requiring SS table lookup
Applied to: Build SS Table Key with Port Code
WHEN
SS table key is constructed
THEN
Build key with 'C' prefix plus 3-digit Canadian customs code from manifest station, and determine SCAC code for lookup
Context: An SS table lookup key being constructed
GIVEN
An SS table lookup key being constructed
Applied to: Haulage Rights SCAC exists?
WHEN
The haulage rights SCAC is evaluated
THEN
If haulage rights SCAC is spaces then use '6105' as SCAC code, otherwise use haulage rights SCAC
Context: A constructed SS table key
GIVEN
A constructed SS table key
Applied to: Lookup SS Table Entry
WHEN
SS table lookup is performed
THEN
Service schedule information is retrieved for haulage agreement validation
Context: An SS table lookup has been performed
GIVEN
An SS table lookup has been performed
Applied to: SS Table Entry Found?
WHEN
The lookup result is evaluated
THEN
If lookup successful then process haulage mode logic, otherwise handle lookup failure based on haulage mode
Context: A successful SS table lookup
GIVEN
A successful SS table lookup
Applied to: Haulage Mode?
WHEN
The shipment mode is evaluated
THEN
If haulage mode then set automated carrier flag, check haulage agreement, and set haulage bill SCAC, otherwise set line bill SCAC
Context: A haulage mode shipment with successful SS table lookup
GIVEN
A haulage mode shipment with successful SS table lookup
Applied to: Set Automated Carrier Flag
WHEN
Automated carrier processing is performed
THEN
Set haulage automated flag from SS table automated carrier field
Context: A haulage shipment with automated haulage flag set
GIVEN
A haulage shipment with automated haulage flag set
Applied to: Set Bill Owner to '6105'
WHEN
Bill owner is determined
THEN
Set bill owner to '6105' for automated haulage
Context: A haulage shipment with SS table data
GIVEN
A haulage shipment with SS table data
Applied to: Haulage Agreement = 'Y'?
WHEN
Haulage agreement status is checked
THEN
If haulage agreement equals 'Y' then accept haulage, otherwise reject haulage
Applied to: Set Bill-As SCAC from Haulage Bill Init
WHEN
Bill-as SCAC is assigned
THEN
Set bill-as SCAC from SS table haulage bill initial field
Context: A non-haulage shipment with SS table data
GIVEN
A non-haulage shipment with SS table data
Applied to: Set Bill-As SCAC from Line Bill Init
WHEN
Bill-as SCAC is assigned
THEN
Set bill-as SCAC from SS table line bill initial field
Context: A failed SS table lookup
GIVEN
A failed SS table lookup
Applied to: Haulage Mode?
WHEN
The shipment mode is evaluated
THEN
If haulage mode then clear haulage automated flag, set reject haulage status, set unknown bill owner and bill-as SCAC, otherwise set default bill owner and bill-as SCAC to '6105'
Context: A non-haulage shipment with failed SS table lookup
GIVEN
A non-haulage shipment with failed SS table lookup
Applied to: Set Bill Owner to '6105'
WHEN
Bill owner is assigned
THEN
Set bill owner to '6105' as default
R-GCCCCADD-cbl-02248 (+17) File: GCCCCADD.cbl Determine automated haulage flags and billing assignments Merged 18 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Determine automated haulage flags and billing assignments':
  • Context - a shipment record with an ima code:
    For Is IMA Code = 'HM'?:
    When the system evaluates the ima code value, then if ima code equals 'hm' then haulage processing is initiated, otherwise haulage flags are cleared.
  • Context - a shipment with ima code 'hm':
    For Haulage Right Carrier Present?:
    When the system checks for haulage right carrier information, then if haulage right carrier is spaces then set unknown haulage defaults, otherwise lookup carrier code.
  • Context - a haulage shipment with missing haulage right carrier:
    For Set Unknown Haulage Rights SCAC:
    When the system processes haulage defaults, then set haulage rights scac to 'unkn', clear automated flag, set bill owner to 'unkn', and set reject haulage status.
  • Context - a valid haulage right carrier code:
    For Lookup Carrier Code in CC Table:
    When the system performs cc table lookup, then retrieve carrier code information for further processing.
  • Context - a cc table lookup operation has been performed:
    For CC Table Lookup Successful?:
    When the system evaluates the lookup results, then if lookup successful then set haulage rights scac from cc table, otherwise set unknown haulage defaults.
  • Context - canadian customs code from manifest station lookup:
    For Build SS Table Key with Port Code:
    When the system builds ss table key, then construct key with 'c' prefix and last 3 digits of canadian customs code.
  • Context - an ss table lookup key and haulage rights scac status:
    For Haulage Rights SCAC Available?:
    When the system determines which scac to use for lookup, then if haulage rights scac is available then use it, otherwise use default '6105' scac.
  • Context - a constructed ss table key with port code and scac:
    For Lookup SS Table Entry:
    When the system performs ss table lookup, then retrieve station/scac data for haulage processing.
  • Context - an ss table lookup operation has been performed for haulage processing:
    For SS Table Lookup Successful?:
    When the system evaluates the lookup results, then if lookup successful then process automated carrier flags and haulage agreement, otherwise set reject haulage defaults.
  • Context - successful ss table lookup with automated carrier flag:
    For Automated Haulage?:
    When the system checks if haulage is automated, then if automated haulage then set bill owner to '6105'.
  • Context - ss table data with haulage agreement indicator:
    For Haulage Agreement = 'Y'?:
    When the system evaluates the haulage agreement flag, then if haulage agreement equals 'y' then set accept haulage status, otherwise set reject haulage status.
  • Context - successful ss table lookup for haulage processing:
    For Set Bill As SCAC from SS Haulage Bill Init:
    When the system sets billing scac, then if haulage processing then use ss haulage bill init, otherwise use ss line bill init.
  • Context - a failed ss table lookup for haulage processing:
    For Set Reject Haulage Status:
    When the system handles the lookup failure, then if haulage processing then set reject status and unknown values, otherwise set default '6105' values.
  • Context - a shipment with ima code not equal to 'hm':
    For Clear Haulage Flags:
    When the system processes non-haulage shipment, then clear haulage rights scac, automated flag, and reject haulage indicator.
  • Context - completed haulage processing with calling program and ccn information:
    For Called from GCX011 and CCN starts with '6105'?:
    When the system evaluates ccn modification eligibility, then if called from gcx011 and ccn starts with '6105' then proceed with bill-as scac validation, otherwise end processing.
  • Context - a bill-as scac code from haulage processing:
    For Bill As SCAC Valid?:
    When the system validates the scac for ccn modification, then if bill-as scac is not 'unkn', not spaces, not low-values, and not '6105' then proceed with ccn modification, otherwise end processing.
  • Context - a valid bill-as scac code for ccn modification:
    For Modify CCN Key with Bill As SCAC:
    When the system modifies the ccn key, then replace first 4 characters of ccn key with bill-as scac code.
  • Context - a modified ccn key with automated haulage status:
    For Automated Haulage?:
    When the system finalizes ccn configuration, then if automated haulage then set ccn type to 'e' and bill owner to '6105', otherwise set ccn type to 'p' and bill owner to bill-as scac.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with an IMA code
GIVEN
A shipment record with an IMA code
Applied to: Is IMA Code = 'HM'?
WHEN
The system evaluates the IMA code value
THEN
If IMA code equals 'HM' then haulage processing is initiated, otherwise haulage flags are cleared
Context: A shipment with IMA code 'HM'
GIVEN
A shipment with IMA code 'HM'
Applied to: Haulage Right Carrier Present?
WHEN
The system checks for haulage right carrier information
THEN
If haulage right carrier is spaces then set unknown haulage defaults, otherwise lookup carrier code
Context: A haulage shipment with missing haulage right carrier
GIVEN
A haulage shipment with missing haulage right carrier
Applied to: Set Unknown Haulage Rights SCAC
WHEN
The system processes haulage defaults
THEN
Set haulage rights SCAC to 'UNKN', clear automated flag, set bill owner to 'UNKN', and set reject haulage status
Context: A valid haulage right carrier code
GIVEN
A valid haulage right carrier code
Applied to: Lookup Carrier Code in CC Table
WHEN
The system performs CC table lookup
THEN
Retrieve carrier code information for further processing
Context: A CC table lookup operation has been performed
GIVEN
A CC table lookup operation has been performed
Applied to: CC Table Lookup Successful?
WHEN
The system evaluates the lookup results
THEN
If lookup successful then set haulage rights SCAC from CC table, otherwise set unknown haulage defaults
Context: Canadian customs code from manifest station lookup
GIVEN
Canadian customs code from manifest station lookup
Applied to: Build SS Table Key with Port Code
WHEN
The system builds SS table key
THEN
Construct key with 'C' prefix and last 3 digits of Canadian customs code
Context: An SS table lookup key and haulage rights SCAC status
GIVEN
An SS table lookup key and haulage rights SCAC status
Applied to: Haulage Rights SCAC Available?
WHEN
The system determines which SCAC to use for lookup
THEN
If haulage rights SCAC is available then use it, otherwise use default '6105' SCAC
Context: A constructed SS table key with port code and SCAC
GIVEN
A constructed SS table key with port code and SCAC
Applied to: Lookup SS Table Entry
WHEN
The system performs SS table lookup
THEN
Retrieve station/SCAC data for haulage processing
Context: An SS table lookup operation has been performed for haulage processing
GIVEN
An SS table lookup operation has been performed for haulage processing
Applied to: SS Table Lookup Successful?
WHEN
The system evaluates the lookup results
THEN
If lookup successful then process automated carrier flags and haulage agreement, otherwise set reject haulage defaults
Context: Successful SS table lookup with automated carrier flag
GIVEN
Successful SS table lookup with automated carrier flag
Applied to: Automated Haulage?
WHEN
The system checks if haulage is automated
THEN
If automated haulage then set bill owner to '6105'
Context: SS table data with haulage agreement indicator
GIVEN
SS table data with haulage agreement indicator
Applied to: Haulage Agreement = 'Y'?
WHEN
The system evaluates the haulage agreement flag
THEN
If haulage agreement equals 'Y' then set accept haulage status, otherwise set reject haulage status
Context: Successful SS table lookup for haulage processing
GIVEN
Successful SS table lookup for haulage processing
Applied to: Set Bill As SCAC from SS Haulage Bill Init
WHEN
The system sets billing SCAC
THEN
If haulage processing then use SS haulage bill init, otherwise use SS line bill init
Context: A failed SS table lookup for haulage processing
GIVEN
A failed SS table lookup for haulage processing
Applied to: Set Reject Haulage Status
WHEN
The system handles the lookup failure
THEN
If haulage processing then set reject status and unknown values, otherwise set default '6105' values
Context: A shipment with IMA code not equal to 'HM'
GIVEN
A shipment with IMA code not equal to 'HM'
Applied to: Clear Haulage Flags
WHEN
The system processes non-haulage shipment
THEN
Clear haulage rights SCAC, automated flag, and reject haulage indicator
Context: Completed haulage processing with calling program and CCN information
GIVEN
Completed haulage processing with calling program and CCN information
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The system evaluates CCN modification eligibility
THEN
If called from GCX011 and CCN starts with '6105' then proceed with bill-as SCAC validation, otherwise end processing
Context: A bill-as SCAC code from haulage processing
GIVEN
A bill-as SCAC code from haulage processing
Applied to: Bill As SCAC Valid?
WHEN
The system validates the SCAC for CCN modification
THEN
If bill-as SCAC is not 'UNKN', not spaces, not low-values, and not '6105' then proceed with CCN modification, otherwise end processing
Context: A valid bill-as SCAC code for CCN modification
GIVEN
A valid bill-as SCAC code for CCN modification
Applied to: Modify CCN Key with Bill As SCAC
WHEN
The system modifies the CCN key
THEN
Replace first 4 characters of CCN key with bill-as SCAC code
Context: A modified CCN key with automated haulage status
GIVEN
A modified CCN key with automated haulage status
Applied to: Automated Haulage?
WHEN
The system finalizes CCN configuration
THEN
If automated haulage then set CCN type to 'E' and bill owner to '6105', otherwise set CCN type to 'P' and bill owner to bill-as SCAC
R-GCCCCADD-cbl-02266 (+20) File: GCCCCADD.cbl Extract and validate importer information from EDI BOL segments Merged 21 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract and validate importer information from EDI BOL segments':
  • Context - the system is ready to process importer information:
    For Initialize Importer Segment:
    When importer processing begins, then the importer segment workspace is cleared and initialized to spaces.
  • Context - an edi bol key exists and importer entity type is defined:
    For Get EDI BOL N1 Segment for Importer:
    When the system searches for importer n1 segment in edi bol data, then the system retrieves the importer entity segment if it exists or sets not found status.
  • Context - importer n1 segment is found in edi bol:
    For Check if Corrector EDI Has Backup Data:
    When the system checks for existing backup importer data, then the system identifies whether backup importer name data is available.
  • Context - backup importer data exists from previous processing:
    For Restore Original Importer Data:
    When the system needs to preserve original importer information, then the system restores all original importer details including name, business number, qualifier, csa indicator, address, city, province, postal code, country, and contact information.
  • Context - importer n1 segment is found and no backup data exists:
    For Extract Importer Entity Information:
    When the system processes the importer entity information, then the system extracts importer name, business number qualifier, business number, and sets the importer found flag.
  • Context - importer information is being processed from edi bol:
    For Set Entity ID to 'IM':
    When the system sets up the importer entity record, then the entity id is set to 'im' to identify this as an importer record.
  • Context - importer n1 segment contains business name information:
    For Extract Importer Name:
    When the system processes importer entity details, then the importer business name is extracted and stored in both customs record and segment fields.
  • Context - importer n1 segment contains business number qualifier:
    For Extract Business Number Qualifier:
    When the system processes importer identification details, then the business number qualifier is extracted and stored in both customs record and segment fields.
  • Context - importer n1 segment contains business number information:
    For Extract Business Number:
    When the system processes importer identification details, then the business number is extracted and stored in both customs record and segment fields.
  • Context - importer entity information has been successfully extracted from edi bol:
    For Set CSA Indicator:
    When the system completes importer entity processing, then the importer found flag is set to indicate successful processing.
  • Context - importer entity has been processed and edi bol key exists:
    For Get EDI BOL N3 Address Segment:
    When the system searches for importer address information, then the system retrieves the n3 address segment if it exists or sets not found status.
  • Context - importer n3 address segment is found in edi bol:
    For Extract Address Line 1 and Extract Address Line 2:
    When the system processes importer address information, then address line 1 is extracted, and if it is blank or low-values then it is set to 'na', and address line 2 is extracted.
  • Context - no importer n3 address segment is found in edi bol:
    For Set Default Address to 'NA':
    When the system needs to populate address information, then address line 1 is set to 'na' and all other address fields are cleared.
  • Context - importer address processing is in progress and edi bol key exists:
    For Get EDI BOL N4 City/State Segment:
    When the system searches for importer city and state information, then the system retrieves the n4 city/state segment if it exists or sets not found status.
  • Context - importer n4 city/state segment is found in edi bol:
    For Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code:
    When the system processes importer geographic information, then city name, state/province code, postal code, and country code are extracted from the segment.
  • Context - no importer n4 city/state segment is found in edi bol:
    For Clear City/State Data:
    When the system needs to handle missing geographic information, then all city, state, postal code, and country fields are cleared.
  • Context - importer geographic information processing is complete:
    For Clear Contact Information:
    When the system finalizes importer segment data, then all contact information fields including contact function code, name, communication qualifier, and communication number are cleared.
  • Context - all importer segment data has been populated:
    For Validate Importer Segment Data:
    When the system validates the importer record, then the system performs validation checks on entity id, name, address, geographic, and contact information fields.
  • Context - importer segment data has been validated successfully:
    For Store Importer in Customs Record:
    When the system stores the importer information, then the importer segment is added to the customs record array for database storage.
  • Context - no importer n1 segment is found in edi bol and backup importer data exists and importer has not been found in segment 55:
    For Clear Importer Data but Keep Backup:
    When the system processes a corrector edi that removes importer information, then the system restores backup importer data and sets appropriate processing flags, but if no backup exists and no segment 55 importer found, then importer fields are cleared.
  • Context - au table importer is found and segment 55 importer is found and business number qualifier is 'bn' or spaces:
    For Set CSA Indicator:
    When the system processes multiple importer data sources, then the csa indicator is turned off to prevent conflicts between importer sources.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process importer information
GIVEN
The system is ready to process importer information
Applied to: Initialize Importer Segment
WHEN
Importer processing begins
THEN
The importer segment workspace is cleared and initialized to spaces
Context: An EDI BOL key exists and importer entity type is defined
GIVEN
An EDI BOL key exists and importer entity type is defined
Applied to: Get EDI BOL N1 Segment for Importer
WHEN
The system searches for importer N1 segment in EDI BOL data
THEN
The system retrieves the importer entity segment if it exists or sets not found status
Context: Importer N1 segment is found in EDI BOL
GIVEN
Importer N1 segment is found in EDI BOL
Applied to: Check if Corrector EDI Has Backup Data
WHEN
The system checks for existing backup importer data
THEN
The system identifies whether backup importer name data is available
Context: Backup importer data exists from previous processing
GIVEN
Backup importer data exists from previous processing
Applied to: Restore Original Importer Data
WHEN
The system needs to preserve original importer information
THEN
The system restores all original importer details including name, business number, qualifier, CSA indicator, address, city, province, postal code, country, and contact information
Context: Importer N1 segment is found and no backup data exists
GIVEN
Importer N1 segment is found and no backup data exists
Applied to: Extract Importer Entity Information
WHEN
The system processes the importer entity information
THEN
The system extracts importer name, business number qualifier, business number, and sets the importer found flag
Context: Importer information is being processed from EDI BOL
GIVEN
Importer information is being processed from EDI BOL
Applied to: Set Entity ID to 'IM'
WHEN
The system sets up the importer entity record
THEN
The entity ID is set to 'IM' to identify this as an importer record
Context: Importer N1 segment contains business name information
GIVEN
Importer N1 segment contains business name information
Applied to: Extract Importer Name
WHEN
The system processes importer entity details
THEN
The importer business name is extracted and stored in both customs record and segment fields
Context: Importer N1 segment contains business number qualifier
GIVEN
Importer N1 segment contains business number qualifier
Applied to: Extract Business Number Qualifier
WHEN
The system processes importer identification details
THEN
The business number qualifier is extracted and stored in both customs record and segment fields
Context: Importer N1 segment contains business number information
GIVEN
Importer N1 segment contains business number information
Applied to: Extract Business Number
WHEN
The system processes importer identification details
THEN
The business number is extracted and stored in both customs record and segment fields
Context: Importer entity information has been successfully extracted from EDI BOL
GIVEN
Importer entity information has been successfully extracted from EDI BOL
Applied to: Set CSA Indicator
WHEN
The system completes importer entity processing
THEN
The importer found flag is set to indicate successful processing
Context: Importer entity has been processed and EDI BOL key exists
GIVEN
Importer entity has been processed and EDI BOL key exists
Applied to: Get EDI BOL N3 Address Segment
WHEN
The system searches for importer address information
THEN
The system retrieves the N3 address segment if it exists or sets not found status
Context: Importer N3 address segment is found in EDI BOL
GIVEN
Importer N3 address segment is found in EDI BOL
Applied to: Extract Address Line 1 and Extract Address Line 2
WHEN
The system processes importer address information
THEN
Address line 1 is extracted, and if it is blank or low-values then it is set to 'NA', and address line 2 is extracted
Context: No importer N3 address segment is found in EDI BOL
GIVEN
No importer N3 address segment is found in EDI BOL
Applied to: Set Default Address to 'NA'
WHEN
The system needs to populate address information
THEN
Address line 1 is set to 'NA' and all other address fields are cleared
Context: Importer address processing is in progress and EDI BOL key exists
GIVEN
Importer address processing is in progress and EDI BOL key exists
Applied to: Get EDI BOL N4 City/State Segment
WHEN
The system searches for importer city and state information
THEN
The system retrieves the N4 city/state segment if it exists or sets not found status
Context: Importer N4 city/state segment is found in EDI BOL
GIVEN
Importer N4 city/state segment is found in EDI BOL
Applied to: Extract City Name, Extract State/Province Code, Extract Postal Code, Extract Country Code
WHEN
The system processes importer geographic information
THEN
City name, state/province code, postal code, and country code are extracted from the segment
Context: No importer N4 city/state segment is found in EDI BOL
GIVEN
No importer N4 city/state segment is found in EDI BOL
Applied to: Clear City/State Data
WHEN
The system needs to handle missing geographic information
THEN
All city, state, postal code, and country fields are cleared
Context: Importer geographic information processing is complete
GIVEN
Importer geographic information processing is complete
Applied to: Clear Contact Information
WHEN
The system finalizes importer segment data
THEN
All contact information fields including contact function code, name, communication qualifier, and communication number are cleared
Context: All importer segment data has been populated
GIVEN
All importer segment data has been populated
Applied to: Validate Importer Segment Data
WHEN
The system validates the importer record
THEN
The system performs validation checks on entity ID, name, address, geographic, and contact information fields
Context: Importer segment data has been validated successfully
GIVEN
Importer segment data has been validated successfully
Applied to: Store Importer in Customs Record
WHEN
The system stores the importer information
THEN
The importer segment is added to the customs record array for database storage
Context: No importer N1 segment is found in EDI BOL and backup importer data exists and importer has not been found in segment 55
GIVEN
No importer N1 segment is found in EDI BOL and backup importer data exists and importer has not been found in segment 55
Applied to: Clear Importer Data but Keep Backup
WHEN
The system processes a corrector EDI that removes importer information
THEN
The system restores backup importer data and sets appropriate processing flags, but if no backup exists and no segment 55 importer found, then importer fields are cleared
Context: AU table importer is found and segment 55 importer is found and business number qualifier is 'BN' or spaces
GIVEN
AU table importer is found and segment 55 importer is found and business number qualifier is 'BN' or spaces
Applied to: Set CSA Indicator
WHEN
The system processes multiple importer data sources
THEN
The CSA indicator is turned off to prevent conflicts between importer sources
R-GCCCCADD-cbl-02287 (+11) File: GCCCCADD.cbl Handle corrector EDI importer data backup and restoration Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle corrector EDI importer data backup and restoration':
  • Context - corrector edi processing is initiated and existing importer data is present in temporary storage (ws-temp-im-name > spaces):
    For Check if Corrector EDI with Existing Importer Data:
    When the system checks for existing importer data backup requirement, then the system should backup all original importer data including chop code, name, qualifiers, business number, csa indicator, address information, city/state/postal data, and contact details to temporary storage variables.
  • Context - importer data backup process is active and temporary importer chop code exists:
    For Store Importer CHOP Code:
    When the system processes the chop code backup step, then the system should move the temporary importer chop code (ws-temp-im-chop) to the customs record chop code field (gccs-sc301-chop-cde).
  • Context - importer data restoration is in progress and temporary importer name exists:
    For Store Importer Name:
    When the system processes the importer name backup step, then the system should set entity id to 'im', move temporary importer name to both customs importer field and n102 name field, and set the entity id validation field.
  • Context - business qualifier backup is required and temporary qualifier data exists:
    For Store Business Number Qualifier:
    When the system processes business qualifier restoration, then the system should move temporary business number qualifier (ws-temp-im-qual) to both customs business number qualifier field (gccc-business-nbr-qual) and n1 segment qualifier field (gccs-n103-id-cde-qual).
  • Context - business number backup is required and temporary business number exists:
    For Store Business Number:
    When the system processes business number restoration, then the system should move temporary business number (ws-temp-im-cde) to both customs business number field (gccc-business-nbr) and n1 segment id code field (gccs-n104-id-cde).
  • Context - csa indicator backup is required and temporary csa indicator exists:
    For Store CSA Indicator:
    When the system processes csa indicator restoration, then the system should move temporary csa indicator (ws-temp-csa-ind) to the customs csa indicator field (gccc-csa-ind).
  • Context - address backup is required and temporary address data exists:
    For Store Address Information:
    When the system processes address information restoration, then the system should move temporary address line 1 (ws-temp-im-adr1) to n301 address info field and temporary address line 2 (ws-temp-im-adr2) to n302 address info field.
  • Context - geographic data backup is required and temporary location data exists:
    For Store City/State/Postal Data:
    When the system processes city/state/postal restoration, then the system should move temporary city (ws-temp-im-city) to n401 city field, temporary province (ws-temp-im-prov) to n402 state field, temporary postal code (ws-temp-im-postal) to n403 postal field, and temporary country (ws-temp-im-ctry) to n404 country field.
  • Context - contact information backup is required and temporary contact data exists:
    For Store Contact Information:
    When the system processes contact information restoration, then the system should move temporary contact function code (ws-temp-im-cont-cde) to per01 contact function field, temporary person name (ws-temp-im-per-name) to per02 name field, temporary communication qualifier (ws-temp-im-com-qual) to per03 communication qualifier field, and temporary communication number (ws-temp-im-com-num) to per04 communication number field.
  • Context - importer data has been successfully restored from backup storage:
    For Set Importer Found Flag:
    When the backup restoration process completes, then the system should set the importer found flag (ws-s55-imp-found) to true to indicate successful importer data processing.
  • Context - edi importer processing is required and no existing importer data backup is needed:
    For Process New EDI Importer Data:
    When the system determines no backup restoration is required, then the system should process the new edi importer data directly and continue with normal processing flow.
  • Context - edi importer processing has failed or resulted in deletion and no backup data is available for restoration and importer not found flag is set:
    For Continue Processing:
    When the system processes the failure condition, then the system should clear the customs importer field (gccc-importer) and entity id code field (gccs-n101-entity-id-cde) to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: Corrector EDI processing is initiated and existing importer data is present in temporary storage (WS-TEMP-IM-NAME > SPACES)
GIVEN
Corrector EDI processing is initiated and existing importer data is present in temporary storage (WS-TEMP-IM-NAME > SPACES)
Applied to: Check if Corrector EDI with Existing Importer Data
WHEN
The system checks for existing importer data backup requirement
THEN
The system should backup all original importer data including CHOP code, name, qualifiers, business number, CSA indicator, address information, city/state/postal data, and contact details to temporary storage variables
Context: Importer data backup process is active and temporary importer CHOP code exists
GIVEN
Importer data backup process is active and temporary importer CHOP code exists
Applied to: Store Importer CHOP Code
WHEN
The system processes the CHOP code backup step
THEN
The system should move the temporary importer CHOP code (WS-TEMP-IM-CHOP) to the customs record CHOP code field (GCCS-SC301-CHOP-CDE)
Context: Importer data restoration is in progress and temporary importer name exists
GIVEN
Importer data restoration is in progress and temporary importer name exists
Applied to: Store Importer Name
WHEN
The system processes the importer name backup step
THEN
The system should set entity ID to 'IM', move temporary importer name to both customs importer field and N102 name field, and set the entity ID validation field
Context: Business qualifier backup is required and temporary qualifier data exists
GIVEN
Business qualifier backup is required and temporary qualifier data exists
Applied to: Store Business Number Qualifier
WHEN
The system processes business qualifier restoration
THEN
The system should move temporary business number qualifier (WS-TEMP-IM-QUAL) to both customs business number qualifier field (GCCC-BUSINESS-NBR-QUAL) and N1 segment qualifier field (GCCS-N103-ID-CDE-QUAL)
Context: Business number backup is required and temporary business number exists
GIVEN
Business number backup is required and temporary business number exists
Applied to: Store Business Number
WHEN
The system processes business number restoration
THEN
The system should move temporary business number (WS-TEMP-IM-CDE) to both customs business number field (GCCC-BUSINESS-NBR) and N1 segment ID code field (GCCS-N104-ID-CDE)
Context: CSA indicator backup is required and temporary CSA indicator exists
GIVEN
CSA indicator backup is required and temporary CSA indicator exists
Applied to: Store CSA Indicator
WHEN
The system processes CSA indicator restoration
THEN
The system should move temporary CSA indicator (WS-TEMP-CSA-IND) to the customs CSA indicator field (GCCC-CSA-IND)
Context: Address backup is required and temporary address data exists
GIVEN
Address backup is required and temporary address data exists
Applied to: Store Address Information
WHEN
The system processes address information restoration
THEN
The system should move temporary address line 1 (WS-TEMP-IM-ADR1) to N301 address info field and temporary address line 2 (WS-TEMP-IM-ADR2) to N302 address info field
Context: Geographic data backup is required and temporary location data exists
GIVEN
Geographic data backup is required and temporary location data exists
Applied to: Store City/State/Postal Data
WHEN
The system processes city/state/postal restoration
THEN
The system should move temporary city (WS-TEMP-IM-CITY) to N401 city field, temporary province (WS-TEMP-IM-PROV) to N402 state field, temporary postal code (WS-TEMP-IM-POSTAL) to N403 postal field, and temporary country (WS-TEMP-IM-CTRY) to N404 country field
Context: Contact information backup is required and temporary contact data exists
GIVEN
Contact information backup is required and temporary contact data exists
Applied to: Store Contact Information
WHEN
The system processes contact information restoration
THEN
The system should move temporary contact function code (WS-TEMP-IM-CONT-CDE) to PER01 contact function field, temporary person name (WS-TEMP-IM-PER-NAME) to PER02 name field, temporary communication qualifier (WS-TEMP-IM-COM-QUAL) to PER03 communication qualifier field, and temporary communication number (WS-TEMP-IM-COM-NUM) to PER04 communication number field
Context: Importer data has been successfully restored from backup storage
GIVEN
Importer data has been successfully restored from backup storage
Applied to: Set Importer Found Flag
WHEN
The backup restoration process completes
THEN
The system should set the importer found flag (WS-S55-IMP-FOUND) to TRUE to indicate successful importer data processing
Context: EDI importer processing is required and no existing importer data backup is needed
GIVEN
EDI importer processing is required and no existing importer data backup is needed
Applied to: Process New EDI Importer Data
WHEN
The system determines no backup restoration is required
THEN
The system should process the new EDI importer data directly and continue with normal processing flow
Context: EDI importer processing has failed or resulted in deletion and no backup data is available for restoration and importer not found flag is set
GIVEN
EDI importer processing has failed or resulted in deletion and no backup data is available for restoration and importer not found flag is set
Applied to: Continue Processing
WHEN
The system processes the failure condition
THEN
The system should clear the customs importer field (GCCC-IMPORTER) and entity ID code field (GCCS-N101-ENTITY-ID-CDE) to spaces
R-GCCCCADD-cbl-02299 (+11) File: GCCCCADD.cbl Validate manifest port configuration and set default IIS Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate manifest port configuration and set default IIS':
  • Context - a shipment is being processed with either action code iis-a6 or multi-manifest indicator set to 'y':
    For Set Manifest From Port to 'IIS-A6':
    When the manifest from port field is empty or spaces, then the system sets the manifest from port to 'iis-a6'.
    For Set Manifest To Port to 'IIS-A6':
    When the manifest to port field is empty or spaces, then the system sets the manifest to port to 'iis-a6'.
  • Context - a manifest from port has been determined for the shipment:
    For Lookup Manifest From Port in MC Table:
    When the system performs a lookup in the mc table using the manifest from port as the key, then the system retrieves the corresponding mc table record if it exists.
  • Context - the mc table lookup for manifest from port was successful:
    For Generate Invalid Customs Code Error:
    When the canadian customs code in the retrieved record equals '00000', then the system generates an error message for invalid canadian customs code and uses the port name in the error.
  • Context - a manifest from port has been specified for the shipment:
    For Generate Invalid Manifest Port Error:
    When the mc table lookup fails to find a matching record, then the system generates an error message for invalid manifest port and uses the port name in the error.
  • Context - the mc table lookup for manifest from port was successful and the canadian customs code is valid (not '00000'):
    For Set Valid Customs and Exit Codes:
    When the system processes the mc table record, then the system sets the manifest from station code to the canadian customs code and sets the us port of exit code from the mc record.
  • Context - a manifest to port has been determined for the shipment:
    For Lookup Manifest To Port in MC Table:
    When the system performs a lookup in the mc table using the manifest to port as the key, then the system retrieves the corresponding mc table record if it exists.
  • Context - the mc table lookup for manifest to port was successful:
    For Generate Invalid Customs Code Error:
    When the canadian customs code in the retrieved record equals '00000', then the system sets error flag 2 and saves the port name for error reporting.
  • Context - a manifest to port has been specified for the shipment:
    For Generate Invalid Manifest Port Error:
    When the mc table lookup fails to find a matching record, then the system sets error flag 3 and saves the port name for error reporting.
  • Context - the mc table lookup for manifest to port was successful and the canadian customs code is valid:
    For Set Valid Customs Code:
    When the system processes the mc table record, then the system sets the manifest to station code, destination station number, and batch print call letters from the mc record.
  • Context - the shipment has ccn type equal to '9':
    For Override Both Ports to 'IIS-A6':
    When the us exit code is not '00000' or the manifest from station is not 'iis-a6' or the manifest to station is not 'iis-a6' or the manifest to and from stations are different, then the system overrides both manifest from station and manifest to station to 'iis-a6'.
  • Context - a shipment is being processed for manifest creation:
    For Keep Existing Manifest To Port:
    When the manifest to port field is empty or spaces, then the system sets error flag 1 to indicate missing manifest to port.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment is being processed with either action code IIS-A6 or multi-manifest indicator set to 'Y'
GIVEN
A shipment is being processed with either action code IIS-A6 or multi-manifest indicator set to 'Y'
Applied to: Set Manifest From Port to 'IIS-A6'
WHEN
The manifest from port field is empty or spaces
THEN
The system sets the manifest from port to 'IIS-A6'
Applied to: Set Manifest To Port to 'IIS-A6'
WHEN
The manifest to port field is empty or spaces
THEN
The system sets the manifest to port to 'IIS-A6'
Context: A manifest from port has been determined for the shipment
GIVEN
A manifest from port has been determined for the shipment
Applied to: Lookup Manifest From Port in MC Table
WHEN
The system performs a lookup in the MC table using the manifest from port as the key
THEN
The system retrieves the corresponding MC table record if it exists
Context: The MC table lookup for manifest from port was successful
GIVEN
The MC table lookup for manifest from port was successful
Applied to: Generate Invalid Customs Code Error
WHEN
The Canadian customs code in the retrieved record equals '00000'
THEN
The system generates an error message for invalid Canadian customs code and uses the port name in the error
Context: A manifest from port has been specified for the shipment
GIVEN
A manifest from port has been specified for the shipment
Applied to: Generate Invalid Manifest Port Error
WHEN
The MC table lookup fails to find a matching record
THEN
The system generates an error message for invalid manifest port and uses the port name in the error
Context: The MC table lookup for manifest from port was successful and the Canadian customs code is valid (not '00000')
GIVEN
The MC table lookup for manifest from port was successful and the Canadian customs code is valid (not '00000')
Applied to: Set Valid Customs and Exit Codes
WHEN
The system processes the MC table record
THEN
The system sets the manifest from station code to the Canadian customs code and sets the US port of exit code from the MC record
Context: A manifest to port has been determined for the shipment
GIVEN
A manifest to port has been determined for the shipment
Applied to: Lookup Manifest To Port in MC Table
WHEN
The system performs a lookup in the MC table using the manifest to port as the key
THEN
The system retrieves the corresponding MC table record if it exists
Context: The MC table lookup for manifest to port was successful
GIVEN
The MC table lookup for manifest to port was successful
Applied to: Generate Invalid Customs Code Error
WHEN
The Canadian customs code in the retrieved record equals '00000'
THEN
The system sets error flag 2 and saves the port name for error reporting
Context: A manifest to port has been specified for the shipment
GIVEN
A manifest to port has been specified for the shipment
Applied to: Generate Invalid Manifest Port Error
WHEN
The MC table lookup fails to find a matching record
THEN
The system sets error flag 3 and saves the port name for error reporting
Context: The MC table lookup for manifest to port was successful and the Canadian customs code is valid
GIVEN
The MC table lookup for manifest to port was successful and the Canadian customs code is valid
Applied to: Set Valid Customs Code
WHEN
The system processes the MC table record
THEN
The system sets the manifest to station code, destination station number, and batch print call letters from the MC record
Context: The shipment has CCN type equal to '9'
GIVEN
The shipment has CCN type equal to '9'
Applied to: Override Both Ports to 'IIS-A6'
WHEN
The US exit code is not '00000' OR the manifest from station is not 'IIS-A6' OR the manifest to station is not 'IIS-A6' OR the manifest to and from stations are different
THEN
The system overrides both manifest from station and manifest to station to 'IIS-A6'
Context: A shipment is being processed for manifest creation
GIVEN
A shipment is being processed for manifest creation
Applied to: Keep Existing Manifest To Port
WHEN
The manifest to port field is empty or spaces
THEN
The system sets error flag 1 to indicate missing manifest to port
R-GCCCCADD-cbl-02311 (+7) File: GCCCCADD.cbl Process manifest Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process manifest':
  • Context - a shipment record with manifest-to port field:
    For Manifest-To Port from SHIPROOT Empty?:
    When the manifest-to port field is empty or spaces, then set error flag 1 to indicate missing manifest-to port.
  • Context - a manifest-to port name from shipment data:
    For Lookup Manifest-To Port in MC Table:
    When looking up the port in the mc manifest codes table, then attempt to retrieve port configuration including customs codes and station information.
  • Context - a manifest-to port lookup attempt in mc table:
    For MC Table Lookup Successful?:
    When the lookup operation completes, then if port is found, proceed with data validation, otherwise set error flag 3 and save port name for error reporting.
  • Context - a manifest port record retrieved from mc table:
    For Canadian Customs Code = '00000'?:
    When the canadian customs code equals '00000', then clear the mc table data, set error flag 2, and save port name for error message as the customs code is invalid.
  • Context - valid mc table data for manifest-to port with non-zero canadian customs code:
    For Set Manifest-To Station Code:
    When processing manifest station information, then set manifest-to station code from canadian customs code, set station number, and set call letters for batch printing.
  • Context - error flag 1 is set indicating missing manifest-to port:
    For Generate 'Invalid Manifest Upon' Error Message:
    When processing manifest-to port validation errors, then retrieve and generate 'invalid manifest upon' error message.
  • Context - error flag 2 is set indicating invalid canadian customs code and saved port name:
    For Generate 'Invalid Canadian Customs Code' Error Message:
    When processing manifest-to port validation errors, then use saved port name and retrieve 'invalid canadian customs code' error message.
  • Context - error flag 3 is set indicating port not found in mc table and saved port name:
    For Generate 'Invalid Manifest Port MC' Error Message:
    When processing manifest-to port validation errors, then use saved port name and retrieve 'invalid manifest port mc' error message.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record with manifest-to port field
GIVEN
A shipment record with manifest-to port field
Applied to: Manifest-To Port from SHIPROOT Empty?
WHEN
The manifest-to port field is empty or spaces
THEN
Set error flag 1 to indicate missing manifest-to port
Context: A manifest-to port name from shipment data
GIVEN
A manifest-to port name from shipment data
Applied to: Lookup Manifest-To Port in MC Table
WHEN
Looking up the port in the MC manifest codes table
THEN
Attempt to retrieve port configuration including customs codes and station information
Context: A manifest-to port lookup attempt in MC table
GIVEN
A manifest-to port lookup attempt in MC table
Applied to: MC Table Lookup Successful?
WHEN
The lookup operation completes
THEN
If port is found, proceed with data validation, otherwise set error flag 3 and save port name for error reporting
Context: A manifest port record retrieved from MC table
GIVEN
A manifest port record retrieved from MC table
Applied to: Canadian Customs Code = '00000'?
WHEN
The Canadian customs code equals '00000'
THEN
Clear the MC table data, set error flag 2, and save port name for error message as the customs code is invalid
Context: Valid MC table data for manifest-to port with non-zero Canadian customs code
GIVEN
Valid MC table data for manifest-to port with non-zero Canadian customs code
Applied to: Set Manifest-To Station Code
WHEN
Processing manifest station information
THEN
Set manifest-to station code from Canadian customs code, set station number, and set call letters for batch printing
Context: Error flag 1 is set indicating missing manifest-to port
GIVEN
Error flag 1 is set indicating missing manifest-to port
Applied to: Generate 'Invalid Manifest Upon' Error Message
WHEN
Processing manifest-to port validation errors
THEN
Retrieve and generate 'Invalid Manifest Upon' error message
Context: Error flag 2 is set indicating invalid Canadian customs code and saved port name
GIVEN
Error flag 2 is set indicating invalid Canadian customs code and saved port name
Applied to: Generate 'Invalid Canadian Customs Code' Error Message
WHEN
Processing manifest-to port validation errors
THEN
Use saved port name and retrieve 'Invalid Canadian Customs Code' error message
Context: Error flag 3 is set indicating port not found in MC table and saved port name
GIVEN
Error flag 3 is set indicating port not found in MC table and saved port name
Applied to: Generate 'Invalid Manifest Port MC' Error Message
WHEN
Processing manifest-to port validation errors
THEN
Use saved port name and retrieve 'Invalid Manifest Port MC' error message
R-GCCCCADD-cbl-02319 (+19) File: GCCCCADD.cbl Execute MC table lookup with Canadian customs code validation and error generation Merged 20 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute MC table lookup with Canadian customs code validation and error generation':
  • Context - a manifest port lookup is required:
    For Initialize Table Access Parameters:
    When the system prepares to access the mc table, then all table access parameters are cleared and initialized to spaces.
  • Context - a table lookup is being prepared:
    For Set Table ID to 'MC':
    When the system needs to identify which table to access, then the table id is set to 'mc' for manifest code table.
  • Context - a manifest from port value exists in the shipment data:
    For Set Manifest From Port as Search Key:
    When the system prepares the table lookup search criteria, then the manifest from port value is set as the search key.
  • Context - table lookup parameters are properly initialized:
    For Call GCCTBIO for Table Lookup:
    When the system executes the table lookup, then the gcctbio service is called with the prepared parameters.
  • Context - a table lookup has been executed:
    For Lookup Successful?:
    When the system checks the lookup result, then the lookup is considered successful if the return flag indicates success.
  • Context - the mc table lookup was successful:
    For Move Table Data to GCSTBRTMC:
    When valid table data is returned, then the table segment data is moved to the mc table structure.
  • Context - valid mc table data has been retrieved:
    For Extract Canadian Customs Code:
    When the system processes the manifest code information, then the canadian customs code is extracted from the table data.
  • Context - a canadian customs code has been extracted from mc table data:
    For Canadian Customs Code = '00000'?:
    When the system validates the customs code, then the code is considered invalid if it equals '00000'.
  • Context - the canadian customs code equals '00000':
    For Clear Table Data:
    When the system detects an invalid customs code, then the mc table data is cleared to spaces.
  • Context - an invalid canadian customs code has been detected:
    For Set Port Name in Error Message:
    When the system prepares an error message, then the manifest port name is set in the message number field.
  • Context - an invalid canadian customs code error needs to be reported:
    For Set Error Number INV-MFST-PORT-CA-CUSTOMS:
    When the system sets the error identification, then the error number is set to inv-mfst-port-ca-customs.
  • Context - an error number for invalid canadian customs code is set:
    For Retrieve Error Message Text:
    When the system needs the error message text, then the error message text is retrieved from the message table.
  • Context - an invalid canadian customs code error message has been retrieved:
    For Add Error Message to Message Array:
    When the system processes the error, then the error message is added to the message array for reporting.
  • Context - the mc table lookup was not successful:
    For Clear Table Data for Failed Lookup:
    When the system handles the lookup failure, then the mc table data is cleared to spaces.
  • Context - an mc table lookup has failed:
    For Set Port Name in Error Message:
    When the system prepares an error message, then the manifest port name is set in the message number field.
  • Context - an mc table lookup failure error needs to be reported:
    For Set Error Number INV-MFST-PORT-MC:
    When the system sets the error identification, then the error number is set to inv-mfst-port-mc.
  • Context - an error number for mc table lookup failure is set:
    For Retrieve Error Message Text:
    When the system needs the error message text, then the error message text is retrieved from the message table.
  • Context - an mc table lookup failure error message has been retrieved:
    For Add Error Message to Message Array:
    When the system processes the error, then the error message is added to the message array for reporting.
  • Context - a valid canadian customs code has been retrieved from mc table:
    For Move Canadian Customs Code to Manifest Station Code:
    When the system processes the valid customs code, then the canadian customs code is moved to the manifest from station code field.
  • Context - valid mc table data with us port exit code exists:
    For Move US Port Exit Code:
    When the system processes the manifest code information, then the us port exit code is moved to the appropriate field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest port lookup is required
GIVEN
A manifest port lookup is required
Applied to: Initialize Table Access Parameters
WHEN
The system prepares to access the MC table
THEN
All table access parameters are cleared and initialized to spaces
Context: A table lookup is being prepared
GIVEN
A table lookup is being prepared
Applied to: Set Table ID to 'MC'
WHEN
The system needs to identify which table to access
THEN
The table ID is set to 'MC' for manifest code table
Context: A manifest from port value exists in the shipment data
GIVEN
A manifest from port value exists in the shipment data
Applied to: Set Manifest From Port as Search Key
WHEN
The system prepares the table lookup search criteria
THEN
The manifest from port value is set as the search key
Context: Table lookup parameters are properly initialized
GIVEN
Table lookup parameters are properly initialized
Applied to: Call GCCTBIO for Table Lookup
WHEN
The system executes the table lookup
THEN
The GCCTBIO service is called with the prepared parameters
Context: A table lookup has been executed
GIVEN
A table lookup has been executed
Applied to: Lookup Successful?
WHEN
The system checks the lookup result
THEN
The lookup is considered successful if the return flag indicates success
Context: The MC table lookup was successful
GIVEN
The MC table lookup was successful
Applied to: Move Table Data to GCSTBRTMC
WHEN
Valid table data is returned
THEN
The table segment data is moved to the MC table structure
Context: Valid MC table data has been retrieved
GIVEN
Valid MC table data has been retrieved
Applied to: Extract Canadian Customs Code
WHEN
The system processes the manifest code information
THEN
The Canadian customs code is extracted from the table data
Context: A Canadian customs code has been extracted from MC table data
GIVEN
A Canadian customs code has been extracted from MC table data
Applied to: Canadian Customs Code = '00000'?
WHEN
The system validates the customs code
THEN
The code is considered invalid if it equals '00000'
Context: The Canadian customs code equals '00000'
GIVEN
The Canadian customs code equals '00000'
Applied to: Clear Table Data
WHEN
The system detects an invalid customs code
THEN
The MC table data is cleared to spaces
Context: An invalid Canadian customs code has been detected
GIVEN
An invalid Canadian customs code has been detected
Applied to: Set Port Name in Error Message
WHEN
The system prepares an error message
THEN
The manifest port name is set in the message number field
Context: An invalid Canadian customs code error needs to be reported
GIVEN
An invalid Canadian customs code error needs to be reported
Applied to: Set Error Number INV-MFST-PORT-CA-CUSTOMS
WHEN
The system sets the error identification
THEN
The error number is set to INV-MFST-PORT-CA-CUSTOMS
Context: An error number for invalid Canadian customs code is set
GIVEN
An error number for invalid Canadian customs code is set
Applied to: Retrieve Error Message Text
WHEN
The system needs the error message text
THEN
The error message text is retrieved from the message table
Context: An invalid Canadian customs code error message has been retrieved
GIVEN
An invalid Canadian customs code error message has been retrieved
Applied to: Add Error Message to Message Array
WHEN
The system processes the error
THEN
The error message is added to the message array for reporting
Context: The MC table lookup was not successful
GIVEN
The MC table lookup was not successful
Applied to: Clear Table Data for Failed Lookup
WHEN
The system handles the lookup failure
THEN
The MC table data is cleared to spaces
Context: An MC table lookup has failed
GIVEN
An MC table lookup has failed
Applied to: Set Port Name in Error Message
WHEN
The system prepares an error message
THEN
The manifest port name is set in the message number field
Context: An MC table lookup failure error needs to be reported
GIVEN
An MC table lookup failure error needs to be reported
Applied to: Set Error Number INV-MFST-PORT-MC
WHEN
The system sets the error identification
THEN
The error number is set to INV-MFST-PORT-MC
Context: An error number for MC table lookup failure is set
GIVEN
An error number for MC table lookup failure is set
Applied to: Retrieve Error Message Text
WHEN
The system needs the error message text
THEN
The error message text is retrieved from the message table
Context: An MC table lookup failure error message has been retrieved
GIVEN
An MC table lookup failure error message has been retrieved
Applied to: Add Error Message to Message Array
WHEN
The system processes the error
THEN
The error message is added to the message array for reporting
Context: A valid Canadian customs code has been retrieved from MC table
GIVEN
A valid Canadian customs code has been retrieved from MC table
Applied to: Move Canadian Customs Code to Manifest Station Code
WHEN
The system processes the valid customs code
THEN
The Canadian customs code is moved to the manifest from station code field
Context: Valid MC table data with US port exit code exists
GIVEN
Valid MC table data with US port exit code exists
Applied to: Move US Port Exit Code
WHEN
The system processes the manifest code information
THEN
The US port exit code is moved to the appropriate field
R-GCCCCADD-cbl-02339 (+9) File: GCCCCADD.cbl Perform cascaded CM and MC table lookups for sub Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Perform cascaded CM and MC table lookups for sub':
  • Context - a cargo manifest is being processed:
    For Is Manifest-To Station = 'IIS-A6'?:
    When the manifest-to station name equals 'iis-a6', then the system should proceed to check destination country for sub-location code determination.
  • Context - the manifest-to station is 'iis-a6':
    For Is Destination Not US?:
    When the destination province/state code is checked against the state-country lookup table and the destination country is not 'us', then the system should proceed to lookup the destination station in the cm table.
  • Context - the manifest-to station is 'iis-a6' and destination is not us:
    For Lookup CM Table with Destination Station Number:
    When the system looks up the destination station number in the cm table, then the system should retrieve the port manifest upon value if the lookup is successful.
  • Context - a cm table lookup has been performed with destination station number:
    For CM Table Lookup Successful?:
    When the table lookup function returns a successful status, then the system should extract the port manifest upon value from the cm table result.
  • Context - the cm table lookup was successful:
    For Get Port Manifest Upon from CM Table:
    When the system processes the cm table result, then the port manifest upon value should be extracted and used for subsequent mc table lookup.
  • Context - a port manifest upon value has been obtained from cm table lookup:
    For Lookup MC Table with Port Manifest Upon:
    When the system looks up this port manifest upon value in the mc table, then the system should attempt to retrieve the corresponding sub-location code.
  • Context - an mc table lookup has been performed with port manifest upon value:
    For MC Table Lookup Successful?:
    When the table lookup function returns a successful status, then the system should extract the sub-location code from the mc table result.
  • Context - the mc table lookup was successful:
    For Set Sub-location Code from MC Table:
    When the system processes the mc table result, then the sub-location code should be assigned from the mc table sub-location code field.
  • Context - an mc table lookup has been attempted:
    For Set Sub-location Code to Spaces:
    When the mc table lookup fails to return valid data, then the sub-location code should be set to spaces.
  • Context - a cm table lookup has been attempted:
    For Set Sub-location Code to Spaces:
    When the cm table lookup fails to return valid data, then the sub-location code should be set to spaces without proceeding to mc table lookup.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed
GIVEN
A cargo manifest is being processed
Applied to: Is Manifest-To Station = 'IIS-A6'?
WHEN
The manifest-to station name equals 'IIS-A6'
THEN
The system should proceed to check destination country for sub-location code determination
Context: The manifest-to station is 'IIS-A6'
GIVEN
The manifest-to station is 'IIS-A6'
Applied to: Is Destination Not US?
WHEN
The destination province/state code is checked against the state-country lookup table and the destination country is not 'US'
THEN
The system should proceed to lookup the destination station in the CM table
Context: The manifest-to station is 'IIS-A6' and destination is not US
GIVEN
The manifest-to station is 'IIS-A6' and destination is not US
Applied to: Lookup CM Table with Destination Station Number
WHEN
The system looks up the destination station number in the CM table
THEN
The system should retrieve the port manifest upon value if the lookup is successful
Context: A CM table lookup has been performed with destination station number
GIVEN
A CM table lookup has been performed with destination station number
Applied to: CM Table Lookup Successful?
WHEN
The table lookup function returns a successful status
THEN
The system should extract the port manifest upon value from the CM table result
Context: The CM table lookup was successful
GIVEN
The CM table lookup was successful
Applied to: Get Port Manifest Upon from CM Table
WHEN
The system processes the CM table result
THEN
The port manifest upon value should be extracted and used for subsequent MC table lookup
Context: A port manifest upon value has been obtained from CM table lookup
GIVEN
A port manifest upon value has been obtained from CM table lookup
Applied to: Lookup MC Table with Port Manifest Upon
WHEN
The system looks up this port manifest upon value in the MC table
THEN
The system should attempt to retrieve the corresponding sub-location code
Context: An MC table lookup has been performed with port manifest upon value
GIVEN
An MC table lookup has been performed with port manifest upon value
Applied to: MC Table Lookup Successful?
WHEN
The table lookup function returns a successful status
THEN
The system should extract the sub-location code from the MC table result
Context: The MC table lookup was successful
GIVEN
The MC table lookup was successful
Applied to: Set Sub-location Code from MC Table
WHEN
The system processes the MC table result
THEN
The sub-location code should be assigned from the MC table sub-location code field
Context: An MC table lookup has been attempted
GIVEN
An MC table lookup has been attempted
Applied to: Set Sub-location Code to Spaces
WHEN
The MC table lookup fails to return valid data
THEN
The sub-location code should be set to spaces
Context: A CM table lookup has been attempted
GIVEN
A CM table lookup has been attempted
Applied to: Set Sub-location Code to Spaces
WHEN
The CM table lookup fails to return valid data
THEN
The sub-location code should be set to spaces without proceeding to MC table lookup
R-GCCCCADD-cbl-02349 (+7) File: GCCCCADD.cbl Process EDI BOL commodity segments with weight extraction and metric unit conversion Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process EDI BOL commodity segments with weight extraction and metric unit conversion':
  • Context - a waybill is being processed for weight and quantity extraction:
    For Check for Valid EDI BOL:
    When the system checks for edi bol availability by examining the origin road number in shiproot, then if origin road number is not zero, retrieve shipmine segment with type 'e' and sequence '1', and if found, extract edi bol key from data line 1 and set valid edi bol flag, otherwise set invalid edi bol flag.
  • Context - a valid edi bol is available and commodity segment sequence number is provided:
    For Get EBSBCCM Commodity Segment:
    When the system retrieves ebsbccm commodity segment with type 'cm' and the current sequence number, then if the segment is found, add the l0-lading-qty to the running total of units, otherwise set commodity segment not found flag.
  • Context - the first commodity segment is being processed (sequence = 1):
    For Get EBSBCCR Weight Segment:
    When the system retrieves ebsbccr weight segment with type 'cr' and dependent key 'cr001', then if weight segment is found, extract n7-weight value, otherwise set weight to 0, and set weight unit to kg if metric indicator is 'm' or 'l', otherwise set to lb, and capture l0-lading-qty-qual as quantity qualifier.
  • Context - edi weight and quantity data is zero or unavailable:
    For Get First SHIPCOMM Record:
    When the system retrieves the first shipcomm record using 'gu' function, then if shipcomm is found, add num-units to quantity total, set quantity qualifier to 'pcs', and add met-cmod-wgt to weight if metric indicator is 'm' or 'l', otherwise add cmod-wgt, and set weight unit accordingly.
  • Context - the first shipcomm record has been processed:
    For Get Next SHIPCOMM Records:
    When the system retrieves subsequent shipcomm records using 'gn' function until no more records are found, then for each additional shipcomm record found, add num-units to quantity total, set quantity qualifier to 'pcs', and add appropriate weight (met-cmod-wgt for metric or cmod-wgt for imperial) to weight total.
  • Context - weight and quantity extraction from all sources is complete:
    For Validate Final Quantities:
    When the system validates the final quantity value, then if quantity is greater than zero, use the extracted quantity value, otherwise set quantity to 1 as default.
  • Context - weight extraction from all sources is complete:
    For Validate Final Quantities:
    When the system validates the final weight value, then if weight is greater than zero, use the extracted weight value, otherwise set weight to '00000001' as default.
  • Context - quantity qualifier extraction from all sources is complete:
    For Validate Quantity Qualifier:
    When the system validates the quantity qualifier value, then if quantity qualifier is empty or spaces, set quantity qualifier to 'pcs' as default.
👨‍💻 Technical ACs (Gherkin)
Context: A waybill is being processed for weight and quantity extraction
GIVEN
A waybill is being processed for weight and quantity extraction
Applied to: Check for Valid EDI BOL
WHEN
The system checks for EDI BOL availability by examining the origin road number in SHIPROOT
THEN
If origin road number is not zero, retrieve SHIPMINE segment with type 'E' and sequence '1', and if found, extract EDI BOL key from data line 1 and set valid EDI BOL flag, otherwise set invalid EDI BOL flag
Context: A valid EDI BOL is available and commodity segment sequence number is provided
GIVEN
A valid EDI BOL is available and commodity segment sequence number is provided
Applied to: Get EBSBCCM Commodity Segment
WHEN
The system retrieves EBSBCCM commodity segment with type 'CM' and the current sequence number
THEN
If the segment is found, add the L0-LADING-QTY to the running total of units, otherwise set commodity segment not found flag
Context: The first commodity segment is being processed (sequence = 1)
GIVEN
The first commodity segment is being processed (sequence = 1)
Applied to: Get EBSBCCR Weight Segment
WHEN
The system retrieves EBSBCCR weight segment with type 'CR' and dependent key 'CR001'
THEN
If weight segment is found, extract N7-WEIGHT value, otherwise set weight to 0, and set weight unit to KG if metric indicator is 'M' or 'L', otherwise set to LB, and capture L0-LADING-QTY-QUAL as quantity qualifier
Context: EDI weight and quantity data is zero or unavailable
GIVEN
EDI weight and quantity data is zero or unavailable
Applied to: Get First SHIPCOMM Record
WHEN
The system retrieves the first SHIPCOMM record using 'GU' function
THEN
If SHIPCOMM is found, add NUM-UNITS to quantity total, set quantity qualifier to 'PCS', and add MET-CMOD-WGT to weight if metric indicator is 'M' or 'L', otherwise add CMOD-WGT, and set weight unit accordingly
Context: The first SHIPCOMM record has been processed
GIVEN
The first SHIPCOMM record has been processed
Applied to: Get Next SHIPCOMM Records
WHEN
The system retrieves subsequent SHIPCOMM records using 'GN' function until no more records are found
THEN
For each additional SHIPCOMM record found, add NUM-UNITS to quantity total, set quantity qualifier to 'PCS', and add appropriate weight (MET-CMOD-WGT for metric or CMOD-WGT for imperial) to weight total
Context: Weight and quantity extraction from all sources is complete
GIVEN
Weight and quantity extraction from all sources is complete
Applied to: Validate Final Quantities
WHEN
The system validates the final quantity value
THEN
If quantity is greater than zero, use the extracted quantity value, otherwise set quantity to 1 as default
Context: Weight extraction from all sources is complete
GIVEN
Weight extraction from all sources is complete
Applied to: Validate Final Quantities
WHEN
The system validates the final weight value
THEN
If weight is greater than zero, use the extracted weight value, otherwise set weight to '00000001' as default
Context: Quantity qualifier extraction from all sources is complete
GIVEN
Quantity qualifier extraction from all sources is complete
Applied to: Validate Quantity Qualifier
WHEN
The system validates the quantity qualifier value
THEN
If quantity qualifier is empty or spaces, set quantity qualifier to 'PCS' as default
R-GCCCCADD-cbl-02357 (+19) File: GCCCCADD.cbl Execute Fastway SHIPCOMM fallback processing with quantity aggregation Merged 20 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Fastway SHIPCOMM fallback processing with quantity aggregation':
  • Context - a shipment requires weight and quantity determination:
    For Check EDI BOL Weight/Quantity Data:
    When the system checks edi bol data for weight and quantity values, then if both edi weight equals zero and edi quantity equals zero, proceed to fastway shipcomm fallback processing, otherwise use edi data.
  • Context - edi bol weight and quantity data has been evaluated:
    For EDI Weight = 0 AND Quantity = 0?:
    When both edi weight equals zero and edi quantity equals zero, then initiate fastway shipcomm record processing to obtain weight and quantity data.
  • Context - fastway shipcomm fallback processing is required:
    For Get First SHIPCOMM Record:
    When the system needs to retrieve commodity data from fastway, then execute gu function to get the first shipcomm record and set found status.
  • Context - a shipcomm record retrieval has been attempted:
    For SHIPCOMM Record Found?:
    When the system checks if a valid shipcomm record was found, then if shipcomm record is found, proceed with data extraction, otherwise end processing.
  • Context - a valid shipcomm record has been found:
    For Add SHIPCOMM Units to Total Quantity:
    When the system processes the shipcomm record for quantity data, then add the num-units value from shipcomm to the running total quantity.
  • Context - shipcomm record data is being processed:
    For Set Quantity Qualifier to 'PCS':
    When quantity units are extracted from shipcomm, then set the quantity qualifier to 'pcs' (pieces) as the standard unit.
  • Context - shipcomm weight data needs to be processed:
    For Metric Indicator = 'M' or 'L'?:
    When the system checks the metric indicator from shipment root, then if metric indicator equals 'm' or 'l', use metric weight processing, otherwise use standard weight processing.
  • Context - metric weight system is detected and shipcomm record is available:
    For Add Metric Weight to Total:
    When the system processes metric weight from shipcomm, then add met-cmod-wgt from shipcomm to the total weight accumulator.
  • Context - metric weight processing is active:
    For Set Weight Unit to KG:
    When weight unit designation is required, then set the weight unit indicator to kg (kilograms).
  • Context - standard weight system is detected and shipcomm record is available:
    For Add Standard Weight to Total:
    When the system processes standard weight from shipcomm, then add cmod-wgt from shipcomm to the total weight accumulator.
  • Context - standard weight processing is active:
    For Set Weight Unit to LB:
    When weight unit designation is required, then set the weight unit indicator to lb (pounds).
  • Context - current shipcomm record has been processed:
    For Get Next SHIPCOMM Record:
    When the system needs to check for additional shipcomm records, then execute gn function to get the next shipcomm record.
  • Context - a gn function has been executed for next shipcomm record:
    For More SHIPCOMM Records?:
    When the system checks if more shipcomm records are available, then if additional records found, continue processing loop, otherwise proceed to validation.
  • Context - all shipcomm records have been processed:
    For Validate Final Quantities:
    When final weight and quantity totals need validation, then check if accumulated totals are greater than zero for proper assignment.
  • Context - quantity has been accumulated from shipcomm records:
    For Total Quantity > 0?:
    When the system validates the total quantity value, then if total quantity is greater than zero, use calculated quantity, otherwise set default quantity to 1.
  • Context - total quantity is greater than zero:
    For Use Calculated Quantity:
    When final quantity assignment is required, then move the calculated total quantity to the cargo manifest quantity field.
  • Context - total calculated quantity is zero or negative:
    For Set Default Quantity = 1:
    When final quantity assignment is required, then set quantity to default value of 1 and assign to cargo manifest.
  • Context - weight has been accumulated from shipcomm records:
    For Total Weight > 0?:
    When the system validates the total weight value, then if total weight is greater than zero, use calculated weight, otherwise set default weight to 1.
  • Context - total weight is greater than zero:
    For Use Calculated Weight:
    When final weight assignment is required, then move the calculated total weight to the cargo manifest weight field.
  • Context - total calculated weight is zero or negative:
    For Set Default Weight = 1:
    When final weight assignment is required, then set weight to default value of '00000001' and assign to cargo manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires weight and quantity determination
GIVEN
A shipment requires weight and quantity determination
Applied to: Check EDI BOL Weight/Quantity Data
WHEN
The system checks EDI BOL data for weight and quantity values
THEN
If both EDI weight equals zero AND EDI quantity equals zero, proceed to Fastway SHIPCOMM fallback processing, otherwise use EDI data
Context: EDI BOL weight and quantity data has been evaluated
GIVEN
EDI BOL weight and quantity data has been evaluated
Applied to: EDI Weight = 0 AND Quantity = 0?
WHEN
Both EDI weight equals zero AND EDI quantity equals zero
THEN
Initiate Fastway SHIPCOMM record processing to obtain weight and quantity data
Context: Fastway SHIPCOMM fallback processing is required
GIVEN
Fastway SHIPCOMM fallback processing is required
Applied to: Get First SHIPCOMM Record
WHEN
The system needs to retrieve commodity data from Fastway
THEN
Execute GU function to get the first SHIPCOMM record and set found status
Context: A SHIPCOMM record retrieval has been attempted
GIVEN
A SHIPCOMM record retrieval has been attempted
Applied to: SHIPCOMM Record Found?
WHEN
The system checks if a valid SHIPCOMM record was found
THEN
If SHIPCOMM record is found, proceed with data extraction, otherwise end processing
Context: A valid SHIPCOMM record has been found
GIVEN
A valid SHIPCOMM record has been found
Applied to: Add SHIPCOMM Units to Total Quantity
WHEN
The system processes the SHIPCOMM record for quantity data
THEN
Add the NUM-UNITS value from SHIPCOMM to the running total quantity
Context: SHIPCOMM record data is being processed
GIVEN
SHIPCOMM record data is being processed
Applied to: Set Quantity Qualifier to 'PCS'
WHEN
Quantity units are extracted from SHIPCOMM
THEN
Set the quantity qualifier to 'PCS' (pieces) as the standard unit
Context: SHIPCOMM weight data needs to be processed
GIVEN
SHIPCOMM weight data needs to be processed
Applied to: Metric Indicator = 'M' or 'L'?
WHEN
The system checks the metric indicator from shipment root
THEN
If metric indicator equals 'M' or 'L', use metric weight processing, otherwise use standard weight processing
Context: Metric weight system is detected and SHIPCOMM record is available
GIVEN
Metric weight system is detected and SHIPCOMM record is available
Applied to: Add Metric Weight to Total
WHEN
The system processes metric weight from SHIPCOMM
THEN
Add MET-CMOD-WGT from SHIPCOMM to the total weight accumulator
Context: Metric weight processing is active
GIVEN
Metric weight processing is active
Applied to: Set Weight Unit to KG
WHEN
Weight unit designation is required
THEN
Set the weight unit indicator to KG (kilograms)
Context: Standard weight system is detected and SHIPCOMM record is available
GIVEN
Standard weight system is detected and SHIPCOMM record is available
Applied to: Add Standard Weight to Total
WHEN
The system processes standard weight from SHIPCOMM
THEN
Add CMOD-WGT from SHIPCOMM to the total weight accumulator
Context: Standard weight processing is active
GIVEN
Standard weight processing is active
Applied to: Set Weight Unit to LB
WHEN
Weight unit designation is required
THEN
Set the weight unit indicator to LB (pounds)
Context: Current SHIPCOMM record has been processed
GIVEN
Current SHIPCOMM record has been processed
Applied to: Get Next SHIPCOMM Record
WHEN
The system needs to check for additional SHIPCOMM records
THEN
Execute GN function to get the next SHIPCOMM record
Context: A GN function has been executed for next SHIPCOMM record
GIVEN
A GN function has been executed for next SHIPCOMM record
Applied to: More SHIPCOMM Records?
WHEN
The system checks if more SHIPCOMM records are available
THEN
If additional records found, continue processing loop, otherwise proceed to validation
Context: All SHIPCOMM records have been processed
GIVEN
All SHIPCOMM records have been processed
Applied to: Validate Final Quantities
WHEN
Final weight and quantity totals need validation
THEN
Check if accumulated totals are greater than zero for proper assignment
Context: Quantity has been accumulated from SHIPCOMM records
GIVEN
Quantity has been accumulated from SHIPCOMM records
Applied to: Total Quantity > 0?
WHEN
The system validates the total quantity value
THEN
If total quantity is greater than zero, use calculated quantity, otherwise set default quantity to 1
Context: Total quantity is greater than zero
GIVEN
Total quantity is greater than zero
Applied to: Use Calculated Quantity
WHEN
Final quantity assignment is required
THEN
Move the calculated total quantity to the cargo manifest quantity field
Context: Total calculated quantity is zero or negative
GIVEN
Total calculated quantity is zero or negative
Applied to: Set Default Quantity = 1
WHEN
Final quantity assignment is required
THEN
Set quantity to default value of 1 and assign to cargo manifest
Context: Weight has been accumulated from SHIPCOMM records
GIVEN
Weight has been accumulated from SHIPCOMM records
Applied to: Total Weight > 0?
WHEN
The system validates the total weight value
THEN
If total weight is greater than zero, use calculated weight, otherwise set default weight to 1
Context: Total weight is greater than zero
GIVEN
Total weight is greater than zero
Applied to: Use Calculated Weight
WHEN
Final weight assignment is required
THEN
Move the calculated total weight to the cargo manifest weight field
Context: Total calculated weight is zero or negative
GIVEN
Total calculated weight is zero or negative
Applied to: Set Default Weight = 1
WHEN
Final weight assignment is required
THEN
Set weight to default value of '00000001' and assign to cargo manifest
R-GCCCCADD-cbl-02377 (+11) File: GCCCCADD.cbl Extract and combine commodity descriptions from multiple data sources with special handling Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract and combine commodity descriptions from multiple data sources with special handling':
  • Context - the system needs to build commodity descriptions:
    For Initialize Description Work Areas:
    When description building process starts, then all description work areas are cleared and initialized to spaces.
  • Context - shipcomm data is available with commodity descriptions:
    For Extract SHIPCOMM Commodity Descriptions:
    When building commodity descriptions from multiple sources, then all 10 cmod-desc lines from shipcomm are extracted and stored in description work area.
  • Context - shiproot data is available with free form descriptions:
    For Extract SHIPROOT Free Form Descriptions:
    When building commodity descriptions from multiple sources, then both free-form-desc lines from shiproot are extracted and stored in description work area.
  • Context - special handling codes and instructions are available in shipment data:
    For Process Special Handling Codes:
    When processing commodity descriptions, then special handling codes are evaluated for inclusion in description.
  • Context - a special handling code is found in shipment data:
    For Check Code Type VA/EV/VS:
    When the special handling code is evaluated, then only codes with type va, ev, or vs are processed for description inclusion.
  • Context - a valid special handling code (va/ev/vs) and its instruction are available:
    For Build Special Handling Description:
    When building the special handling description, then the code and instruction are combined into a formatted description work entry.
  • Context - a formatted special handling description entry is ready:
    For Add to Description Array:
    When adding to the description array, then the entry is placed in the first available position in the special handling description array (positions 1-3).
  • Context - descriptions have been extracted from shipcomm, shiproot, and special handling sources:
    For Combine All Description Sources:
    When combining all description sources, then all description components are merged into a single work area for processing.
  • Context - combined description data is ready for compression:
    For Prepare for Compression:
    When preparing for compression processing, then description length parameters are set to 45000 and 22500 characters respectively for compression utility.
  • Context - description data is prepared with proper length parameters:
    For Call GCCCOMP Utility:
    When compression is required, then gcccomp utility is called with cccom, source description, target description, and length parameters.
  • Context - description has been successfully compressed by gcccomp utility:
    For Store Compressed Description:
    When storing the final description, then the compressed description is moved to gccc-lading-description field.
  • Context - compressed description data is available:
    For Populate Description Arrays:
    When populating description arrays, then description data is distributed across all 46 ws-gcsccs53-cargo-data array positions.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to build commodity descriptions
GIVEN
The system needs to build commodity descriptions
Applied to: Initialize Description Work Areas
WHEN
Description building process starts
THEN
All description work areas are cleared and initialized to spaces
Context: SHIPCOMM data is available with commodity descriptions
GIVEN
SHIPCOMM data is available with commodity descriptions
Applied to: Extract SHIPCOMM Commodity Descriptions
WHEN
Building commodity descriptions from multiple sources
THEN
All 10 CMOD-DESC lines from SHIPCOMM are extracted and stored in description work area
Context: SHIPROOT data is available with free form descriptions
GIVEN
SHIPROOT data is available with free form descriptions
Applied to: Extract SHIPROOT Free Form Descriptions
WHEN
Building commodity descriptions from multiple sources
THEN
Both FREE-FORM-DESC lines from SHIPROOT are extracted and stored in description work area
Context: Special handling codes and instructions are available in shipment data
GIVEN
Special handling codes and instructions are available in shipment data
Applied to: Process Special Handling Codes
WHEN
Processing commodity descriptions
THEN
Special handling codes are evaluated for inclusion in description
Context: A special handling code is found in shipment data
GIVEN
A special handling code is found in shipment data
Applied to: Check Code Type VA/EV/VS
WHEN
The special handling code is evaluated
THEN
Only codes with type VA, EV, or VS are processed for description inclusion
Context: A valid special handling code (VA/EV/VS) and its instruction are available
GIVEN
A valid special handling code (VA/EV/VS) and its instruction are available
Applied to: Build Special Handling Description
WHEN
Building the special handling description
THEN
The code and instruction are combined into a formatted description work entry
Context: A formatted special handling description entry is ready
GIVEN
A formatted special handling description entry is ready
Applied to: Add to Description Array
WHEN
Adding to the description array
THEN
The entry is placed in the first available position in the special handling description array (positions 1-3)
Context: Descriptions have been extracted from SHIPCOMM, SHIPROOT, and special handling sources
GIVEN
Descriptions have been extracted from SHIPCOMM, SHIPROOT, and special handling sources
Applied to: Combine All Description Sources
WHEN
Combining all description sources
THEN
All description components are merged into a single work area for processing
Context: Combined description data is ready for compression
GIVEN
Combined description data is ready for compression
Applied to: Prepare for Compression
WHEN
Preparing for compression processing
THEN
Description length parameters are set to 45000 and 22500 characters respectively for compression utility
Context: Description data is prepared with proper length parameters
GIVEN
Description data is prepared with proper length parameters
Applied to: Call GCCCOMP Utility
WHEN
Compression is required
THEN
GCCCOMP utility is called with CCCOM, source description, target description, and length parameters
Context: Description has been successfully compressed by GCCCOMP utility
GIVEN
Description has been successfully compressed by GCCCOMP utility
Applied to: Store Compressed Description
WHEN
Storing the final description
THEN
The compressed description is moved to GCCC-LADING-DESCRIPTION field
Context: Compressed description data is available
GIVEN
Compressed description data is available
Applied to: Populate Description Arrays
WHEN
Populating description arrays
THEN
Description data is distributed across all 46 WS-GCSCCS53-CARGO-DATA array positions
R-GCCCCADD-cbl-02389 (+13) File: GCCCCADD.cbl Extract UN numbers and proper shipping names from EDI BOL hazmat segments Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract UN numbers and proper shipping names from EDI BOL hazmat segments':
  • Context - the system is starting hazmat information processing:
    For Initialize Hazmat Variables:
    When hazmat processing begins, then the commodity description danger field is cleared and the un number field is cleared and the hazmat not found flag is set.
  • Context - hazmat processing variables have been initialized:
    For Set Sequence Counter to 1:
    When beginning to search for hazmat segments, then the commodity hazmat sequence counter is set to 1.
  • Context - the system needs to retrieve hazmat commodity segments:
    For EDI BOL Valid?:
    When the edi bol validation flag indicates invalid bol, then the hazmat commodity segment not found flag is set and edi hazmat processing is skipped.
  • Context - the edi bol is valid and a sequence counter is set:
    For Get EBSBCCM-CH Segment:
    When retrieving the ebsbccm hazmat commodity segment with type 'ch', then the system attempts to read the hazmat commodity data for the specified sequence number.
  • Context - an attempt was made to retrieve the ebsbccm-ch segment:
    For EBSBCCM-CH Found?:
    When the database status code is spaces (successful), then the hazmat commodity segment found flag is set.
  • Context - a hazmat commodity segment has been found:
    For UN Number Starts with 'UN'?:
    When the lh1-un-na-id-cd field starts with 'un', then the un number format is considered valid for hazmat processing.
  • Context - the un number format validation has passed:
    For Extract UN Number from LH1-UN-NA-ID-CD:
    When extracting hazmat identification information, then the lh1-un-na-id-cd value is moved to the commodity un number field.
  • Context - a valid un number has been extracted from the hazmat commodity segment:
    For Set Hazmat Found Flag:
    When hazmat identification processing is successful, then the hazmat found flag is set to true.
  • Context - a valid un number has been found in the hazmat commodity segment:
    For Initialize HS Sequence to 1:
    When beginning to search for hazmat shipping information, then the hazmat shipping info sequence counter is set to 1.
  • Context - a valid un number exists and the shipping info sequence is initialized:
    For Get EBSBCHI Segment:
    When retrieving the ebsbchi hazmat shipping info segment with type 'hs', then the system attempts to read the hazmat shipping information for the current commodity and sequence.
  • Context - an attempt was made to retrieve the ebsbchi-hs segment:
    For EBSBCHI-HS Found?:
    When the database status code is spaces (successful), then the hazmat shipping info found flag is set.
  • Context - the hazmat shipping information segment has been successfully retrieved:
    For Extract Proper Shipping Name from LH3-PROPER-SHIP-NAME:
    When extracting the proper shipping name, then the lh3-proper-ship-name value is moved to the commodity description danger field.
  • Context - the current hazmat commodity segment does not contain a valid un number or hazmat processing for current segment is complete:
    For Increment CH Sequence Counter:
    When continuing the search for valid hazmat information, then the commodity hazmat sequence counter is incremented by 1.
  • Context - the hazmat sequence counter has been incremented:
    For More CH Segments Available?:
    When the sequence counter is less than or equal to 98 and hazmat information has not been found, then continue processing additional hazmat commodity segments.
👨‍💻 Technical ACs (Gherkin)
Context: The system is starting hazmat information processing
GIVEN
The system is starting hazmat information processing
Applied to: Initialize Hazmat Variables
WHEN
Hazmat processing begins
THEN
The commodity description danger field is cleared AND the UN number field is cleared AND the hazmat not found flag is set
Context: Hazmat processing variables have been initialized
GIVEN
Hazmat processing variables have been initialized
Applied to: Set Sequence Counter to 1
WHEN
Beginning to search for hazmat segments
THEN
The commodity hazmat sequence counter is set to 1
Context: The system needs to retrieve hazmat commodity segments
GIVEN
The system needs to retrieve hazmat commodity segments
Applied to: EDI BOL Valid?
WHEN
The EDI BOL validation flag indicates invalid BOL
THEN
The hazmat commodity segment not found flag is set AND EDI hazmat processing is skipped
Context: The EDI BOL is valid AND a sequence counter is set
GIVEN
The EDI BOL is valid AND a sequence counter is set
Applied to: Get EBSBCCM-CH Segment
WHEN
Retrieving the EBSBCCM hazmat commodity segment with type 'CH'
THEN
The system attempts to read the hazmat commodity data for the specified sequence number
Context: An attempt was made to retrieve the EBSBCCM-CH segment
GIVEN
An attempt was made to retrieve the EBSBCCM-CH segment
Applied to: EBSBCCM-CH Found?
WHEN
The database status code is spaces (successful)
THEN
The hazmat commodity segment found flag is set
Context: A hazmat commodity segment has been found
GIVEN
A hazmat commodity segment has been found
Applied to: UN Number Starts with 'UN'?
WHEN
The LH1-UN-NA-ID-CD field starts with 'UN'
THEN
The UN number format is considered valid for hazmat processing
Context: The UN number format validation has passed
GIVEN
The UN number format validation has passed
Applied to: Extract UN Number from LH1-UN-NA-ID-CD
WHEN
Extracting hazmat identification information
THEN
The LH1-UN-NA-ID-CD value is moved to the commodity UN number field
Context: A valid UN number has been extracted from the hazmat commodity segment
GIVEN
A valid UN number has been extracted from the hazmat commodity segment
Applied to: Set Hazmat Found Flag
WHEN
Hazmat identification processing is successful
THEN
The hazmat found flag is set to true
Context: A valid UN number has been found in the hazmat commodity segment
GIVEN
A valid UN number has been found in the hazmat commodity segment
Applied to: Initialize HS Sequence to 1
WHEN
Beginning to search for hazmat shipping information
THEN
The hazmat shipping info sequence counter is set to 1
Context: A valid UN number exists AND the shipping info sequence is initialized
GIVEN
A valid UN number exists AND the shipping info sequence is initialized
Applied to: Get EBSBCHI Segment
WHEN
Retrieving the EBSBCHI hazmat shipping info segment with type 'HS'
THEN
The system attempts to read the hazmat shipping information for the current commodity and sequence
Context: An attempt was made to retrieve the EBSBCHI-HS segment
GIVEN
An attempt was made to retrieve the EBSBCHI-HS segment
Applied to: EBSBCHI-HS Found?
WHEN
The database status code is spaces (successful)
THEN
The hazmat shipping info found flag is set
Context: The hazmat shipping information segment has been successfully retrieved
GIVEN
The hazmat shipping information segment has been successfully retrieved
Applied to: Extract Proper Shipping Name from LH3-PROPER-SHIP-NAME
WHEN
Extracting the proper shipping name
THEN
The LH3-PROPER-SHIP-NAME value is moved to the commodity description danger field
Context: The current hazmat commodity segment does not contain a valid UN number OR hazmat processing for current segment is complete
GIVEN
The current hazmat commodity segment does not contain a valid UN number OR hazmat processing for current segment is complete
Applied to: Increment CH Sequence Counter
WHEN
Continuing the search for valid hazmat information
THEN
The commodity hazmat sequence counter is incremented by 1
Context: The hazmat sequence counter has been incremented
GIVEN
The hazmat sequence counter has been incremented
Applied to: More CH Segments Available?
WHEN
The sequence counter is less than or equal to 98 AND hazmat information has not been found
THEN
Continue processing additional hazmat commodity segments
R-GCCCCADD-cbl-02403 (+11) File: GCCCCADD.cbl Process Fastway hazmat data extraction with UN code validation Merged 12 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Fastway hazmat data extraction with UN code validation':
  • Context - a shipment root record exists with valid root key:
    For Get SHIPCOMM Segment:
    When the system attempts to retrieve commodity data from fastway shipcomm segment, then the shipcomm segment is retrieved and made available for hazmat processing.
  • Context - the system has attempted to retrieve shipcomm segment data:
    For SHIPCOMM Found?:
    When the retrieval operation completes, then if shipcomm data is found, continue with emergency response data retrieval, otherwise skip fastway hazmat processing.
  • Context - shipcomm segment data is available with valid commodity information:
    For Get SHIPERP Segment:
    When the system retrieves emergency response data from shiperp segment, then shiperp segment containing hazmat identification codes is made available for validation.
  • Context - the system has attempted to retrieve shiperp segment data:
    For SHIPERP Found?:
    When the retrieval operation completes, then if shiperp data is found, proceed with un code format validation, otherwise skip fastway hazmat processing.
  • Context - emergency response data is available in shiperp segment:
    For Check UN Code Format:
    When the system examines the un/na code field, then the un code format is validated to ensure it starts with 'un' prefix.
  • Context - a un/na code exists in the emergency response data:
    For UN Code Starts with 'UN'?:
    When the system checks if the code starts with 'un' in the first two positions, then if the code starts with 'un', proceed with hazmat data extraction, otherwise skip fastway processing.
  • Context - a valid un code format has been confirmed in the emergency response data:
    For Extract UN Code to GCCC-UN-NUMBER:
    When the system processes the un/na code field, then the complete un code is extracted and stored in the customs cargo control un number field.
  • Context - a valid un number has been extracted from emergency response data:
    For Clear Hazmat Description:
    When the system prepares to retrieve detailed hazmat description, then the hazmat description field is cleared to ensure clean data population.
  • Context - valid un number exists and hazmat description field is initialized:
    For Get SHIPERPD Segment:
    When the system attempts to retrieve shiperpd segment data using emergency response stcc code, then shiperpd segment containing detailed hazmat descriptions is made available for extraction.
  • Context - the system has attempted to retrieve shiperpd segment data:
    For SHIPERPD Found?:
    When the retrieval operation completes, then if shiperpd data is found, extract hazmat description, otherwise proceed with hazmat found flag setting.
  • Context - shiperpd segment data is available with hazmat description information:
    For Extract Hazmat Description from ERPD-HAZ-DESC:
    When the system processes the hazmat description field from erpd-haz-desc, then the first 15 characters of hazmat description are extracted and stored in the customs commodity danger description field.
  • Context - valid un number has been extracted and hazmat description processing is complete:
    For Set Hazmat Found Flag:
    When the fastway hazmat extraction process concludes, then the hazmat found flag is set to indicate successful extraction from fastway sources.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment root record exists with valid root key
GIVEN
A shipment root record exists with valid root key
Applied to: Get SHIPCOMM Segment
WHEN
The system attempts to retrieve commodity data from Fastway SHIPCOMM segment
THEN
The SHIPCOMM segment is retrieved and made available for hazmat processing
Context: The system has attempted to retrieve SHIPCOMM segment data
GIVEN
The system has attempted to retrieve SHIPCOMM segment data
Applied to: SHIPCOMM Found?
WHEN
The retrieval operation completes
THEN
If SHIPCOMM data is found, continue with emergency response data retrieval, otherwise skip Fastway hazmat processing
Context: SHIPCOMM segment data is available with valid commodity information
GIVEN
SHIPCOMM segment data is available with valid commodity information
Applied to: Get SHIPERP Segment
WHEN
The system retrieves emergency response data from SHIPERP segment
THEN
SHIPERP segment containing hazmat identification codes is made available for validation
Context: The system has attempted to retrieve SHIPERP segment data
GIVEN
The system has attempted to retrieve SHIPERP segment data
Applied to: SHIPERP Found?
WHEN
The retrieval operation completes
THEN
If SHIPERP data is found, proceed with UN code format validation, otherwise skip Fastway hazmat processing
Context: Emergency response data is available in SHIPERP segment
GIVEN
Emergency response data is available in SHIPERP segment
Applied to: Check UN Code Format
WHEN
The system examines the UN/NA code field
THEN
The UN code format is validated to ensure it starts with 'UN' prefix
Context: A UN/NA code exists in the emergency response data
GIVEN
A UN/NA code exists in the emergency response data
Applied to: UN Code Starts with 'UN'?
WHEN
The system checks if the code starts with 'UN' in the first two positions
THEN
If the code starts with 'UN', proceed with hazmat data extraction, otherwise skip Fastway processing
Context: A valid UN code format has been confirmed in the emergency response data
GIVEN
A valid UN code format has been confirmed in the emergency response data
Applied to: Extract UN Code to GCCC-UN-NUMBER
WHEN
The system processes the UN/NA code field
THEN
The complete UN code is extracted and stored in the customs cargo control UN number field
Context: A valid UN number has been extracted from emergency response data
GIVEN
A valid UN number has been extracted from emergency response data
Applied to: Clear Hazmat Description
WHEN
The system prepares to retrieve detailed hazmat description
THEN
The hazmat description field is cleared to ensure clean data population
Context: Valid UN number exists and hazmat description field is initialized
GIVEN
Valid UN number exists and hazmat description field is initialized
Applied to: Get SHIPERPD Segment
WHEN
The system attempts to retrieve SHIPERPD segment data using emergency response STCC code
THEN
SHIPERPD segment containing detailed hazmat descriptions is made available for extraction
Context: The system has attempted to retrieve SHIPERPD segment data
GIVEN
The system has attempted to retrieve SHIPERPD segment data
Applied to: SHIPERPD Found?
WHEN
The retrieval operation completes
THEN
If SHIPERPD data is found, extract hazmat description, otherwise proceed with hazmat found flag setting
Context: SHIPERPD segment data is available with hazmat description information
GIVEN
SHIPERPD segment data is available with hazmat description information
Applied to: Extract Hazmat Description from ERPD-HAZ-DESC
WHEN
The system processes the hazmat description field from ERPD-HAZ-DESC
THEN
The first 15 characters of hazmat description are extracted and stored in the customs commodity danger description field
Context: Valid UN number has been extracted and hazmat description processing is complete
GIVEN
Valid UN number has been extracted and hazmat description processing is complete
Applied to: Set Hazmat Found Flag
WHEN
The Fastway hazmat extraction process concludes
THEN
The hazmat found flag is set to indicate successful extraction from Fastway sources
R-GCCCCADD-cbl-02415 (+23) File: GCCCCADD.cbl Build shipper and consignee records with EDI BOL to Fastway fallback logic Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build shipper and consignee records with EDI BOL to Fastway fallback logic':
  • Context - a shipment record is being processed for shipper information:
    For EDI BOL Shipper Data Available?:
    When the system checks for edi bol shipper data availability by looking up ebsnrsc segment with type 'hn' and sequence '01', then if edi bol shipper data is found, use edi data source; otherwise fallback to fastway shipment root data.
  • Context - edi bol shipper data is available in ebsnrsc segment:
    For Extract Shipper Name and CHOP from EDI BOL:
    When the system processes the shipper n1 segment data, then set entity id to 'sh', extract shipper name from f1-consignor-name, extract chop code from f1-shpr-chop, and clear id code qualifier and id code fields.
  • Context - edi bol shipper data is not available:
    For Use Fastway Shipper Data:
    When the system needs shipper information for the manifest, then set entity id to 'sh', extract shipper name from shpr-nm of shiproot, extract chop code from shpr-chop of shiproot, and clear id code qualifier and id code fields.
  • Context - shipper basic information has been processed:
    For EDI BOL Shipper Address Available?:
    When the system checks for edi bol shipper address data by looking up ebsnrsa segment with types 'hn' and 'ha', then if edi bol address data is found, use edi address source; otherwise use fastway address data.
  • Context - edi bol shipper address data is available in ebsnrsa segment:
    For Extract Address from EDI BOL:
    When the system processes the shipper address information, then extract address line 1 from f2-addl-name-addr-1, extract address line 2 from f2-addl-name-addr-2, and if address line 1 is blank set it to 'na'.
  • Context - edi bol shipper address data is not available:
    For Use Fastway Address Data:
    When the system needs shipper address information, then if shpr-addr(1) is blank set address line 1 to 'na', otherwise use shpr-addr(1) for address line 1, and set address line 2 to spaces.
  • Context - shipper address information has been processed:
    For EDI BOL Shipper City/State Available?:
    When the system checks for edi bol shipper city/state data by looking up ebsnrsa segment with types 'hn' and 'hc', then if edi bol city/state data is found, use edi source; otherwise parse fastway address data.
  • Context - edi bol shipper city/state data is available in ebsnrsa segment:
    For Extract City/State/Postal from EDI BOL:
    When the system processes the shipper location information, then extract city from f4-city-name, extract state/province from f4-state-prov-code, extract postal code from f4-postal-code, and extract country code from f4-country-code.
  • Context - edi bol shipper city/state data is not available:
    For Parse Fastway Address for City/State/Postal:
    When the system needs shipper location information, then parse shpr-addr(2) to extract city name, state/province code, and postal code, then lookup country code from state/province using tb-state-country table.
  • Context - shipper location information has been processed:
    For EDI BOL Contact Info Available?:
    When the system checks for edi bol shipper contact data by looking up ebsnrsa segment with types 'hn' and 'gp', then if edi bol contact data is found, extract contact information; otherwise set contact fields to blank.
  • Context - edi bol shipper contact data is available in ebsnrsa segment:
    For Extract Contact Information from EDI BOL:
    When the system processes the shipper contact information, then extract contact function code from per-contact-func-code, extract contact name from per-name, extract communication number qualifier from per-commun-no-qual, and extract communication number from per-commun-number.
  • Context - a shipment record is being processed for consignee information:
    For EDI BOL Consignee Data Available?:
    When the system checks for edi bol consignee data availability by looking up ebsnrsc segment with type 'cn' and sequence '01', then if edi bol consignee data is found, use edi data source; otherwise fallback to fastway shipment root data.
  • Context - edi bol consignee data is available in ebsnrsc segment:
    For Extract Consignee Name and CHOP from EDI BOL:
    When the system processes the consignee n1 segment data, then set entity id to 'cn', extract consignee name from d1-shipper-name, extract chop code from d1-cons-chop, and clear id code qualifier and id code fields.
  • Context - edi bol consignee data is not available:
    For Use Fastway Consignee Data:
    When the system needs consignee information for the manifest, then set entity id to 'cn', extract consignee name from cons-data(1) of shiproot, extract chop code from cons-chop of shiproot, and clear id code qualifier and id code fields.
  • Context - consignee basic information has been processed:
    For EDI BOL Consignee Address Available?:
    When the system checks for edi bol consignee address data by looking up ebsnrsa segment with types 'cn' and 'ca', then if edi bol address data is found, use edi address source; otherwise use fastway address data.
  • Context - edi bol consignee address data is available in ebsnrsa segment:
    For Extract Address from EDI BOL:
    When the system processes the consignee address information, then extract address line 1 from d2-addl-name-addr-1, extract address line 2 from d2-addl-name-addr-2, and if address line 1 is blank set it to 'na'.
  • Context - edi bol consignee address data is not available:
    For Use Fastway Address Data:
    When the system needs consignee address information, then if cons-data(3) is blank set address line 1 to 'na', otherwise use cons-data(3) for address line 1, and set address line 2 to spaces.
  • Context - consignee address information has been processed:
    For EDI BOL Consignee City/State Available?:
    When the system checks for edi bol consignee city/state data by looking up ebsnrsa segment with types 'cn' and 'cc', then if edi bol city/state data is found, use edi source; otherwise parse fastway address data.
  • Context - edi bol consignee city/state data is available in ebsnrsa segment:
    For Extract City/State/Postal from EDI BOL:
    When the system processes the consignee location information, then extract city from d4-city-name, extract state/province from d4-state-prov-code, extract postal code from d4-postal-code, and extract country code from d4-country-code.
  • Context - edi bol consignee city/state data is not available:
    For Parse Fastway Address for City/State/Postal:
    When the system needs consignee location information, then parse cons-data(4) to extract city name, state/province code, and postal code, then lookup country code from state/province using tb-state-country table.
  • Context - consignee location information has been processed:
    For EDI BOL Contact Info Available?:
    When the system checks for edi bol consignee contact data by looking up ebsnrsa segment with types 'cn' and 'gp', then if edi bol contact data is found, extract contact information; otherwise set contact fields to blank.
  • Context - edi bol consignee contact data is available in ebsnrsa segment:
    For Extract Contact Information from EDI BOL:
    When the system processes the consignee contact information, then extract contact function code from per-contact-func-code, extract contact name from per-name, extract communication number qualifier from per-commun-no-qual, and extract communication number from per-commun-number.
  • Context - shipper and consignee records have been processed:
    For Apply Address Defaults if Missing:
    When required address fields are missing or incomplete, then set address line 1 to 'na' if blank, set address line 2 to 'na' if blank or contains only one character followed by spaces, and set default country codes ('us' for shipper, 'ca' for consignee) when address line 2 is defaulted.
  • Context - a state or province code is available for shipper or consignee:
    For Determine Country Code from State/Province:
    When the system needs to determine the corresponding country code, then search tb-state-country table for matching state/province code and set country code from the corresponding table entry, or set to spaces if no match found.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment record is being processed for shipper information
GIVEN
A shipment record is being processed for shipper information
Applied to: EDI BOL Shipper Data Available?
WHEN
The system checks for EDI BOL shipper data availability by looking up EBSNRSC segment with type 'HN' and sequence '01'
THEN
If EDI BOL shipper data is found, use EDI data source; otherwise fallback to Fastway shipment root data
Context: EDI BOL shipper data is available in EBSNRSC segment
GIVEN
EDI BOL shipper data is available in EBSNRSC segment
Applied to: Extract Shipper Name and CHOP from EDI BOL
WHEN
The system processes the shipper N1 segment data
THEN
Set entity ID to 'SH', extract shipper name from F1-CONSIGNOR-NAME, extract CHOP code from F1-SHPR-CHOP, and clear ID code qualifier and ID code fields
Context: EDI BOL shipper data is not available
GIVEN
EDI BOL shipper data is not available
Applied to: Use Fastway Shipper Data
WHEN
The system needs shipper information for the manifest
THEN
Set entity ID to 'SH', extract shipper name from SHPR-NM of SHIPROOT, extract CHOP code from SHPR-CHOP of SHIPROOT, and clear ID code qualifier and ID code fields
Context: Shipper basic information has been processed
GIVEN
Shipper basic information has been processed
Applied to: EDI BOL Shipper Address Available?
WHEN
The system checks for EDI BOL shipper address data by looking up EBSNRSA segment with types 'HN' and 'HA'
THEN
If EDI BOL address data is found, use EDI address source; otherwise use Fastway address data
Context: EDI BOL shipper address data is available in EBSNRSA segment
GIVEN
EDI BOL shipper address data is available in EBSNRSA segment
Applied to: Extract Address from EDI BOL
WHEN
The system processes the shipper address information
THEN
Extract address line 1 from F2-ADDL-NAME-ADDR-1, extract address line 2 from F2-ADDL-NAME-ADDR-2, and if address line 1 is blank set it to 'NA'
Context: EDI BOL shipper address data is not available
GIVEN
EDI BOL shipper address data is not available
Applied to: Use Fastway Address Data
WHEN
The system needs shipper address information
THEN
If SHPR-ADDR(1) is blank set address line 1 to 'NA', otherwise use SHPR-ADDR(1) for address line 1, and set address line 2 to spaces
Context: Shipper address information has been processed
GIVEN
Shipper address information has been processed
Applied to: EDI BOL Shipper City/State Available?
WHEN
The system checks for EDI BOL shipper city/state data by looking up EBSNRSA segment with types 'HN' and 'HC'
THEN
If EDI BOL city/state data is found, use EDI source; otherwise parse Fastway address data
Context: EDI BOL shipper city/state data is available in EBSNRSA segment
GIVEN
EDI BOL shipper city/state data is available in EBSNRSA segment
Applied to: Extract City/State/Postal from EDI BOL
WHEN
The system processes the shipper location information
THEN
Extract city from F4-CITY-NAME, extract state/province from F4-STATE-PROV-CODE, extract postal code from F4-POSTAL-CODE, and extract country code from F4-COUNTRY-CODE
Context: EDI BOL shipper city/state data is not available
GIVEN
EDI BOL shipper city/state data is not available
Applied to: Parse Fastway Address for City/State/Postal
WHEN
The system needs shipper location information
THEN
Parse SHPR-ADDR(2) to extract city name, state/province code, and postal code, then lookup country code from state/province using TB-STATE-COUNTRY table
Context: Shipper location information has been processed
GIVEN
Shipper location information has been processed
Applied to: EDI BOL Contact Info Available?
WHEN
The system checks for EDI BOL shipper contact data by looking up EBSNRSA segment with types 'HN' and 'GP'
THEN
If EDI BOL contact data is found, extract contact information; otherwise set contact fields to blank
Context: EDI BOL shipper contact data is available in EBSNRSA segment
GIVEN
EDI BOL shipper contact data is available in EBSNRSA segment
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes the shipper contact information
THEN
Extract contact function code from PER-CONTACT-FUNC-CODE, extract contact name from PER-NAME, extract communication number qualifier from PER-COMMUN-NO-QUAL, and extract communication number from PER-COMMUN-NUMBER
Context: A shipment record is being processed for consignee information
GIVEN
A shipment record is being processed for consignee information
Applied to: EDI BOL Consignee Data Available?
WHEN
The system checks for EDI BOL consignee data availability by looking up EBSNRSC segment with type 'CN' and sequence '01'
THEN
If EDI BOL consignee data is found, use EDI data source; otherwise fallback to Fastway shipment root data
Context: EDI BOL consignee data is available in EBSNRSC segment
GIVEN
EDI BOL consignee data is available in EBSNRSC segment
Applied to: Extract Consignee Name and CHOP from EDI BOL
WHEN
The system processes the consignee N1 segment data
THEN
Set entity ID to 'CN', extract consignee name from D1-SHIPPER-NAME, extract CHOP code from D1-CONS-CHOP, and clear ID code qualifier and ID code fields
Context: EDI BOL consignee data is not available
GIVEN
EDI BOL consignee data is not available
Applied to: Use Fastway Consignee Data
WHEN
The system needs consignee information for the manifest
THEN
Set entity ID to 'CN', extract consignee name from CONS-DATA(1) of SHIPROOT, extract CHOP code from CONS-CHOP of SHIPROOT, and clear ID code qualifier and ID code fields
Context: Consignee basic information has been processed
GIVEN
Consignee basic information has been processed
Applied to: EDI BOL Consignee Address Available?
WHEN
The system checks for EDI BOL consignee address data by looking up EBSNRSA segment with types 'CN' and 'CA'
THEN
If EDI BOL address data is found, use EDI address source; otherwise use Fastway address data
Context: EDI BOL consignee address data is available in EBSNRSA segment
GIVEN
EDI BOL consignee address data is available in EBSNRSA segment
Applied to: Extract Address from EDI BOL
WHEN
The system processes the consignee address information
THEN
Extract address line 1 from D2-ADDL-NAME-ADDR-1, extract address line 2 from D2-ADDL-NAME-ADDR-2, and if address line 1 is blank set it to 'NA'
Context: EDI BOL consignee address data is not available
GIVEN
EDI BOL consignee address data is not available
Applied to: Use Fastway Address Data
WHEN
The system needs consignee address information
THEN
If CONS-DATA(3) is blank set address line 1 to 'NA', otherwise use CONS-DATA(3) for address line 1, and set address line 2 to spaces
Context: Consignee address information has been processed
GIVEN
Consignee address information has been processed
Applied to: EDI BOL Consignee City/State Available?
WHEN
The system checks for EDI BOL consignee city/state data by looking up EBSNRSA segment with types 'CN' and 'CC'
THEN
If EDI BOL city/state data is found, use EDI source; otherwise parse Fastway address data
Context: EDI BOL consignee city/state data is available in EBSNRSA segment
GIVEN
EDI BOL consignee city/state data is available in EBSNRSA segment
Applied to: Extract City/State/Postal from EDI BOL
WHEN
The system processes the consignee location information
THEN
Extract city from D4-CITY-NAME, extract state/province from D4-STATE-PROV-CODE, extract postal code from D4-POSTAL-CODE, and extract country code from D4-COUNTRY-CODE
Context: EDI BOL consignee city/state data is not available
GIVEN
EDI BOL consignee city/state data is not available
Applied to: Parse Fastway Address for City/State/Postal
WHEN
The system needs consignee location information
THEN
Parse CONS-DATA(4) to extract city name, state/province code, and postal code, then lookup country code from state/province using TB-STATE-COUNTRY table
Context: Consignee location information has been processed
GIVEN
Consignee location information has been processed
Applied to: EDI BOL Contact Info Available?
WHEN
The system checks for EDI BOL consignee contact data by looking up EBSNRSA segment with types 'CN' and 'GP'
THEN
If EDI BOL contact data is found, extract contact information; otherwise set contact fields to blank
Context: EDI BOL consignee contact data is available in EBSNRSA segment
GIVEN
EDI BOL consignee contact data is available in EBSNRSA segment
Applied to: Extract Contact Information from EDI BOL
WHEN
The system processes the consignee contact information
THEN
Extract contact function code from PER-CONTACT-FUNC-CODE, extract contact name from PER-NAME, extract communication number qualifier from PER-COMMUN-NO-QUAL, and extract communication number from PER-COMMUN-NUMBER
Context: Shipper and consignee records have been processed
GIVEN
Shipper and consignee records have been processed
Applied to: Apply Address Defaults if Missing
WHEN
Required address fields are missing or incomplete
THEN
Set address line 1 to 'NA' if blank, set address line 2 to 'NA' if blank or contains only one character followed by spaces, and set default country codes ('US' for shipper, 'CA' for consignee) when address line 2 is defaulted
Context: A state or province code is available for shipper or consignee
GIVEN
A state or province code is available for shipper or consignee
Applied to: Determine Country Code from State/Province
WHEN
The system needs to determine the corresponding country code
THEN
Search TB-STATE-COUNTRY table for matching state/province code and set country code from the corresponding table entry, or set to spaces if no match found
R-GCCCCADD-cbl-02439 (+25) File: GCCCCADD.cbl Process additional entity types with address validation and contact information Merged 26 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process additional entity types with address validation and contact information':
  • Context - an edi bol record exists with sf entity type pn in sequence 01:
    For Process SF - Stuffer Entity:
    When the system processes sf entity data, then the system extracts sf name, address information, city/state/postal data, and contact information, validates the entity data, and creates a record with entity id 'sf'.
  • Context - sf entity is being processed:
    For Get SF Address Data:
    When the sf address information is spaces or empty, then the system sets the address to 'na' as default value.
  • Context - an edi bol record exists with uc entity type un in sequence 01:
    For Process UC - Ultimate Consignee:
    When the system processes uc entity data, then the system extracts uc name, address information, city/state/postal data, and contact information, validates the entity data, and creates a record with entity id 'uc'.
  • Context - uc entity is being processed:
    For Get UC Address Data:
    When the uc address information is not found or spaces, then the system sets the primary address to 'na' and secondary address to spaces as default values.
  • Context - an edi bol record exists with bn entity type in sequence 01 and organization id is 'bn':
    For Process BN - Beneficial Owner:
    When the system processes bn entity data, then the system extracts bn name, consignee chop code, address information, city/state/postal data, validates the entity data, and creates a record with entity id 'bn'.
  • Context - bn entity is being processed:
    For Get BN Address Data:
    When the bn address information is spaces or empty, then the system sets the address to 'na' as default value.
  • Context - transportation data exists with organization id 'c1' or consignee data code is 'c' in fastway:
    For Process C1 - Carrier Entity:
    When the system processes c1 entity data, then the system extracts c1 name from edi transportation data if found, otherwise uses consignee data from fastway, gets address and contact information, validates the entity data, and creates a record with entity id 'c1'.
  • Context - c1 entity is being processed from fastway data:
    For Get C1 Address Data:
    When the c1 address information is spaces or empty, then the system sets the address to 'na' as default value.
  • Context - edi transportation data exists with organization id 'n1':
    For Process N1 - Notify Party:
    When the system processes n1 entity data, then the system extracts n1 name, address, and contact information, validates the entity data, and creates a record with entity id 'n1'.
  • Context - edi mcoa data exists with organization id 'pf' or 'ss' and type 'ot':
    For Process PF/SS - MCOA Entities:
    When the system processes pf/ss entity data, then the system extracts entity name, id code qualifier, id code, address information from on segment, city/state/postal data from oc segment, validates the entity data, and creates a record with the respective entity id.
  • Context - pf/ss entity is being processed:
    For Get PF/SS Address Data:
    When the pf/ss address information is not found in on segment, then the system sets the primary address to 'na' and secondary address to spaces as default values.
  • Context - edi transportation data exists with organization id matching '11', 'mc', 'oo', or 'fw':
    For Process Additional Entities - 11, MC, OO, FW:
    When the system processes the additional entity data, then the system extracts entity name, address information from t2 segment, city/state/postal data from ta segment, contact information from t3 segment, validates the entity data, and creates a record with the respective entity id.
  • Context - additional entity (11, mc, oo, fw) is being processed:
    For Get Entity Address Data:
    When the entity address information is spaces or empty, then the system sets the address to 'na' as default value.
  • Context - edi bol data exists with nn entity type and entity id code is valid:
    For Process NN - Multiple Entities:
    When the system processes nn entity data for each sequence number, then the system extracts entity name, consignee chop code, address information from gc segment, city/state/postal data from ga segment, validates the entity data, and creates a record with the entity id from the nn segment.
  • Context - nn entity is being processed:
    For Get NN Address Data:
    When the nn address information is not found in gc segment or is spaces, then the system sets the address to 'na' as default value and clears secondary address.
  • Context - entity data contains address, city/state, or contact information:
    For Validate Required Fields:
    When the entity id code or entity name is missing, then the system generates required field error messages for missing entity id code and entity name.
  • Context - entity sequence number is greater than 2 (not shipper or consignee):
    For Validate Required Fields:
    When entity id code is present but not in valid values list or is shipper/consignee/customs broker, then the system generates an invalid entity id code error message.
  • Context - entity has a valid entity id code:
    For Validate Address Information:
    When the primary address information is missing or spaces, then the system generates a required address information error message.
  • Context - entity has address data present:
    For Validate Address Information:
    When city name is missing or has less than 2 characters, then the system generates required city name error message or minimum length error message.
    For Validate Address Information:
    When country code is missing or spaces, then the system generates a required country code error message.
  • Context - entity has postal code information:
    For Validate Address Information:
    When postal code is present but has less than 3 characters, then the system generates a minimum length error message for postal code.
  • Context - entity country code is canada, usa, or mexico:
    For Validate Address Information:
    When state/province code is missing or invalid for the specified country, then the system generates required state/province error message or invalid state/province error message.
  • Context - entity has state/province code but missing country code:
    For Validate Address Information:
    When state/province code matches an entry in the state-country lookup table, then the system sets the country code based on the lookup table match.
  • Context - entity has contact person name or communication number:
    For Validate Contact Information:
    When communication number qualifier is missing, then the system generates a required communication qualifier error message.
  • Context - entity has communication number qualifier:
    For Validate Contact Information:
    When communication qualifier is not spaces, 'fx' (fax), or 'te' (telephone), then the system generates an invalid communication qualifier error message.
  • Context - entity has communication number qualifier or contact person name:
    For Validate Contact Information:
    When communication number is missing or spaces, then the system generates a required communication number error message.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL record exists with SF entity type PN in sequence 01
GIVEN
An EDI BOL record exists with SF entity type PN in sequence 01
Applied to: Process SF - Stuffer Entity
WHEN
The system processes SF entity data
THEN
The system extracts SF name, address information, city/state/postal data, and contact information, validates the entity data, and creates a record with entity ID 'SF'
Context: SF entity is being processed
GIVEN
SF entity is being processed
Applied to: Get SF Address Data
WHEN
The SF address information is spaces or empty
THEN
The system sets the address to 'NA' as default value
Context: An EDI BOL record exists with UC entity type UN in sequence 01
GIVEN
An EDI BOL record exists with UC entity type UN in sequence 01
Applied to: Process UC - Ultimate Consignee
WHEN
The system processes UC entity data
THEN
The system extracts UC name, address information, city/state/postal data, and contact information, validates the entity data, and creates a record with entity ID 'UC'
Context: UC entity is being processed
GIVEN
UC entity is being processed
Applied to: Get UC Address Data
WHEN
The UC address information is not found or spaces
THEN
The system sets the primary address to 'NA' and secondary address to spaces as default values
Context: An EDI BOL record exists with BN entity type in sequence 01 and organization ID is 'BN'
GIVEN
An EDI BOL record exists with BN entity type in sequence 01 and organization ID is 'BN'
Applied to: Process BN - Beneficial Owner
WHEN
The system processes BN entity data
THEN
The system extracts BN name, consignee chop code, address information, city/state/postal data, validates the entity data, and creates a record with entity ID 'BN'
Context: BN entity is being processed
GIVEN
BN entity is being processed
Applied to: Get BN Address Data
WHEN
The BN address information is spaces or empty
THEN
The system sets the address to 'NA' as default value
Context: Transportation data exists with organization ID 'C1' or consignee data code is 'C' in Fastway
GIVEN
Transportation data exists with organization ID 'C1' or consignee data code is 'C' in Fastway
Applied to: Process C1 - Carrier Entity
WHEN
The system processes C1 entity data
THEN
The system extracts C1 name from EDI transportation data if found, otherwise uses consignee data from Fastway, gets address and contact information, validates the entity data, and creates a record with entity ID 'C1'
Context: C1 entity is being processed from Fastway data
GIVEN
C1 entity is being processed from Fastway data
Applied to: Get C1 Address Data
WHEN
The C1 address information is spaces or empty
THEN
The system sets the address to 'NA' as default value
Context: EDI transportation data exists with organization ID 'N1'
GIVEN
EDI transportation data exists with organization ID 'N1'
Applied to: Process N1 - Notify Party
WHEN
The system processes N1 entity data
THEN
The system extracts N1 name, address, and contact information, validates the entity data, and creates a record with entity ID 'N1'
Context: EDI MCOA data exists with organization ID 'PF' or 'SS' and type 'OT'
GIVEN
EDI MCOA data exists with organization ID 'PF' or 'SS' and type 'OT'
Applied to: Process PF/SS - MCOA Entities
WHEN
The system processes PF/SS entity data
THEN
The system extracts entity name, ID code qualifier, ID code, address information from ON segment, city/state/postal data from OC segment, validates the entity data, and creates a record with the respective entity ID
Context: PF/SS entity is being processed
GIVEN
PF/SS entity is being processed
Applied to: Get PF/SS Address Data
WHEN
The PF/SS address information is not found in ON segment
THEN
The system sets the primary address to 'NA' and secondary address to spaces as default values
Context: EDI transportation data exists with organization ID matching '11', 'MC', 'OO', or 'FW'
GIVEN
EDI transportation data exists with organization ID matching '11', 'MC', 'OO', or 'FW'
Applied to: Process Additional Entities - 11, MC, OO, FW
WHEN
The system processes the additional entity data
THEN
The system extracts entity name, address information from T2 segment, city/state/postal data from TA segment, contact information from T3 segment, validates the entity data, and creates a record with the respective entity ID
Context: Additional entity (11, MC, OO, FW) is being processed
GIVEN
Additional entity (11, MC, OO, FW) is being processed
Applied to: Get Entity Address Data
WHEN
The entity address information is spaces or empty
THEN
The system sets the address to 'NA' as default value
Context: EDI BOL data exists with NN entity type and entity ID code is valid
GIVEN
EDI BOL data exists with NN entity type and entity ID code is valid
Applied to: Process NN - Multiple Entities
WHEN
The system processes NN entity data for each sequence number
THEN
The system extracts entity name, consignee chop code, address information from GC segment, city/state/postal data from GA segment, validates the entity data, and creates a record with the entity ID from the NN segment
Context: NN entity is being processed
GIVEN
NN entity is being processed
Applied to: Get NN Address Data
WHEN
The NN address information is not found in GC segment or is spaces
THEN
The system sets the address to 'NA' as default value and clears secondary address
Context: Entity data contains address, city/state, or contact information
GIVEN
Entity data contains address, city/state, or contact information
Applied to: Validate Required Fields
WHEN
The entity ID code or entity name is missing
THEN
The system generates required field error messages for missing entity ID code and entity name
Context: Entity sequence number is greater than 2 (not shipper or consignee)
GIVEN
Entity sequence number is greater than 2 (not shipper or consignee)
Applied to: Validate Required Fields
WHEN
Entity ID code is present but not in valid values list or is shipper/consignee/customs broker
THEN
The system generates an invalid entity ID code error message
Context: Entity has a valid entity ID code
GIVEN
Entity has a valid entity ID code
Applied to: Validate Address Information
WHEN
The primary address information is missing or spaces
THEN
The system generates a required address information error message
Context: Entity has address data present
GIVEN
Entity has address data present
Applied to: Validate Address Information
WHEN
City name is missing or has less than 2 characters
THEN
The system generates required city name error message or minimum length error message
Applied to: Validate Address Information
WHEN
Country code is missing or spaces
THEN
The system generates a required country code error message
Context: Entity has postal code information
GIVEN
Entity has postal code information
Applied to: Validate Address Information
WHEN
Postal code is present but has less than 3 characters
THEN
The system generates a minimum length error message for postal code
Context: Entity country code is Canada, USA, or Mexico
GIVEN
Entity country code is Canada, USA, or Mexico
Applied to: Validate Address Information
WHEN
State/province code is missing or invalid for the specified country
THEN
The system generates required state/province error message or invalid state/province error message
Context: Entity has state/province code but missing country code
GIVEN
Entity has state/province code but missing country code
Applied to: Validate Address Information
WHEN
State/province code matches an entry in the state-country lookup table
THEN
The system sets the country code based on the lookup table match
Context: Entity has contact person name or communication number
GIVEN
Entity has contact person name or communication number
Applied to: Validate Contact Information
WHEN
Communication number qualifier is missing
THEN
The system generates a required communication qualifier error message
Context: Entity has communication number qualifier
GIVEN
Entity has communication number qualifier
Applied to: Validate Contact Information
WHEN
Communication qualifier is not spaces, 'FX' (fax), or 'TE' (telephone)
THEN
The system generates an invalid communication qualifier error message
Context: Entity has communication number qualifier or contact person name
GIVEN
Entity has communication number qualifier or contact person name
Applied to: Validate Contact Information
WHEN
Communication number is missing or spaces
THEN
The system generates a required communication number error message
R-GCCCCADD-cbl-02465 (+20) File: GCCCCADD.cbl Execute AU table lookup with importer data extraction and CSA indicator management Merged 21 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute AU table lookup with importer data extraction and CSA indicator management':
  • Context - a customs manifest processing request is initiated:
    For Initialize AU Table Parameters:
    When the system needs to lookup importer information from the au table, then the system initializes lookup parameters by clearing all table keys and flags, setting function code to 'gu' for retrieval, setting table id to 'au', and preparing for database access.
  • Context - au table lookup parameters are initialized and consignee chop code exists in the shipment data:
    For Set Consignee CHOP as Key:
    When the system prepares the au table lookup key, then the system sets the consignee chop code from the shipment root as the chop key in the au table lookup parameters.
  • Context - au table lookup parameters have consignee chop set and commodity code exists in the manifest data:
    For Set Commodity Code as Key:
    When the system completes the au table lookup key configuration, then the system sets the commodity code from the manifest as the commodity key in the au table lookup parameters.
  • Context - au table lookup parameters are fully configured with consignee chop and commodity code:
    For Execute AU Table Lookup:
    When the system executes the au table lookup, then the system calls the table i/o routine to retrieve the au record and sets the return status based on whether a matching record is found.
  • Context - au table lookup has been executed with consignee chop and commodity code:
    For AU Record Found?:
    When the system evaluates the lookup results, then if the lookup return flag indicates success, the system proceeds to extract au data; otherwise, it skips au processing and continues with the next step.
  • Context - au table lookup found a matching record:
    For Extract AU Importer Data:
    When the system processes the au record data, then the system extracts the importer name from the au table segment and stores it for further processing.
  • Context - au record data has been accessed and importer name extracted:
    For Extract AU Business Number:
    When the system continues processing the au record, then the system extracts the business number from the au table segment for importer business identification.
  • Context - au importer and business number data have been extracted:
    For Check CSA Indicator Status:
    When the system checks the current csa indicator status and existing importer data, then if csa indicator is already on or importer data is already populated from another source, the system skips au data assignment; otherwise, it proceeds to set au data.
  • Context - au data is available and csa indicator is not already active and no existing importer data:
    For Set Importer Name from AU:
    When the system assigns au importer information to the manifest, then the system sets the importer name field in the customs manifest to the importer value from the au table record.
  • Context - au importer name has been assigned to the manifest:
    For Set Business Number from AU:
    When the system continues assigning au business information, then the system sets the business number field in the customs manifest to the business number value from the au table record.
  • Context - au business number has been assigned to the manifest:
    For Set Business Number Qualifier to M5:
    When the system sets the business number qualifier, then the system sets the business number qualifier field to 'm5' to indicate the business number source type.
  • Context - au importer data and business number qualifier have been assigned:
    For Turn CSA Indicator ON:
    When the system finalizes au data assignment, then the system turns on the csa indicator to reflect that the importer is eligible for customs self-assessment processing.
  • Context - au importer data has been successfully assigned and csa indicator activated:
    For Mark AU Importer Found Flag:
    When the system updates processing status flags, then the system sets the au importer found flag to true to track that au processing was successful.
  • Context - au processing has completed and au importer found flag is set:
    For AU Importer Found AND S55 Importer Not Found?:
    When the system evaluates whether to create a new importer record, then if au importer was found and no s55 importer record exists, the system proceeds to create a new importer record; otherwise, it completes au processing.
  • Context - conditions are met for creating a new importer record:
    For Create Importer Record in Customs:
    When the system creates the importer record, then the system initializes a new gcsccs55 record structure, sets the ccn key, record type to '55', and assigns the next available sequence number.
  • Context - a new importer record structure has been created:
    For Set Entity ID to IM:
    When the system sets the entity classification, then the system sets the entity id code to 'im' to identify this record as an importer entity.
  • Context - importer record has entity id set and au importer name is available:
    For Set Importer Name:
    When the system populates importer identification fields, then the system sets the name field in the customs record to the au importer name and also updates the main importer field in the manifest.
  • Context - importer name has been set in the customs record:
    For Set Business Number and Qualifier:
    When the system completes business identification setup, then the system sets the id code to the au business number, sets the id code qualifier to 'm5', and updates corresponding fields in the main manifest.
  • Context - business identification fields have been set in the importer record:
    For Set Default Address to NA:
    When the system sets address information, then the system sets the primary address field to 'na' (not available) and clears the secondary address field and all location fields.
  • Context - address information has been set with default values:
    For Clear Contact Information:
    When the system initializes contact fields, then the system clears all contact-related fields including per data to indicate no contact information is available.
  • Context - new importer record has been fully populated with au data:
    For Turn CSA Indicator ON:
    When the system finalizes the record creation, then the system turns on the csa indicator in the main manifest to enable customs self-assessment processing for this importer.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest processing request is initiated
GIVEN
A customs manifest processing request is initiated
Applied to: Initialize AU Table Parameters
WHEN
The system needs to lookup importer information from the AU table
THEN
The system initializes lookup parameters by clearing all table keys and flags, setting function code to 'GU' for retrieval, setting table ID to 'AU', and preparing for database access
Context: AU table lookup parameters are initialized and consignee CHOP code exists in the shipment data
GIVEN
AU table lookup parameters are initialized and consignee CHOP code exists in the shipment data
Applied to: Set Consignee CHOP as Key
WHEN
The system prepares the AU table lookup key
THEN
The system sets the consignee CHOP code from the shipment root as the CHOP key in the AU table lookup parameters
Context: AU table lookup parameters have consignee CHOP set and commodity code exists in the manifest data
GIVEN
AU table lookup parameters have consignee CHOP set and commodity code exists in the manifest data
Applied to: Set Commodity Code as Key
WHEN
The system completes the AU table lookup key configuration
THEN
The system sets the commodity code from the manifest as the commodity key in the AU table lookup parameters
Context: AU table lookup parameters are fully configured with consignee CHOP and commodity code
GIVEN
AU table lookup parameters are fully configured with consignee CHOP and commodity code
Applied to: Execute AU Table Lookup
WHEN
The system executes the AU table lookup
THEN
The system calls the table I/O routine to retrieve the AU record and sets the return status based on whether a matching record is found
Context: AU table lookup has been executed with consignee CHOP and commodity code
GIVEN
AU table lookup has been executed with consignee CHOP and commodity code
Applied to: AU Record Found?
WHEN
The system evaluates the lookup results
THEN
If the lookup return flag indicates success, the system proceeds to extract AU data; otherwise, it skips AU processing and continues with the next step
Context: AU table lookup found a matching record
GIVEN
AU table lookup found a matching record
Applied to: Extract AU Importer Data
WHEN
The system processes the AU record data
THEN
The system extracts the importer name from the AU table segment and stores it for further processing
Context: AU record data has been accessed and importer name extracted
GIVEN
AU record data has been accessed and importer name extracted
Applied to: Extract AU Business Number
WHEN
The system continues processing the AU record
THEN
The system extracts the business number from the AU table segment for importer business identification
Context: AU importer and business number data have been extracted
GIVEN
AU importer and business number data have been extracted
Applied to: Check CSA Indicator Status
WHEN
The system checks the current CSA indicator status and existing importer data
THEN
If CSA indicator is already on OR importer data is already populated from another source, the system skips AU data assignment; otherwise, it proceeds to set AU data
Context: AU data is available and CSA indicator is not already active and no existing importer data
GIVEN
AU data is available and CSA indicator is not already active and no existing importer data
Applied to: Set Importer Name from AU
WHEN
The system assigns AU importer information to the manifest
THEN
The system sets the importer name field in the customs manifest to the importer value from the AU table record
Context: AU importer name has been assigned to the manifest
GIVEN
AU importer name has been assigned to the manifest
Applied to: Set Business Number from AU
WHEN
The system continues assigning AU business information
THEN
The system sets the business number field in the customs manifest to the business number value from the AU table record
Context: AU business number has been assigned to the manifest
GIVEN
AU business number has been assigned to the manifest
Applied to: Set Business Number Qualifier to M5
WHEN
The system sets the business number qualifier
THEN
The system sets the business number qualifier field to 'M5' to indicate the business number source type
Context: AU importer data and business number qualifier have been assigned
GIVEN
AU importer data and business number qualifier have been assigned
Applied to: Turn CSA Indicator ON
WHEN
The system finalizes AU data assignment
THEN
The system turns on the CSA indicator to reflect that the importer is eligible for customs self-assessment processing
Context: AU importer data has been successfully assigned and CSA indicator activated
GIVEN
AU importer data has been successfully assigned and CSA indicator activated
Applied to: Mark AU Importer Found Flag
WHEN
The system updates processing status flags
THEN
The system sets the AU importer found flag to true to track that AU processing was successful
Context: AU processing has completed and AU importer found flag is set
GIVEN
AU processing has completed and AU importer found flag is set
Applied to: AU Importer Found AND S55 Importer Not Found?
WHEN
The system evaluates whether to create a new importer record
THEN
If AU importer was found AND no S55 importer record exists, the system proceeds to create a new importer record; otherwise, it completes AU processing
Context: Conditions are met for creating a new importer record
GIVEN
Conditions are met for creating a new importer record
Applied to: Create Importer Record in Customs
WHEN
The system creates the importer record
THEN
The system initializes a new GCSCCS55 record structure, sets the CCN key, record type to '55', and assigns the next available sequence number
Context: A new importer record structure has been created
GIVEN
A new importer record structure has been created
Applied to: Set Entity ID to IM
WHEN
The system sets the entity classification
THEN
The system sets the entity ID code to 'IM' to identify this record as an importer entity
Context: Importer record has entity ID set and AU importer name is available
GIVEN
Importer record has entity ID set and AU importer name is available
Applied to: Set Importer Name
WHEN
The system populates importer identification fields
THEN
The system sets the name field in the customs record to the AU importer name and also updates the main importer field in the manifest
Context: Importer name has been set in the customs record
GIVEN
Importer name has been set in the customs record
Applied to: Set Business Number and Qualifier
WHEN
The system completes business identification setup
THEN
The system sets the ID code to the AU business number, sets the ID code qualifier to 'M5', and updates corresponding fields in the main manifest
Context: Business identification fields have been set in the importer record
GIVEN
Business identification fields have been set in the importer record
Applied to: Set Default Address to NA
WHEN
The system sets address information
THEN
The system sets the primary address field to 'NA' (Not Available) and clears the secondary address field and all location fields
Context: Address information has been set with default values
GIVEN
Address information has been set with default values
Applied to: Clear Contact Information
WHEN
The system initializes contact fields
THEN
The system clears all contact-related fields including PER data to indicate no contact information is available
Context: New importer record has been fully populated with AU data
GIVEN
New importer record has been fully populated with AU data
Applied to: Turn CSA Indicator ON
WHEN
The system finalizes the record creation
THEN
The system turns on the CSA indicator in the main manifest to enable customs self-assessment processing for this importer
R-GCCCCADD-cbl-02486 (+5) File: GCCCCADD.cbl Execute progressive broker search with expanding criteria and wildcard matching Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute progressive broker search with expanding criteria and wildcard matching':
  • Context - a shipment requires broker assignment and all search criteria are available (shipper chop code, consignee chop code, origin station number, destination station number, origin splc as wildcard, destination splc with road number, and commodity code):
    For Search 1: Full Criteria Match:
    When the system executes the first broker search with complete criteria, then the system calls the crossing table lookup service with all specified parameters and sets the broker data found flag based on the lookup result.
  • Context - the initial broker search with full criteria returned no results:
    For Search 2: Wildcard Shipper CHOP:
    When the system executes the second broker search replacing shipper chop code with wildcard and keeping consignee chop, origin station, destination station, origin splc, destination splc with road number, and commodity code unchanged, then the system calls the crossing table lookup service with modified criteria and sets the broker data found flag based on the lookup result.
  • Context - both the initial and secondary broker searches returned no results:
    For Search 3: Wildcard All Criteria:
    When the system executes the third broker search replacing shipper chop code, origin station, and commodity code with wildcards while keeping consignee chop, destination station, origin splc, and destination splc with road number unchanged, then the system calls the crossing table lookup service with maximum wildcard criteria and sets the broker data found flag based on the lookup result.
  • Context - broker data has been found in the crossing table lookup:
    For Override Flag = Y?:
    When the override flag in the crossing table data equals 'y', then the system unconditionally applies the broker name from the crossing table and updates the manifest-to station if specified in the crossing table data.
  • Context - broker data has been found in the crossing table lookup and the override flag is not 'y':
    For Current Broker Empty or Default?:
    When the current broker name is spaces, 'unknown', or 'not-req', then the system applies the broker name from the crossing table and updates the manifest-to station if specified in the crossing table data.
  • Context - broker data has been applied from the crossing table:
    For Update Manifest-To Station:
    When the crossing table data contains a canadian manifest-to station specification that is not spaces, then the system updates the manifest-to station name, performs mc table lookup for the new station, validates the canadian customs code, and updates related station information including customs code, station number, and call letters.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment requires broker assignment and all search criteria are available (shipper CHOP code, consignee CHOP code, origin station number, destination station number, origin SPLC as wildcard, destination SPLC with road number, and commodity code)
GIVEN
A shipment requires broker assignment and all search criteria are available (shipper CHOP code, consignee CHOP code, origin station number, destination station number, origin SPLC as wildcard, destination SPLC with road number, and commodity code)
Applied to: Search 1: Full Criteria Match
WHEN
The system executes the first broker search with complete criteria
THEN
The system calls the crossing table lookup service with all specified parameters and sets the broker data found flag based on the lookup result
Context: The initial broker search with full criteria returned no results
GIVEN
The initial broker search with full criteria returned no results
Applied to: Search 2: Wildcard Shipper CHOP
WHEN
The system executes the second broker search replacing shipper CHOP code with wildcard and keeping consignee CHOP, origin station, destination station, origin SPLC, destination SPLC with road number, and commodity code unchanged
THEN
The system calls the crossing table lookup service with modified criteria and sets the broker data found flag based on the lookup result
Context: Both the initial and secondary broker searches returned no results
GIVEN
Both the initial and secondary broker searches returned no results
Applied to: Search 3: Wildcard All Criteria
WHEN
The system executes the third broker search replacing shipper CHOP code, origin station, and commodity code with wildcards while keeping consignee CHOP, destination station, origin SPLC, and destination SPLC with road number unchanged
THEN
The system calls the crossing table lookup service with maximum wildcard criteria and sets the broker data found flag based on the lookup result
Context: Broker data has been found in the crossing table lookup
GIVEN
Broker data has been found in the crossing table lookup
Applied to: Override Flag = Y?
WHEN
The override flag in the crossing table data equals 'Y'
THEN
The system unconditionally applies the broker name from the crossing table and updates the manifest-to station if specified in the crossing table data
Context: Broker data has been found in the crossing table lookup and the override flag is not 'Y'
GIVEN
Broker data has been found in the crossing table lookup and the override flag is not 'Y'
Applied to: Current Broker Empty or Default?
WHEN
The current broker name is spaces, 'UNKNOWN', or 'NOT-REQ'
THEN
The system applies the broker name from the crossing table and updates the manifest-to station if specified in the crossing table data
Context: Broker data has been applied from the crossing table
GIVEN
Broker data has been applied from the crossing table
Applied to: Update Manifest-To Station
WHEN
The crossing table data contains a Canadian manifest-to station specification that is not spaces
THEN
The system updates the manifest-to station name, performs MC table lookup for the new station, validates the Canadian customs code, and updates related station information including customs code, station number, and call letters
R-GCCCCADD-cbl-02492 (+19) File: GCCCCADD.cbl Build entity segments with comprehensive address and contact validation Merged 20 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build entity segments with comprehensive address and contact validation':
  • Context - edi bol contains stuffer entity data with entity id 'pn':
    For Build SF - Stuffer Entity:
    When processing stuffer entity segment, then create sf entity record with name, address, city/state/postal, and contact information from edi data.
  • Context - edi bol contains ultimate consignee entity data with entity id 'un':
    For Build UC - Ultimate Consignee Entity:
    When processing ultimate consignee entity segment, then create uc entity record with name, address, city/state/postal, and contact information from edi data.
  • Context - edi bol contains beneficial owner entity data with organization id 'bn':
    For Build BN - Beneficial Owner Entity:
    When processing beneficial owner entity segment, then create bn entity record with name, address, city/state/postal information from transportation data.
  • Context - edi transportation data contains organization id 'c1' or fastway consignee data code is 'c':
    For Build C1 - Carrier Entity:
    When processing carrier entity segment, then create c1 entity record with name, address, city/state/postal, and contact information from available data source.
  • Context - edi transportation data contains organization id 'n1':
    For Build N1 - Notify Party Entity:
    When processing notify party entity segment, then create n1 entity record with name, address, city/state/postal, and contact information.
  • Context - edi charges data contains organization id 'pf' or 'ss':
    For Build PF/SS - Payment/Service Entities:
    When processing payment/service entity segments, then create entity record with organization id, name, id code qualifier, id code, address, and city/state/postal information.
  • Context - edi transportation data contains organization ids '11', 'nn', 'mc', 'oo', or 'fw':
    For Build Additional Entities - 11, NN, MC, OO, FW:
    When processing additional entity segments, then create corresponding entity records with name, address, city/state/postal, and contact information.
  • Context - edi bol contains importer entity data or existing importer data is available:
    For Build IM - Importer Entity:
    When processing importer entity segment, then create im entity record with name, business number, qualifier, address, and contact information, and set csa indicator appropriately.
  • Context - entity record has address, city/state, or contact information:
    For Check Entity ID Values:
    When entity id is blank or entity name is blank, then generate validation error for required entity id and name fields.
  • Context - entity sequence number is greater than 2:
    For Validate Name Requirements:
    When entity id is not in valid list or is shipper/consignee/customs broker, then generate validation error for invalid entity id value.
  • Context - entity id and name are not blank:
    For Validate Address Line 1 Required:
    When address line 1 is blank, then generate validation error for required address information.
  • Context - entity record is being created:
    For Set NA for Missing Address:
    When address line 1 is blank, then set address line 1 to 'na'.
  • Context - city/state/postal information is provided:
    For Check City Name Length ≥ 2:
    When city name is present and city name length is less than 2 characters, then generate validation error for minimum length requirement.
    For Check Postal Code Length ≥ 3:
    When postal code is present and postal code length is less than 3 characters, then generate validation error for minimum length requirement.
  • Context - country code is canada, usa, or mexico:
    For Validate State Required for CA/US/MX:
    When state/province code is blank, then generate validation error for required state/province information.
  • Context - state/province code and country code are both provided:
    For Validate Province-Country Match:
    When state/province code does not match the country code in reference table, then generate validation error for invalid state/province combination.
  • Context - state/province code is provided and country code is blank:
    For Assign Country Codes:
    When processing address information, then look up country code from state-country reference table and assign to country field.
  • Context - contact information is provided:
    For Validate Communication Qualifier:
    When communication qualifier is not blank, 'fx', or 'te', then generate validation error for invalid communication qualifier value.
  • Context - communication qualifier is not blank or contact name is not blank:
    For Check Communication Number Required:
    When communication number is blank, then generate validation error for required communication number.
  • Context - entity is shipper (sequence 1) or consignee (sequence 2):
    For Validate Entity Data Complete:
    When entity name, address, city/state/postal, and contact information are all blank, then generate validation errors for all required shipper or consignee fields.
👨‍💻 Technical ACs (Gherkin)
Context: EDI BOL contains stuffer entity data with entity ID 'PN'
GIVEN
EDI BOL contains stuffer entity data with entity ID 'PN'
Applied to: Build SF - Stuffer Entity
WHEN
Processing stuffer entity segment
THEN
Create SF entity record with name, address, city/state/postal, and contact information from EDI data
Context: EDI BOL contains ultimate consignee entity data with entity ID 'UN'
GIVEN
EDI BOL contains ultimate consignee entity data with entity ID 'UN'
Applied to: Build UC - Ultimate Consignee Entity
WHEN
Processing ultimate consignee entity segment
THEN
Create UC entity record with name, address, city/state/postal, and contact information from EDI data
Context: EDI BOL contains beneficial owner entity data with organization ID 'BN'
GIVEN
EDI BOL contains beneficial owner entity data with organization ID 'BN'
Applied to: Build BN - Beneficial Owner Entity
WHEN
Processing beneficial owner entity segment
THEN
Create BN entity record with name, address, city/state/postal information from transportation data
Context: EDI transportation data contains organization ID 'C1' OR Fastway consignee data code is 'C'
GIVEN
EDI transportation data contains organization ID 'C1' OR Fastway consignee data code is 'C'
Applied to: Build C1 - Carrier Entity
WHEN
Processing carrier entity segment
THEN
Create C1 entity record with name, address, city/state/postal, and contact information from available data source
Context: EDI transportation data contains organization ID 'N1'
GIVEN
EDI transportation data contains organization ID 'N1'
Applied to: Build N1 - Notify Party Entity
WHEN
Processing notify party entity segment
THEN
Create N1 entity record with name, address, city/state/postal, and contact information
Context: EDI charges data contains organization ID 'PF' or 'SS'
GIVEN
EDI charges data contains organization ID 'PF' or 'SS'
Applied to: Build PF/SS - Payment/Service Entities
WHEN
Processing payment/service entity segments
THEN
Create entity record with organization ID, name, ID code qualifier, ID code, address, and city/state/postal information
Context: EDI transportation data contains organization IDs '11', 'NN', 'MC', 'OO', or 'FW'
GIVEN
EDI transportation data contains organization IDs '11', 'NN', 'MC', 'OO', or 'FW'
Applied to: Build Additional Entities - 11, NN, MC, OO, FW
WHEN
Processing additional entity segments
THEN
Create corresponding entity records with name, address, city/state/postal, and contact information
Context: EDI BOL contains importer entity data OR existing importer data is available
GIVEN
EDI BOL contains importer entity data OR existing importer data is available
Applied to: Build IM - Importer Entity
WHEN
Processing importer entity segment
THEN
Create IM entity record with name, business number, qualifier, address, and contact information, and set CSA indicator appropriately
Context: Entity record has address, city/state, or contact information
GIVEN
Entity record has address, city/state, or contact information
Applied to: Check Entity ID Values
WHEN
Entity ID is blank OR entity name is blank
THEN
Generate validation error for required entity ID and name fields
Context: Entity sequence number is greater than 2
GIVEN
Entity sequence number is greater than 2
Applied to: Validate Name Requirements
WHEN
Entity ID is not in valid list OR is shipper/consignee/customs broker
THEN
Generate validation error for invalid entity ID value
Context: Entity ID and name are not blank
GIVEN
Entity ID and name are not blank
Applied to: Validate Address Line 1 Required
WHEN
Address line 1 is blank
THEN
Generate validation error for required address information
Context: Entity record is being created
GIVEN
Entity record is being created
Applied to: Set NA for Missing Address
WHEN
Address line 1 is blank
THEN
Set address line 1 to 'NA'
Context: City/state/postal information is provided
GIVEN
City/state/postal information is provided
Applied to: Check City Name Length ≥ 2
WHEN
City name is present AND city name length is less than 2 characters
THEN
Generate validation error for minimum length requirement
Applied to: Check Postal Code Length ≥ 3
WHEN
Postal code is present AND postal code length is less than 3 characters
THEN
Generate validation error for minimum length requirement
Context: Country code is Canada, USA, or Mexico
GIVEN
Country code is Canada, USA, or Mexico
Applied to: Validate State Required for CA/US/MX
WHEN
State/province code is blank
THEN
Generate validation error for required state/province information
Context: State/province code and country code are both provided
GIVEN
State/province code and country code are both provided
Applied to: Validate Province-Country Match
WHEN
State/province code does not match the country code in reference table
THEN
Generate validation error for invalid state/province combination
Context: State/province code is provided AND country code is blank
GIVEN
State/province code is provided AND country code is blank
Applied to: Assign Country Codes
WHEN
Processing address information
THEN
Look up country code from state-country reference table and assign to country field
Context: Contact information is provided
GIVEN
Contact information is provided
Applied to: Validate Communication Qualifier
WHEN
Communication qualifier is not blank, 'FX', or 'TE'
THEN
Generate validation error for invalid communication qualifier value
Context: Communication qualifier is not blank OR contact name is not blank
GIVEN
Communication qualifier is not blank OR contact name is not blank
Applied to: Check Communication Number Required
WHEN
Communication number is blank
THEN
Generate validation error for required communication number
Context: Entity is shipper (sequence 1) OR consignee (sequence 2)
GIVEN
Entity is shipper (sequence 1) OR consignee (sequence 2)
Applied to: Validate Entity Data Complete
WHEN
Entity name, address, city/state/postal, and contact information are all blank
THEN
Generate validation errors for all required shipper or consignee fields
R-GCCCCADD-cbl-02512 (+13) File: GCCCCADD.cbl Validate entity requirements with comprehensive error message generation Merged 14 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate entity requirements with comprehensive error message generation':
  • Context - a record with sequence number indicating shipper (0001) or consignee (0002):
    For Is Shipper or Consignee Record?:
    When all core fields (name, address, city/state/postal, contact) are empty, then generate comprehensive error messages for all missing required fields.
  • Context - a record segment with address, city/state, or contact information present:
    For Entity ID Present?:
    When entity identifier code is missing or empty, then generate error message requiring entity identifier.
  • Context - a record with entity identifier code populated:
    For Name Present?:
    When entity name field is missing or empty, then generate error message requiring entity name.
  • Context - a record with sequence number greater than 2 and entity identifier present:
    For Entity ID Valid for Record Type?:
    When entity identifier is not in valid list or is shipper/consignee/customs broker type, then generate error message for invalid entity identifier value.
  • Context - a record with entity identifier code present:
    For Entity ID Present but Address Missing?:
    When primary address information is missing or empty, then generate error message requiring address information.
  • Context - a record with geographic information section populated:
    For City Name Present?:
    When city name field is missing or empty, then generate error message requiring city name.
  • Context - a record with city name provided:
    For City Name Length >= 2?:
    When city name length is less than 2 characters, then generate error message for minimum length requirement.
  • Context - a record with postal code field populated:
    For Postal Code Length >= 3?:
    When postal code length is less than 3 characters, then generate error message for postal code minimum length requirement.
  • Context - a record with country code indicating canada, united states, or mexico:
    For Country is CA/US/MX?:
    When state or province code is missing or empty, then generate error message requiring state or province code.
  • Context - a record with both state/province code and country code provided:
    For State/Country Combination Valid?:
    When state/province code does not correspond to the specified country in reference table, then generate error message for invalid state/province and country combination.
  • Context - a record with contact person name populated:
    For Contact Name Present but Qualifier Missing?:
    When communication number qualifier is missing or empty, then generate error message requiring communication qualifier.
  • Context - a record with communication number populated:
    For Communication Number Present but Qualifier Missing?:
    When communication number qualifier is missing or empty, then generate error message requiring communication qualifier.
  • Context - a record with communication qualifier populated:
    For Qualifier Valid Value?:
    When qualifier value is not spaces, 'fx', or 'te', then generate error message for invalid communication qualifier value.
  • Context - a record with communication qualifier populated or contact person name populated:
    For Qualifier or Name Present but Number Missing?:
    When communication number is missing or empty, then generate error message requiring communication number.
👨‍💻 Technical ACs (Gherkin)
Context: A record with sequence number indicating shipper (0001) or consignee (0002)
GIVEN
A record with sequence number indicating shipper (0001) or consignee (0002)
Applied to: Is Shipper or Consignee Record?
WHEN
All core fields (name, address, city/state/postal, contact) are empty
THEN
Generate comprehensive error messages for all missing required fields
Context: A record segment with address, city/state, or contact information present
GIVEN
A record segment with address, city/state, or contact information present
Applied to: Entity ID Present?
WHEN
Entity identifier code is missing or empty
THEN
Generate error message requiring entity identifier
Context: A record with entity identifier code populated
GIVEN
A record with entity identifier code populated
Applied to: Name Present?
WHEN
Entity name field is missing or empty
THEN
Generate error message requiring entity name
Context: A record with sequence number greater than 2 and entity identifier present
GIVEN
A record with sequence number greater than 2 and entity identifier present
Applied to: Entity ID Valid for Record Type?
WHEN
Entity identifier is not in valid list or is shipper/consignee/customs broker type
THEN
Generate error message for invalid entity identifier value
Context: A record with entity identifier code present
GIVEN
A record with entity identifier code present
Applied to: Entity ID Present but Address Missing?
WHEN
Primary address information is missing or empty
THEN
Generate error message requiring address information
Context: A record with geographic information section populated
GIVEN
A record with geographic information section populated
Applied to: City Name Present?
WHEN
City name field is missing or empty
THEN
Generate error message requiring city name
Context: A record with city name provided
GIVEN
A record with city name provided
Applied to: City Name Length >= 2?
WHEN
City name length is less than 2 characters
THEN
Generate error message for minimum length requirement
Context: A record with postal code field populated
GIVEN
A record with postal code field populated
Applied to: Postal Code Length >= 3?
WHEN
Postal code length is less than 3 characters
THEN
Generate error message for postal code minimum length requirement
Context: A record with country code indicating Canada, United States, or Mexico
GIVEN
A record with country code indicating Canada, United States, or Mexico
Applied to: Country is CA/US/MX?
WHEN
State or province code is missing or empty
THEN
Generate error message requiring state or province code
Context: A record with both state/province code and country code provided
GIVEN
A record with both state/province code and country code provided
Applied to: State/Country Combination Valid?
WHEN
State/province code does not correspond to the specified country in reference table
THEN
Generate error message for invalid state/province and country combination
Context: A record with contact person name populated
GIVEN
A record with contact person name populated
Applied to: Contact Name Present but Qualifier Missing?
WHEN
Communication number qualifier is missing or empty
THEN
Generate error message requiring communication qualifier
Context: A record with communication number populated
GIVEN
A record with communication number populated
Applied to: Communication Number Present but Qualifier Missing?
WHEN
Communication number qualifier is missing or empty
THEN
Generate error message requiring communication qualifier
Context: A record with communication qualifier populated
GIVEN
A record with communication qualifier populated
Applied to: Qualifier Valid Value?
WHEN
Qualifier value is not spaces, 'FX', or 'TE'
THEN
Generate error message for invalid communication qualifier value
Context: A record with communication qualifier populated or contact person name populated
GIVEN
A record with communication qualifier populated or contact person name populated
Applied to: Qualifier or Name Present but Number Missing?
WHEN
Communication number is missing or empty
THEN
Generate error message requiring communication number
R-GCCCCADD-cbl-02526 (+7) File: GCCCCADD.cbl Execute address validation with state Merged 8 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute address validation with state':
  • Context - an address validation process is initiated:
    For N4 Address Data Present?:
    When the n4 address data segment is empty or not present, then the system should skip all address validation steps and complete the validation process.
  • Context - n4 address data is present for validation:
    For City Name Present?:
    When the city name field is empty or contains only spaces, then the system should generate a required city name error message.
  • Context - a city name is provided in the address data:
    For City Name Length >= 2?:
    When the city name has fewer than 2 characters after removing trailing spaces, then the system should generate a minimum length requirement error message.
  • Context - a postal code is provided in the address data:
    For Postal Code Length >= 3?:
    When the postal code has fewer than 3 characters after removing trailing spaces, then the system should generate a postal code minimum length requirement error message.
  • Context - address data contains a country code of canada, usa, or mexico:
    For State/Province Present?:
    When the state or province code field is empty or contains only spaces, then the system should generate a required state/province error message.
  • Context - address data contains both state/province code and country code for canada, usa, or mexico:
    For Valid State-Country Combination?:
    When the state/province code does not exist in the state-country lookup table for the specified country, then the system should generate an invalid state/province code error message.
  • Context - address data contains a state/province code but no country code:
    For Auto-Assign Country from State:
    When the state/province code is found in the state-country lookup table, then the system should automatically assign the corresponding country code from the lookup table.
  • Context - address validation is being performed:
    For Country Code Present?:
    When the country code field is empty or contains only spaces after all processing, then the system should generate a required country code error message.
👨‍💻 Technical ACs (Gherkin)
Context: An address validation process is initiated
GIVEN
An address validation process is initiated
Applied to: N4 Address Data Present?
WHEN
The N4 address data segment is empty or not present
THEN
The system should skip all address validation steps and complete the validation process
Context: N4 address data is present for validation
GIVEN
N4 address data is present for validation
Applied to: City Name Present?
WHEN
The city name field is empty or contains only spaces
THEN
The system should generate a required city name error message
Context: A city name is provided in the address data
GIVEN
A city name is provided in the address data
Applied to: City Name Length >= 2?
WHEN
The city name has fewer than 2 characters after removing trailing spaces
THEN
The system should generate a minimum length requirement error message
Context: A postal code is provided in the address data
GIVEN
A postal code is provided in the address data
Applied to: Postal Code Length >= 3?
WHEN
The postal code has fewer than 3 characters after removing trailing spaces
THEN
The system should generate a postal code minimum length requirement error message
Context: Address data contains a country code of Canada, USA, or Mexico
GIVEN
Address data contains a country code of Canada, USA, or Mexico
Applied to: State/Province Present?
WHEN
The state or province code field is empty or contains only spaces
THEN
The system should generate a required state/province error message
Context: Address data contains both state/province code and country code for Canada, USA, or Mexico
GIVEN
Address data contains both state/province code and country code for Canada, USA, or Mexico
Applied to: Valid State-Country Combination?
WHEN
The state/province code does not exist in the state-country lookup table for the specified country
THEN
The system should generate an invalid state/province code error message
Context: Address data contains a state/province code but no country code
GIVEN
Address data contains a state/province code but no country code
Applied to: Auto-Assign Country from State
WHEN
The state/province code is found in the state-country lookup table
THEN
The system should automatically assign the corresponding country code from the lookup table
Context: Address validation is being performed
GIVEN
Address validation is being performed
Applied to: Country Code Present?
WHEN
The country code field is empty or contains only spaces after all processing
THEN
The system should generate a required country code error message
R-GCCCCADD-cbl-02534 (+22) File: GCCCCADD.cbl Build and validate shipper/consignee records with EDI BOL and Fastway integration Merged 23 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build and validate shipper/consignee records with EDI BOL and Fastway integration':
  • Context - a customs manifest processing request is initiated:
    For Initialize Shipper Record:
    When the system begins building shipper records, then a new shipper record is initialized with ccn key, record type 55, and sequence 0001.
  • Context - a shipper record needs to be built for customs processing:
    For EDI BOL Shipper Data Available?:
    When the system checks for edi bol shipper data availability, then the system identifies if edi bol contains shipper name and contact information.
  • Context - edi bol shipper data is available:
    For Extract Shipper Name from EDI BOL:
    When the system processes the shipper information, then shipper entity id is set to 'sh', shipper name is extracted from consignor name field, and shipper chop code is extracted from edi bol.
  • Context - edi bol shipper data is not available:
    For Use Fastway Shipper Data:
    When the system needs shipper information for customs processing, then shipper chop code and name are extracted from shiproot fastway data with entity id set to 'sh'.
  • Context - shipper name information has been processed:
    For EDI BOL Address Available?:
    When the system checks for address data availability, then the system identifies if edi bol contains shipper address information.
  • Context - edi bol address data is available:
    For Extract Address from EDI BOL:
    When the system processes address information, then address line 1 and address line 2 are extracted from edi bol additional name/address fields.
  • Context - edi bol address data is not available:
    For Use Fastway Address Data:
    When the system needs address information, then address information is extracted from shiproot shipper address fields.
  • Context - address information is missing from both edi bol and fastway sources:
    For Set Default 'NA' if Address Missing:
    When the system processes address fields, then address line 1 is set to 'na' as default value.
  • Context - address information has been processed:
    For EDI BOL City/State Available?:
    When the system checks for city and state data availability, then the system identifies if edi bol contains city, state, postal code, and country information.
  • Context - edi bol city/state data is available:
    For Extract City/State/Postal from EDI BOL:
    When the system processes geographic information, then city name, state/province code, postal code, and country code are extracted from edi bol geographic fields.
  • Context - edi bol city/state data is not available and fastway address data exists:
    For Parse Fastway Address String:
    When the system processes the fastway address string, then city name, state/province code, and postal code are parsed from the fastway address string format.
  • Context - state or province code has been extracted from address data:
    For Lookup Country Code from State:
    When the system needs to determine the corresponding country code, then country code is looked up from state-country reference table using the state/province code as key.
  • Context - geographic information has been processed:
    For EDI BOL Contact Info Available?:
    When the system checks for contact data availability, then the system identifies if edi bol contains contact function code, name, and communication details.
  • Context - edi bol contact information is available:
    For Extract Contact Details from EDI BOL:
    When the system processes contact details, then contact function code, contact name, communication number qualifier, and communication number are extracted from edi bol.
  • Context - shipper record has been populated with available data:
    For Validate Shipper Record:
    When the system validates the shipper record, then required fields are checked for completeness and format compliance.
  • Context - a shipper record needs validation:
    For Check Required Fields:
    When the system checks required fields, then entity id, name, and address line 1 are verified as non-empty, and error messages are generated for missing required fields.
  • Context - address information has been populated:
    For Validate Address Format:
    When the system validates address format, then city name minimum length of 2 characters and postal code minimum length of 3 characters are enforced.
  • Context - state/province code and country code have been determined:
    For Validate State/Country Combination:
    When the system validates the state-country combination, then state/province code is verified as valid for canada, usa, or mexico, and error messages are generated for invalid combinations.
  • Context - shipper record processing is complete:
    For Initialize Consignee Record:
    When the system begins building consignee records, then a new consignee record is initialized with ccn key, record type 55, and sequence 0002.
  • Context - a consignee record needs to be built for customs processing:
    For EDI BOL Consignee Data Available?:
    When the system checks for edi bol consignee data availability, then the system identifies if edi bol contains consignee name and contact information.
  • Context - edi bol consignee data is available:
    For Extract Consignee Name from EDI BOL:
    When the system processes the consignee information, then consignee entity id is set to 'cn', consignee name is extracted from shipper name field, and consignee chop code is extracted from edi bol.
  • Context - edi bol consignee data is not available:
    For Use Fastway Consignee Data:
    When the system needs consignee information for customs processing, then consignee chop code and name are extracted from shiproot consignee data with entity id set to 'cn'.
  • Context - shipper and consignee records have been validated successfully:
    For Store Shipper and Consignee Records:
    When the system completes record building process, then shipper record is stored at array position 1 and consignee record is stored at array position 2 in the customs manifest data structure.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest processing request is initiated
GIVEN
A customs manifest processing request is initiated
Applied to: Initialize Shipper Record
WHEN
The system begins building shipper records
THEN
A new shipper record is initialized with CCN key, record type 55, and sequence 0001
Context: A shipper record needs to be built for customs processing
GIVEN
A shipper record needs to be built for customs processing
Applied to: EDI BOL Shipper Data Available?
WHEN
The system checks for EDI BOL shipper data availability
THEN
The system identifies if EDI BOL contains shipper name and contact information
Context: EDI BOL shipper data is available
GIVEN
EDI BOL shipper data is available
Applied to: Extract Shipper Name from EDI BOL
WHEN
The system processes the shipper information
THEN
Shipper entity ID is set to 'SH', shipper name is extracted from consignor name field, and shipper CHOP code is extracted from EDI BOL
Context: EDI BOL shipper data is not available
GIVEN
EDI BOL shipper data is not available
Applied to: Use Fastway Shipper Data
WHEN
The system needs shipper information for customs processing
THEN
Shipper CHOP code and name are extracted from SHIPROOT Fastway data with entity ID set to 'SH'
Context: Shipper name information has been processed
GIVEN
Shipper name information has been processed
Applied to: EDI BOL Address Available?
WHEN
The system checks for address data availability
THEN
The system identifies if EDI BOL contains shipper address information
Context: EDI BOL address data is available
GIVEN
EDI BOL address data is available
Applied to: Extract Address from EDI BOL
WHEN
The system processes address information
THEN
Address line 1 and address line 2 are extracted from EDI BOL additional name/address fields
Context: EDI BOL address data is not available
GIVEN
EDI BOL address data is not available
Applied to: Use Fastway Address Data
WHEN
The system needs address information
THEN
Address information is extracted from SHIPROOT shipper address fields
Context: Address information is missing from both EDI BOL and Fastway sources
GIVEN
Address information is missing from both EDI BOL and Fastway sources
Applied to: Set Default 'NA' if Address Missing
WHEN
The system processes address fields
THEN
Address line 1 is set to 'NA' as default value
Context: Address information has been processed
GIVEN
Address information has been processed
Applied to: EDI BOL City/State Available?
WHEN
The system checks for city and state data availability
THEN
The system identifies if EDI BOL contains city, state, postal code, and country information
Context: EDI BOL city/state data is available
GIVEN
EDI BOL city/state data is available
Applied to: Extract City/State/Postal from EDI BOL
WHEN
The system processes geographic information
THEN
City name, state/province code, postal code, and country code are extracted from EDI BOL geographic fields
Context: EDI BOL city/state data is not available and Fastway address data exists
GIVEN
EDI BOL city/state data is not available and Fastway address data exists
Applied to: Parse Fastway Address String
WHEN
The system processes the Fastway address string
THEN
City name, state/province code, and postal code are parsed from the Fastway address string format
Context: State or province code has been extracted from address data
GIVEN
State or province code has been extracted from address data
Applied to: Lookup Country Code from State
WHEN
The system needs to determine the corresponding country code
THEN
Country code is looked up from state-country reference table using the state/province code as key
Context: Geographic information has been processed
GIVEN
Geographic information has been processed
Applied to: EDI BOL Contact Info Available?
WHEN
The system checks for contact data availability
THEN
The system identifies if EDI BOL contains contact function code, name, and communication details
Context: EDI BOL contact information is available
GIVEN
EDI BOL contact information is available
Applied to: Extract Contact Details from EDI BOL
WHEN
The system processes contact details
THEN
Contact function code, contact name, communication number qualifier, and communication number are extracted from EDI BOL
Context: Shipper record has been populated with available data
GIVEN
Shipper record has been populated with available data
Applied to: Validate Shipper Record
WHEN
The system validates the shipper record
THEN
Required fields are checked for completeness and format compliance
Context: A shipper record needs validation
GIVEN
A shipper record needs validation
Applied to: Check Required Fields
WHEN
The system checks required fields
THEN
Entity ID, name, and address line 1 are verified as non-empty, and error messages are generated for missing required fields
Context: Address information has been populated
GIVEN
Address information has been populated
Applied to: Validate Address Format
WHEN
The system validates address format
THEN
City name minimum length of 2 characters and postal code minimum length of 3 characters are enforced
Context: State/province code and country code have been determined
GIVEN
State/province code and country code have been determined
Applied to: Validate State/Country Combination
WHEN
The system validates the state-country combination
THEN
State/province code is verified as valid for Canada, USA, or Mexico, and error messages are generated for invalid combinations
Context: Shipper record processing is complete
GIVEN
Shipper record processing is complete
Applied to: Initialize Consignee Record
WHEN
The system begins building consignee records
THEN
A new consignee record is initialized with CCN key, record type 55, and sequence 0002
Context: A consignee record needs to be built for customs processing
GIVEN
A consignee record needs to be built for customs processing
Applied to: EDI BOL Consignee Data Available?
WHEN
The system checks for EDI BOL consignee data availability
THEN
The system identifies if EDI BOL contains consignee name and contact information
Context: EDI BOL consignee data is available
GIVEN
EDI BOL consignee data is available
Applied to: Extract Consignee Name from EDI BOL
WHEN
The system processes the consignee information
THEN
Consignee entity ID is set to 'CN', consignee name is extracted from shipper name field, and consignee CHOP code is extracted from EDI BOL
Context: EDI BOL consignee data is not available
GIVEN
EDI BOL consignee data is not available
Applied to: Use Fastway Consignee Data
WHEN
The system needs consignee information for customs processing
THEN
Consignee CHOP code and name are extracted from SHIPROOT consignee data with entity ID set to 'CN'
Context: Shipper and consignee records have been validated successfully
GIVEN
Shipper and consignee records have been validated successfully
Applied to: Store Shipper and Consignee Records
WHEN
The system completes record building process
THEN
Shipper record is stored at array position 1 and consignee record is stored at array position 2 in the customs manifest data structure
R-GCCCCADD-cbl-02557 (+11) File: GCCCCADD.cbl Process importer data with corrector EDI backup and restoration logic Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process importer data with corrector EDI backup and restoration logic':
  • Context - a cargo manifest processing request is initiated:
    For Check if Corrector EDI with Existing Importer Data:
    When the system checks for existing importer data in temporary variables, then if temporary importer name contains data, the system identifies this as corrector edi processing with existing data, otherwise it proceeds as new processing.
  • Context - corrector edi processing is identified with existing importer data:
    For Backup Original Importer Data to Temporary Variables:
    When the system needs to preserve original importer information, then all importer details including chop code, name, qualifier, business number, csa indicator, address, city, province, postal code, country, and contact information are copied to temporary storage variables.
  • Context - importer data needs to be retrieved from the database:
    For Search for Existing Importer Records in Database:
    When the system searches through sequence numbers 3 to 24 for importer entity records, then the system retrieves customs records with entity id 'im' and extracts importer information if found.
  • Context - an importer record is found in the database with entity id 'im':
    For Extract and Store Original Importer Information:
    When the system processes the retrieved importer record, then all importer attributes including chop code, name, business number qualifier, business number, csa indicator, address lines, city, province, postal code, country, and contact details are extracted and stored in temporary variables, and the importer found flag is set.
  • Context - original importer data has been backed up:
    For Clear Current Importer Data Fields:
    When the system prepares to process new importer information, then the current importer, business number, and business number qualifier fields are cleared to spaces.
  • Context - the system needs to process importer data from edi sources:
    For Process New Importer Data from EDI BOL:
    When edi bol importer segment is accessed using the edi bol key, then if the edi segment is found and contains entity id 'im', the importer data is processed, otherwise the system prepares to use backup data.
  • Context - valid importer data is available from edi bol with entity id 'im':
    For Create Importer Record from EDI Data:
    When the system creates the importer customs record, then the importer name is stored in customs database, business number qualifier and business number are captured, importer found flag is set, and csa indicator status is determined based on business number qualifier.
  • Context - no new importer data is available from edi bol and backup data exists in temporary variables:
    For Restore Original Importer Data from Backup Variables:
    When the system needs to restore original importer information, then all importer details including chop code, entity id, name, business qualifiers, csa indicator, address, city, province, postal code, country, and contact information are restored from temporary variables to the customs record.
  • Context - importer data has been restored from backup variables:
    For Set Importer Found Flag:
    When the system completes the importer data restoration process, then the importer found flag is set to indicate successful importer data processing.
  • Context - importer data has been processed from either edi or backup sources:
    For Validate Business Number and Qualifier:
    When the system validates the business number and qualifier combination, then if both au table importer and record 55 importer are found and business number qualifier is 'bn' or spaces, the csa indicator is turned off.
  • Context - importer data has been validated and processed:
    For Update CSA Indicator Based on Data Source:
    When the system determines the appropriate csa indicator status, then the csa indicator is set based on business rules considering the data source, business number qualifier, and existing importer records.
  • Context - all importer data has been processed and validated:
    For Build Final Importer Database Record:
    When the system creates the final importer database record, then a complete customs record type 55 is built with all importer information, validated segments, and proper sequence numbering for database storage.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest processing request is initiated
GIVEN
A cargo manifest processing request is initiated
Applied to: Check if Corrector EDI with Existing Importer Data
WHEN
The system checks for existing importer data in temporary variables
THEN
If temporary importer name contains data, the system identifies this as corrector EDI processing with existing data, otherwise it proceeds as new processing
Context: Corrector EDI processing is identified with existing importer data
GIVEN
Corrector EDI processing is identified with existing importer data
Applied to: Backup Original Importer Data to Temporary Variables
WHEN
The system needs to preserve original importer information
THEN
All importer details including CHOP code, name, qualifier, business number, CSA indicator, address, city, province, postal code, country, and contact information are copied to temporary storage variables
Context: Importer data needs to be retrieved from the database
GIVEN
Importer data needs to be retrieved from the database
Applied to: Search for Existing Importer Records in Database
WHEN
The system searches through sequence numbers 3 to 24 for importer entity records
THEN
The system retrieves customs records with entity ID 'IM' and extracts importer information if found
Context: An importer record is found in the database with entity ID 'IM'
GIVEN
An importer record is found in the database with entity ID 'IM'
Applied to: Extract and Store Original Importer Information
WHEN
The system processes the retrieved importer record
THEN
All importer attributes including CHOP code, name, business number qualifier, business number, CSA indicator, address lines, city, province, postal code, country, and contact details are extracted and stored in temporary variables, and the importer found flag is set
Context: Original importer data has been backed up
GIVEN
Original importer data has been backed up
Applied to: Clear Current Importer Data Fields
WHEN
The system prepares to process new importer information
THEN
The current importer, business number, and business number qualifier fields are cleared to spaces
Context: The system needs to process importer data from EDI sources
GIVEN
The system needs to process importer data from EDI sources
Applied to: Process New Importer Data from EDI BOL
WHEN
EDI BOL importer segment is accessed using the EDI BOL key
THEN
If the EDI segment is found and contains entity ID 'IM', the importer data is processed, otherwise the system prepares to use backup data
Context: Valid importer data is available from EDI BOL with entity ID 'IM'
GIVEN
Valid importer data is available from EDI BOL with entity ID 'IM'
Applied to: Create Importer Record from EDI Data
WHEN
The system creates the importer customs record
THEN
The importer name is stored in customs database, business number qualifier and business number are captured, importer found flag is set, and CSA indicator status is determined based on business number qualifier
Context: No new importer data is available from EDI BOL and backup data exists in temporary variables
GIVEN
No new importer data is available from EDI BOL and backup data exists in temporary variables
Applied to: Restore Original Importer Data from Backup Variables
WHEN
The system needs to restore original importer information
THEN
All importer details including CHOP code, entity ID, name, business qualifiers, CSA indicator, address, city, province, postal code, country, and contact information are restored from temporary variables to the customs record
Context: Importer data has been restored from backup variables
GIVEN
Importer data has been restored from backup variables
Applied to: Set Importer Found Flag
WHEN
The system completes the importer data restoration process
THEN
The importer found flag is set to indicate successful importer data processing
Context: Importer data has been processed from either EDI or backup sources
GIVEN
Importer data has been processed from either EDI or backup sources
Applied to: Validate Business Number and Qualifier
WHEN
The system validates the business number and qualifier combination
THEN
If both AU table importer and record 55 importer are found and business number qualifier is 'BN' or spaces, the CSA indicator is turned off
Context: Importer data has been validated and processed
GIVEN
Importer data has been validated and processed
Applied to: Update CSA Indicator Based on Data Source
WHEN
The system determines the appropriate CSA indicator status
THEN
The CSA indicator is set based on business rules considering the data source, business number qualifier, and existing importer records
Context: All importer data has been processed and validated
GIVEN
All importer data has been processed and validated
Applied to: Build Final Importer Database Record
WHEN
The system creates the final importer database record
THEN
A complete customs record type 55 is built with all importer information, validated segments, and proper sequence numbering for database storage
R-GCCCCADD-cbl-02569 (+21) File: GCCCCADD.cbl Execute complex sub Merged 22 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute complex sub':
  • Context - a cargo manifest is being processed with a manifest-to station name:
    For Is Manifest-To Station IIS-A6?:
    When the system evaluates the manifest-to station name, then if manifest-to station equals 'iis-a6', proceed to destination country check; otherwise proceed directly to consignee facility lookup.
  • Context - a manifest-to station is 'iis-a6' and destination state/province code is available:
    For Is Destination US?:
    When the system searches the state-country lookup table for the destination state code, then if the destination country is 'us', skip destination station lookup and proceed to consignee facility lookup; otherwise perform destination station lookup.
  • Context - manifest-to station is 'iis-a6' and destination is not us:
    For Lookup CM Table with Destination Station:
    When the system performs a lookup in cm table using destination station number, then retrieve the corresponding city municipality record for port manifest processing.
  • Context - a cm table lookup has been performed using destination station number:
    For CM Table Lookup Successful?:
    When the system evaluates the lookup return status, then if lookup is successful, extract port manifest upon data; otherwise set sub-location code to spaces.
  • Context - cm table lookup was successful and returned a valid record:
    For Get Port Manifest Upon from CM Table:
    When the system processes the cm table record, then extract the port manifest upon field for subsequent manifest code table lookup.
  • Context - port manifest upon value has been extracted from cm table:
    For Lookup MC Table with Port Manifest Upon:
    When the system performs a lookup in mc table using the port manifest upon value, then retrieve the corresponding manifest code record for sub-location processing.
  • Context - an mc table lookup has been performed using port manifest upon value:
    For MC Table Lookup Successful?:
    When the system evaluates the lookup return status, then if lookup is successful, extract sub-location code from mc table; otherwise set sub-location code to spaces.
  • Context - mc table lookup was successful and returned a valid record:
    For Set Sub-location Code from MC Table:
    When the system processes the mc table record, then assign the sub-location code from the mc table record to the cargo manifest.
  • Context - either cm table lookup or mc table lookup has failed:
    For Set Sub-location Code to Spaces:
    When the system processes the failed lookup result, then set the sub-location code to spaces to indicate no valid sub-location found.
  • Context - consignee chop code and destination station number are available:
    For Lookup RF Table with Consignee CHOP and Station:
    When the system performs a lookup in rf table using consignee chop and destination station, then retrieve the corresponding rail facility record for bonded status determination.
  • Context - an rf table lookup has been performed using consignee chop and station:
    For RF Table Lookup Successful?:
    When the system evaluates the lookup return status, then if lookup is successful, extract sub-location code and set customer bonded indicator; otherwise set customer bonded indicator to false.
  • Context - rf table lookup was successful and returned a valid record:
    For Set Sub-location Code from RF Table:
    When the system processes the rf table record, then assign the sub-location code from the rf table record to the cargo manifest.
  • Context - rf table lookup was successful and returned a valid rail facility record:
    For Set Customer Bonded Indicator to True:
    When the system processes the successful rf table lookup, then set the customer bonded indicator to true to indicate bonded facility status.
  • Context - rf table lookup failed to return a valid rail facility record:
    For Set Customer Bonded Indicator to False:
    When the system processes the failed rf table lookup, then set the customer bonded indicator to false to indicate non-bonded facility status.
  • Context - sub-location code assignment processes have completed:
    For Sub-location Code Present?:
    When the system evaluates the current sub-location code value, then if sub-location code is not spaces, continue processing without error; otherwise evaluate additional exemption conditions.
  • Context - sub-location code is spaces and csa indicator status is available:
    For CSA Indicator On?:
    When the system evaluates the csa indicator, then if csa indicator is on, continue processing without error; otherwise check manifest station equality.
  • Context - sub-location code is spaces, csa indicator is off, and manifest station names are available:
    For Manifest From equals Manifest To and Not IIS-A6?:
    When the system compares manifest from station name with manifest to station name, then if manifest from equals manifest to and manifest to is not 'iis-a6', continue processing without error; otherwise check destination country.
  • Context - sub-location code is spaces, previous exemptions don't apply, and destination country information is available:
    For Destination is US?:
    When the system evaluates the destination country, then if destination is us, continue processing without error; otherwise check arrival indicator.
  • Context - sub-location code is spaces, all previous exemptions don't apply, and arrival indicator is available:
    For Arrival Indicator is Y?:
    When the system evaluates the arrival indicator, then if arrival indicator is 'y', continue processing without error; otherwise set sub-location error flag.
  • Context - either sub-location code is present or one of the exemption conditions is met:
    For Continue Processing - No Error:
    When the system completes sub-location validation, then continue with normal cargo manifest processing without generating sub-location errors.
  • Context - sub-location code is spaces and none of the exemption conditions are met:
    For Set Sub-location Error Flag:
    When the system completes all sub-location validation checks, then set the sub-location error flag to indicate validation failure.
  • Context - sub-location error flag has been set due to validation failure:
    For Generate Sub-location Error Message:
    When the system processes the error condition, then generate and add error message for invalid destination station sub-location code to the message collection.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed with a manifest-to station name
GIVEN
A cargo manifest is being processed with a manifest-to station name
Applied to: Is Manifest-To Station IIS-A6?
WHEN
The system evaluates the manifest-to station name
THEN
If manifest-to station equals 'IIS-A6', proceed to destination country check; otherwise proceed directly to consignee facility lookup
Context: A manifest-to station is 'IIS-A6' and destination state/province code is available
GIVEN
A manifest-to station is 'IIS-A6' and destination state/province code is available
Applied to: Is Destination US?
WHEN
The system searches the state-country lookup table for the destination state code
THEN
If the destination country is 'US', skip destination station lookup and proceed to consignee facility lookup; otherwise perform destination station lookup
Context: Manifest-to station is 'IIS-A6' and destination is not US
GIVEN
Manifest-to station is 'IIS-A6' and destination is not US
Applied to: Lookup CM Table with Destination Station
WHEN
The system performs a lookup in CM table using destination station number
THEN
Retrieve the corresponding city municipality record for port manifest processing
Context: A CM table lookup has been performed using destination station number
GIVEN
A CM table lookup has been performed using destination station number
Applied to: CM Table Lookup Successful?
WHEN
The system evaluates the lookup return status
THEN
If lookup is successful, extract port manifest upon data; otherwise set sub-location code to spaces
Context: CM table lookup was successful and returned a valid record
GIVEN
CM table lookup was successful and returned a valid record
Applied to: Get Port Manifest Upon from CM Table
WHEN
The system processes the CM table record
THEN
Extract the port manifest upon field for subsequent manifest code table lookup
Context: Port manifest upon value has been extracted from CM table
GIVEN
Port manifest upon value has been extracted from CM table
Applied to: Lookup MC Table with Port Manifest Upon
WHEN
The system performs a lookup in MC table using the port manifest upon value
THEN
Retrieve the corresponding manifest code record for sub-location processing
Context: An MC table lookup has been performed using port manifest upon value
GIVEN
An MC table lookup has been performed using port manifest upon value
Applied to: MC Table Lookup Successful?
WHEN
The system evaluates the lookup return status
THEN
If lookup is successful, extract sub-location code from MC table; otherwise set sub-location code to spaces
Context: MC table lookup was successful and returned a valid record
GIVEN
MC table lookup was successful and returned a valid record
Applied to: Set Sub-location Code from MC Table
WHEN
The system processes the MC table record
THEN
Assign the sub-location code from the MC table record to the cargo manifest
Context: Either CM table lookup or MC table lookup has failed
GIVEN
Either CM table lookup or MC table lookup has failed
Applied to: Set Sub-location Code to Spaces
WHEN
The system processes the failed lookup result
THEN
Set the sub-location code to spaces to indicate no valid sub-location found
Context: Consignee CHOP code and destination station number are available
GIVEN
Consignee CHOP code and destination station number are available
Applied to: Lookup RF Table with Consignee CHOP and Station
WHEN
The system performs a lookup in RF table using consignee CHOP and destination station
THEN
Retrieve the corresponding rail facility record for bonded status determination
Context: An RF table lookup has been performed using consignee CHOP and station
GIVEN
An RF table lookup has been performed using consignee CHOP and station
Applied to: RF Table Lookup Successful?
WHEN
The system evaluates the lookup return status
THEN
If lookup is successful, extract sub-location code and set customer bonded indicator; otherwise set customer bonded indicator to false
Context: RF table lookup was successful and returned a valid record
GIVEN
RF table lookup was successful and returned a valid record
Applied to: Set Sub-location Code from RF Table
WHEN
The system processes the RF table record
THEN
Assign the sub-location code from the RF table record to the cargo manifest
Context: RF table lookup was successful and returned a valid rail facility record
GIVEN
RF table lookup was successful and returned a valid rail facility record
Applied to: Set Customer Bonded Indicator to True
WHEN
The system processes the successful RF table lookup
THEN
Set the customer bonded indicator to true to indicate bonded facility status
Context: RF table lookup failed to return a valid rail facility record
GIVEN
RF table lookup failed to return a valid rail facility record
Applied to: Set Customer Bonded Indicator to False
WHEN
The system processes the failed RF table lookup
THEN
Set the customer bonded indicator to false to indicate non-bonded facility status
Context: Sub-location code assignment processes have completed
GIVEN
Sub-location code assignment processes have completed
Applied to: Sub-location Code Present?
WHEN
The system evaluates the current sub-location code value
THEN
If sub-location code is not spaces, continue processing without error; otherwise evaluate additional exemption conditions
Context: Sub-location code is spaces and CSA indicator status is available
GIVEN
Sub-location code is spaces and CSA indicator status is available
Applied to: CSA Indicator On?
WHEN
The system evaluates the CSA indicator
THEN
If CSA indicator is on, continue processing without error; otherwise check manifest station equality
Context: Sub-location code is spaces, CSA indicator is off, and manifest station names are available
GIVEN
Sub-location code is spaces, CSA indicator is off, and manifest station names are available
Applied to: Manifest From equals Manifest To and Not IIS-A6?
WHEN
The system compares manifest from station name with manifest to station name
THEN
If manifest from equals manifest to and manifest to is not 'IIS-A6', continue processing without error; otherwise check destination country
Context: Sub-location code is spaces, previous exemptions don't apply, and destination country information is available
GIVEN
Sub-location code is spaces, previous exemptions don't apply, and destination country information is available
Applied to: Destination is US?
WHEN
The system evaluates the destination country
THEN
If destination is US, continue processing without error; otherwise check arrival indicator
Context: Sub-location code is spaces, all previous exemptions don't apply, and arrival indicator is available
GIVEN
Sub-location code is spaces, all previous exemptions don't apply, and arrival indicator is available
Applied to: Arrival Indicator is Y?
WHEN
The system evaluates the arrival indicator
THEN
If arrival indicator is 'Y', continue processing without error; otherwise set sub-location error flag
Context: Either sub-location code is present or one of the exemption conditions is met
GIVEN
Either sub-location code is present or one of the exemption conditions is met
Applied to: Continue Processing - No Error
WHEN
The system completes sub-location validation
THEN
Continue with normal cargo manifest processing without generating sub-location errors
Context: Sub-location code is spaces and none of the exemption conditions are met
GIVEN
Sub-location code is spaces and none of the exemption conditions are met
Applied to: Set Sub-location Error Flag
WHEN
The system completes all sub-location validation checks
THEN
Set the sub-location error flag to indicate validation failure
Context: Sub-location error flag has been set due to validation failure
GIVEN
Sub-location error flag has been set due to validation failure
Applied to: Generate Sub-location Error Message
WHEN
The system processes the error condition
THEN
Generate and add error message for invalid destination station sub-location code to the message collection
R-GCCCCADD-cbl-02591 (+25) File: GCCCCADD.cbl Process haulage rights validation with carrier code lookup and billing assignment Merged 26 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process haulage rights validation with carrier code lookup and billing assignment':
  • Context - a shipment with an ima (intermodal movement) code:
    For Is IMA Code = 'HM'?:
    When the system checks the ima code value, then if ima code equals 'hm' then process haulage rights, otherwise clear all haulage-related fields.
  • Context - a shipment identified as haulage movement (ima code = 'hm'):
    For Haulage Right Carrier Exists?:
    When the system checks if haulage right carrier field contains data, then if haulage right carrier is blank then set default rejection values, otherwise proceed with carrier lookup.
  • Context - a haulage movement without a specified haulage rights carrier:
    For Set Default Values: - SCAC: 'UNKN' - Automated Flag: Blank - Bill Owner: 'UNKN' - Status: REJECT:
    When the system processes the haulage validation, then set haulage rights scac to 'unkn', clear automated flag, set bill owner to 'unkn', and set status to reject haulage.
  • Context - a haulage movement with a specified haulage rights carrier code:
    For Lookup Carrier Code in CC Table:
    When the system looks up the carrier code in the cc (carrier code) table, then retrieve carrier information if found, otherwise prepare for default handling.
  • Context - a carrier code lookup has been performed in the cc table:
    For Carrier Code Found?:
    When the system evaluates the lookup result, then if carrier code is found then use retrieved scac code, otherwise set default rejection values.
  • Context - a successful carrier code lookup in the cc table:
    For Set Haulage Rights SCAC from CC Table:
    When the system processes the carrier information, then set the haulage rights scac to the ccra code from the cc table lookup result.
  • Context - a carrier code lookup that failed to find the specified carrier:
    For Set Default Reject Values:
    When the system processes the failed lookup, then set haulage rights scac to 'unkn', clear automated flag, set reject haulage status, and set bill owner to 'unkn'.
  • Context - a haulage movement with carrier information and manifest customs code:
    For Build SS Table Lookup Key: - Port Code from Customs Code - SCAC Code:
    When the system prepares to lookup haulage agreement information, then build ss table key using 'c' prefix plus last 3 digits of canadian customs code for port, and either haulage rights scac or default '6105' for carrier.
  • Context - a constructed ss table lookup key with port code and scac information:
    For Lookup Haulage Agreement in SS Table:
    When the system queries the ss (haulage agreement) table, then retrieve haulage agreement record if found, otherwise prepare for default processing.
  • Context - a haulage agreement table lookup has been performed:
    For SS Table Record Found?:
    When the system evaluates the lookup result, then if ss table record is found then process agreement details, otherwise set default rejection values.
  • Context - a successful ss table lookup with haulage agreement information:
    For Set Automated Carrier Flag from SS Table:
    When the system processes the agreement details, then set the haulage automated flag to the automated carrier value from the ss table record.
  • Context - a haulage movement with automated carrier flag set from ss table:
    For Automated Haulage?:
    When the system checks if haulage is automated, then if automated haulage then set bill owner to '6105', otherwise continue with current bill owner.
  • Context - a haulage movement identified as automated:
    For Set Bill Owner to '6105':
    When the system processes bill owner assignment, then set the bill owner to '6105' for automated haulage processing.
  • Context - a haulage movement with ss table agreement information:
    For Haulage Agreement = 'Y'?:
    When the system checks the haulage agreement indicator, then if haulage agreement equals 'y' then accept haulage, otherwise reject haulage.
  • Context - a haulage movement with valid agreement (haulage agreement = 'y'):
    For Set Status: ACCEPT HAULAGE:
    When the system processes the agreement validation, then set the haulage status to accept haulage.
  • Context - a haulage movement without valid agreement (haulage agreement ≠ 'y'):
    For Set Status: REJECT HAULAGE:
    When the system processes the agreement validation, then set the haulage status to reject haulage.
  • Context - a haulage movement with valid ss table record:
    For Set Bill-As SCAC from SS Table 'Haulage Bill Initial':
    When the system processes billing assignment for haulage, then set the bill-as scac to the haulage bill initial value from the ss table.
  • Context - a non-haulage movement with valid ss table record:
    For Set Bill-As SCAC from SS Table 'Line Bill Initial':
    When the system processes billing assignment for line haul, then set the bill-as scac to the line bill initial value from the ss table.
  • Context - a haulage movement where ss table lookup failed:
    For Set Default Values for No SS Record: - Automated Flag: Blank - Status: REJECT - Bill Owner: 'UNKN' - Bill-As SCAC: 'UNKN':
    When the system processes the failed lookup, then clear automated flag, set reject haulage status, set bill owner to 'unkn', and set bill-as scac to 'unkn'.
  • Context - a non-haulage movement where ss table lookup failed:
    For Set Non-Haulage Defaults: - Bill Owner: '6105' - Bill-As SCAC: '6105':
    When the system processes the failed lookup, then set bill owner to '6105' and set bill-as scac to '6105'.
  • Context - a shipment that is not a haulage movement (ima code ≠ 'hm'):
    For Clear Haulage Fields: - Rights SCAC: Blank - Automated Flag: Blank - Reject Indicator: Blank:
    When the system processes the movement type, then clear haulage rights scac, automated flag, and reject haulage indicator.
  • Context - a processed haulage movement with billing information:
    For Called from GCX011 and CCN starts with '6105'?:
    When the system checks if called from gcx011 and ccn key starts with '6105', then if both conditions are true then proceed with ccn update validation, otherwise complete processing.
  • Context - a haulage movement eligible for ccn update with bill-as scac assigned:
    For Bill-As SCAC is Valid and Not Default?:
    When the system validates the bill-as scac value, then if bill-as scac is not 'unkn', not blank, not low-values, and not '6105' then proceed with ccn update, otherwise complete processing.
  • Context - a haulage movement with valid bill-as scac for ccn update:
    For Update CCN Key with Bill-As SCAC:
    When the system processes the ccn key update, then replace the first 4 characters of ccn key with the bill-as scac code.
  • Context - a ccn key updated with bill-as scac for automated haulage:
    For Set CCN Key Suffix to 'E' Set Bill Owner to '6105':
    When the system processes automated haulage ccn formatting, then set the 5th character of ccn key to 'e' and set bill owner to '6105'.
  • Context - a ccn key updated with bill-as scac for non-automated haulage:
    For Set CCN Key Suffix to 'P' Set Bill Owner to Bill-As SCAC:
    When the system processes manual haulage ccn formatting, then set the 5th character of ccn key to 'p' and set bill owner to the bill-as scac value.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with an IMA (Intermodal Movement) code
GIVEN
A shipment with an IMA (Intermodal Movement) code
Applied to: Is IMA Code = 'HM'?
WHEN
The system checks the IMA code value
THEN
If IMA code equals 'HM' then process haulage rights, otherwise clear all haulage-related fields
Context: A shipment identified as haulage movement (IMA code = 'HM')
GIVEN
A shipment identified as haulage movement (IMA code = 'HM')
Applied to: Haulage Right Carrier Exists?
WHEN
The system checks if haulage right carrier field contains data
THEN
If haulage right carrier is blank then set default rejection values, otherwise proceed with carrier lookup
Context: A haulage movement without a specified haulage rights carrier
GIVEN
A haulage movement without a specified haulage rights carrier
Applied to: Set Default Values: - SCAC: 'UNKN' - Automated Flag: Blank - Bill Owner: 'UNKN' - Status: REJECT
WHEN
The system processes the haulage validation
THEN
Set haulage rights SCAC to 'UNKN', clear automated flag, set bill owner to 'UNKN', and set status to reject haulage
Context: A haulage movement with a specified haulage rights carrier code
GIVEN
A haulage movement with a specified haulage rights carrier code
Applied to: Lookup Carrier Code in CC Table
WHEN
The system looks up the carrier code in the CC (Carrier Code) table
THEN
Retrieve carrier information if found, otherwise prepare for default handling
Context: A carrier code lookup has been performed in the CC table
GIVEN
A carrier code lookup has been performed in the CC table
Applied to: Carrier Code Found?
WHEN
The system evaluates the lookup result
THEN
If carrier code is found then use retrieved SCAC code, otherwise set default rejection values
Context: A successful carrier code lookup in the CC table
GIVEN
A successful carrier code lookup in the CC table
Applied to: Set Haulage Rights SCAC from CC Table
WHEN
The system processes the carrier information
THEN
Set the haulage rights SCAC to the CCRA code from the CC table lookup result
Context: A carrier code lookup that failed to find the specified carrier
GIVEN
A carrier code lookup that failed to find the specified carrier
Applied to: Set Default Reject Values
WHEN
The system processes the failed lookup
THEN
Set haulage rights SCAC to 'UNKN', clear automated flag, set reject haulage status, and set bill owner to 'UNKN'
Context: A haulage movement with carrier information and manifest customs code
GIVEN
A haulage movement with carrier information and manifest customs code
Applied to: Build SS Table Lookup Key: - Port Code from Customs Code - SCAC Code
WHEN
The system prepares to lookup haulage agreement information
THEN
Build SS table key using 'C' prefix plus last 3 digits of Canadian customs code for port, and either haulage rights SCAC or default '6105' for carrier
Context: A constructed SS table lookup key with port code and SCAC information
GIVEN
A constructed SS table lookup key with port code and SCAC information
Applied to: Lookup Haulage Agreement in SS Table
WHEN
The system queries the SS (Haulage Agreement) table
THEN
Retrieve haulage agreement record if found, otherwise prepare for default processing
Context: A haulage agreement table lookup has been performed
GIVEN
A haulage agreement table lookup has been performed
Applied to: SS Table Record Found?
WHEN
The system evaluates the lookup result
THEN
If SS table record is found then process agreement details, otherwise set default rejection values
Context: A successful SS table lookup with haulage agreement information
GIVEN
A successful SS table lookup with haulage agreement information
Applied to: Set Automated Carrier Flag from SS Table
WHEN
The system processes the agreement details
THEN
Set the haulage automated flag to the automated carrier value from the SS table record
Context: A haulage movement with automated carrier flag set from SS table
GIVEN
A haulage movement with automated carrier flag set from SS table
Applied to: Automated Haulage?
WHEN
The system checks if haulage is automated
THEN
If automated haulage then set bill owner to '6105', otherwise continue with current bill owner
Context: A haulage movement identified as automated
GIVEN
A haulage movement identified as automated
Applied to: Set Bill Owner to '6105'
WHEN
The system processes bill owner assignment
THEN
Set the bill owner to '6105' for automated haulage processing
Context: A haulage movement with SS table agreement information
GIVEN
A haulage movement with SS table agreement information
Applied to: Haulage Agreement = 'Y'?
WHEN
The system checks the haulage agreement indicator
THEN
If haulage agreement equals 'Y' then accept haulage, otherwise reject haulage
Context: A haulage movement with valid agreement (haulage agreement = 'Y')
GIVEN
A haulage movement with valid agreement (haulage agreement = 'Y')
Applied to: Set Status: ACCEPT HAULAGE
WHEN
The system processes the agreement validation
THEN
Set the haulage status to accept haulage
Context: A haulage movement without valid agreement (haulage agreement ≠ 'Y')
GIVEN
A haulage movement without valid agreement (haulage agreement ≠ 'Y')
Applied to: Set Status: REJECT HAULAGE
WHEN
The system processes the agreement validation
THEN
Set the haulage status to reject haulage
Context: A haulage movement with valid SS table record
GIVEN
A haulage movement with valid SS table record
Applied to: Set Bill-As SCAC from SS Table 'Haulage Bill Initial'
WHEN
The system processes billing assignment for haulage
THEN
Set the bill-as SCAC to the haulage bill initial value from the SS table
Context: A non-haulage movement with valid SS table record
GIVEN
A non-haulage movement with valid SS table record
Applied to: Set Bill-As SCAC from SS Table 'Line Bill Initial'
WHEN
The system processes billing assignment for line haul
THEN
Set the bill-as SCAC to the line bill initial value from the SS table
Context: A haulage movement where SS table lookup failed
GIVEN
A haulage movement where SS table lookup failed
Applied to: Set Default Values for No SS Record: - Automated Flag: Blank - Status: REJECT - Bill Owner: 'UNKN' - Bill-As SCAC: 'UNKN'
WHEN
The system processes the failed lookup
THEN
Clear automated flag, set reject haulage status, set bill owner to 'UNKN', and set bill-as SCAC to 'UNKN'
Context: A non-haulage movement where SS table lookup failed
GIVEN
A non-haulage movement where SS table lookup failed
Applied to: Set Non-Haulage Defaults: - Bill Owner: '6105' - Bill-As SCAC: '6105'
WHEN
The system processes the failed lookup
THEN
Set bill owner to '6105' and set bill-as SCAC to '6105'
Context: A shipment that is not a haulage movement (IMA code ≠ 'HM')
GIVEN
A shipment that is not a haulage movement (IMA code ≠ 'HM')
Applied to: Clear Haulage Fields: - Rights SCAC: Blank - Automated Flag: Blank - Reject Indicator: Blank
WHEN
The system processes the movement type
THEN
Clear haulage rights SCAC, automated flag, and reject haulage indicator
Context: A processed haulage movement with billing information
GIVEN
A processed haulage movement with billing information
Applied to: Called from GCX011 and CCN starts with '6105'?
WHEN
The system checks if called from GCX011 and CCN key starts with '6105'
THEN
If both conditions are true then proceed with CCN update validation, otherwise complete processing
Context: A haulage movement eligible for CCN update with Bill-As SCAC assigned
GIVEN
A haulage movement eligible for CCN update with Bill-As SCAC assigned
Applied to: Bill-As SCAC is Valid and Not Default?
WHEN
The system validates the Bill-As SCAC value
THEN
If Bill-As SCAC is not 'UNKN', not blank, not low-values, and not '6105' then proceed with CCN update, otherwise complete processing
Context: A haulage movement with valid Bill-As SCAC for CCN update
GIVEN
A haulage movement with valid Bill-As SCAC for CCN update
Applied to: Update CCN Key with Bill-As SCAC
WHEN
The system processes the CCN key update
THEN
Replace the first 4 characters of CCN key with the Bill-As SCAC code
Context: A CCN key updated with Bill-As SCAC for automated haulage
GIVEN
A CCN key updated with Bill-As SCAC for automated haulage
Applied to: Set CCN Key Suffix to 'E' Set Bill Owner to '6105'
WHEN
The system processes automated haulage CCN formatting
THEN
Set the 5th character of CCN key to 'E' and set bill owner to '6105'
Context: A CCN key updated with Bill-As SCAC for non-automated haulage
GIVEN
A CCN key updated with Bill-As SCAC for non-automated haulage
Applied to: Set CCN Key Suffix to 'P' Set Bill Owner to Bill-As SCAC
WHEN
The system processes manual haulage CCN formatting
THEN
Set the 5th character of CCN key to 'P' and set bill owner to the Bill-As SCAC value
R-GCCCCADD-cbl-02617 (+30) File: GCCCCADD.cbl Extract importer information from EDI BOL with validation and backup handling Merged 31 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract importer information from EDI BOL with validation and backup handling':
  • Context - the system needs to process importer information from edi bol:
    For Start Importer Segment Building:
    When importer segment building is initiated, then the importer segment data structure is cleared and ready for processing.
  • Context - importer segment processing is starting:
    For Initialize Importer Segment:
    When the importer segment needs to be initialized, then all importer segment fields are cleared to spaces.
  • Context - an edi bol key exists for the shipment:
    For Get Importer N1 Segment from EDI BOL:
    When the system needs importer information, then the system retrieves the n1 segment with entity type 'im' from the edi bol.
  • Context - a request has been made to retrieve importer data from edi bol:
    For EDI BOL Importer Data Found?:
    When the system checks the retrieval status, then the system determines if importer data is available or if corrector edi deleted the importer.
  • Context - importer data has been retrieved from edi bol:
    For Extract Entity ID Code:
    When the system processes the n1 segment, then the entity identification code is extracted and made available for validation.
  • Context - an entity identification code has been extracted from the n1 segment:
    For Entity ID = 'IM' Importer?:
    When the system validates the entity type, then the system confirms if the entity id equals 'im' indicating an importer.
  • Context - a valid importer entity has been found in edi bol:
    For Backup Importer Data Exists?:
    When the system checks for existing backup data, then the system determines if backup importer name data is available from earlier processing.
  • Context - backup importer data exists from previous processing:
    For Restore Backup Importer Data:
    When the system needs to populate importer information, then all backup importer details including name, business number, address, and contact information are restored to the current segment.
  • Context - valid importer data exists in edi bol and no backup data is available:
    For Process New Importer N1 Segment:
    When the system processes the importer information, then the system creates new importer customs data and processes associated address and contact segments.
  • Context - new importer data is being processed from edi bol:
    For Create Importer N1 for Customs:
    When the system creates customs importer information, then the importer entity id code is set and importer found flag is marked.
  • Context - importer n1 segment data is available from edi bol:
    For Set Importer Name and Business Number:
    When the system populates importer identification, then the importer name is set from n1 name field and business number is set from n1 id code field.
  • Context - importer business number has been set:
    For Set Business Number Qualifier:
    When the system processes business number qualification, then the business number qualifier is set from n1 id code qualifier field for both customs and segment data.
  • Context - importer identification information has been processed:
    For Mark Importer Found Flag:
    When the system updates processing status, then the importer found flag is set to indicate successful processing.
  • Context - importer information has been processed:
    For Check CSA Indicator Logic:
    When the system evaluates csa indicator requirements, then the system checks if au importer data exists, s55 importer data exists, and business number qualifier is valid.
  • Context - importer data has been processed from multiple sources:
    For AU Importer Found AND S55 Importer Found AND Business Number Qualifier Valid?:
    When the system evaluates csa indicator status, then the system verifies if au importer is found and s55 importer is found and business number qualifier is 'bn' or spaces.
  • Context - au importer data exists and s55 importer data exists and business number qualifier is 'bn' or spaces:
    For Turn Off CSA Indicator:
    When the system processes csa indicator logic, then the csa indicator is turned off.
  • Context - importer n1 segment has been processed:
    For Get and Process N3 Address Segment:
    When the system needs importer address information, then the system retrieves the n3 address segment for the importer from edi bol.
  • Context - a request has been made to retrieve importer address data:
    For N3 Address Data Found?:
    When the system checks the retrieval status, then the system determines if n3 address segment data is available.
  • Context - n3 address data has been successfully retrieved from edi bol:
    For Set Address Information:
    When the system processes address information, then address line 1 is set from edi data or 'na' if blank, and address line 2 is set from edi data.
  • Context - n3 address data is not available from edi bol:
    For Set Default 'NA' Address:
    When the system processes address information, then address line 1 is set to 'na' and n3 data fields are cleared.
  • Context - importer address information has been processed:
    For Get and Process N4 City/State Segment:
    When the system needs importer geographic information, then the system retrieves the n4 city/state segment for the importer from edi bol.
  • Context - a request has been made to retrieve importer city/state data:
    For N4 City/State Data Found?:
    When the system checks the retrieval status, then the system determines if n4 city/state segment data is available.
  • Context - n4 city/state data has been successfully retrieved from edi bol:
    For Set City, State, Postal, Country:
    When the system processes geographic information, then city name, state/province code, postal code, and country code are set from edi data.
  • Context - n4 city/state data is not available from edi bol:
    For Clear N4 Data Fields:
    When the system processes geographic information, then all n4 data fields including city, state, postal code, and country are cleared.
  • Context - importer geographic information has been processed:
    For Clear Contact Information:
    When the system processes contact information, then all contact data fields are cleared to spaces.
  • Context - importer segment data has been populated:
    For Validate N1 Segment Data:
    When the system validates the segment, then all required fields are validated according to customs requirements and business rules.
  • Context - importer segment data has been validated successfully:
    For Insert into Customs Record 55:
    When the system saves the importer information, then the importer segment is inserted into customs record type 55 with appropriate sequence number.
  • Context - no importer data was found in the current edi bol:
    For Corrector EDI Deleted Importer?:
    When the system checks for data deletion, then the system determines if the importer was deleted by a corrector edi transaction.
  • Context - corrector edi has deleted importer data:
    For Backup Data Available?:
    When the system checks for recovery options, then the system determines if backup importer name data is available for restoration.
  • Context - corrector edi deleted importer data and backup data is available:
    For Restore Backup Importer Data:
    When the system restores importer information, then all backup importer details are restored and csa indicator logic is applied.
  • Context - no importer data is available and no backup data exists:
    For Clear Importer Fields:
    When the system processes importer information, then importer name is cleared if no s55 importer data exists, and entity id code is cleared.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process importer information from EDI BOL
GIVEN
The system needs to process importer information from EDI BOL
Applied to: Start Importer Segment Building
WHEN
Importer segment building is initiated
THEN
The importer segment data structure is cleared and ready for processing
Context: Importer segment processing is starting
GIVEN
Importer segment processing is starting
Applied to: Initialize Importer Segment
WHEN
The importer segment needs to be initialized
THEN
All importer segment fields are cleared to spaces
Context: An EDI BOL key exists for the shipment
GIVEN
An EDI BOL key exists for the shipment
Applied to: Get Importer N1 Segment from EDI BOL
WHEN
The system needs importer information
THEN
The system retrieves the N1 segment with entity type 'IM' from the EDI BOL
Context: A request has been made to retrieve importer data from EDI BOL
GIVEN
A request has been made to retrieve importer data from EDI BOL
Applied to: EDI BOL Importer Data Found?
WHEN
The system checks the retrieval status
THEN
The system determines if importer data is available or if corrector EDI deleted the importer
Context: Importer data has been retrieved from EDI BOL
GIVEN
Importer data has been retrieved from EDI BOL
Applied to: Extract Entity ID Code
WHEN
The system processes the N1 segment
THEN
The entity identification code is extracted and made available for validation
Context: An entity identification code has been extracted from the N1 segment
GIVEN
An entity identification code has been extracted from the N1 segment
Applied to: Entity ID = 'IM' Importer?
WHEN
The system validates the entity type
THEN
The system confirms if the entity ID equals 'IM' indicating an importer
Context: A valid importer entity has been found in EDI BOL
GIVEN
A valid importer entity has been found in EDI BOL
Applied to: Backup Importer Data Exists?
WHEN
The system checks for existing backup data
THEN
The system determines if backup importer name data is available from earlier processing
Context: Backup importer data exists from previous processing
GIVEN
Backup importer data exists from previous processing
Applied to: Restore Backup Importer Data
WHEN
The system needs to populate importer information
THEN
All backup importer details including name, business number, address, and contact information are restored to the current segment
Context: Valid importer data exists in EDI BOL and no backup data is available
GIVEN
Valid importer data exists in EDI BOL and no backup data is available
Applied to: Process New Importer N1 Segment
WHEN
The system processes the importer information
THEN
The system creates new importer customs data and processes associated address and contact segments
Context: New importer data is being processed from EDI BOL
GIVEN
New importer data is being processed from EDI BOL
Applied to: Create Importer N1 for Customs
WHEN
The system creates customs importer information
THEN
The importer entity ID code is set and importer found flag is marked
Context: Importer N1 segment data is available from EDI BOL
GIVEN
Importer N1 segment data is available from EDI BOL
Applied to: Set Importer Name and Business Number
WHEN
The system populates importer identification
THEN
The importer name is set from N1 name field and business number is set from N1 ID code field
Context: Importer business number has been set
GIVEN
Importer business number has been set
Applied to: Set Business Number Qualifier
WHEN
The system processes business number qualification
THEN
The business number qualifier is set from N1 ID code qualifier field for both customs and segment data
Context: Importer identification information has been processed
GIVEN
Importer identification information has been processed
Applied to: Mark Importer Found Flag
WHEN
The system updates processing status
THEN
The importer found flag is set to indicate successful processing
Context: Importer information has been processed
GIVEN
Importer information has been processed
Applied to: Check CSA Indicator Logic
WHEN
The system evaluates CSA indicator requirements
THEN
The system checks if AU importer data exists, S55 importer data exists, and business number qualifier is valid
Context: Importer data has been processed from multiple sources
GIVEN
Importer data has been processed from multiple sources
Applied to: AU Importer Found AND S55 Importer Found AND Business Number Qualifier Valid?
WHEN
The system evaluates CSA indicator status
THEN
The system verifies if AU importer is found AND S55 importer is found AND business number qualifier is 'BN' or spaces
Context: AU importer data exists and S55 importer data exists and business number qualifier is 'BN' or spaces
GIVEN
AU importer data exists and S55 importer data exists and business number qualifier is 'BN' or spaces
Applied to: Turn Off CSA Indicator
WHEN
The system processes CSA indicator logic
THEN
The CSA indicator is turned off
Context: Importer N1 segment has been processed
GIVEN
Importer N1 segment has been processed
Applied to: Get and Process N3 Address Segment
WHEN
The system needs importer address information
THEN
The system retrieves the N3 address segment for the importer from EDI BOL
Context: A request has been made to retrieve importer address data
GIVEN
A request has been made to retrieve importer address data
Applied to: N3 Address Data Found?
WHEN
The system checks the retrieval status
THEN
The system determines if N3 address segment data is available
Context: N3 address data has been successfully retrieved from EDI BOL
GIVEN
N3 address data has been successfully retrieved from EDI BOL
Applied to: Set Address Information
WHEN
The system processes address information
THEN
Address line 1 is set from EDI data or 'NA' if blank, and address line 2 is set from EDI data
Context: N3 address data is not available from EDI BOL
GIVEN
N3 address data is not available from EDI BOL
Applied to: Set Default 'NA' Address
WHEN
The system processes address information
THEN
Address line 1 is set to 'NA' and N3 data fields are cleared
Context: Importer address information has been processed
GIVEN
Importer address information has been processed
Applied to: Get and Process N4 City/State Segment
WHEN
The system needs importer geographic information
THEN
The system retrieves the N4 city/state segment for the importer from EDI BOL
Context: A request has been made to retrieve importer city/state data
GIVEN
A request has been made to retrieve importer city/state data
Applied to: N4 City/State Data Found?
WHEN
The system checks the retrieval status
THEN
The system determines if N4 city/state segment data is available
Context: N4 city/state data has been successfully retrieved from EDI BOL
GIVEN
N4 city/state data has been successfully retrieved from EDI BOL
Applied to: Set City, State, Postal, Country
WHEN
The system processes geographic information
THEN
City name, state/province code, postal code, and country code are set from EDI data
Context: N4 city/state data is not available from EDI BOL
GIVEN
N4 city/state data is not available from EDI BOL
Applied to: Clear N4 Data Fields
WHEN
The system processes geographic information
THEN
All N4 data fields including city, state, postal code, and country are cleared
Context: Importer geographic information has been processed
GIVEN
Importer geographic information has been processed
Applied to: Clear Contact Information
WHEN
The system processes contact information
THEN
All contact data fields are cleared to spaces
Context: Importer segment data has been populated
GIVEN
Importer segment data has been populated
Applied to: Validate N1 Segment Data
WHEN
The system validates the segment
THEN
All required fields are validated according to customs requirements and business rules
Context: Importer segment data has been validated successfully
GIVEN
Importer segment data has been validated successfully
Applied to: Insert into Customs Record 55
WHEN
The system saves the importer information
THEN
The importer segment is inserted into customs record type 55 with appropriate sequence number
Context: No importer data was found in the current EDI BOL
GIVEN
No importer data was found in the current EDI BOL
Applied to: Corrector EDI Deleted Importer?
WHEN
The system checks for data deletion
THEN
The system determines if the importer was deleted by a corrector EDI transaction
Context: Corrector EDI has deleted importer data
GIVEN
Corrector EDI has deleted importer data
Applied to: Backup Data Available?
WHEN
The system checks for recovery options
THEN
The system determines if backup importer name data is available for restoration
Context: Corrector EDI deleted importer data and backup data is available
GIVEN
Corrector EDI deleted importer data and backup data is available
Applied to: Restore Backup Importer Data
WHEN
The system restores importer information
THEN
All backup importer details are restored and CSA indicator logic is applied
Context: No importer data is available and no backup data exists
GIVEN
No importer data is available and no backup data exists
Applied to: Clear Importer Fields
WHEN
The system processes importer information
THEN
Importer name is cleared if no S55 importer data exists, and entity ID code is cleared
R-GCCCCADD-cbl-02648 (+4) File: GCCCCADD.cbl Validate Canadian Customs Code Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Canadian Customs Code':
  • Context - a manifest from port value is provided from the shipment root:
    For Lookup MC Table with Manifest Port:
    When the system looks up the manifest from port in the mc table using table lookup function, then if the lookup is successful, the system retrieves the mc table segment data, otherwise it clears the mc table data and prepares for error processing.
  • Context - a canadian customs code is retrieved from the mc table for the manifest from port:
    For Check if code equals '00000' and generate specific error messages for invalid customs codes:
    When the canadian customs code equals '00000', then the system clears the mc table data, sets the port name as message number, retrieves the invalid canadian customs error message, and adds it to the validation error list.
  • Context - a manifest from port value needs to be validated in the mc table:
    For Set Invalid Port Error:
    When the mc table lookup fails to find the manifest port, then the system clears the mc table data, sets the port name as message number, retrieves the invalid manifest port error message, and adds it to the validation error list.
  • Context - a canadian customs code is retrieved from the mc table and is not '00000':
    For Set Valid Canadian Customs Code:
    When the canadian customs code validation passes, then the system assigns the canadian customs code to the manifest from station code field.
  • Context - valid mc table data is available for the manifest from port:
    For Continue Processing:
    When the canadian customs code validation is complete, then the system assigns the us state exit code from the mc table to the us port of exit code field.
👨‍💻 Technical ACs (Gherkin)
Context: A manifest from port value is provided from the shipment root
GIVEN
A manifest from port value is provided from the shipment root
Applied to: Lookup MC Table with Manifest Port
WHEN
The system looks up the manifest from port in the MC table using table lookup function
THEN
If the lookup is successful, the system retrieves the MC table segment data, otherwise it clears the MC table data and prepares for error processing
Context: A Canadian customs code is retrieved from the MC table for the manifest from port
GIVEN
A Canadian customs code is retrieved from the MC table for the manifest from port
Applied to: Check if code equals '00000' and generate specific error messages for invalid customs codes
WHEN
The Canadian customs code equals '00000'
THEN
The system clears the MC table data, sets the port name as message number, retrieves the invalid Canadian customs error message, and adds it to the validation error list
Context: A manifest from port value needs to be validated in the MC table
GIVEN
A manifest from port value needs to be validated in the MC table
Applied to: Set Invalid Port Error
WHEN
The MC table lookup fails to find the manifest port
THEN
The system clears the MC table data, sets the port name as message number, retrieves the invalid manifest port error message, and adds it to the validation error list
Context: A Canadian customs code is retrieved from the MC table and is not '00000'
GIVEN
A Canadian customs code is retrieved from the MC table and is not '00000'
Applied to: Set Valid Canadian Customs Code
WHEN
The Canadian customs code validation passes
THEN
The system assigns the Canadian customs code to the manifest from station code field
Context: Valid MC table data is available for the manifest from port
GIVEN
Valid MC table data is available for the manifest from port
Applied to: Continue Processing
WHEN
The Canadian customs code validation is complete
THEN
The system assigns the US state exit code from the MC table to the US port of exit code field
R-GCCCCADD-cbl-02653 (+2) File: GCCCCADD.cbl Apply Special CCN Type 9 Processing Rules Merged 3 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Apply Special CCN Type 9 Processing Rules':
  • Context - a shipment with ccn type equal to '9' and manifest station lookup has been completed with us exit code and station information available:
    For Override Manifest Ports Set From = 'IIS-A6' Set To = 'IIS-A6':
    When the us exit code is not '00000' or the manifest from station is not 'iis-a6' or the manifest to station is not 'iis-a6' or the manifest from station does not equal the manifest to station, then both manifest from station name and manifest to station name must be set to 'iis-a6' to standardize the manifest routing.
  • Context - a shipment with ccn type equal to '9' and manifest station lookup has been completed with standard configuration:
    For Continue with Normal Processing Use Existing Manifest Codes:
    When the us exit code equals '00000' and the manifest from station equals 'iis-a6' and the manifest to station equals 'iis-a6' and the manifest from station equals the manifest to station, then the existing manifest to station code, station number, and call letters must be preserved from the table lookup results.
  • Context - a shipment is being processed for manifest station configuration:
    For Continue with Normal Processing Use Existing Manifest Codes:
    When the ccn type is not equal to '9', then the system must continue with normal manifest station processing using the existing manifest codes from table lookups without applying type 9 override rules.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment with CCN type equal to '9' and manifest station lookup has been completed with US exit code and station information available
GIVEN
A shipment with CCN type equal to '9' and manifest station lookup has been completed with US exit code and station information available
Applied to: Override Manifest Ports Set From = 'IIS-A6' Set To = 'IIS-A6'
WHEN
The US exit code is not '00000' OR the manifest from station is not 'IIS-A6' OR the manifest to station is not 'IIS-A6' OR the manifest from station does not equal the manifest to station
THEN
Both manifest from station name and manifest to station name must be set to 'IIS-A6' to standardize the manifest routing
Context: A shipment with CCN type equal to '9' and manifest station lookup has been completed with standard configuration
GIVEN
A shipment with CCN type equal to '9' and manifest station lookup has been completed with standard configuration
Applied to: Continue with Normal Processing Use Existing Manifest Codes
WHEN
The US exit code equals '00000' AND the manifest from station equals 'IIS-A6' AND the manifest to station equals 'IIS-A6' AND the manifest from station equals the manifest to station
THEN
The existing manifest to station code, station number, and call letters must be preserved from the table lookup results
Context: A shipment is being processed for manifest station configuration
GIVEN
A shipment is being processed for manifest station configuration
Applied to: Continue with Normal Processing Use Existing Manifest Codes
WHEN
The CCN type is not equal to '9'
THEN
The system must continue with normal manifest station processing using the existing manifest codes from table lookups without applying type 9 override rules
R-GCCCCADD-cbl-02656 (+13) File: GCCCCADD.cbl Execute GCCTBIO Table Lookup Process Merged 14 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute GCCTBIO Table Lookup Process':
  • Context - a table lookup operation is about to be performed:
    For Initialize Lookup Parameters:
    When the lookup parameters need to be initialized, then all key values, pcb flags, ssa flags, and return flags are cleared to spaces.
  • Context - a table lookup operation is being configured:
    For Set Function Code to GU:
    When the function code needs to be set, then the function code is set to 'gu' for get unique operation.
  • Context - a table lookup operation requires specific table and key identification:
    For Set Table ID and Key Values:
    When the table id and key values are being configured, then the table id is set to the target table type and key values are populated with search criteria.
  • Context - all lookup parameters are properly configured:
    For Call GCCTBIO Program:
    When the table lookup needs to be executed, then the gcctbio program is called with the configured parameters.
  • Context - a table lookup operation has been executed:
    For Move Table Data to Working Storage:
    When the lookup returns successful status, then the retrieved table data is moved to the appropriate working storage segment and success flag is set.
    For Set Failure Flag:
    When the lookup returns unsuccessful status, then the table segment is cleared to spaces and failure flag is set.
  • Context - a manifest port code needs validation:
    For Set Table ID and Key Values:
    When the table lookup is configured for mc table, then the table id is set to 'mc' and the port code is used as the search key.
  • Context - importer information needs to be retrieved:
    For Set Table ID and Key Values:
    When the table lookup is configured for au table, then the table id is set to 'au' and consignee chop and commodity code are used as search keys.
  • Context - a quantity qualifier needs validation:
    For Set Table ID and Key Values:
    When the table lookup is configured for mu table, then the table id is set to 'mu' and the quantity qualifier is used as the search key.
  • Context - destination station information needs to be retrieved:
    For Set Table ID and Key Values:
    When the table lookup is configured for cm table, then the table id is set to 'cm' and the destination station number is used as the search key.
  • Context - customer bonded status needs to be determined:
    For Set Table ID and Key Values:
    When the table lookup is configured for rf table, then the table id is set to 'rf' and consignee chop and station number are used as search keys.
  • Context - a haulage rights carrier needs validation:
    For Set Table ID and Key Values:
    When the table lookup is configured for cc table, then the table id is set to 'cc' and the carrier code is used as the search key.
  • Context - haulage and billing information needs to be retrieved:
    For Set Table ID and Key Values:
    When the table lookup is configured for ss table, then the table id is set to 'ss' and port code with scac code are used as search keys.
  • Context - an error message needs to be retrieved:
    For Set Table ID and Key Values:
    When the table lookup is configured for ms table, then the table id is set to 'ms' and the error message number is used as the search key.
👨‍💻 Technical ACs (Gherkin)
Context: A table lookup operation is about to be performed
GIVEN
A table lookup operation is about to be performed
Applied to: Initialize Lookup Parameters
WHEN
The lookup parameters need to be initialized
THEN
All key values, PCB flags, SSA flags, and return flags are cleared to spaces
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 function code needs to be set
THEN
The function code is set to 'GU' for Get Unique operation
Context: A table lookup operation requires specific table and key identification
GIVEN
A table lookup operation requires specific table and key identification
Applied to: Set Table ID and Key Values
WHEN
The table ID and key values are being configured
THEN
The table ID is set to the target table type and key values are populated with search criteria
Context: All lookup parameters are properly configured
GIVEN
All lookup parameters are properly configured
Applied to: Call GCCTBIO Program
WHEN
The table lookup needs to be executed
THEN
The GCCTBIO program is called with the configured parameters
Context: A table lookup operation has been executed
GIVEN
A table lookup operation has been executed
Applied to: Move Table Data to Working Storage
WHEN
The lookup returns successful status
THEN
The retrieved table data is moved to the appropriate working storage segment and success flag is set
Applied to: Set Failure Flag
WHEN
The lookup returns unsuccessful status
THEN
The table segment is cleared to spaces and failure flag is set
Context: A manifest port code needs validation
GIVEN
A manifest port code needs validation
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for MC table
THEN
The table ID is set to 'MC' and the port code is used as the search key
Context: Importer information needs to be retrieved
GIVEN
Importer information needs to be retrieved
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for AU table
THEN
The table ID is set to 'AU' and consignee chop and commodity code are used as search keys
Context: A quantity qualifier needs validation
GIVEN
A quantity qualifier needs validation
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for MU table
THEN
The table ID is set to 'MU' and the quantity qualifier is used as the search key
Context: Destination station information needs to be retrieved
GIVEN
Destination station information needs to be retrieved
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for CM table
THEN
The table ID is set to 'CM' and the destination station number is used as the search key
Context: Customer bonded status needs to be determined
GIVEN
Customer bonded status needs to be determined
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for RF table
THEN
The table ID is set to 'RF' and consignee chop and station number are used as search keys
Context: A haulage rights carrier needs validation
GIVEN
A haulage rights carrier needs validation
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for CC table
THEN
The table ID is set to 'CC' and the carrier code is used as the search key
Context: Haulage and billing information needs to be retrieved
GIVEN
Haulage and billing information needs to be retrieved
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for SS table
THEN
The table ID is set to 'SS' and port code with SCAC code are used as search keys
Context: An error message needs to be retrieved
GIVEN
An error message needs to be retrieved
Applied to: Set Table ID and Key Values
WHEN
The table lookup is configured for MS table
THEN
The table ID is set to 'MS' and the error message number is used as the search key
R-GCCCCADD-cbl-02670 (+10) File: GCCCCADD.cbl Execute CM Table Lookup for Port Manifest Upon Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute CM Table Lookup for Port Manifest Upon':
  • Context - a cargo manifest is being processed with a manifest-to station name:
    For Is Manifest-To Station 'IIS-A6'?:
    When the system checks if the manifest-to station name equals 'iis-a6', then the system proceeds to destination country validation if true, otherwise ends the cm table lookup process.
  • Context - the manifest-to station is 'iis-a6' and destination state code is available:
    For Is Destination Not US?:
    When the system searches the state-country table to determine if the destination state belongs to us, then the system continues with cm table lookup if destination is not us, otherwise ends the process.
  • Context - the destination is confirmed as non-us and requires cm table lookup:
    For Get Destination Station Number from SHIPROOT:
    When the system accesses the shiproot data structure, then the destination station number is retrieved and prepared for numeric conversion.
  • Context - the destination station number has been retrieved from shiproot:
    For Convert Station Number to Numeric Format:
    When the system processes the station number for table lookup, then the station number is converted to numeric format and stored in the working storage variable.
  • Context - the destination station number is in proper numeric format:
    For Execute CM Table Lookup with Station Number:
    When the system calls the table lookup service with table id 'cm' and the station number as the search key, then the system attempts to retrieve the corresponding cm table record.
  • Context - a cm table lookup has been executed with the destination station number:
    For CM Table Lookup Successful?:
    When the system checks the return status of the table lookup operation, then the system proceeds to extract cm data if successful, otherwise sets sub-location code to spaces.
  • Context - the cm table lookup was successful and returned valid data:
    For Extract Port Manifest Upon from CM Data:
    When the system accesses the cm table segment data, then the port manifest upon value is extracted and prepared for mc table lookup.
  • Context - the port manifest upon value has been extracted from cm table data:
    For Execute MC Table Lookup with Port Manifest Upon:
    When the system calls the table lookup service with table id 'mc' and the port manifest upon value as the search key, then the system attempts to retrieve the corresponding mc table record.
  • Context - an mc table lookup has been executed with the port manifest upon value:
    For MC Table Lookup Successful?:
    When the system checks the return status of the mc table lookup operation, then the system proceeds to extract sub-location code if successful, otherwise sets sub-location code to spaces.
  • Context - the mc table lookup was successful and returned valid sub-location code data:
    For Set Sub-location Code to Retrieved Value:
    When the system accesses the mc table segment data, then the sub-location code is extracted and assigned to the cargo manifest sub-location code field.
  • Context - either the cm table lookup or mc table lookup has failed:
    For Set Sub-location Code to Spaces:
    When the system determines that valid sub-location data cannot be retrieved, then the sub-location code field is set to spaces to indicate no valid sub-location.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed with a manifest-to station name
GIVEN
A cargo manifest is being processed with a manifest-to station name
Applied to: Is Manifest-To Station 'IIS-A6'?
WHEN
The system checks if the manifest-to station name equals 'IIS-A6'
THEN
The system proceeds to destination country validation if true, otherwise ends the CM table lookup process
Context: The manifest-to station is 'IIS-A6' and destination state code is available
GIVEN
The manifest-to station is 'IIS-A6' and destination state code is available
Applied to: Is Destination Not US?
WHEN
The system searches the state-country table to determine if the destination state belongs to US
THEN
The system continues with CM table lookup if destination is not US, otherwise ends the process
Context: The destination is confirmed as non-US and requires CM table lookup
GIVEN
The destination is confirmed as non-US and requires CM table lookup
Applied to: Get Destination Station Number from SHIPROOT
WHEN
The system accesses the SHIPROOT data structure
THEN
The destination station number is retrieved and prepared for numeric conversion
Context: The destination station number has been retrieved from SHIPROOT
GIVEN
The destination station number has been retrieved from SHIPROOT
Applied to: Convert Station Number to Numeric Format
WHEN
The system processes the station number for table lookup
THEN
The station number is converted to numeric format and stored in the working storage variable
Context: The destination station number is in proper numeric format
GIVEN
The destination station number is in proper numeric format
Applied to: Execute CM Table Lookup with Station Number
WHEN
The system calls the table lookup service with table ID 'CM' and the station number as the search key
THEN
The system attempts to retrieve the corresponding CM table record
Context: A CM table lookup has been executed with the destination station number
GIVEN
A CM table lookup has been executed with the destination station number
Applied to: CM Table Lookup Successful?
WHEN
The system checks the return status of the table lookup operation
THEN
The system proceeds to extract CM data if successful, otherwise sets sub-location code to spaces
Context: The CM table lookup was successful and returned valid data
GIVEN
The CM table lookup was successful and returned valid data
Applied to: Extract Port Manifest Upon from CM Data
WHEN
The system accesses the CM table segment data
THEN
The port manifest upon value is extracted and prepared for MC table lookup
Context: The port manifest upon value has been extracted from CM table data
GIVEN
The port manifest upon value has been extracted from CM table data
Applied to: Execute MC Table Lookup with Port Manifest Upon
WHEN
The system calls the table lookup service with table ID 'MC' and the port manifest upon value as the search key
THEN
The system attempts to retrieve the corresponding MC table record
Context: An MC table lookup has been executed with the port manifest upon value
GIVEN
An MC table lookup has been executed with the port manifest upon value
Applied to: MC Table Lookup Successful?
WHEN
The system checks the return status of the MC table lookup operation
THEN
The system proceeds to extract sub-location code if successful, otherwise sets sub-location code to spaces
Context: The MC table lookup was successful and returned valid sub-location code data
GIVEN
The MC table lookup was successful and returned valid sub-location code data
Applied to: Set Sub-location Code to Retrieved Value
WHEN
The system accesses the MC table segment data
THEN
The sub-location code is extracted and assigned to the cargo manifest sub-location code field
Context: Either the CM table lookup or MC table lookup has failed
GIVEN
Either the CM table lookup or MC table lookup has failed
Applied to: Set Sub-location Code to Spaces
WHEN
The system determines that valid sub-location data cannot be retrieved
THEN
The sub-location code field is set to spaces to indicate no valid sub-location
R-GCCCCADD-cbl-02681 (+15) File: GCCCCADD.cbl Process Individual Commodity Segments Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Individual Commodity Segments':
  • Context - the system is ready to process commodity data from edi segments:
    For Initialize Commodity Counters:
    When commodity processing begins, then weight counter is set to zero and quantity counter is set to zero.
  • Context - commodity processing is being initialized:
    For Set CCM Sequence to 1:
    When the system prepares to read commodity segments, then the ccm sequence counter is set to 1.
  • Context - a ccm sequence number is available and edi bol key is valid:
    For Get EBSBCCM Segment:
    When the system attempts to retrieve ebsbccm segment data, then the system calls ebclgio to fetch the commodity segment for the current sequence.
  • Context - an attempt has been made to retrieve ebsbccm segment data:
    For EBSBCCM Segment Found?:
    When the system checks the retrieval status, then if the segment is found then continue processing else use fastway fallback data.
  • Context - a valid ebsbccm segment has been retrieved:
    For Extract Lading Quantity from L0-LADING-QTY:
    When the system processes the segment data, then the lading quantity is extracted from l0-lading-qty field.
  • Context - lading quantity has been extracted from the current segment:
    For Add to Total Units Counter:
    When the system updates totals, then the lading quantity is added to the total units counter (ws-num-units-9).
  • Context - a commodity segment is being processed:
    For First Segment?:
    When the system checks the sequence number, then if ccm sequence equals 1 then retrieve weight segment and set quantity qualifier else skip weight processing.
  • Context - this is the first commodity segment being processed:
    For Get EBSBCCR Weight Segment:
    When the system needs weight information, then the system calls ebclgio to retrieve ebsbccr segment with type 'cr' and dependent key 'cr001'.
    For Extract Quantity Qualifier from L0-LADING-QTY-QUAL:
    When the system sets quantity qualifier information, then the quantity qualifier is extracted from l0-lading-qty-qual and stored in gccc-lading-quantity-qualifier.
  • Context - an attempt has been made to retrieve ebsbccr weight segment:
    For Weight Segment Found?:
    When the system checks the retrieval status, then if weight segment is found then extract n7-weight value else set weight to zero.
  • Context - a valid ebsbccr weight segment has been retrieved:
    For Extract Weight from N7-WEIGHT:
    When the system processes weight data, then the weight value is extracted from n7-weight field and stored in ws-cmod-weight-9.
  • Context - no ebsbccr weight segment was found:
    For Set Weight to Zero:
    When the system needs to set a weight value, then the weight counter (ws-cmod-weight-9) is set to zero.
  • Context - weight data has been processed from edi segment:
    For Determine Weight Unit from Metric Indicator:
    When the system determines the weight unit, then if metric indicator is 'm' or 'l' then set weight unit to kilograms else set weight unit to pounds.
  • Context - current commodity segment has been processed:
    For Increment CCM Sequence Counter:
    When the system prepares for the next segment, then the ccm sequence counter (ws-ccm-cm-seq) is incremented by 1.
  • Context - current commodity segment processing is complete:
    For More Segments Available?:
    When the system checks for continuation, then if ccm sequence is less than or equal to 98 and segments are still being found then continue processing else complete commodity processing.
  • Context - no edi commodity segments are found or initial edi segment retrieval fails:
    For No EDI Data - Use Fastway Fallback:
    When the system needs commodity data, then the system retrieves commodity information from fastway shipcomm segments using gu and gn functions.
👨‍💻 Technical ACs (Gherkin)
Context: The system is ready to process commodity data from EDI segments
GIVEN
The system is ready to process commodity data from EDI segments
Applied to: Initialize Commodity Counters
WHEN
Commodity processing begins
THEN
Weight counter is set to zero AND quantity counter is set to zero
Context: Commodity processing is being initialized
GIVEN
Commodity processing is being initialized
Applied to: Set CCM Sequence to 1
WHEN
The system prepares to read commodity segments
THEN
The CCM sequence counter is set to 1
Context: A CCM sequence number is available AND EDI BOL key is valid
GIVEN
A CCM sequence number is available AND EDI BOL key is valid
Applied to: Get EBSBCCM Segment
WHEN
The system attempts to retrieve EBSBCCM segment data
THEN
The system calls EBCLGIO to fetch the commodity segment for the current sequence
Context: An attempt has been made to retrieve EBSBCCM segment data
GIVEN
An attempt has been made to retrieve EBSBCCM segment data
Applied to: EBSBCCM Segment Found?
WHEN
The system checks the retrieval status
THEN
IF the segment is found THEN continue processing ELSE use FastWay fallback data
Context: A valid EBSBCCM segment has been retrieved
GIVEN
A valid EBSBCCM segment has been retrieved
Applied to: Extract Lading Quantity from L0-LADING-QTY
WHEN
The system processes the segment data
THEN
The lading quantity is extracted from L0-LADING-QTY field
Context: Lading quantity has been extracted from the current segment
GIVEN
Lading quantity has been extracted from the current segment
Applied to: Add to Total Units Counter
WHEN
The system updates totals
THEN
The lading quantity is added to the total units counter (WS-NUM-UNITS-9)
Context: A commodity segment is being processed
GIVEN
A commodity segment is being processed
Applied to: First Segment?
WHEN
The system checks the sequence number
THEN
IF CCM sequence equals 1 THEN retrieve weight segment and set quantity qualifier ELSE skip weight processing
Context: This is the first commodity segment being processed
GIVEN
This is the first commodity segment being processed
Applied to: Get EBSBCCR Weight Segment
WHEN
The system needs weight information
THEN
The system calls EBCLGIO to retrieve EBSBCCR segment with type 'CR' and dependent key 'CR001'
Applied to: Extract Quantity Qualifier from L0-LADING-QTY-QUAL
WHEN
The system sets quantity qualifier information
THEN
The quantity qualifier is extracted from L0-LADING-QTY-QUAL and stored in GCCC-LADING-QUANTITY-QUALIFIER
Context: An attempt has been made to retrieve EBSBCCR weight segment
GIVEN
An attempt has been made to retrieve EBSBCCR weight segment
Applied to: Weight Segment Found?
WHEN
The system checks the retrieval status
THEN
IF weight segment is found THEN extract N7-WEIGHT value ELSE set weight to zero
Context: A valid EBSBCCR weight segment has been retrieved
GIVEN
A valid EBSBCCR weight segment has been retrieved
Applied to: Extract Weight from N7-WEIGHT
WHEN
The system processes weight data
THEN
The weight value is extracted from N7-WEIGHT field and stored in WS-CMOD-WEIGHT-9
Context: No EBSBCCR weight segment was found
GIVEN
No EBSBCCR weight segment was found
Applied to: Set Weight to Zero
WHEN
The system needs to set a weight value
THEN
The weight counter (WS-CMOD-WEIGHT-9) is set to zero
Context: Weight data has been processed from EDI segment
GIVEN
Weight data has been processed from EDI segment
Applied to: Determine Weight Unit from Metric Indicator
WHEN
The system determines the weight unit
THEN
IF metric indicator is 'M' or 'L' THEN set weight unit to kilograms ELSE set weight unit to pounds
Context: Current commodity segment has been processed
GIVEN
Current commodity segment has been processed
Applied to: Increment CCM Sequence Counter
WHEN
The system prepares for the next segment
THEN
The CCM sequence counter (WS-CCM-CM-SEQ) is incremented by 1
Context: Current commodity segment processing is complete
GIVEN
Current commodity segment processing is complete
Applied to: More Segments Available?
WHEN
The system checks for continuation
THEN
IF CCM sequence is less than or equal to 98 AND segments are still being found THEN continue processing ELSE complete commodity processing
Context: No EDI commodity segments are found OR initial EDI segment retrieval fails
GIVEN
No EDI commodity segments are found OR initial EDI segment retrieval fails
Applied to: No EDI Data - Use Fastway Fallback
WHEN
The system needs commodity data
THEN
The system retrieves commodity information from FastWay SHIPCOMM segments using GU and GN functions
R-GCCCCADD-cbl-02697 (+3) File: GCCCCADD.cbl Handle Metric Unit Conversion Logic Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Handle Metric Unit Conversion Logic':
  • Context - a shipment root record with a metric indicator field:
    For Check Metric Indicator in SHIPROOT:
    When the metric indicator is 'm' (metric) or 'l' (liters), then the system sets the weight unit to kg (kilograms).
    For Set Weight Unit to LB - Pounds:
    When the metric indicator is not 'm' (metric) or 'l' (liters), then the system sets the weight unit to lb (pounds).
  • Context - a shipment with metric indicator set to 'm' or 'l' and commodity weight data available:
    For Apply Weight Unit to Commodity Weight:
    When processing commodity weight from edi bol or shipment commodity data, then the system adds the metric commodity weight to the total weight calculation and sets the weight unit flag to kilograms.
  • Context - a shipment with metric indicator not set to 'm' or 'l' and commodity weight data available:
    For Apply Weight Unit to Commodity Weight:
    When processing commodity weight from edi bol or shipment commodity data, then the system adds the standard commodity weight to the total weight calculation and sets the weight unit flag to pounds.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment root record with a metric indicator field
GIVEN
A shipment root record with a metric indicator field
Applied to: Check Metric Indicator in SHIPROOT
WHEN
The metric indicator is 'M' (Metric) or 'L' (Liters)
THEN
The system sets the weight unit to KG (kilograms)
Applied to: Set Weight Unit to LB - Pounds
WHEN
The metric indicator is not 'M' (Metric) or 'L' (Liters)
THEN
The system sets the weight unit to LB (pounds)
Context: A shipment with metric indicator set to 'M' or 'L' and commodity weight data available
GIVEN
A shipment with metric indicator set to 'M' or 'L' and commodity weight data available
Applied to: Apply Weight Unit to Commodity Weight
WHEN
Processing commodity weight from EDI BOL or shipment commodity data
THEN
The system adds the metric commodity weight to the total weight calculation and sets the weight unit flag to kilograms
Context: A shipment with metric indicator not set to 'M' or 'L' and commodity weight data available
GIVEN
A shipment with metric indicator not set to 'M' or 'L' and commodity weight data available
Applied to: Apply Weight Unit to Commodity Weight
WHEN
Processing commodity weight from EDI BOL or shipment commodity data
THEN
The system adds the standard commodity weight to the total weight calculation and sets the weight unit flag to pounds
R-GCCCCADD-cbl-02701 (+12) File: GCCCCADD.cbl Process Special Handling Codes VA/EV/VS Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Special Handling Codes VA/EV/VS':
  • Context - a shipment has special handling codes defined in positions 1 through 7:
    For Start Special Handling Code Processing:
    When the system processes special handling codes, then the system should initialize processing counter to 1 and begin iterating through available special handling code positions.
  • Context - the system is processing special handling codes with a counter variable:
    For Counter <= 7?:
    When the counter value is checked against the maximum limit, then processing should continue if counter is less than or equal to 7, otherwise processing should end.
  • Context - the counter is pointing to a valid position within the special handling codes array:
    For Get Special Handling Code at Counter Position:
    When the system needs to examine a special handling code, then the system should extract the special handling code from the current counter position.
  • Context - a special handling code has been extracted from the current position:
    For Code = 'VA' or 'EV' or 'VS'?:
    When the system evaluates the code type, then the system should identify if the code is va (value added), ev (equipment value), or vs (value service) and proceed with description processing, otherwise increment counter and continue.
  • Context - a special handling code has been identified as va, ev, or vs:
    For Extract Special Handling Code:
    When the system processes the value-added service code, then the system should move the special handling code to the description work code field.
  • Context - a value-added service code has been extracted:
    For Extract Special Handling Instructions:
    When the system processes the associated instructions, then the system should move the special handling instructions to the description work description field.
  • Context - value-added service code and instructions have been extracted:
    For First Description Slot Empty?:
    When the system needs to store the description information, then the system should check if the first special handling description slot is empty and available for use.
  • Context - the first description slot is empty and value-added service information is ready:
    For Store in First Description Slot:
    When the system stores the description information, then the system should move the description work information to the first special handling description slot.
  • Context - the first description slot is not empty and value-added service information needs storage:
    For Second Description Slot Empty?:
    When the system checks for alternative storage location, then the system should check if the second special handling description slot is empty and available for use.
  • Context - the first description slot is occupied and the second slot is empty:
    For Store in Second Description Slot:
    When the system stores the description information, then the system should move the description work information to the second special handling description slot.
  • Context - both first and second description slots are occupied:
    For Store in Third Description Slot:
    When the system needs to store value-added service information, then the system should move the description work information to the third special handling description slot.
  • Context - current special handling code position has been processed:
    For Increment Counter:
    When the system needs to continue processing remaining positions, then the system should increment the counter by 1 to move to the next special handling code position.
  • Context - all special handling code positions have been examined or counter exceeds maximum limit:
    For End Special Handling Processing:
    When the processing loop condition is no longer met, then the system should exit the special handling code processing routine.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has special handling codes defined in positions 1 through 7
GIVEN
A shipment has special handling codes defined in positions 1 through 7
Applied to: Start Special Handling Code Processing
WHEN
The system processes special handling codes
THEN
The system should initialize processing counter to 1 and begin iterating through available special handling code positions
Context: The system is processing special handling codes with a counter variable
GIVEN
The system is processing special handling codes with a counter variable
Applied to: Counter <= 7?
WHEN
The counter value is checked against the maximum limit
THEN
Processing should continue if counter is less than or equal to 7, otherwise processing should end
Context: The counter is pointing to a valid position within the special handling codes array
GIVEN
The counter is pointing to a valid position within the special handling codes array
Applied to: Get Special Handling Code at Counter Position
WHEN
The system needs to examine a special handling code
THEN
The system should extract the special handling code from the current counter position
Context: A special handling code has been extracted from the current position
GIVEN
A special handling code has been extracted from the current position
Applied to: Code = 'VA' or 'EV' or 'VS'?
WHEN
The system evaluates the code type
THEN
The system should identify if the code is VA (Value Added), EV (Equipment Value), or VS (Value Service) and proceed with description processing, otherwise increment counter and continue
Context: A special handling code has been identified as VA, EV, or VS
GIVEN
A special handling code has been identified as VA, EV, or VS
Applied to: Extract Special Handling Code
WHEN
The system processes the value-added service code
THEN
The system should move the special handling code to the description work code field
Context: A value-added service code has been extracted
GIVEN
A value-added service code has been extracted
Applied to: Extract Special Handling Instructions
WHEN
The system processes the associated instructions
THEN
The system should move the special handling instructions to the description work description field
Context: Value-added service code and instructions have been extracted
GIVEN
Value-added service code and instructions have been extracted
Applied to: First Description Slot Empty?
WHEN
The system needs to store the description information
THEN
The system should check if the first special handling description slot is empty and available for use
Context: The first description slot is empty and value-added service information is ready
GIVEN
The first description slot is empty and value-added service information is ready
Applied to: Store in First Description Slot
WHEN
The system stores the description information
THEN
The system should move the description work information to the first special handling description slot
Context: The first description slot is not empty and value-added service information needs storage
GIVEN
The first description slot is not empty and value-added service information needs storage
Applied to: Second Description Slot Empty?
WHEN
The system checks for alternative storage location
THEN
The system should check if the second special handling description slot is empty and available for use
Context: The first description slot is occupied and the second slot is empty
GIVEN
The first description slot is occupied and the second slot is empty
Applied to: Store in Second Description Slot
WHEN
The system stores the description information
THEN
The system should move the description work information to the second special handling description slot
Context: Both first and second description slots are occupied
GIVEN
Both first and second description slots are occupied
Applied to: Store in Third Description Slot
WHEN
The system needs to store value-added service information
THEN
The system should move the description work information to the third special handling description slot
Context: Current special handling code position has been processed
GIVEN
Current special handling code position has been processed
Applied to: Increment Counter
WHEN
The system needs to continue processing remaining positions
THEN
The system should increment the counter by 1 to move to the next special handling code position
Context: All special handling code positions have been examined or counter exceeds maximum limit
GIVEN
All special handling code positions have been examined or counter exceeds maximum limit
Applied to: End Special Handling Processing
WHEN
The processing loop condition is no longer met
THEN
The system should exit the special handling code processing routine
R-GCCCCADD-cbl-02714 (+6) File: GCCCCADD.cbl Validate UN Number Format and Extract Hazmat Data Merged 7 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate UN Number Format and Extract Hazmat Data':
  • Context - a hazardous material segment contains an identification code in lh1-un-na-id-cd field:
    For Check UN Prefix Format:
    When the system checks the first two characters of the identification code, then the system should verify that the prefix equals 'un' to confirm valid un number format.
  • Context - a hazardous material identification code has been validated with 'un' prefix:
    For Extract UN Number:
    When the system processes the lh1-un-na-id-cd field, then the system should extract the complete un number and store it in the commodity un number field.
  • Context - a valid un number has been extracted from hazardous material data:
    For Set Hazmat Found Flag:
    When the system confirms the un number format and extraction, then the system should set the hazmat found flag to true to indicate successful hazmat processing.
  • Context - a valid un number has been identified and hazmat sequence is established:
    For Get Proper Shipping Name:
    When the system accesses the lh3 hazmat information segment, then the system should retrieve the proper shipping name from lh3-proper-ship-name field if available.
  • Context - the proper shipping name has been successfully retrieved from lh3 segment:
    For Store Proper Shipping Name:
    When the system processes the hazmat description data, then the system should store the proper shipping name in the commodity description danger field.
  • Context - the current hazmat sequence has been processed and no valid un number was found:
    For Move to Next Hazmat Sequence:
    When the system needs to continue searching for hazardous materials, then the system should increment the hazmat sequence counter and continue processing if within the maximum limit of 98 sequences.
  • Context - the system is processing hazardous material sequences and current sequence is complete:
    For More Sequences to Check?:
    When the system evaluates continuation criteria, then the system should continue processing if sequence number is 98 or less and hazmat has not been found, otherwise terminate hazmat processing.
👨‍💻 Technical ACs (Gherkin)
Context: A hazardous material segment contains an identification code in LH1-UN-NA-ID-CD field
GIVEN
A hazardous material segment contains an identification code in LH1-UN-NA-ID-CD field
Applied to: Check UN Prefix Format
WHEN
The system checks the first two characters of the identification code
THEN
The system should verify that the prefix equals 'UN' to confirm valid UN number format
Context: A hazardous material identification code has been validated with 'UN' prefix
GIVEN
A hazardous material identification code has been validated with 'UN' prefix
Applied to: Extract UN Number
WHEN
The system processes the LH1-UN-NA-ID-CD field
THEN
The system should extract the complete UN number and store it in the commodity UN number field
Context: A valid UN number has been extracted from hazardous material data
GIVEN
A valid UN number has been extracted from hazardous material data
Applied to: Set Hazmat Found Flag
WHEN
The system confirms the UN number format and extraction
THEN
The system should set the hazmat found flag to true to indicate successful hazmat processing
Context: A valid UN number has been identified and hazmat sequence is established
GIVEN
A valid UN number has been identified and hazmat sequence is established
Applied to: Get Proper Shipping Name
WHEN
The system accesses the LH3 hazmat information segment
THEN
The system should retrieve the proper shipping name from LH3-PROPER-SHIP-NAME field if available
Context: The proper shipping name has been successfully retrieved from LH3 segment
GIVEN
The proper shipping name has been successfully retrieved from LH3 segment
Applied to: Store Proper Shipping Name
WHEN
The system processes the hazmat description data
THEN
The system should store the proper shipping name in the commodity description danger field
Context: The current hazmat sequence has been processed and no valid UN number was found
GIVEN
The current hazmat sequence has been processed and no valid UN number was found
Applied to: Move to Next Hazmat Sequence
WHEN
The system needs to continue searching for hazardous materials
THEN
The system should increment the hazmat sequence counter and continue processing if within the maximum limit of 98 sequences
Context: The system is processing hazardous material sequences and current sequence is complete
GIVEN
The system is processing hazardous material sequences and current sequence is complete
Applied to: More Sequences to Check?
WHEN
The system evaluates continuation criteria
THEN
The system should continue processing if sequence number is 98 or less AND hazmat has not been found, otherwise terminate hazmat processing
R-GCCCCADD-cbl-02721 (+10) File: GCCCCADD.cbl Process Transportation Entity Data Lookup Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Transportation Entity Data Lookup':
  • Context - a transportation entity lookup process is starting:
    For Initialize Search Parameters:
    When the search initialization is performed, then the entity not found flag is set to true and the transportation segment found flag is set to true.
  • Context - transportation entity search parameters are initialized:
    For Set Search Sequence to 1:
    When the search sequence is being set up, then the search sequence counter is set to 1.
  • Context - a search sequence number is established and edi bol key is available:
    For Search Transportation Segments:
    When transportation segment lookup is performed using segment type 'tn' and the current sequence, then the system attempts to retrieve the transportation segment data from ebsnrtd.
  • Context - a transportation segment lookup has been attempted:
    For Transportation Segment Found?:
    When the system checks the lookup result status, then if the status code is spaces then the segment is found, otherwise the segment is not found.
  • Context - a transportation segment has been successfully retrieved:
    For Check D5-ORG-ID Match:
    When the organization id needs to be extracted, then the d5-org-id field is extracted from the transportation segment data.
  • Context - an organization id has been extracted from the transportation segment and a target entity id is specified:
    For D5-ORG-ID Matches Target?:
    When the comparison is performed, then if the d5-org-id equals the target entity id then a match is found, otherwise continue searching.
  • Context - the organization id from a transportation segment matches the target entity id:
    For Mark Entity Found:
    When the entity found status is updated, then the entity found flag is set to true.
  • Context - the current transportation segment does not contain the target entity id:
    For Increment Search Sequence:
    When the search needs to continue to the next segment, then the search sequence counter is incremented by 1.
  • Context - the search sequence has been incremented and the target entity has not been found:
    For More Segments to Search?:
    When the system checks for continuation of the search loop, then if the transportation segment found flag is true then continue searching, otherwise stop the search.
  • Context - a transportation segment with matching organization id has been found:
    For Entity Located Successfully:
    When the search process completes successfully, then the entity found flag remains true and the search sequence is decremented by 1 to reflect the correct position.
  • Context - all available transportation segments have been searched or no segments were found:
    For Entity Not Found:
    When the target entity id was not matched in any segment, then the entity not found flag remains true.
👨‍💻 Technical ACs (Gherkin)
Context: A transportation entity lookup process is starting
GIVEN
A transportation entity lookup process is starting
Applied to: Initialize Search Parameters
WHEN
The search initialization is performed
THEN
The entity not found flag is set to true and the transportation segment found flag is set to true
Context: Transportation entity search parameters are initialized
GIVEN
Transportation entity search parameters are initialized
Applied to: Set Search Sequence to 1
WHEN
The search sequence is being set up
THEN
The search sequence counter is set to 1
Context: A search sequence number is established and EDI BOL key is available
GIVEN
A search sequence number is established and EDI BOL key is available
Applied to: Search Transportation Segments
WHEN
Transportation segment lookup is performed using segment type 'TN' and the current sequence
THEN
The system attempts to retrieve the transportation segment data from EBSNRTD
Context: A transportation segment lookup has been attempted
GIVEN
A transportation segment lookup has been attempted
Applied to: Transportation Segment Found?
WHEN
The system checks the lookup result status
THEN
If the status code is spaces then the segment is found, otherwise the segment is not found
Context: A transportation segment has been successfully retrieved
GIVEN
A transportation segment has been successfully retrieved
Applied to: Check D5-ORG-ID Match
WHEN
The organization ID needs to be extracted
THEN
The D5-ORG-ID field is extracted from the transportation segment data
Context: An organization ID has been extracted from the transportation segment and a target entity ID is specified
GIVEN
An organization ID has been extracted from the transportation segment and a target entity ID is specified
Applied to: D5-ORG-ID Matches Target?
WHEN
The comparison is performed
THEN
If the D5-ORG-ID equals the target entity ID then a match is found, otherwise continue searching
Context: The organization ID from a transportation segment matches the target entity ID
GIVEN
The organization ID from a transportation segment matches the target entity ID
Applied to: Mark Entity Found
WHEN
The entity found status is updated
THEN
The entity found flag is set to true
Context: The current transportation segment does not contain the target entity ID
GIVEN
The current transportation segment does not contain the target entity ID
Applied to: Increment Search Sequence
WHEN
The search needs to continue to the next segment
THEN
The search sequence counter is incremented by 1
Context: The search sequence has been incremented and the target entity has not been found
GIVEN
The search sequence has been incremented and the target entity has not been found
Applied to: More Segments to Search?
WHEN
The system checks for continuation of the search loop
THEN
If the transportation segment found flag is true then continue searching, otherwise stop the search
Context: A transportation segment with matching organization ID has been found
GIVEN
A transportation segment with matching organization ID has been found
Applied to: Entity Located Successfully
WHEN
The search process completes successfully
THEN
The entity found flag remains true and the search sequence is decremented by 1 to reflect the correct position
Context: All available transportation segments have been searched or no segments were found
GIVEN
All available transportation segments have been searched or no segments were found
Applied to: Entity Not Found
WHEN
The target entity ID was not matched in any segment
THEN
The entity not found flag remains true
R-GCCCCADD-cbl-02732 (+11) File: GCCCCADD.cbl Build MCOA Entity Segments Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build MCOA Entity Segments':
  • Context - the system needs to process mcoa entity segments:
    For Start MCOA Entity Processing:
    When mcoa entity processing begins, then the mcoa sequence counter is initialized and processing flags are reset.
  • Context - a mcoa sequence number is available:
    For Get MCOA Segment by Sequence:
    When the system attempts to retrieve the mcoa segment, then the mcoa segment data is retrieved from ebsmcoa using the sequence number.
  • Context - an attempt to retrieve mcoa segment has been made:
    For MCOA Segment Found?:
    When the system checks the retrieval status, then if no error status is returned and segment type is 'ot', the segment is considered found, otherwise processing stops.
  • Context - a valid mcoa segment has been found:
    For Entity Type is PF or SS?:
    When the system checks the organization id in the segment, then if the organization id is 'pf' or 'ss', the entity is processed, otherwise it is skipped.
  • Context - a mcoa segment with entity type pf or ss is found:
    For Extract Entity Information:
    When the system extracts entity information, then the organization id is set as entity id code, organization name is set as entity name, id code qualifier and id code are extracted from the segment.
  • Context - entity information has been extracted from mcoa segment:
    For Get MCOA Address Segment:
    When the system attempts to retrieve address information, then the mcoa on segment is retrieved using the same sequence number.
  • Context - an attempt to retrieve mcoa address segment has been made:
    For Address Segment Found?:
    When the system checks if address data is available, then if address segment is found, extract address lines 1 and 2, otherwise set address line 1 to 'na' and clear address line 2.
  • Context - address information has been processed:
    For Get MCOA City/State Segment:
    When the system attempts to retrieve city/state information, then the mcoa oc segment is retrieved using the same sequence number.
  • Context - an attempt to retrieve mcoa city/state segment has been made:
    For City/State Segment Found?:
    When the system checks if city/state data is available, then if city/state segment is found, extract city name, state/province code, postal code and country code, otherwise clear all city/state information fields.
  • Context - all mcoa entity information has been extracted and processed:
    For Validate Entity Segment:
    When the system validates the entity segment, then standard entity validation rules are applied to ensure data integrity.
  • Context - a valid mcoa entity segment has been created and validated:
    For Insert Entity Record:
    When the system inserts the entity record, then the entity record is inserted into the gcsccs55 array with the appropriate sequence number.
  • Context - an mcoa entity has been processed:
    For More MCOA Segments?:
    When the system checks for more segments, then the sequence counter is incremented and processing continues if more segments are available, otherwise mcoa processing ends.
👨‍💻 Technical ACs (Gherkin)
Context: The system needs to process MCOA entity segments
GIVEN
The system needs to process MCOA entity segments
Applied to: Start MCOA Entity Processing
WHEN
MCOA entity processing begins
THEN
The MCOA sequence counter is initialized and processing flags are reset
Context: A MCOA sequence number is available
GIVEN
A MCOA sequence number is available
Applied to: Get MCOA Segment by Sequence
WHEN
The system attempts to retrieve the MCOA segment
THEN
The MCOA segment data is retrieved from EBSMCOA using the sequence number
Context: An attempt to retrieve MCOA segment has been made
GIVEN
An attempt to retrieve MCOA segment has been made
Applied to: MCOA Segment Found?
WHEN
The system checks the retrieval status
THEN
If no error status is returned and segment type is 'OT', the segment is considered found, otherwise processing stops
Context: A valid MCOA segment has been found
GIVEN
A valid MCOA segment has been found
Applied to: Entity Type is PF or SS?
WHEN
The system checks the organization ID in the segment
THEN
If the organization ID is 'PF' or 'SS', the entity is processed, otherwise it is skipped
Context: A MCOA segment with entity type PF or SS is found
GIVEN
A MCOA segment with entity type PF or SS is found
Applied to: Extract Entity Information
WHEN
The system extracts entity information
THEN
The organization ID is set as entity ID code, organization name is set as entity name, ID code qualifier and ID code are extracted from the segment
Context: Entity information has been extracted from MCOA segment
GIVEN
Entity information has been extracted from MCOA segment
Applied to: Get MCOA Address Segment
WHEN
The system attempts to retrieve address information
THEN
The MCOA ON segment is retrieved using the same sequence number
Context: An attempt to retrieve MCOA address segment has been made
GIVEN
An attempt to retrieve MCOA address segment has been made
Applied to: Address Segment Found?
WHEN
The system checks if address data is available
THEN
If address segment is found, extract address lines 1 and 2, otherwise set address line 1 to 'NA' and clear address line 2
Context: Address information has been processed
GIVEN
Address information has been processed
Applied to: Get MCOA City/State Segment
WHEN
The system attempts to retrieve city/state information
THEN
The MCOA OC segment is retrieved using the same sequence number
Context: An attempt to retrieve MCOA city/state segment has been made
GIVEN
An attempt to retrieve MCOA city/state segment has been made
Applied to: City/State Segment Found?
WHEN
The system checks if city/state data is available
THEN
If city/state segment is found, extract city name, state/province code, postal code and country code, otherwise clear all city/state information fields
Context: All MCOA entity information has been extracted and processed
GIVEN
All MCOA entity information has been extracted and processed
Applied to: Validate Entity Segment
WHEN
The system validates the entity segment
THEN
Standard entity validation rules are applied to ensure data integrity
Context: A valid MCOA entity segment has been created and validated
GIVEN
A valid MCOA entity segment has been created and validated
Applied to: Insert Entity Record
WHEN
The system inserts the entity record
THEN
The entity record is inserted into the GCSCCS55 array with the appropriate sequence number
Context: An MCOA entity has been processed
GIVEN
An MCOA entity has been processed
Applied to: More MCOA Segments?
WHEN
The system checks for more segments
THEN
The sequence counter is incremented and processing continues if more segments are available, otherwise MCOA processing ends
R-GCCCCADD-cbl-02744 (+5) File: GCCCCADD.cbl Execute Crossing Table Search with Progressive Criteria Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Crossing Table Search with Progressive Criteria':
  • Context - a shipment has shipper chop code, consignee chop code, origin station number, destination road number, and commodity code available:
    For Search 1: Specific Shipper CHOP + Consignee CHOP + Origin Station + Destination Road + Commodity Code:
    When the system performs the first crossing table search with all specific criteria, then the system searches the crossing table using shipper chop, consignee chop, origin station, destination road prefixed with 'road', and commodity code to find matching broker information.
  • Context - the primary crossing table search with specific criteria returned no results:
    For Search 2: Wildcard Shipper CHOP + Consignee CHOP + Wildcard Origin + Destination Road + Commodity Code:
    When the system performs the second crossing table search with partial wildcards, then the system searches using wildcard for shipper chop, specific consignee chop, wildcard for origin station, destination road prefixed with 'road', and specific commodity code.
  • Context - both primary and secondary crossing table searches returned no results:
    For Search 3: Wildcard Shipper CHOP + Wildcard Origin + Wildcard Commodity Code:
    When the system performs the third crossing table search with maximum wildcards, then the system searches using wildcard for shipper chop, wildcard for origin station, and wildcard for commodity code.
  • Context - a crossing table search has been executed with specific search criteria:
    For Data Found?:
    When the system evaluates the search results, then if broker data is found, the system proceeds to return results; if no data is found, the system proceeds to the next search iteration or concludes with no broker data.
  • Context - one of the crossing table searches has successfully found matching broker data:
    For Return Search Results:
    When the system processes the successful search results, then the system returns the found broker information including broker name and any associated manifest routing details.
  • Context - all three crossing table searches (specific, partial wildcard, and maximum wildcard) have been executed:
    For No Broker Data Found:
    When none of the searches return matching broker data, then the system concludes that no broker data is available for the given shipment criteria.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has shipper CHOP code, consignee CHOP code, origin station number, destination road number, and commodity code available
GIVEN
A shipment has shipper CHOP code, consignee CHOP code, origin station number, destination road number, and commodity code available
Applied to: Search 1: Specific Shipper CHOP + Consignee CHOP + Origin Station + Destination Road + Commodity Code
WHEN
The system performs the first crossing table search with all specific criteria
THEN
The system searches the crossing table using shipper CHOP, consignee CHOP, origin station, destination road prefixed with 'ROAD', and commodity code to find matching broker information
Context: The primary crossing table search with specific criteria returned no results
GIVEN
The primary crossing table search with specific criteria returned no results
Applied to: Search 2: Wildcard Shipper CHOP + Consignee CHOP + Wildcard Origin + Destination Road + Commodity Code
WHEN
The system performs the second crossing table search with partial wildcards
THEN
The system searches using wildcard for shipper CHOP, specific consignee CHOP, wildcard for origin station, destination road prefixed with 'ROAD', and specific commodity code
Context: Both primary and secondary crossing table searches returned no results
GIVEN
Both primary and secondary crossing table searches returned no results
Applied to: Search 3: Wildcard Shipper CHOP + Wildcard Origin + Wildcard Commodity Code
WHEN
The system performs the third crossing table search with maximum wildcards
THEN
The system searches using wildcard for shipper CHOP, wildcard for origin station, and wildcard for commodity code
Context: A crossing table search has been executed with specific search criteria
GIVEN
A crossing table search has been executed with specific search criteria
Applied to: Data Found?
WHEN
The system evaluates the search results
THEN
If broker data is found, the system proceeds to return results; if no data is found, the system proceeds to the next search iteration or concludes with no broker data
Context: One of the crossing table searches has successfully found matching broker data
GIVEN
One of the crossing table searches has successfully found matching broker data
Applied to: Return Search Results
WHEN
The system processes the successful search results
THEN
The system returns the found broker information including broker name and any associated manifest routing details
Context: All three crossing table searches (specific, partial wildcard, and maximum wildcard) have been executed
GIVEN
All three crossing table searches (specific, partial wildcard, and maximum wildcard) have been executed
Applied to: No Broker Data Found
WHEN
None of the searches return matching broker data
THEN
The system concludes that no broker data is available for the given shipment criteria
R-GCCCCADD-cbl-02750 (+3) File: GCCCCADD.cbl Validate Entity ID Values Against Allowed Types Merged 4 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Validate Entity ID Values Against Allowed Types':
  • Context - a customs record segment is being processed for entity information:
    For Entity ID Present?:
    When the entity id code field is evaluated for presence, then if entity id code is spaces, skip entity validation and complete processing, otherwise proceed with entity validation.
  • Context - an entity record with a sequence number is being processed:
    For Sequence > 2?:
    When the sequence number is evaluated against the threshold of 2, then if sequence number is 2 or less, skip entity type validation, otherwise apply entity type validation rules.
  • Context - an entity record with sequence number greater than 2 has an entity id code:
    For Valid Entity ID Code?:
    When the entity id code is checked against valid entity type values and restricted entity types, then if entity id code is not in valid values list or is sh (shipper) or is cn (consignee) or is cb (customs broker), generate invalid entity id error, otherwise accept the entity id.
  • Context - an entity id code has failed validation due to invalid value or restricted type usage:
    For Generate Invalid Entity ID Error:
    When the system needs to report the validation failure, then generate error message 'invalid entity id value' and add to message collection for the record.
👨‍💻 Technical ACs (Gherkin)
Context: A customs record segment is being processed for entity information
GIVEN
A customs record segment is being processed for entity information
Applied to: Entity ID Present?
WHEN
The entity ID code field is evaluated for presence
THEN
If entity ID code is spaces, skip entity validation and complete processing, otherwise proceed with entity validation
Context: An entity record with a sequence number is being processed
GIVEN
An entity record with a sequence number is being processed
Applied to: Sequence > 2?
WHEN
The sequence number is evaluated against the threshold of 2
THEN
If sequence number is 2 or less, skip entity type validation, otherwise apply entity type validation rules
Context: An entity record with sequence number greater than 2 has an entity ID code
GIVEN
An entity record with sequence number greater than 2 has an entity ID code
Applied to: Valid Entity ID Code?
WHEN
The entity ID code is checked against valid entity type values and restricted entity types
THEN
If entity ID code is not in valid values list OR is SH (shipper) OR is CN (consignee) OR is CB (customs broker), generate invalid entity ID error, otherwise accept the entity ID
Context: An entity ID code has failed validation due to invalid value or restricted type usage
GIVEN
An entity ID code has failed validation due to invalid value or restricted type usage
Applied to: Generate Invalid Entity ID Error
WHEN
The system needs to report the validation failure
THEN
Generate error message 'Invalid Entity ID Value' and add to message collection for the record
R-GCCCCADD-cbl-02754 (+15) File: GCCCCADD.cbl Generate Comprehensive Error Messages for Missing Required Fields Merged 16 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Comprehensive Error Messages for Missing Required Fields':
  • Context - a shipper record is being validated and the record sequence is 0001 and all required fields (name, address, city, state, postal code, country) are empty:
    For Generate Shipper Required Field Errors:
    When the system performs n1 segment validation, then the system generates error messages for shipper name required, address required, city required, state required, postal code required, and country required.
  • Context - a consignee record is being validated and the record sequence is 0002 and all required fields (name, address, city, state, postal code, country) are empty:
    For Generate Consignee Required Field Errors:
    When the system performs n1 segment validation, then the system generates error messages for consignee name required, address required, city required, state required, postal code required, and country required.
  • Context - an n1 segment is being validated and the entity id code is present and the name field is empty:
    For Add N102 Name Required Error Message:
    When the system checks field consistency, then the system generates an error message indicating that the name field is required when entity id is specified.
  • Context - an n1 segment is being validated and address information is present (n3 or n4 or per data is not empty) and the entity id code is empty:
    For Add N101 Entity ID Required Error:
    When the system checks field dependencies, then the system generates an error message indicating that entity id is required when address information is provided.
  • Context - an n1 segment is being validated and address information is present (n3 or n4 or per data is not empty) and the name field is empty:
    For Add N102 Name Required Error:
    When the system checks field dependencies, then the system generates an error message indicating that name is required when address information is provided.
  • Context - an n1 segment has entity id and name populated and the address line 1 field is empty:
    For Validate N3 Address Fields:
    When the system validates address requirements, then the system generates an error message indicating that address is required for the identified entity.
  • Context - an n4 segment contains geographic data and the city name field is empty:
    For Validate N4 Geographic Fields:
    When the system validates geographic information, then the system generates an error message indicating that city name is required.
  • Context - an n4 segment contains a city name and the city name length is less than 2 characters:
    For Validate N4 Geographic Fields:
    When the system validates city name format, then the system generates an error message indicating minimum length of 2 characters is required.
  • Context - an n4 segment contains a postal code and the postal code length is less than 3 characters:
    For Validate N4 Geographic Fields:
    When the system validates postal code format, then the system generates an error message indicating minimum length of 3 characters is required.
  • Context - an n4 segment has country code of canada, usa, or mexico and the state/province code is empty:
    For Validate N4 Geographic Fields:
    When the system validates geographic requirements, then the system generates an error message indicating that state/province code is required for the specified country.
  • Context - an n4 segment has both state/province code and country code populated and the state code is not valid for the specified country:
    For Validate N4 Geographic Fields:
    When the system cross-validates state and country codes, then the system generates an error message indicating invalid state/province code for the country.
  • Context - an n4 segment contains geographic data and the country code field is empty:
    For Validate N4 Geographic Fields:
    When the system validates geographic completeness, then the system generates an error message indicating that country code is required.
  • Context - a per segment has contact person name populated and the communication number qualifier is empty:
    For Validate PER Contact Fields:
    When the system validates contact information consistency, then the system generates an error message indicating that communication qualifier is required when contact name is provided.
  • Context - a per segment has communication number populated and the communication number qualifier is empty:
    For Validate PER Contact Fields:
    When the system validates contact information consistency, then the system generates an error message indicating that communication qualifier is required when phone number is provided.
  • Context - a per segment has communication number qualifier populated and the qualifier is not spaces, 'fx' (fax), or 'te' (telephone):
    For Validate PER Contact Fields:
    When the system validates qualifier values, then the system generates an error message indicating invalid communication qualifier value.
  • Context - a per segment has communication qualifier or contact person name populated and the communication number is empty:
    For Validate PER Contact Fields:
    When the system validates contact completeness, then the system generates an error message indicating that communication number is required.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper record is being validated AND the record sequence is 0001 AND all required fields (name, address, city, state, postal code, country) are empty
GIVEN
A shipper record is being validated AND the record sequence is 0001 AND all required fields (name, address, city, state, postal code, country) are empty
Applied to: Generate Shipper Required Field Errors
WHEN
The system performs N1 segment validation
THEN
The system generates error messages for shipper name required, address required, city required, state required, postal code required, and country required
Context: A consignee record is being validated AND the record sequence is 0002 AND all required fields (name, address, city, state, postal code, country) are empty
GIVEN
A consignee record is being validated AND the record sequence is 0002 AND all required fields (name, address, city, state, postal code, country) are empty
Applied to: Generate Consignee Required Field Errors
WHEN
The system performs N1 segment validation
THEN
The system generates error messages for consignee name required, address required, city required, state required, postal code required, and country required
Context: An N1 segment is being validated AND the entity ID code is present AND the name field is empty
GIVEN
An N1 segment is being validated AND the entity ID code is present AND the name field is empty
Applied to: Add N102 Name Required Error Message
WHEN
The system checks field consistency
THEN
The system generates an error message indicating that the name field is required when entity ID is specified
Context: An N1 segment is being validated AND address information is present (N3 or N4 or PER data is not empty) AND the entity ID code is empty
GIVEN
An N1 segment is being validated AND address information is present (N3 or N4 or PER data is not empty) AND the entity ID code is empty
Applied to: Add N101 Entity ID Required Error
WHEN
The system checks field dependencies
THEN
The system generates an error message indicating that entity ID is required when address information is provided
Context: An N1 segment is being validated AND address information is present (N3 or N4 or PER data is not empty) AND the name field is empty
GIVEN
An N1 segment is being validated AND address information is present (N3 or N4 or PER data is not empty) AND the name field is empty
Applied to: Add N102 Name Required Error
WHEN
The system checks field dependencies
THEN
The system generates an error message indicating that name is required when address information is provided
Context: An N1 segment has entity ID and name populated AND the address line 1 field is empty
GIVEN
An N1 segment has entity ID and name populated AND the address line 1 field is empty
Applied to: Validate N3 Address Fields
WHEN
The system validates address requirements
THEN
The system generates an error message indicating that address is required for the identified entity
Context: An N4 segment contains geographic data AND the city name field is empty
GIVEN
An N4 segment contains geographic data AND the city name field is empty
Applied to: Validate N4 Geographic Fields
WHEN
The system validates geographic information
THEN
The system generates an error message indicating that city name is required
Context: An N4 segment contains a city name AND the city name length is less than 2 characters
GIVEN
An N4 segment contains a city name AND the city name length is less than 2 characters
Applied to: Validate N4 Geographic Fields
WHEN
The system validates city name format
THEN
The system generates an error message indicating minimum length of 2 characters is required
Context: An N4 segment contains a postal code AND the postal code length is less than 3 characters
GIVEN
An N4 segment contains a postal code AND the postal code length is less than 3 characters
Applied to: Validate N4 Geographic Fields
WHEN
The system validates postal code format
THEN
The system generates an error message indicating minimum length of 3 characters is required
Context: An N4 segment has country code of Canada, USA, or Mexico AND the state/province code is empty
GIVEN
An N4 segment has country code of Canada, USA, or Mexico AND the state/province code is empty
Applied to: Validate N4 Geographic Fields
WHEN
The system validates geographic requirements
THEN
The system generates an error message indicating that state/province code is required for the specified country
Context: An N4 segment has both state/province code and country code populated AND the state code is not valid for the specified country
GIVEN
An N4 segment has both state/province code and country code populated AND the state code is not valid for the specified country
Applied to: Validate N4 Geographic Fields
WHEN
The system cross-validates state and country codes
THEN
The system generates an error message indicating invalid state/province code for the country
Context: An N4 segment contains geographic data AND the country code field is empty
GIVEN
An N4 segment contains geographic data AND the country code field is empty
Applied to: Validate N4 Geographic Fields
WHEN
The system validates geographic completeness
THEN
The system generates an error message indicating that country code is required
Context: A PER segment has contact person name populated AND the communication number qualifier is empty
GIVEN
A PER segment has contact person name populated AND the communication number qualifier is empty
Applied to: Validate PER Contact Fields
WHEN
The system validates contact information consistency
THEN
The system generates an error message indicating that communication qualifier is required when contact name is provided
Context: A PER segment has communication number populated AND the communication number qualifier is empty
GIVEN
A PER segment has communication number populated AND the communication number qualifier is empty
Applied to: Validate PER Contact Fields
WHEN
The system validates contact information consistency
THEN
The system generates an error message indicating that communication qualifier is required when phone number is provided
Context: A PER segment has communication number qualifier populated AND the qualifier is not spaces, 'FX' (fax), or 'TE' (telephone)
GIVEN
A PER segment has communication number qualifier populated AND the qualifier is not spaces, 'FX' (fax), or 'TE' (telephone)
Applied to: Validate PER Contact Fields
WHEN
The system validates qualifier values
THEN
The system generates an error message indicating invalid communication qualifier value
Context: A PER segment has communication qualifier or contact person name populated AND the communication number is empty
GIVEN
A PER segment has communication qualifier or contact person name populated AND the communication number is empty
Applied to: Validate PER Contact Fields
WHEN
The system validates contact completeness
THEN
The system generates an error message indicating that communication number is required
R-GCCCCADD-cbl-02770 (+6) File: GCCCCADD.cbl Perform State Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Perform State':
  • Context - a state/province code and country code are provided for validation:
    For Search TB-STATE-COUNTRY Table:
    When the system searches the tb-state-country lookup table for matching state and country combination, then the system sets valid province flag if match is found, otherwise sets invalid province flag.
  • Context - a state/province code that does not exist in the lookup table for the specified country:
    For Generate Error Message:
    When the validation process determines the state/province code is invalid, then the system generates an error message indicating invalid state/province code and adds it to the message collection.
  • Context - a state/province code that exists in the state-country lookup table:
    For Move Country Code to Output Field:
    When the system finds a matching entry in the tb-state-country table, then the system automatically sets the corresponding country code from the lookup table entry.
  • Context - shipper address information with state/province code is provided:
    For Set Valid Province Flag:
    When the shipper state/province code is validated against the state-country lookup table, then if valid, the corresponding country code is assigned to shipper country field, otherwise an error message is generated for invalid shipper state/province code.
  • Context - consignee address information with state/province code is provided:
    For Set Valid Province Flag:
    When the consignee state/province code is validated against the state-country lookup table, then if valid, the corresponding country code is assigned to consignee country field, otherwise an error message is generated for invalid consignee state/province code.
  • Context - an address record with state/province code but missing country code:
    For Move Country Code to Output Field:
    When the state/province code is found in the state-country lookup table, then the system automatically populates the country code field with the corresponding value from the lookup table.
  • Context - a destination state/province code from shipment data:
    For Set Valid Province Flag:
    When the system searches the state-country table for the destination state code, then if the state code corresponds to country 'us', set destination as us, otherwise set as non-us destination.
👨‍💻 Technical ACs (Gherkin)
Context: A state/province code and country code are provided for validation
GIVEN
A state/province code and country code are provided for validation
Applied to: Search TB-STATE-COUNTRY Table
WHEN
The system searches the TB-STATE-COUNTRY lookup table for matching state and country combination
THEN
The system sets valid province flag if match is found, otherwise sets invalid province flag
Context: A state/province code that does not exist in the lookup table for the specified country
GIVEN
A state/province code that does not exist in the lookup table for the specified country
Applied to: Generate Error Message
WHEN
The validation process determines the state/province code is invalid
THEN
The system generates an error message indicating invalid state/province code and adds it to the message collection
Context: A state/province code that exists in the state-country lookup table
GIVEN
A state/province code that exists in the state-country lookup table
Applied to: Move Country Code to Output Field
WHEN
The system finds a matching entry in the TB-STATE-COUNTRY table
THEN
The system automatically sets the corresponding country code from the lookup table entry
Context: Shipper address information with state/province code is provided
GIVEN
Shipper address information with state/province code is provided
Applied to: Set Valid Province Flag
WHEN
The shipper state/province code is validated against the state-country lookup table
THEN
If valid, the corresponding country code is assigned to shipper country field, otherwise an error message is generated for invalid shipper state/province code
Context: Consignee address information with state/province code is provided
GIVEN
Consignee address information with state/province code is provided
Applied to: Set Valid Province Flag
WHEN
The consignee state/province code is validated against the state-country lookup table
THEN
If valid, the corresponding country code is assigned to consignee country field, otherwise an error message is generated for invalid consignee state/province code
Context: An address record with state/province code but missing country code
GIVEN
An address record with state/province code but missing country code
Applied to: Move Country Code to Output Field
WHEN
The state/province code is found in the state-country lookup table
THEN
The system automatically populates the country code field with the corresponding value from the lookup table
Context: A destination state/province code from shipment data
GIVEN
A destination state/province code from shipment data
Applied to: Set Valid Province Flag
WHEN
The system searches the state-country table for the destination state code
THEN
If the state code corresponds to country 'US', set destination as US, otherwise set as non-US destination
R-GCCCCADD-cbl-02777 (+3) File: GCCCCADD.cbl Parse Fastway Address String into Components Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Parse Fastway Address String into Components':
  • Context - a shipper address is stored in shpr-addr(2) field in fastway shipment data:
    For Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field:
    When the system processes shipper address information for customs manifest creation, then the concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding n4 segment fields.
  • Context - a consignee address is stored in cons-data(4) field in fastway shipment data:
    For Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field:
    When the system processes consignee address information for customs manifest creation, then the concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding n4 segment fields.
  • Context - a notify party address is stored in cons-data(4) field in fastway shipment data:
    For Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field:
    When the system processes notify party address information for customs manifest creation, then the concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding n4 segment fields.
  • Context - a state or province code has been extracted from an address field:
    For Validate Extracted Components:
    When the system needs to determine the corresponding country code, then the system searches the tb-state-country table to find the matching country code for the state/province and moves it to the country field, or leaves it blank if no match is found.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper address is stored in SHPR-ADDR(2) field in Fastway shipment data
GIVEN
A shipper address is stored in SHPR-ADDR(2) field in Fastway shipment data
Applied to: Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field
WHEN
The system processes shipper address information for customs manifest creation
THEN
The concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding N4 segment fields
Context: A consignee address is stored in CONS-DATA(4) field in Fastway shipment data
GIVEN
A consignee address is stored in CONS-DATA(4) field in Fastway shipment data
Applied to: Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field
WHEN
The system processes consignee address information for customs manifest creation
THEN
The concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding N4 segment fields
Context: A notify party address is stored in CONS-DATA(4) field in Fastway shipment data
GIVEN
A notify party address is stored in CONS-DATA(4) field in Fastway shipment data
Applied to: Parse Fastway Address String into Components - Extract city, state, and postal code from concatenated address field
WHEN
The system processes notify party address information for customs manifest creation
THEN
The concatenated address string is parsed into separate city name, state/province code, and postal code components and moved to the corresponding N4 segment fields
Context: A state or province code has been extracted from an address field
GIVEN
A state or province code has been extracted from an address field
Applied to: Validate Extracted Components
WHEN
The system needs to determine the corresponding country code
THEN
The system searches the TB-STATE-COUNTRY table to find the matching country code for the state/province and moves it to the country field, or leaves it blank if no match is found
R-GCCCCADD-cbl-02781 (+23) File: GCCCCADD.cbl Execute Corrector EDI Backup and Restore Logic Merged 24 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Corrector EDI Backup and Restore Logic':
  • Context - a corrector edi transaction is being processed:
    For Check if Corrector EDI has Importer Data?:
    When the system checks for importer data presence in the edi, then if importer, business number, and business number qualifier are all present, proceed to search existing records, otherwise continue with normal processing.
  • Context - corrector edi contains importer data and importer, business number, and business number qualifier are present:
    For Search Existing Importer Records:
    When the system searches through sequence numbers 3 to 24 for existing importer records, then continue searching until an importer is found or sequence exceeds 24.
  • Context - a customs record type 55 has been retrieved during the search:
    For Found Existing Importer in Record 55?:
    When the system checks the entity id code in the record, then if the entity id code equals 'im', mark as importer found and proceed to backup data, otherwise continue searching.
  • Context - an existing importer record has been found in the customs data:
    For Store Importer CHOP & Store Importer Name & Store Business Number Qualifier & Store Business Number & Store CSA Indicator & Store Address Information & Store City/State/Postal & Store Contact Information:
    When the system needs to backup the original importer information, then store the chop code from the existing record to temporary storage for potential restoration and store the importer name from the existing record to temporary storage for potential restoration and store the business number qualifier from the existing record to temporary storage for potential restoration and store the business number from the existing record to temporary storage for potential restoration and store the csa indicator from the existing record to temporary storage for potential restoration and store both address line 1 and address line 2 from the existing record to temporary storage for potential restoration and store the city name, state/province code, postal code, and country code from the existing record to temporary storage for potential restoration and store the contact function code, person name, communication number qualifier, and communication number from the existing record to temporary storage for potential restoration.
  • Context - original importer data has been successfully backed up to temporary storage:
    For Clear Current Importer Fields:
    When the system needs to clear current importer fields for corrector edi processing, then set importer, business number, and business number qualifier fields to spaces in the current processing area.
  • Context - corrector edi processing has been completed and original importer data was backed up:
    For Corrector EDI Deletes Importer?:
    When the system checks if the corrector edi has deleted importer information, then if backed up importer name exists and no new importer data is found in sequence 55, proceed to restore backed up data, otherwise continue normal processing.
  • Context - corrector edi has deleted importer information and restoration is needed:
    For No Backup Data Available?:
    When the system checks for availability of backed up importer data, then if backed up importer name is present, proceed with data restoration, otherwise clear importer fields.
  • Context - corrector edi has deleted importer information and backup data is available:
    For Set Importer CHOP from Backup & Set Importer Name from Backup & Set Business Qualifier from Backup & Set Business Number from Backup & Set CSA Indicator from Backup & Set Address from Backup & Set City/State/Postal from Backup & Set Contact Info from Backup:
    When the system restores importer information from backup, then set the chop code in both the customs record and current processing fields from the backed up value and set the importer name in both the customs record and current processing fields from the backed up value and set the business number qualifier in both the customs record and current processing fields from the backed up value and set the business number in both the customs record and current processing fields from the backed up value and set the csa indicator in the current processing fields from the backed up value and set both address line 1 and address line 2 in the customs record from the backed up values and set the city name, state/province code, postal code, and country code in the customs record from the backed up values and set the contact function code, person name, communication number qualifier, and communication number in the customs record from the backed up values.
  • Context - importer data has been successfully restored from backup:
    For Mark Importer Found Flag:
    When the system completes the restoration process, then set the importer found flag to indicate that valid importer data is now available for processing.
  • Context - corrector edi has deleted importer information and no backup data is available for restoration:
    For Clear Importer Fields:
    When the system cannot restore importer data from backup, then clear the importer field in the current processing area and set importer not found flag.
👨‍💻 Technical ACs (Gherkin)
Context: A corrector EDI transaction is being processed
GIVEN
A corrector EDI transaction is being processed
Applied to: Check if Corrector EDI has Importer Data?
WHEN
The system checks for importer data presence in the EDI
THEN
If importer, business number, and business number qualifier are all present, proceed to search existing records, otherwise continue with normal processing
Context: Corrector EDI contains importer data and importer, business number, and business number qualifier are present
GIVEN
Corrector EDI contains importer data and importer, business number, and business number qualifier are present
Applied to: Search Existing Importer Records
WHEN
The system searches through sequence numbers 3 to 24 for existing importer records
THEN
Continue searching until an importer is found or sequence exceeds 24
Context: A customs record type 55 has been retrieved during the search
GIVEN
A customs record type 55 has been retrieved during the search
Applied to: Found Existing Importer in Record 55?
WHEN
The system checks the entity ID code in the record
THEN
If the entity ID code equals 'IM', mark as importer found and proceed to backup data, otherwise continue searching
Context: An existing importer record has been found in the customs data
GIVEN
An existing importer record has been found in the customs data
Applied to: Store Importer CHOP & Store Importer Name & Store Business Number Qualifier & Store Business Number & Store CSA Indicator & Store Address Information & Store City/State/Postal & Store Contact Information
WHEN
The system needs to backup the original importer information
THEN
Store the CHOP code from the existing record to temporary storage for potential restoration AND Store the importer name from the existing record to temporary storage for potential restoration AND Store the business number qualifier from the existing record to temporary storage for potential restoration AND Store the business number from the existing record to temporary storage for potential restoration AND Store the CSA indicator from the existing record to temporary storage for potential restoration AND Store both address line 1 and address line 2 from the existing record to temporary storage for potential restoration AND Store the city name, state/province code, postal code, and country code from the existing record to temporary storage for potential restoration AND Store the contact function code, person name, communication number qualifier, and communication number from the existing record to temporary storage for potential restoration
Context: Original importer data has been successfully backed up to temporary storage
GIVEN
Original importer data has been successfully backed up to temporary storage
Applied to: Clear Current Importer Fields
WHEN
The system needs to clear current importer fields for corrector EDI processing
THEN
Set importer, business number, and business number qualifier fields to spaces in the current processing area
Context: Corrector EDI processing has been completed and original importer data was backed up
GIVEN
Corrector EDI processing has been completed and original importer data was backed up
Applied to: Corrector EDI Deletes Importer?
WHEN
The system checks if the corrector EDI has deleted importer information
THEN
If backed up importer name exists and no new importer data is found in sequence 55, proceed to restore backed up data, otherwise continue normal processing
Context: Corrector EDI has deleted importer information and restoration is needed
GIVEN
Corrector EDI has deleted importer information and restoration is needed
Applied to: No Backup Data Available?
WHEN
The system checks for availability of backed up importer data
THEN
If backed up importer name is present, proceed with data restoration, otherwise clear importer fields
Context: Corrector EDI has deleted importer information and backup data is available
GIVEN
Corrector EDI has deleted importer information and backup data is available
Applied to: Set Importer CHOP from Backup & Set Importer Name from Backup & Set Business Qualifier from Backup & Set Business Number from Backup & Set CSA Indicator from Backup & Set Address from Backup & Set City/State/Postal from Backup & Set Contact Info from Backup
WHEN
The system restores importer information from backup
THEN
Set the CHOP code in both the customs record and current processing fields from the backed up value AND Set the importer name in both the customs record and current processing fields from the backed up value AND Set the business number qualifier in both the customs record and current processing fields from the backed up value AND Set the business number in both the customs record and current processing fields from the backed up value AND Set the CSA indicator in the current processing fields from the backed up value AND Set both address line 1 and address line 2 in the customs record from the backed up values AND Set the city name, state/province code, postal code, and country code in the customs record from the backed up values AND Set the contact function code, person name, communication number qualifier, and communication number in the customs record from the backed up values
Context: Importer data has been successfully restored from backup
GIVEN
Importer data has been successfully restored from backup
Applied to: Mark Importer Found Flag
WHEN
The system completes the restoration process
THEN
Set the importer found flag to indicate that valid importer data is now available for processing
Context: Corrector EDI has deleted importer information and no backup data is available for restoration
GIVEN
Corrector EDI has deleted importer information and no backup data is available for restoration
Applied to: Clear Importer Fields
WHEN
The system cannot restore importer data from backup
THEN
Clear the importer field in the current processing area and set importer not found flag
R-GCCCCADD-cbl-02805 (+15) File: GCCCCADD.cbl Execute Multiple Table Lookup Cascade Merged 16 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Execute Multiple Table Lookup Cascade':
  • Context - a cargo manifest is being processed with a manifest-to station name:
    For Is Manifest-To Station = 'IIS-A6'?:
    When the manifest-to station name equals 'iis-a6', then the system proceeds to check destination country for enhanced sub-location processing.
  • Context - the manifest-to station is 'iis-a6' and destination state code is available:
    For Is Destination Not US?:
    When the destination state code does not correspond to a us state, then the system proceeds to lookup cm table for port manifest information.
  • Context - the destination is not us and manifest-to station is 'iis-a6':
    For Lookup CM Table with Destination Station Number:
    When the system performs cm table lookup using destination station number, then the system attempts to retrieve port manifest upon information from cm table.
  • Context - a cm table lookup has been performed using destination station number:
    For CM Table Lookup Successful?:
    When the cm table lookup returns successful status, then the system extracts port manifest upon value for subsequent mc table lookup.
  • Context - cm table lookup was successful:
    For Get Port Manifest Upon from CM Table:
    When the system processes the cm table results, then the port manifest upon value is extracted for mc table lookup.
  • Context - port manifest upon value has been extracted from cm table:
    For Lookup MC Table with Port Manifest Upon:
    When the system performs mc table lookup using port manifest upon value, then the system attempts to retrieve sub-location code from mc table.
  • Context - an mc table lookup has been performed using port manifest upon value:
    For MC Table Lookup Successful?:
    When the mc table lookup returns successful status, then the system extracts sub-location code from mc table results.
  • Context - mc table lookup was successful:
    For Extract Sub-location Code from MC Table:
    When the system processes the mc table results, then the sub-location code is extracted and assigned to the cargo manifest.
  • Context - either cm table lookup failed or mc table lookup failed:
    For Set Sub-location Code to Spaces:
    When the system cannot retrieve valid sub-location information, then the sub-location code is set to spaces (blank).
  • Context - consignee chop code and destination station number are available:
    For Lookup RF Table with Consignee CHOP and Station:
    When the system performs rf table lookup using consignee chop and station, then the system attempts to retrieve customer bonded information and sub-location code.
  • Context - an rf table lookup has been performed using consignee chop and station:
    For RF Table Lookup Successful?:
    When the rf table lookup returns successful status, then the system extracts sub-location code and sets customer bonded indicator to true.
  • Context - rf table lookup was successful:
    For Extract Sub-location Code from RF Table:
    When the system processes the rf table results, then the sub-location code is extracted from rf table and customer bonded indicator is set to true.
  • Context - rf table lookup was successful for consignee chop and station:
    For Set Customer Bonded Indicator to True:
    When valid rail facility information is found, then the customer bonded indicator is set to true.
  • Context - rf table lookup failed for consignee chop and station:
    For Set Customer Bonded Indicator to False:
    When no valid rail facility information is found, then the customer bonded indicator is set to false.
  • Context - sub-location code processing has been completed and various indicators are set:
    For Sub-location Code Requirements Met?:
    When sub-location code is not blank or (sub-location code is blank and (csa indicator is on or manifest stations are same and not iis-a6 or destination is us or arrival indicator is y)), then sub-location code requirements are considered met and processing continues.
  • Context - sub-location code requirements validation has been performed:
    For Set Sub-location Error Flag:
    When sub-location code requirements are not met, then sub-location error flag is set to indicate validation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A cargo manifest is being processed with a manifest-to station name
GIVEN
A cargo manifest is being processed with a manifest-to station name
Applied to: Is Manifest-To Station = 'IIS-A6'?
WHEN
The manifest-to station name equals 'IIS-A6'
THEN
The system proceeds to check destination country for enhanced sub-location processing
Context: The manifest-to station is 'IIS-A6' and destination state code is available
GIVEN
The manifest-to station is 'IIS-A6' and destination state code is available
Applied to: Is Destination Not US?
WHEN
The destination state code does not correspond to a US state
THEN
The system proceeds to lookup CM table for port manifest information
Context: The destination is not US and manifest-to station is 'IIS-A6'
GIVEN
The destination is not US and manifest-to station is 'IIS-A6'
Applied to: Lookup CM Table with Destination Station Number
WHEN
The system performs CM table lookup using destination station number
THEN
The system attempts to retrieve port manifest upon information from CM table
Context: A CM table lookup has been performed using destination station number
GIVEN
A CM table lookup has been performed using destination station number
Applied to: CM Table Lookup Successful?
WHEN
The CM table lookup returns successful status
THEN
The system extracts port manifest upon value for subsequent MC table lookup
Context: CM table lookup was successful
GIVEN
CM table lookup was successful
Applied to: Get Port Manifest Upon from CM Table
WHEN
The system processes the CM table results
THEN
The port manifest upon value is extracted for MC table lookup
Context: Port manifest upon value has been extracted from CM table
GIVEN
Port manifest upon value has been extracted from CM table
Applied to: Lookup MC Table with Port Manifest Upon
WHEN
The system performs MC table lookup using port manifest upon value
THEN
The system attempts to retrieve sub-location code from MC table
Context: An MC table lookup has been performed using port manifest upon value
GIVEN
An MC table lookup has been performed using port manifest upon value
Applied to: MC Table Lookup Successful?
WHEN
The MC table lookup returns successful status
THEN
The system extracts sub-location code from MC table results
Context: MC table lookup was successful
GIVEN
MC table lookup was successful
Applied to: Extract Sub-location Code from MC Table
WHEN
The system processes the MC table results
THEN
The sub-location code is extracted and assigned to the cargo manifest
Context: Either CM table lookup failed or MC table lookup failed
GIVEN
Either CM table lookup failed or MC table lookup failed
Applied to: Set Sub-location Code to Spaces
WHEN
The system cannot retrieve valid sub-location information
THEN
The sub-location code is set to spaces (blank)
Context: Consignee CHOP code and destination station number are available
GIVEN
Consignee CHOP code and destination station number are available
Applied to: Lookup RF Table with Consignee CHOP and Station
WHEN
The system performs RF table lookup using consignee CHOP and station
THEN
The system attempts to retrieve customer bonded information and sub-location code
Context: An RF table lookup has been performed using consignee CHOP and station
GIVEN
An RF table lookup has been performed using consignee CHOP and station
Applied to: RF Table Lookup Successful?
WHEN
The RF table lookup returns successful status
THEN
The system extracts sub-location code and sets customer bonded indicator to true
Context: RF table lookup was successful
GIVEN
RF table lookup was successful
Applied to: Extract Sub-location Code from RF Table
WHEN
The system processes the RF table results
THEN
The sub-location code is extracted from RF table and customer bonded indicator is set to true
Context: RF table lookup was successful for consignee CHOP and station
GIVEN
RF table lookup was successful for consignee CHOP and station
Applied to: Set Customer Bonded Indicator to True
WHEN
Valid rail facility information is found
THEN
The customer bonded indicator is set to true
Context: RF table lookup failed for consignee CHOP and station
GIVEN
RF table lookup failed for consignee CHOP and station
Applied to: Set Customer Bonded Indicator to False
WHEN
No valid rail facility information is found
THEN
The customer bonded indicator is set to false
Context: Sub-location code processing has been completed and various indicators are set
GIVEN
Sub-location code processing has been completed and various indicators are set
Applied to: Sub-location Code Requirements Met?
WHEN
Sub-location code is not blank OR (sub-location code is blank AND (CSA indicator is on OR manifest stations are same and not IIS-A6 OR destination is US OR arrival indicator is Y))
THEN
Sub-location code requirements are considered met and processing continues
Context: Sub-location code requirements validation has been performed
GIVEN
Sub-location code requirements validation has been performed
Applied to: Set Sub-location Error Flag
WHEN
Sub-location code requirements are not met
THEN
Sub-location error flag is set to indicate validation failure
R-GCCCCADD-cbl-02821 (+3) File: GCCCCADD.cbl Build SS Table Lookup Key from Port and SCAC Codes Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Build SS Table Lookup Key from Port and SCAC Codes':
  • Context - a canadian customs code is available from the manifest customs station lookup:
    For Extract Port Code from Customs Code:
    When the system needs to construct the ss table port code, then the port code should be set to 'c' prefix followed by the last 3 digits of the canadian customs code.
  • Context - the system is constructing an ss table lookup key:
    For Haulage Rights SCAC Available?:
    When the haulage rights scac code is available and not spaces, then use the haulage rights scac code for the ss table key.
    For Use Default SCAC '6105':
    When the haulage rights scac code is spaces or not available, then use the default scac code '6105' for the ss table key.
  • Context - the port code and scac code have been determined:
    For Construct Complete SS Table Key:
    When the system constructs the complete ss table key, then the ss table key should combine the port code and scac code into the final lookup key format.
👨‍💻 Technical ACs (Gherkin)
Context: A Canadian customs code is available from the manifest customs station lookup
GIVEN
A Canadian customs code is available from the manifest customs station lookup
Applied to: Extract Port Code from Customs Code
WHEN
The system needs to construct the SS table port code
THEN
The port code should be set to 'C' prefix followed by the last 3 digits of the Canadian customs code
Context: The system is constructing an SS table lookup key
GIVEN
The system is constructing an SS table lookup key
Applied to: Haulage Rights SCAC Available?
WHEN
The haulage rights SCAC code is available and not spaces
THEN
Use the haulage rights SCAC code for the SS table key
Applied to: Use Default SCAC '6105'
WHEN
The haulage rights SCAC code is spaces or not available
THEN
Use the default SCAC code '6105' for the SS table key
Context: The port code and SCAC code have been determined
GIVEN
The port code and SCAC code have been determined
Applied to: Construct Complete SS Table Key
WHEN
The system constructs the complete SS table key
THEN
The SS table key should combine the port code and SCAC code into the final lookup key format
R-GCCCCADD-cbl-02825 (+4) File: GCCCCADD.cbl Process Business Number Qualifier Validation Merged 5 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Process Business Number Qualifier Validation':
  • Context - importer data exists in edi bol n1 segment:
    For Extract Business Number Qualifier from N1 Segment & Extract Business Number from N1 Segment & Store Qualifier in GCCC-BUSINESS-NBR-QUAL:
    When processing importer information from edi bol, then extract business number qualifier from n1 segment and store in gccc-business-nbr-qual and gccs-n103-id-cde-qual and extract business number from n1 segment and store in gccc-business-nbr and gccs-n104-id-cde and store importer name from n1 segment in gccc-importer and gccs-n102-name.
  • Context - business number qualifier is 'bn' or spaces and importer data found in au table and importer data found in edi s55 segment:
    For Set CSA Indicator OFF:
    When processing importer business number qualifier validation, then set csa indicator to off to disable csa processing.
  • Context - business number qualifier is 'm5':
    For Set CSA Indicator ON:
    When processing importer business number qualifier validation, then set csa indicator to on to enable csa processing.
👨‍💻 Technical ACs (Gherkin)
Context: Importer data exists in EDI BOL N1 segment
GIVEN
Importer data exists in EDI BOL N1 segment
Applied to: Extract Business Number Qualifier from N1 Segment & Extract Business Number from N1 Segment & Store Qualifier in GCCC-BUSINESS-NBR-QUAL
WHEN
Processing importer information from EDI BOL
THEN
Extract business number qualifier from N1 segment and store in GCCC-BUSINESS-NBR-QUAL and GCCS-N103-ID-CDE-QUAL AND Extract business number from N1 segment and store in GCCC-BUSINESS-NBR and GCCS-N104-ID-CDE AND Store importer name from N1 segment in GCCC-IMPORTER and GCCS-N102-NAME
Context: Business number qualifier is 'BN' or spaces AND importer data found in AU table AND importer data found in EDI S55 segment
GIVEN
Business number qualifier is 'BN' or spaces AND importer data found in AU table AND importer data found in EDI S55 segment
Applied to: Set CSA Indicator OFF
WHEN
Processing importer business number qualifier validation
THEN
Set CSA indicator to OFF to disable CSA processing
Context: Business number qualifier is 'M5'
GIVEN
Business number qualifier is 'M5'
Applied to: Set CSA Indicator ON
WHEN
Processing importer business number qualifier validation
THEN
Set CSA indicator to ON to enable CSA processing
R-GCCCCADD-cbl-02830 (+8) File: GCCCCADD.cbl Retrieve Error Message: INV Merged 9 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Retrieve Error Message: INV':
  • Context - an invalid canadian customs code has been detected for a manifest port:
    For Set Error Message Number to INV-MFST-PORT-CA-CUSTOMS:
    When the system needs to retrieve the error message for inv-mfst-port-ca-customs, then the system sets the error message number to inv-mfst-port-ca-customs for message lookup.
  • Context - the system needs to lookup an error message in the ms table:
    For Initialize Table Lookup Parameters:
    When preparing to call the table lookup function, then the system clears all table lookup parameters including key values, flags, and return codes.
  • Context - the error message number is set and table lookup parameters are initialized:
    For Call GCCTBIO to Access MS Table:
    When the system calls gcctbio with function code 'gu' and table id 'ms', then the system attempts to retrieve the message text from the ms table using the error message number as the key.
  • Context - the system has attempted to retrieve a message from the ms table:
    For Message Found in MS Table?:
    When the table lookup function returns a status, then the system checks if the return flag equals successful to determine if the message was found.
  • Context - a message record has been successfully retrieved from the ms table:
    For Retrieve English Error Message Text:
    When the system processes the retrieved message data, then the system moves the english text field from the message table segment to the working message label.
  • Context - the message lookup in the ms table was unsuccessful:
    For Set Empty Message Text:
    When the system needs to handle the missing message scenario, then the system clears the message table segment to spaces.
  • Context - an error condition has occurred requiring message retrieval and a message error number is available:
    For Error Message Retrieval Request:
    When the system needs to retrieve error message text from the message table, then the system should initialize table lookup parameters, set function code to 'gu', set table id to 'ms', use the message error number as the key, and call the table access routine.
  • Context - a table lookup operation has been performed on the message table:
    For Table Lookup Successful?:
    When the table lookup returns successfully, then the system should move the table segment to the message structure, extract the english text from the ms table, and move the text to the message label for display.
    For Table Lookup Successful?:
    When the table lookup fails or returns an error, then the system should set the ms table segment to spaces to clear any invalid data.
👨‍💻 Technical ACs (Gherkin)
Context: An invalid Canadian customs code has been detected for a manifest port
GIVEN
An invalid Canadian customs code has been detected for a manifest port
Applied to: Set Error Message Number to INV-MFST-PORT-CA-CUSTOMS
WHEN
The system needs to retrieve the error message for INV-MFST-PORT-CA-CUSTOMS
THEN
The system sets the error message number to INV-MFST-PORT-CA-CUSTOMS for message lookup
Context: The system needs to lookup an error message in the MS table
GIVEN
The system needs to lookup an error message in the MS table
Applied to: Initialize Table Lookup Parameters
WHEN
Preparing to call the table lookup function
THEN
The system clears all table lookup parameters including key values, flags, and return codes
Context: The error message number is set and table lookup parameters are initialized
GIVEN
The error message number is set and table lookup parameters are initialized
Applied to: Call GCCTBIO to Access MS Table
WHEN
The system calls GCCTBIO with function code 'GU' and table ID 'MS'
THEN
The system attempts to retrieve the message text from the MS table using the error message number as the key
Context: The system has attempted to retrieve a message from the MS table
GIVEN
The system has attempted to retrieve a message from the MS table
Applied to: Message Found in MS Table?
WHEN
The table lookup function returns a status
THEN
The system checks if the return flag equals SUCCESSFUL to determine if the message was found
Context: A message record has been successfully retrieved from the MS table
GIVEN
A message record has been successfully retrieved from the MS table
Applied to: Retrieve English Error Message Text
WHEN
The system processes the retrieved message data
THEN
The system moves the English text field from the message table segment to the working message label
Context: The message lookup in the MS table was unsuccessful
GIVEN
The message lookup in the MS table was unsuccessful
Applied to: Set Empty Message Text
WHEN
The system needs to handle the missing message scenario
THEN
The system clears the message table segment to spaces
Context: An error condition has occurred requiring message retrieval and a message error number is available
GIVEN
An error condition has occurred requiring message retrieval and a message error number is available
Applied to: Error Message Retrieval Request
WHEN
The system needs to retrieve error message text from the message table
THEN
The system should initialize table lookup parameters, set function code to 'GU', set table ID to 'MS', use the message error number as the key, and call the table access routine
Context: A table lookup operation has been performed on the message table
GIVEN
A table lookup operation has been performed on the message table
Applied to: Table Lookup Successful?
WHEN
The table lookup returns successfully
THEN
The system should move the table segment to the message structure, extract the English text from the MS table, and move the text to the message label for display
Applied to: Table Lookup Successful?
WHEN
The table lookup fails or returns an error
THEN
The system should set the MS table segment to spaces to clear any invalid data
R-GCCCCADD-cbl-02839 (+11) File: GCCCCADD.cbl Get EBSBCCM Segment Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get EBSBCCM Segment':
  • Context - a request to retrieve ebsbccm commodity segment data:
    For Initialize EDI BOL I/O Parameters:
    When the system begins the edi bol segment retrieval process, then the edi bol i/o parameters are cleared and initialized to spaces.
  • Context - edi bol i/o parameters are initialized:
    For Set Segment Type to EBSBCCM:
    When the system prepares to retrieve commodity segment data, then the segment type is set to 'ebsbccm' to specify commodity segment retrieval.
  • Context - the segment type is configured for ebsbccm:
    For Set Function Code to GU:
    When the system prepares the database retrieval operation, then the function code is set to 'gu' to perform a get unique operation.
  • Context - the function code is set for database retrieval:
    For Set EDI BOL Key from Waybill:
    When the system needs to identify the specific bill of lading, then the edi bol key from the waybill is assigned to the root key parameter.
  • Context - the edi bol key is configured for segment identification:
    For Set Type to CM - Commodity:
    When the system needs to specify the commodity segment subtype, then the type identifier is set to 'cm' to indicate commodity information.
  • Context - the commodity type identifier is set to cm:
    For Set Sequence Number:
    When the system needs to identify a specific commodity segment occurrence, then the sequence number from the commodity sequence counter is assigned to the segment parameters.
  • Context - all segment retrieval parameters are configured:
    For Valid EDI BOL?:
    When the system checks for edi bol validity, then if the edi bol is invalid, the system sets the ebsbccm not found flag and skips segment retrieval.
  • Context - the edi bol is valid and all parameters are set:
    For Call EBCLGIO to Retrieve Segment:
    When the system executes the segment retrieval operation, then the ebclgio program is called with the configured parameters to retrieve the ebsbccm segment.
  • Context - the ebclgio segment retrieval operation has completed:
    For Segment Found?:
    When the system checks the retrieval status, then if the status code is spaces, the segment was found successfully, otherwise the segment was not found.
  • Context - the commodity segment retrieval was successful:
    For Set EBSBCCM Found Flag:
    When the system processes the successful retrieval result, then the ebsbccm found flag is set to true to indicate successful segment retrieval.
  • Context - the ebsbccm segment is found and the success flag is set:
    For Extract Lading Quantity:
    When the system processes the retrieved commodity data, then the lading quantity (l0-lading-qty) is added to the running total of units.
  • Context - the commodity segment retrieval was unsuccessful or edi bol is invalid:
    For Set EBSBCCM Not Found Flag:
    When the system processes the failed retrieval result, then the ebsbccm not found flag is set to true to indicate unsuccessful segment retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve EBSBCCM commodity segment data
GIVEN
A request to retrieve EBSBCCM commodity segment data
Applied to: Initialize EDI BOL I/O Parameters
WHEN
The system begins the EDI BOL segment retrieval process
THEN
The EDI BOL I/O parameters are cleared and initialized to spaces
Context: EDI BOL I/O parameters are initialized
GIVEN
EDI BOL I/O parameters are initialized
Applied to: Set Segment Type to EBSBCCM
WHEN
The system prepares to retrieve commodity segment data
THEN
The segment type is set to 'EBSBCCM' to specify commodity segment retrieval
Context: The segment type is configured for EBSBCCM
GIVEN
The segment type is configured for EBSBCCM
Applied to: Set Function Code to GU
WHEN
The system prepares the database retrieval operation
THEN
The function code is set to 'GU' to perform a get unique operation
Context: The function code is set for database retrieval
GIVEN
The function code is set for database retrieval
Applied to: Set EDI BOL Key from Waybill
WHEN
The system needs to identify the specific bill of lading
THEN
The EDI BOL key from the waybill is assigned to the root key parameter
Context: The EDI BOL key is configured for segment identification
GIVEN
The EDI BOL key is configured for segment identification
Applied to: Set Type to CM - Commodity
WHEN
The system needs to specify the commodity segment subtype
THEN
The type identifier is set to 'CM' to indicate commodity information
Context: The commodity type identifier is set to CM
GIVEN
The commodity type identifier is set to CM
Applied to: Set Sequence Number
WHEN
The system needs to identify a specific commodity segment occurrence
THEN
The sequence number from the commodity sequence counter is assigned to the segment parameters
Context: All segment retrieval parameters are configured
GIVEN
All segment retrieval parameters are configured
Applied to: Valid EDI BOL?
WHEN
The system checks for EDI BOL validity
THEN
If the EDI BOL is invalid, the system sets the EBSBCCM not found flag and skips segment retrieval
Context: The EDI BOL is valid and all parameters are set
GIVEN
The EDI BOL is valid and all parameters are set
Applied to: Call EBCLGIO to Retrieve Segment
WHEN
The system executes the segment retrieval operation
THEN
The EBCLGIO program is called with the configured parameters to retrieve the EBSBCCM segment
Context: The EBCLGIO segment retrieval operation has completed
GIVEN
The EBCLGIO segment retrieval operation has completed
Applied to: Segment Found?
WHEN
The system checks the retrieval status
THEN
If the status code is spaces, the segment was found successfully, otherwise the segment was not found
Context: The commodity segment retrieval was successful
GIVEN
The commodity segment retrieval was successful
Applied to: Set EBSBCCM Found Flag
WHEN
The system processes the successful retrieval result
THEN
The EBSBCCM found flag is set to true to indicate successful segment retrieval
Context: The EBSBCCM segment is found and the success flag is set
GIVEN
The EBSBCCM segment is found and the success flag is set
Applied to: Extract Lading Quantity
WHEN
The system processes the retrieved commodity data
THEN
The lading quantity (L0-LADING-QTY) is added to the running total of units
Context: The commodity segment retrieval was unsuccessful or EDI BOL is invalid
GIVEN
The commodity segment retrieval was unsuccessful or EDI BOL is invalid
Applied to: Set EBSBCCM Not Found Flag
WHEN
The system processes the failed retrieval result
THEN
The EBSBCCM not found flag is set to true to indicate unsuccessful segment retrieval
R-GCCCCADD-cbl-02851 (+11) File: GCCCCADD.cbl Get EBSBCCR Weight Segment Merged 12 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get EBSBCCR Weight Segment':
  • Context - a request to retrieve weight data from edi bol weight segment:
    For Initialize EBWLGIO Parameters:
    When the system begins weight segment retrieval process, then communication parameters are cleared and accept status is set to ge for database access.
  • Context - communication parameters are initialized for weight segment retrieval:
    For Set Segment Type to EBSBCCR:
    When the system configures segment type for database query, then segment type is set to ebsbccr to target weight records.
  • Context - segment type is configured for weight data retrieval:
    For Set Function Code to GU:
    When the system sets database operation type, then function code is set to gu to retrieve unique weight record.
  • Context - database function code is set for weight retrieval:
    For Set Root Key from EDI BOL Key:
    When the system configures shipment identification, then root key is set to edi bol key to target specific shipment weight data.
  • Context - root key is configured for shipment identification:
    For Set Type to CR:
    When the system sets record type for weight data, then type is set to cr to target commodity weight records.
  • Context - record type is set to cr for commodity weight data:
    For Set Dependent Key to CR001:
    When the system specifies which commodity weight record to retrieve, then dependent key is set to cr001 to access the first weight record.
  • Context - all retrieval parameters are configured for weight segment access:
    For Valid EDI BOL?:
    When the system checks edi bol validity status, then if edi bol is invalid, weight segment is marked as not found, otherwise proceed with database retrieval.
  • Context - edi bol validity check is performed:
    For Set Weight Segment Not Found:
    When edi bol is determined to be invalid, then weight segment found flag is set to not found without attempting database retrieval.
  • Context - edi bol is valid and all retrieval parameters are set:
    For Call EBCLGIO to Retrieve Weight Data:
    When the system executes database retrieval operation, then ebclgio is called with communication parameters to retrieve weight segment data.
  • Context - database retrieval operation is executed:
    For Weight Data Retrieved Successfully?:
    When the system checks database operation status, then if status code is spaces (success), mark weight segment as found, otherwise mark as not found.
  • Context - database retrieval operation completed:
    For Set Weight Segment Found Flag:
    When database status indicates successful retrieval (status code is spaces), then weight segment found flag is set to true.
    For Set Weight Segment Not Found Flag:
    When database status indicates retrieval failure (status code is not spaces), then weight segment found flag is set to false.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve weight data from EDI BOL weight segment
GIVEN
A request to retrieve weight data from EDI BOL weight segment
Applied to: Initialize EBWLGIO Parameters
WHEN
The system begins weight segment retrieval process
THEN
Communication parameters are cleared and accept status is set to GE for database access
Context: Communication parameters are initialized for weight segment retrieval
GIVEN
Communication parameters are initialized for weight segment retrieval
Applied to: Set Segment Type to EBSBCCR
WHEN
The system configures segment type for database query
THEN
Segment type is set to EBSBCCR to target weight records
Context: Segment type is configured for weight data retrieval
GIVEN
Segment type is configured for weight data retrieval
Applied to: Set Function Code to GU
WHEN
The system sets database operation type
THEN
Function code is set to GU to retrieve unique weight record
Context: Database function code is set for weight retrieval
GIVEN
Database function code is set for weight retrieval
Applied to: Set Root Key from EDI BOL Key
WHEN
The system configures shipment identification
THEN
Root key is set to EDI BOL key to target specific shipment weight data
Context: Root key is configured for shipment identification
GIVEN
Root key is configured for shipment identification
Applied to: Set Type to CR
WHEN
The system sets record type for weight data
THEN
Type is set to CR to target commodity weight records
Context: Record type is set to CR for commodity weight data
GIVEN
Record type is set to CR for commodity weight data
Applied to: Set Dependent Key to CR001
WHEN
The system specifies which commodity weight record to retrieve
THEN
Dependent key is set to CR001 to access the first weight record
Context: All retrieval parameters are configured for weight segment access
GIVEN
All retrieval parameters are configured for weight segment access
Applied to: Valid EDI BOL?
WHEN
The system checks EDI BOL validity status
THEN
If EDI BOL is invalid, weight segment is marked as not found, otherwise proceed with database retrieval
Context: EDI BOL validity check is performed
GIVEN
EDI BOL validity check is performed
Applied to: Set Weight Segment Not Found
WHEN
EDI BOL is determined to be invalid
THEN
Weight segment found flag is set to not found without attempting database retrieval
Context: EDI BOL is valid and all retrieval parameters are set
GIVEN
EDI BOL is valid and all retrieval parameters are set
Applied to: Call EBCLGIO to Retrieve Weight Data
WHEN
The system executes database retrieval operation
THEN
EBCLGIO is called with communication parameters to retrieve weight segment data
Context: Database retrieval operation is executed
GIVEN
Database retrieval operation is executed
Applied to: Weight Data Retrieved Successfully?
WHEN
The system checks database operation status
THEN
If status code is spaces (success), mark weight segment as found, otherwise mark as not found
Context: Database retrieval operation completed
GIVEN
Database retrieval operation completed
Applied to: Set Weight Segment Found Flag
WHEN
Database status indicates successful retrieval (status code is spaces)
THEN
Weight segment found flag is set to true
Applied to: Set Weight Segment Not Found Flag
WHEN
Database status indicates retrieval failure (status code is not spaces)
THEN
Weight segment found flag is set to false
R-GCCCCADD-cbl-02863 (+7) File: GCCCCADD.cbl Extract Special Handling Code Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Special Handling Code':
  • Context - a shipment has special handling codes in positions 1 through 7:
    For Get Special Handling Code at Counter Position:
    When the system processes each special handling code position, then the system retrieves the special handling code from the current counter position.
  • Context - a special handling code has been retrieved from a shipment position:
    For Code = 'VA' OR 'EV' OR 'VS'?:
    When the code is 'va' (value added) or 'ev' (event) or 'vs' (value service), then the system accepts the code as valid for further processing.
  • Context - a valid special handling code has been identified:
    For Extract Code and Instruction:
    When the system processes the code, then the system extracts both the special handling code and its corresponding instruction into work fields.
  • Context - valid special handling code and instruction have been extracted:
    For First Special Handling Slot Empty?:
    When the first special handling slot is empty, then the system stores the code and instruction in the first slot.
  • Context - valid special handling code and instruction have been extracted and the first slot is occupied:
    For Second Special Handling Slot Empty?:
    When the second special handling slot is empty, then the system stores the code and instruction in the second slot.
  • Context - valid special handling code and instruction have been extracted and both first and second slots are occupied:
    For Store in Third Slot:
    When the system needs to store the special handling information, then the system stores the code and instruction in the third slot.
  • Context - the current special handling code position has been processed:
    For Increment Counter:
    When the system completes processing of the current position, then the system increments the counter to process the next position.
  • Context - the system is processing special handling codes:
    For Counter <= 7?:
    When the counter exceeds 7 positions, then the system completes special handling code extraction processing.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment has special handling codes in positions 1 through 7
GIVEN
A shipment has special handling codes in positions 1 through 7
Applied to: Get Special Handling Code at Counter Position
WHEN
The system processes each special handling code position
THEN
The system retrieves the special handling code from the current counter position
Context: A special handling code has been retrieved from a shipment position
GIVEN
A special handling code has been retrieved from a shipment position
Applied to: Code = 'VA' OR 'EV' OR 'VS'?
WHEN
The code is 'VA' (Value Added) OR 'EV' (Event) OR 'VS' (Value Service)
THEN
The system accepts the code as valid for further processing
Context: A valid special handling code has been identified
GIVEN
A valid special handling code has been identified
Applied to: Extract Code and Instruction
WHEN
The system processes the code
THEN
The system extracts both the special handling code and its corresponding instruction into work fields
Context: Valid special handling code and instruction have been extracted
GIVEN
Valid special handling code and instruction have been extracted
Applied to: First Special Handling Slot Empty?
WHEN
The first special handling slot is empty
THEN
The system stores the code and instruction in the first slot
Context: Valid special handling code and instruction have been extracted AND the first slot is occupied
GIVEN
Valid special handling code and instruction have been extracted AND the first slot is occupied
Applied to: Second Special Handling Slot Empty?
WHEN
The second special handling slot is empty
THEN
The system stores the code and instruction in the second slot
Context: Valid special handling code and instruction have been extracted AND both first and second slots are occupied
GIVEN
Valid special handling code and instruction have been extracted AND both first and second slots are occupied
Applied to: Store in Third Slot
WHEN
The system needs to store the special handling information
THEN
The system stores the code and instruction in the third slot
Context: The current special handling code position has been processed
GIVEN
The current special handling code position has been processed
Applied to: Increment Counter
WHEN
The system completes processing of the current position
THEN
The system increments the counter to process the next position
Context: The system is processing special handling codes
GIVEN
The system is processing special handling codes
Applied to: Counter <= 7?
WHEN
The counter exceeds 7 positions
THEN
The system completes special handling code extraction processing
R-GCCCCADD-cbl-02871 (+12) File: GCCCCADD.cbl Extract Special Handling Instructions Merged 13 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Special Handling Instructions':
  • Context - special handling codes need to be processed:
    For Initialize Counter to 1:
    When starting the special handling extraction process, then counter is set to 1 to begin processing from the first array position.
  • Context - counter is at a specific position in the special handling codes array:
    For Counter <= 7?:
    When checking if more special handling codes need to be processed, then continue processing if counter is 7 or less, otherwise stop processing.
  • Context - counter is pointing to a valid position in the special handling codes array:
    For Get Special Handling Code at Counter Position:
    When processing special handling codes, then extract the special handling code from spcl-hndlg-cde at the counter position.
  • Context - a special handling code has been extracted from the array:
    For Code = 'VA', 'EV', or 'VS'?:
    When validating the special handling code type, then process the code only if it equals 'va', 'ev', or 'vs', otherwise skip to next position.
  • Context - a valid special handling code ('va', 'ev', or 'vs') has been identified:
    For Extract Instruction Text from SPCL-HNDLG-INST Array:
    When extracting the corresponding instruction details, then retrieve the instruction text from spcl-hndlg-inst array at the same counter position.
  • Context - a valid special handling code has been extracted:
    For Move Code to Work Area:
    When preparing the code for storage, then move the special handling code to desc-work-code work area.
  • Context - special handling instruction text has been extracted:
    For Move Instruction Text to Work Area:
    When preparing the instruction for storage, then move the instruction text to desc-work-desc work area.
  • Context - special handling information needs to be stored:
    For First Special Handling Slot Empty?:
    When checking storage slot availability, then use first slot if ws-desc-fw-spcl-hndlg(1) is empty (spaces), otherwise check next slot.
  • Context - first special handling storage slot is empty:
    For Store in First Special Handling Slot:
    When storing special handling information, then move desc-work-info to ws-desc-fw-spcl-hndlg(1).
  • Context - first special handling storage slot is occupied and special handling information needs to be stored:
    For Second Special Handling Slot Empty?:
    When checking second storage slot availability, then use second slot if ws-desc-fw-spcl-hndlg(2) is empty (spaces), otherwise use third slot.
  • Context - first special handling storage slot is occupied and second slot is empty:
    For Store in Second Special Handling Slot:
    When storing special handling information, then move desc-work-info to ws-desc-fw-spcl-hndlg(2).
  • Context - first and second special handling storage slots are occupied:
    For Store in Third Special Handling Slot:
    When storing special handling information, then move desc-work-info to ws-desc-fw-spcl-hndlg(3).
  • Context - current special handling code has been processed (either stored or skipped):
    For Increment Counter:
    When moving to the next array position, then add 1 to the counter to point to the next special handling code position.
👨‍💻 Technical ACs (Gherkin)
Context: Special handling codes need to be processed
GIVEN
Special handling codes need to be processed
Applied to: Initialize Counter to 1
WHEN
Starting the special handling extraction process
THEN
Counter is set to 1 to begin processing from the first array position
Context: Counter is at a specific position in the special handling codes array
GIVEN
Counter is at a specific position in the special handling codes array
Applied to: Counter <= 7?
WHEN
Checking if more special handling codes need to be processed
THEN
Continue processing if counter is 7 or less, otherwise stop processing
Context: Counter is pointing to a valid position in the special handling codes array
GIVEN
Counter is pointing to a valid position in the special handling codes array
Applied to: Get Special Handling Code at Counter Position
WHEN
Processing special handling codes
THEN
Extract the special handling code from SPCL-HNDLG-CDE at the counter position
Context: A special handling code has been extracted from the array
GIVEN
A special handling code has been extracted from the array
Applied to: Code = 'VA', 'EV', or 'VS'?
WHEN
Validating the special handling code type
THEN
Process the code only if it equals 'VA', 'EV', or 'VS', otherwise skip to next position
Context: A valid special handling code ('VA', 'EV', or 'VS') has been identified
GIVEN
A valid special handling code ('VA', 'EV', or 'VS') has been identified
Applied to: Extract Instruction Text from SPCL-HNDLG-INST Array
WHEN
Extracting the corresponding instruction details
THEN
Retrieve the instruction text from SPCL-HNDLG-INST array at the same counter position
Context: A valid special handling code has been extracted
GIVEN
A valid special handling code has been extracted
Applied to: Move Code to Work Area
WHEN
Preparing the code for storage
THEN
Move the special handling code to DESC-WORK-CODE work area
Context: Special handling instruction text has been extracted
GIVEN
Special handling instruction text has been extracted
Applied to: Move Instruction Text to Work Area
WHEN
Preparing the instruction for storage
THEN
Move the instruction text to DESC-WORK-DESC work area
Context: Special handling information needs to be stored
GIVEN
Special handling information needs to be stored
Applied to: First Special Handling Slot Empty?
WHEN
Checking storage slot availability
THEN
Use first slot if WS-DESC-FW-SPCL-HNDLG(1) is empty (spaces), otherwise check next slot
Context: First special handling storage slot is empty
GIVEN
First special handling storage slot is empty
Applied to: Store in First Special Handling Slot
WHEN
Storing special handling information
THEN
Move DESC-WORK-INFO to WS-DESC-FW-SPCL-HNDLG(1)
Context: First special handling storage slot is occupied and special handling information needs to be stored
GIVEN
First special handling storage slot is occupied and special handling information needs to be stored
Applied to: Second Special Handling Slot Empty?
WHEN
Checking second storage slot availability
THEN
Use second slot if WS-DESC-FW-SPCL-HNDLG(2) is empty (spaces), otherwise use third slot
Context: First special handling storage slot is occupied and second slot is empty
GIVEN
First special handling storage slot is occupied and second slot is empty
Applied to: Store in Second Special Handling Slot
WHEN
Storing special handling information
THEN
Move DESC-WORK-INFO to WS-DESC-FW-SPCL-HNDLG(2)
Context: First and second special handling storage slots are occupied
GIVEN
First and second special handling storage slots are occupied
Applied to: Store in Third Special Handling Slot
WHEN
Storing special handling information
THEN
Move DESC-WORK-INFO to WS-DESC-FW-SPCL-HNDLG(3)
Context: Current special handling code has been processed (either stored or skipped)
GIVEN
Current special handling code has been processed (either stored or skipped)
Applied to: Increment Counter
WHEN
Moving to the next array position
THEN
Add 1 to the counter to point to the next special handling code position
R-GCCCCADD-cbl-02884 (+16) File: GCCCCADD.cbl Read Hazmat Segment from EDI BOL Merged 17 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Read Hazmat Segment from EDI BOL':
  • Context - hazmat processing is starting for an edi bol:
    For Initialize CCM Sequence to 1:
    When the system begins to read hazmat commodity segments, then the ccm sequence counter is initialized to 1 to start reading from the first hazmat segment.
  • Context - a valid edi bol key exists for the shipment:
    For Set EDI BOL Key Parameters:
    When the system prepares to read hazmat segments, then the edi bol key is set as the root key parameter for segment retrieval.
  • Context - the system needs to read hazmat commodity data:
    For Set Segment Type to EBSBCCM:
    When configuring the segment retrieval parameters, then the segment type is set to 'ebsbccm' to target chemical hazmat segments.
  • Context - the system needs to retrieve a specific hazmat segment:
    For Set Function Code to GU:
    When setting up the database access parameters, then the function code is set to 'gu' to perform a get unique operation.
  • Context - the system is processing hazmat commodity data:
    For Set Type to CH - Chemical Hazmat:
    When specifying the type of hazmat segment to retrieve, then the type is set to 'ch' to identify chemical hazmat segments.
  • Context - a ccm sequence counter is maintained for hazmat processing:
    For Set Sequence Number:
    When preparing to retrieve a specific hazmat segment, then the sequence number parameter is set to the current ccm sequence value.
  • Context - an edi bol key has been provided for hazmat processing:
    For Valid EDI BOL?:
    When the system attempts to access hazmat segments, then if the edi bol is invalid, hazmat processing is marked as not found and terminated.
  • Context - all segment retrieval parameters are configured and edi bol is valid:
    For Call EBCLGIO to Read Segment:
    When the system executes the database call, then the ebclgio program is called to retrieve the ebsbccm hazmat segment.
  • Context - a database call has been executed to retrieve a hazmat segment:
    For Segment Found?:
    When the system checks the result of the database call, then if the segment is not found, hazmat processing is marked as not found, otherwise processing continues.
  • Context - a hazmat segment has been successfully retrieved from the edi bol:
    For Set Hazmat Found Flag:
    When the system processes the found segment, then the hazmat found flag is set to indicate successful segment retrieval.
  • Context - a hazmat segment has been successfully retrieved:
    For Extract UN Number from LH1-UN-NA-ID-CD:
    When the system processes the hazmat data, then the un/na identification code is extracted from the lh1-un-na-id-cd field.
  • Context - a un/na identification code has been extracted from hazmat data:
    For UN Number Starts with 'UN'?:
    When the system validates the identification code format, then if the code starts with 'un', it is processed as a valid un number, otherwise the sequence is incremented to check the next segment.
  • Context - an identification code starting with 'un' has been found in hazmat data:
    For Set Hazmat Found Status:
    When the system confirms the un number validity, then the hazmat found status is set to indicate successful un number identification.
  • Context - a valid un number has been identified from hazmat data:
    For Move UN Number to Output:
    When the system processes the validated un number, then the un number is moved to the customs manifest un number field.
  • Context - the current hazmat segment has been processed but no valid un number was found:
    For Increment CCM Sequence:
    When the system continues searching for hazmat data, then the ccm sequence counter is incremented by 1 to target the next segment.
  • Context - the ccm sequence has been incremented:
    For More Segments to Process?:
    When the system checks for continuation of hazmat processing, then if the sequence is within limits and no valid un number has been found, processing continues with the next segment, otherwise processing ends.
  • Context - all hazmat segments have been processed or edi bol is invalid:
    For Set Hazmat Not Found Flag:
    When no valid un number has been identified, then the hazmat not found flag is set to indicate unsuccessful hazmat processing.
👨‍💻 Technical ACs (Gherkin)
Context: Hazmat processing is starting for an EDI BOL
GIVEN
Hazmat processing is starting for an EDI BOL
Applied to: Initialize CCM Sequence to 1
WHEN
The system begins to read hazmat commodity segments
THEN
The CCM sequence counter is initialized to 1 to start reading from the first hazmat segment
Context: A valid EDI BOL key exists for the shipment
GIVEN
A valid EDI BOL key exists for the shipment
Applied to: Set EDI BOL Key Parameters
WHEN
The system prepares to read hazmat segments
THEN
The EDI BOL key is set as the root key parameter for segment retrieval
Context: The system needs to read hazmat commodity data
GIVEN
The system needs to read hazmat commodity data
Applied to: Set Segment Type to EBSBCCM
WHEN
Configuring the segment retrieval parameters
THEN
The segment type is set to 'EBSBCCM' to target chemical hazmat segments
Context: The system needs to retrieve a specific hazmat segment
GIVEN
The system needs to retrieve a specific hazmat segment
Applied to: Set Function Code to GU
WHEN
Setting up the database access parameters
THEN
The function code is set to 'GU' to perform a get unique operation
Context: The system is processing hazmat commodity data
GIVEN
The system is processing hazmat commodity data
Applied to: Set Type to CH - Chemical Hazmat
WHEN
Specifying the type of hazmat segment to retrieve
THEN
The type is set to 'CH' to identify chemical hazmat segments
Context: A CCM sequence counter is maintained for hazmat processing
GIVEN
A CCM sequence counter is maintained for hazmat processing
Applied to: Set Sequence Number
WHEN
Preparing to retrieve a specific hazmat segment
THEN
The sequence number parameter is set to the current CCM sequence value
Context: An EDI BOL key has been provided for hazmat processing
GIVEN
An EDI BOL key has been provided for hazmat processing
Applied to: Valid EDI BOL?
WHEN
The system attempts to access hazmat segments
THEN
If the EDI BOL is invalid, hazmat processing is marked as not found and terminated
Context: All segment retrieval parameters are configured and EDI BOL is valid
GIVEN
All segment retrieval parameters are configured and EDI BOL is valid
Applied to: Call EBCLGIO to Read Segment
WHEN
The system executes the database call
THEN
The EBCLGIO program is called to retrieve the EBSBCCM hazmat segment
Context: A database call has been executed to retrieve a hazmat segment
GIVEN
A database call has been executed to retrieve a hazmat segment
Applied to: Segment Found?
WHEN
The system checks the result of the database call
THEN
If the segment is not found, hazmat processing is marked as not found, otherwise processing continues
Context: A hazmat segment has been successfully retrieved from the EDI BOL
GIVEN
A hazmat segment has been successfully retrieved from the EDI BOL
Applied to: Set Hazmat Found Flag
WHEN
The system processes the found segment
THEN
The hazmat found flag is set to indicate successful segment retrieval
Context: A hazmat segment has been successfully retrieved
GIVEN
A hazmat segment has been successfully retrieved
Applied to: Extract UN Number from LH1-UN-NA-ID-CD
WHEN
The system processes the hazmat data
THEN
The UN/NA identification code is extracted from the LH1-UN-NA-ID-CD field
Context: A UN/NA identification code has been extracted from hazmat data
GIVEN
A UN/NA identification code has been extracted from hazmat data
Applied to: UN Number Starts with 'UN'?
WHEN
The system validates the identification code format
THEN
If the code starts with 'UN', it is processed as a valid UN number, otherwise the sequence is incremented to check the next segment
Context: An identification code starting with 'UN' has been found in hazmat data
GIVEN
An identification code starting with 'UN' has been found in hazmat data
Applied to: Set Hazmat Found Status
WHEN
The system confirms the UN number validity
THEN
The hazmat found status is set to indicate successful UN number identification
Context: A valid UN number has been identified from hazmat data
GIVEN
A valid UN number has been identified from hazmat data
Applied to: Move UN Number to Output
WHEN
The system processes the validated UN number
THEN
The UN number is moved to the customs manifest UN number field
Context: The current hazmat segment has been processed but no valid UN number was found
GIVEN
The current hazmat segment has been processed but no valid UN number was found
Applied to: Increment CCM Sequence
WHEN
The system continues searching for hazmat data
THEN
The CCM sequence counter is incremented by 1 to target the next segment
Context: The CCM sequence has been incremented
GIVEN
The CCM sequence has been incremented
Applied to: More Segments to Process?
WHEN
The system checks for continuation of hazmat processing
THEN
If the sequence is within limits and no valid UN number has been found, processing continues with the next segment, otherwise processing ends
Context: All hazmat segments have been processed or EDI BOL is invalid
GIVEN
All hazmat segments have been processed or EDI BOL is invalid
Applied to: Set Hazmat Not Found Flag
WHEN
No valid UN number has been identified
THEN
The hazmat not found flag is set to indicate unsuccessful hazmat processing
R-GCCCCADD-cbl-02901 (+3) File: GCCCCADD.cbl Read LH3 Segment for Description Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Read LH3 Segment for Description':
  • Context - a hazmat information sequence counter is set and ebsbchi hazmat segment exists for the current edi bol:
    For Read LH3 Segment for Description:
    When the system attempts to retrieve the lh3 proper shipping name from the ebsbchi hazmat information segment, then if the ebsbchi hazmat segment is found, extract the lh3 proper shipping name and store it in the commodity description danger field, otherwise no description is available.
  • Context - hazmat information processing is required for the customs manifest:
    For Set Hazmat Information Sequence Counter:
    When the system begins processing lh3 hazmat description segments, then the hazmat information sequence counter is set to 1 to start processing from the first sequence.
  • Context - a request to retrieve hazmat information from ebsbchi segment has been made:
    For EBSBCHI Hazmat Segment Found?:
    When the system checks for the existence of ebsbchi hazmat segment with lh3 data, then if the segment is found and contains valid data, proceed to extract the proper shipping name, otherwise indicate no description is available.
  • Context - the lh3 proper shipping name has been successfully extracted from the ebsbchi hazmat segment:
    For Store Proper Shipping Name in Commodity Description Danger Field:
    When the system processes the extracted proper shipping name, then the lh3 proper shipping name is stored in the commodity description danger field for inclusion in the customs manifest.
👨‍💻 Technical ACs (Gherkin)
Context: A hazmat information sequence counter is set and EBSBCHI hazmat segment exists for the current EDI BOL
GIVEN
A hazmat information sequence counter is set and EBSBCHI hazmat segment exists for the current EDI BOL
Applied to: Read LH3 Segment for Description
WHEN
The system attempts to retrieve the LH3 proper shipping name from the EBSBCHI hazmat information segment
THEN
If the EBSBCHI hazmat segment is found, extract the LH3 proper shipping name and store it in the commodity description danger field, otherwise no description is available
Context: Hazmat information processing is required for the customs manifest
GIVEN
Hazmat information processing is required for the customs manifest
Applied to: Set Hazmat Information Sequence Counter
WHEN
The system begins processing LH3 hazmat description segments
THEN
The hazmat information sequence counter is set to 1 to start processing from the first sequence
Context: A request to retrieve hazmat information from EBSBCHI segment has been made
GIVEN
A request to retrieve hazmat information from EBSBCHI segment has been made
Applied to: EBSBCHI Hazmat Segment Found?
WHEN
The system checks for the existence of EBSBCHI hazmat segment with LH3 data
THEN
If the segment is found and contains valid data, proceed to extract the proper shipping name, otherwise indicate no description is available
Context: The LH3 proper shipping name has been successfully extracted from the EBSBCHI hazmat segment
GIVEN
The LH3 proper shipping name has been successfully extracted from the EBSBCHI hazmat segment
Applied to: Store Proper Shipping Name in Commodity Description Danger Field
WHEN
The system processes the extracted proper shipping name
THEN
The LH3 proper shipping name is stored in the commodity description danger field for inclusion in the customs manifest
R-GCCCCADD-cbl-02905 (+9) File: GCCCCADD.cbl Search Transportation Segments Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search Transportation Segments':
  • Context - a transportation segment search is initiated:
    For Initialize Search Parameters:
    When the search parameters need to be initialized, then the organization id status is set to not found and the transportation segment found status is set to true.
  • Context - a transportation segment search is being initialized:
    For Set Sequence Counter to 1:
    When the sequence counter needs to be set for iteration, then the sequence counter is set to 1 to begin searching from the first sequence.
  • Context - a transportation segment needs to be retrieved from edi bol:
    For Prepare EBSNRTD Segment Request:
    When the segment request is being prepared, then the segment type is set to ebsnrtd, function code is set to gu, operator is set to equals, type is set to tn, and the current sequence number is assigned.
  • Context - transportation segment request parameters are configured:
    For Execute EDI BOL Segment Retrieval:
    When the edi bol segment retrieval is executed, then the ebclgio service is called with the configured parameters to retrieve the transportation segment.
  • Context - a transportation segment retrieval has been executed:
    For Segment Found?:
    When the retrieval result needs to be validated, then if the status code is spaces then the segment is found, otherwise the segment is not found.
  • Context - a transportation segment has been successfully retrieved:
    For Organization ID Matches Target?:
    When the organization id needs to be validated against the target, then if the retrieved organization id equals the target organization id then a match is found, otherwise continue searching.
  • Context - the retrieved organization id matches the target organization id:
    For Mark Organization ID as Found:
    When the search status needs to be updated, then the organization id found status is set to true.
  • Context - the current transportation segment does not match the target organization id:
    For Increment Sequence Counter:
    When the search needs to continue to the next sequence, then the sequence counter is incremented by 1.
  • Context - a transportation segment search iteration has completed:
    For Continue Search?:
    When the continuation criteria needs to be evaluated, then if the segment was not found then set transportation segment not found status to true, otherwise if organization id is not found then continue searching.
  • Context - the transportation segment search has completed:
    For Adjust Final Sequence Counter:
    When the final sequence counter needs to be adjusted, then the sequence counter is decremented by 1 to reflect the correct final sequence number.
👨‍💻 Technical ACs (Gherkin)
Context: A transportation segment search is initiated
GIVEN
A transportation segment search is initiated
Applied to: Initialize Search Parameters
WHEN
The search parameters need to be initialized
THEN
The organization ID status is set to not found and the transportation segment found status is set to true
Context: A transportation segment search is being initialized
GIVEN
A transportation segment search is being initialized
Applied to: Set Sequence Counter to 1
WHEN
The sequence counter needs to be set for iteration
THEN
The sequence counter is set to 1 to begin searching from the first sequence
Context: A transportation segment needs to be retrieved from EDI BOL
GIVEN
A transportation segment needs to be retrieved from EDI BOL
Applied to: Prepare EBSNRTD Segment Request
WHEN
The segment request is being prepared
THEN
The segment type is set to EBSNRTD, function code is set to GU, operator is set to equals, type is set to TN, and the current sequence number is assigned
Context: Transportation segment request parameters are configured
GIVEN
Transportation segment request parameters are configured
Applied to: Execute EDI BOL Segment Retrieval
WHEN
The EDI BOL segment retrieval is executed
THEN
The EBCLGIO service is called with the configured parameters to retrieve the transportation segment
Context: A transportation segment retrieval has been executed
GIVEN
A transportation segment retrieval has been executed
Applied to: Segment Found?
WHEN
The retrieval result needs to be validated
THEN
If the status code is spaces then the segment is found, otherwise the segment is not found
Context: A transportation segment has been successfully retrieved
GIVEN
A transportation segment has been successfully retrieved
Applied to: Organization ID Matches Target?
WHEN
The organization ID needs to be validated against the target
THEN
If the retrieved organization ID equals the target organization ID then a match is found, otherwise continue searching
Context: The retrieved organization ID matches the target organization ID
GIVEN
The retrieved organization ID matches the target organization ID
Applied to: Mark Organization ID as Found
WHEN
The search status needs to be updated
THEN
The organization ID found status is set to true
Context: The current transportation segment does not match the target organization ID
GIVEN
The current transportation segment does not match the target organization ID
Applied to: Increment Sequence Counter
WHEN
The search needs to continue to the next sequence
THEN
The sequence counter is incremented by 1
Context: A transportation segment search iteration has completed
GIVEN
A transportation segment search iteration has completed
Applied to: Continue Search?
WHEN
The continuation criteria needs to be evaluated
THEN
If the segment was not found then set transportation segment not found status to true, otherwise if organization ID is not found then continue searching
Context: The transportation segment search has completed
GIVEN
The transportation segment search has completed
Applied to: Adjust Final Sequence Counter
WHEN
The final sequence counter needs to be adjusted
THEN
The sequence counter is decremented by 1 to reflect the correct final sequence number
R-GCCCCADD-cbl-02915 (+3) File: GCCCCADD.cbl Get MCOA Segment by Sequence Merged 4 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get MCOA Segment by Sequence':
  • Context - an edi bol key exists and mcoa sequence number is provided:
    For Get MCOA Segment by Sequence - Retrieve EBSMCOA segment data with sequence number validation:
    When system attempts to retrieve ebsmcoa segment with type 'ot' (other), then system successfully retrieves the mcoa segment data and sets found flag.
  • Context - mcoa sequence number is available for processing:
    For Set EDI BOL Key as Root Key:
    When system prepares to retrieve mcoa segment data, then system sets edi bol key as root key, mcoa sequence number, segment type as ebsmcoa, type as ot, and function code as gu.
  • Context - mcoa segment has been successfully retrieved from edi bol:
    For Segment Type is OT?:
    When system validates the segment type, then if segment type equals 'ot' then set mcoa found flag, otherwise set mcoa not found flag.
  • Context - mcoa segment retrieval has been attempted:
    For Set MCOA Not Found Flag:
    When segment retrieval fails or segment type is not 'ot', then system sets mcoa not found flag to indicate unsuccessful retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: An EDI BOL key exists and MCOA sequence number is provided
GIVEN
An EDI BOL key exists and MCOA sequence number is provided
Applied to: Get MCOA Segment by Sequence - Retrieve EBSMCOA segment data with sequence number validation
WHEN
System attempts to retrieve EBSMCOA segment with type 'OT' (Other)
THEN
System successfully retrieves the MCOA segment data and sets found flag
Context: MCOA sequence number is available for processing
GIVEN
MCOA sequence number is available for processing
Applied to: Set EDI BOL Key as Root Key
WHEN
System prepares to retrieve MCOA segment data
THEN
System sets EDI BOL key as root key, MCOA sequence number, segment type as EBSMCOA, type as OT, and function code as GU
Context: MCOA segment has been successfully retrieved from EDI BOL
GIVEN
MCOA segment has been successfully retrieved from EDI BOL
Applied to: Segment Type is OT?
WHEN
System validates the segment type
THEN
If segment type equals 'OT' then set MCOA found flag, otherwise set MCOA not found flag
Context: MCOA segment retrieval has been attempted
GIVEN
MCOA segment retrieval has been attempted
Applied to: Set MCOA Not Found Flag
WHEN
Segment retrieval fails or segment type is not 'OT'
THEN
System sets MCOA not found flag to indicate unsuccessful retrieval
R-GCCCCADD-cbl-02919 (+10) File: GCCCCADD.cbl Get MCOA Address Segment Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get MCOA Address Segment':
  • Context - a mcoa address segment retrieval is requested:
    For Set EDI BOL Key and Sequence Number:
    When the system prepares to retrieve address information, then the edi bol key is set from the stored key for record 55 processing and the mcoa sequence number is used as the sequence identifier.
  • Context - the system needs to retrieve mcoa address information:
    For Set Segment Type to EBSMCOA:
    When setting up the data retrieval parameters, then the segment type is set to 'ebsmcoa' to identify the correct data structure.
  • Context - the system is configured to retrieve mcoa segment data:
    For Set Type to ON for Address:
    When specifying the type of mcoa data to retrieve, then the type is set to 'on' to indicate address information is required.
  • Context - the retrieval parameters are configured for mcoa address data:
    For Call EBCLGIO to Retrieve ON Segment:
    When the system executes the data retrieval operation, then ebclgio is called to retrieve the on segment from the mcoa data structure.
  • Context - a data retrieval operation for mcoa address segment has been executed:
    For ON Segment Found?:
    When the system checks the retrieval result, then if the status code is spaces, the segment is considered found, otherwise it is not found.
  • Context - the mcoa address segment has been successfully retrieved:
    For Extract Address Line 1 from F6-ADDL-NAME-ADDR-1 & Extract Address Line 2 from F6-ADDL-NAME-ADDR-2:
    When the system processes the address information, then the first address line is extracted from f6-addl-name-addr-1 field and stored in the address info field and the second address line is extracted from f6-addl-name-addr-2 field and stored in the second address info field.
  • Context - the mcoa address segment has been successfully retrieved and processed:
    For Set Address Found Flag:
    When the system updates the processing status, then the address found flag is set to indicate successful retrieval.
  • Context - the mcoa address segment could not be retrieved:
    For Set Default Address Line 1 to 'NA' & Clear Address Line 2:
    When the system handles the missing address information, then the first address line is set to 'na' as a default value and the second address line is cleared to spaces.
  • Context - the mcoa address segment could not be retrieved and default values have been set:
    For Set Address Not Found Flag:
    When the system updates the processing status, then the address not found flag is set to indicate unsuccessful retrieval.
👨‍💻 Technical ACs (Gherkin)
Context: A MCOA address segment retrieval is requested
GIVEN
A MCOA address segment retrieval is requested
Applied to: Set EDI BOL Key and Sequence Number
WHEN
The system prepares to retrieve address information
THEN
The EDI BOL key is set from the stored key for record 55 processing and the MCOA sequence number is used as the sequence identifier
Context: The system needs to retrieve MCOA address information
GIVEN
The system needs to retrieve MCOA address information
Applied to: Set Segment Type to EBSMCOA
WHEN
Setting up the data retrieval parameters
THEN
The segment type is set to 'EBSMCOA' to identify the correct data structure
Context: The system is configured to retrieve MCOA segment data
GIVEN
The system is configured to retrieve MCOA segment data
Applied to: Set Type to ON for Address
WHEN
Specifying the type of MCOA data to retrieve
THEN
The type is set to 'ON' to indicate address information is required
Context: The retrieval parameters are configured for MCOA address data
GIVEN
The retrieval parameters are configured for MCOA address data
Applied to: Call EBCLGIO to Retrieve ON Segment
WHEN
The system executes the data retrieval operation
THEN
EBCLGIO is called to retrieve the ON segment from the MCOA data structure
Context: A data retrieval operation for MCOA address segment has been executed
GIVEN
A data retrieval operation for MCOA address segment has been executed
Applied to: ON Segment Found?
WHEN
The system checks the retrieval result
THEN
If the status code is spaces, the segment is considered found, otherwise it is not found
Context: The MCOA address segment has been successfully retrieved
GIVEN
The MCOA address segment has been successfully retrieved
Applied to: Extract Address Line 1 from F6-ADDL-NAME-ADDR-1 & Extract Address Line 2 from F6-ADDL-NAME-ADDR-2
WHEN
The system processes the address information
THEN
The first address line is extracted from F6-ADDL-NAME-ADDR-1 field and stored in the address info field AND The second address line is extracted from F6-ADDL-NAME-ADDR-2 field and stored in the second address info field
Context: The MCOA address segment has been successfully retrieved and processed
GIVEN
The MCOA address segment has been successfully retrieved and processed
Applied to: Set Address Found Flag
WHEN
The system updates the processing status
THEN
The address found flag is set to indicate successful retrieval
Context: The MCOA address segment could not be retrieved
GIVEN
The MCOA address segment could not be retrieved
Applied to: Set Default Address Line 1 to 'NA' & Clear Address Line 2
WHEN
The system handles the missing address information
THEN
The first address line is set to 'NA' as a default value AND The second address line is cleared to spaces
Context: The MCOA address segment could not be retrieved and default values have been set
GIVEN
The MCOA address segment could not be retrieved and default values have been set
Applied to: Set Address Not Found Flag
WHEN
The system updates the processing status
THEN
The address not found flag is set to indicate unsuccessful retrieval
R-GCCCCADD-cbl-02930 (+7) File: GCCCCADD.cbl Get MCOA City/State Segment Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Get MCOA City/State Segment':
  • Context - a request to retrieve mcoa geographic segment data:
    For Initialize EBWLGIO Parameters:
    When the system initializes the retrieval parameters, then the edi bol key, mcoa sequence number, segment type as ebsmcoa, type as oc, operator as equals, and function code as gu are set for the geographic data lookup.
  • Context - properly initialized ebwlgio parameters for mcoa oc segment retrieval:
    For Call EBCLGIO to Retrieve Segment:
    When the system calls ebclgio to retrieve the segment data, then the system attempts to fetch the geographic segment data from the edi bol database.
  • Context - an attempt to retrieve mcoa oc geographic segment data:
    For Segment Found?:
    When the system checks the status code from the retrieval operation, then if status code equals spaces, the segment is found; otherwise, the segment is not found.
  • Context - a successfully retrieved mcoa oc geographic segment:
    For Extract City Name from F7-CITY-NAME, Extract State/Province Code from F7-STATE-PROV-CODE, Extract Postal Code from F7-POSTAL-CODE, Extract Country Code from F7-COUNTRY-CODE:
    When the system processes the segment data, then the city name, state/province code, postal code, and country code are extracted from the f7 fields in the segment.
  • Context - successfully extracted geographic data from mcoa oc segment including city name, state/province code, postal code, and country code:
    For Move Data to N4 Address Fields:
    When the system populates the address fields, then the extracted data is moved to the corresponding n4 address fields (n401-city-name, n402-state-prov-cde, n403-postal-cde, n404-country-cde).
  • Context - successfully retrieved and processed mcoa oc geographic segment data:
    For Set Geographic Data Found Flag:
    When the system completes the data extraction and population, then the geographic data found flag is set to indicate successful processing.
  • Context - mcoa oc geographic segment data is not available or retrieval failed:
    For Clear All N4 Address Fields:
    When the system handles the missing data condition, then all n4 address fields (city name, state/province code, postal code, country code) are cleared to spaces.
  • Context - mcoa oc geographic segment data could not be retrieved or is not available:
    For Set Geographic Data Not Found Flag:
    When the system completes the failed retrieval processing, then the geographic data not found flag is set to indicate unsuccessful processing.
👨‍💻 Technical ACs (Gherkin)
Context: A request to retrieve MCOA geographic segment data
GIVEN
A request to retrieve MCOA geographic segment data
Applied to: Initialize EBWLGIO Parameters
WHEN
The system initializes the retrieval parameters
THEN
The EDI BOL key, MCOA sequence number, segment type as EBSMCOA, type as OC, operator as equals, and function code as GU are set for the geographic data lookup
Context: Properly initialized EBWLGIO parameters for MCOA OC segment retrieval
GIVEN
Properly initialized EBWLGIO parameters for MCOA OC segment retrieval
Applied to: Call EBCLGIO to Retrieve Segment
WHEN
The system calls EBCLGIO to retrieve the segment data
THEN
The system attempts to fetch the geographic segment data from the EDI BOL database
Context: An attempt to retrieve MCOA OC geographic segment data
GIVEN
An attempt to retrieve MCOA OC geographic segment data
Applied to: Segment Found?
WHEN
The system checks the status code from the retrieval operation
THEN
If status code equals spaces, the segment is found; otherwise, the segment is not found
Context: A successfully retrieved MCOA OC geographic segment
GIVEN
A successfully retrieved MCOA OC geographic segment
Applied to: Extract City Name from F7-CITY-NAME, Extract State/Province Code from F7-STATE-PROV-CODE, Extract Postal Code from F7-POSTAL-CODE, Extract Country Code from F7-COUNTRY-CODE
WHEN
The system processes the segment data
THEN
The city name, state/province code, postal code, and country code are extracted from the F7 fields in the segment
Context: Successfully extracted geographic data from MCOA OC segment including city name, state/province code, postal code, and country code
GIVEN
Successfully extracted geographic data from MCOA OC segment including city name, state/province code, postal code, and country code
Applied to: Move Data to N4 Address Fields
WHEN
The system populates the address fields
THEN
The extracted data is moved to the corresponding N4 address fields (N401-CITY-NAME, N402-STATE-PROV-CDE, N403-POSTAL-CDE, N404-COUNTRY-CDE)
Context: Successfully retrieved and processed MCOA OC geographic segment data
GIVEN
Successfully retrieved and processed MCOA OC geographic segment data
Applied to: Set Geographic Data Found Flag
WHEN
The system completes the data extraction and population
THEN
The geographic data found flag is set to indicate successful processing
Context: MCOA OC geographic segment data is not available or retrieval failed
GIVEN
MCOA OC geographic segment data is not available or retrieval failed
Applied to: Clear All N4 Address Fields
WHEN
The system handles the missing data condition
THEN
All N4 address fields (city name, state/province code, postal code, country code) are cleared to spaces
Context: MCOA OC geographic segment data could not be retrieved or is not available
GIVEN
MCOA OC geographic segment data could not be retrieved or is not available
Applied to: Set Geographic Data Not Found Flag
WHEN
The system completes the failed retrieval processing
THEN
The geographic data not found flag is set to indicate unsuccessful processing
R-GCCCCADD-cbl-02938 (+6) File: GCCCCADD.cbl Search 1: Specific Shipper CHOP + Consignee CHOP + Origin Station + Destination Road + Commodity Code Merged 7 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search 1: Specific Shipper CHOP + Consignee CHOP + Origin Station + Destination Road + Commodity Code':
  • Context - a shipment root record exists with shipper chop information:
    For Set Shipper CHOP from SHIPROOT:
    When preparing crossing table lookup parameters for broker determination, then the shipper chop code from shipment root is assigned to the crossing table search parameter.
  • Context - a shipment root record exists with consignee chop information:
    For Set Consignee CHOP from SHIPROOT:
    When preparing crossing table lookup parameters for broker determination, then the consignee chop code from shipment root is assigned to the crossing table search parameter.
  • Context - a shipment root record contains origin station number:
    For Convert Origin Station Number to Numeric:
    When preparing crossing table lookup parameters for broker determination, then the origin station number is converted to numeric format and assigned to the crossing table search parameter.
  • Context - a shipment root record contains destination road number:
    For Build Destination SPLC Code with 'ROAD' + Road Number:
    When preparing crossing table lookup parameters for broker determination, then the destination road number is converted to numeric format and concatenated with 'road' prefix to form the destination splc code.
  • Context - a shipment commodity record exists with stcc code information:
    For Set Commodity Code from SHIPCOMM:
    When preparing crossing table lookup parameters for broker determination, then the commodity stcc code from shipment commodity is assigned to the crossing table search parameter.
  • Context - all crossing table search parameters are populated with shipper chop, consignee chop, origin station number, destination splc code, and commodity code:
    For Execute GCCCROS2 Call with Exact Match Parameters:
    When executing the first crossing table lookup attempt for broker determination, then the gcccros2 program is called with the exact match parameters to search for broker information.
  • Context - a crossing table lookup has been executed with exact match parameters:
    For Broker Data Found?:
    When evaluating the result of the crossing table search, then if broker data is found, set the data found flag to true, otherwise continue to the next search attempt.
👨‍💻 Technical ACs (Gherkin)
Context: A shipment root record exists with shipper CHOP information
GIVEN
A shipment root record exists with shipper CHOP information
Applied to: Set Shipper CHOP from SHIPROOT
WHEN
Preparing crossing table lookup parameters for broker determination
THEN
The shipper CHOP code from shipment root is assigned to the crossing table search parameter
Context: A shipment root record exists with consignee CHOP information
GIVEN
A shipment root record exists with consignee CHOP information
Applied to: Set Consignee CHOP from SHIPROOT
WHEN
Preparing crossing table lookup parameters for broker determination
THEN
The consignee CHOP code from shipment root is assigned to the crossing table search parameter
Context: A shipment root record contains origin station number
GIVEN
A shipment root record contains origin station number
Applied to: Convert Origin Station Number to Numeric
WHEN
Preparing crossing table lookup parameters for broker determination
THEN
The origin station number is converted to numeric format and assigned to the crossing table search parameter
Context: A shipment root record contains destination road number
GIVEN
A shipment root record contains destination road number
Applied to: Build Destination SPLC Code with 'ROAD' + Road Number
WHEN
Preparing crossing table lookup parameters for broker determination
THEN
The destination road number is converted to numeric format and concatenated with 'ROAD' prefix to form the destination SPLC code
Context: A shipment commodity record exists with STCC code information
GIVEN
A shipment commodity record exists with STCC code information
Applied to: Set Commodity Code from SHIPCOMM
WHEN
Preparing crossing table lookup parameters for broker determination
THEN
The commodity STCC code from shipment commodity is assigned to the crossing table search parameter
Context: All crossing table search parameters are populated with shipper CHOP, consignee CHOP, origin station number, destination SPLC code, and commodity code
GIVEN
All crossing table search parameters are populated with shipper CHOP, consignee CHOP, origin station number, destination SPLC code, and commodity code
Applied to: Execute GCCCROS2 Call with Exact Match Parameters
WHEN
Executing the first crossing table lookup attempt for broker determination
THEN
The GCCCROS2 program is called with the exact match parameters to search for broker information
Context: A crossing table lookup has been executed with exact match parameters
GIVEN
A crossing table lookup has been executed with exact match parameters
Applied to: Broker Data Found?
WHEN
Evaluating the result of the crossing table search
THEN
If broker data is found, set the data found flag to true, otherwise continue to the next search attempt
R-GCCCCADD-cbl-02945 (+7) File: GCCCCADD.cbl Search 2: Wildcard Shipper CHOP + Consignee CHOP + Wildcard Origin + Destination Road + Commodity Code Merged 8 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search 2: Wildcard Shipper CHOP + Consignee CHOP + Wildcard Origin + Destination Road + Commodity Code':
  • Context - a crossing table lookup is required for broker assignment and the first lookup attempt with specific shipper chop has failed:
    For Set Wildcard Shipper CHOP to '*':
    When the system performs a second lookup pattern with wildcard shipper chop set to '*' while keeping original consignee chop, wildcard origin station set to '*', destination road number from shipment root, and commodity code from shipment commodity data, then the crossing table is searched with the wildcard shipper pattern and if broker data is found then broker information is returned and if no broker data is found then the system proceeds to the next search pattern.
  • Context - a crossing table lookup with wildcard shipper chop is being performed:
    For Set Wildcard Origin Station to '*':
    When the system prepares the second search pattern parameters, then the origin station parameter is set to wildcard value '*' to broaden the search criteria.
  • Context - a crossing table lookup with wildcard shipper chop is being performed and destination road number exists in shipment root data:
    For Keep Destination Road Number:
    When the system prepares the second search pattern parameters, then the destination road number from shipment root is preserved and used in the crossing table lookup with format 'road' plus the 3-digit road number.
  • Context - a crossing table lookup with wildcard shipper chop is being performed and commodity code exists in shipment commodity data:
    For Keep Original Commodity Code:
    When the system prepares the second search pattern parameters, then the commodity code from shipment commodity data is preserved and used in the crossing table lookup.
  • Context - all wildcard search parameters are prepared with wildcard shipper chop, original consignee chop, wildcard origin station, destination road number, and commodity code:
    For Execute Crossing Table Lookup:
    When the crossing table lookup is executed using gcccros2 program, then the crossing table is searched with the wildcard pattern parameters and the lookup result indicates whether broker data was found.
  • Context - a crossing table lookup with wildcard shipper chop has been executed:
    For Broker Data Found?:
    When the system evaluates the lookup result status, then if broker data is found then the system returns the broker information and if no broker data is found then the system proceeds to the next search pattern.
  • Context - broker data has been found through wildcard crossing table lookup:
    For Return Broker Information:
    When the system processes the successful lookup result, then the broker information from the crossing table segment is made available for manifest processing.
  • Context - the wildcard shipper chop crossing table lookup has been executed and no broker data was found:
    For Proceed to Next Search Pattern:
    When the system evaluates the failed lookup result, then the system proceeds to execute the next search pattern with different wildcard criteria.
👨‍💻 Technical ACs (Gherkin)
Context: A crossing table lookup is required for broker assignment AND the first lookup attempt with specific shipper CHOP has failed
GIVEN
A crossing table lookup is required for broker assignment AND the first lookup attempt with specific shipper CHOP has failed
Applied to: Set Wildcard Shipper CHOP to '*'
WHEN
The system performs a second lookup pattern with wildcard shipper CHOP set to '*' while keeping original consignee CHOP, wildcard origin station set to '*', destination road number from shipment root, and commodity code from shipment commodity data
THEN
The crossing table is searched with the wildcard shipper pattern AND if broker data is found then broker information is returned AND if no broker data is found then the system proceeds to the next search pattern
Context: A crossing table lookup with wildcard shipper CHOP is being performed
GIVEN
A crossing table lookup with wildcard shipper CHOP is being performed
Applied to: Set Wildcard Origin Station to '*'
WHEN
The system prepares the second search pattern parameters
THEN
The origin station parameter is set to wildcard value '*' to broaden the search criteria
Context: A crossing table lookup with wildcard shipper CHOP is being performed AND destination road number exists in shipment root data
GIVEN
A crossing table lookup with wildcard shipper CHOP is being performed AND destination road number exists in shipment root data
Applied to: Keep Destination Road Number
WHEN
The system prepares the second search pattern parameters
THEN
The destination road number from shipment root is preserved and used in the crossing table lookup with format 'ROAD' plus the 3-digit road number
Context: A crossing table lookup with wildcard shipper CHOP is being performed AND commodity code exists in shipment commodity data
GIVEN
A crossing table lookup with wildcard shipper CHOP is being performed AND commodity code exists in shipment commodity data
Applied to: Keep Original Commodity Code
WHEN
The system prepares the second search pattern parameters
THEN
The commodity code from shipment commodity data is preserved and used in the crossing table lookup
Context: All wildcard search parameters are prepared with wildcard shipper CHOP, original consignee CHOP, wildcard origin station, destination road number, and commodity code
GIVEN
All wildcard search parameters are prepared with wildcard shipper CHOP, original consignee CHOP, wildcard origin station, destination road number, and commodity code
Applied to: Execute Crossing Table Lookup
WHEN
The crossing table lookup is executed using GCCCROS2 program
THEN
The crossing table is searched with the wildcard pattern parameters AND the lookup result indicates whether broker data was found
Context: A crossing table lookup with wildcard shipper CHOP has been executed
GIVEN
A crossing table lookup with wildcard shipper CHOP has been executed
Applied to: Broker Data Found?
WHEN
The system evaluates the lookup result status
THEN
If broker data is found then the system returns the broker information AND if no broker data is found then the system proceeds to the next search pattern
Context: Broker data has been found through wildcard crossing table lookup
GIVEN
Broker data has been found through wildcard crossing table lookup
Applied to: Return Broker Information
WHEN
The system processes the successful lookup result
THEN
The broker information from the crossing table segment is made available for manifest processing
Context: The wildcard shipper CHOP crossing table lookup has been executed AND no broker data was found
GIVEN
The wildcard shipper CHOP crossing table lookup has been executed AND no broker data was found
Applied to: Proceed to Next Search Pattern
WHEN
The system evaluates the failed lookup result
THEN
The system proceeds to execute the next search pattern with different wildcard criteria
R-GCCCCADD-cbl-02953 (+8) File: GCCCCADD.cbl Search 3: Wildcard Shipper CHOP + Wildcard Origin + Wildcard Commodity Code Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Search 3: Wildcard Shipper CHOP + Wildcard Origin + Wildcard Commodity Code':
  • Context - previous broker lookup attempts with specific shipper chop, origin station, and commodity code have failed to find broker data:
    For Set Wildcard for Shipper CHOP:
    When the system executes the final wildcard search by setting wildcard values for shipper chop code and origin station while keeping the actual destination station number and commodity code from the shipment, then the crossing table lookup is performed with maximum wildcard criteria to attempt finding any applicable broker assignment for the shipment.
  • Context - a broker lookup is being performed with maximum wildcard criteria:
    For Set Wildcard for Shipper CHOP:
    When the system needs to set the shipper chop code parameter for the crossing table lookup, then the shipper chop code is set to the canadian broker wildcard value instead of the actual shipper chop from the shipment.
  • Context - a broker lookup is being performed with maximum wildcard criteria and the shipper chop has been set to wildcard:
    For Set Wildcard for Origin Station:
    When the system needs to set the origin station parameter for the crossing table lookup, then the origin station is set to the canadian broker wildcard value instead of the actual origin station number from the shipment.
  • Context - a broker lookup is being performed with wildcard shipper chop and origin station values:
    For Keep Destination Station from Shiproot:
    When the system sets the destination station parameter for the crossing table lookup, then the destination station is set to the actual destination road number from the shipment root data, formatted as 'road' plus the 3-digit road number.
  • Context - a broker lookup is being performed with wildcard shipper chop and origin station values and actual destination station:
    For Keep Commodity Code from Shipcomm:
    When the system sets the commodity code parameter for the crossing table lookup, then the commodity code is set to the actual stcc code from the shipment commodity data.
  • Context - all crossing table lookup parameters have been set with wildcard shipper chop, wildcard origin station, actual destination station, and actual commodity code:
    For Execute Crossing Table Lookup with GCCCROS2:
    When the system executes the crossing table lookup, then the gcccros2 program is called with the configured parameters to search for applicable broker assignment data.
  • Context - the crossing table lookup with maximum wildcard criteria has been executed:
    For Broker Data Found?:
    When the system evaluates the lookup result, then if the return code indicates data was found, the broker data is considered successfully retrieved, otherwise the lookup is considered unsuccessful.
    For Return Success - Broker Data Retrieved:
    When the lookup result indicates that broker data was found, then the broker lookup process is marked as successful and the retrieved broker data is available for use.
    For Continue to Next Search Strategy:
    When the lookup result indicates that no broker data was found, then the system continues with the next step in the broker assignment process since all crossing table lookup attempts have been exhausted.
👨‍💻 Technical ACs (Gherkin)
Context: Previous broker lookup attempts with specific shipper CHOP, origin station, and commodity code have failed to find broker data
GIVEN
Previous broker lookup attempts with specific shipper CHOP, origin station, and commodity code have failed to find broker data
Applied to: Set Wildcard for Shipper CHOP
WHEN
The system executes the final wildcard search by setting wildcard values for shipper CHOP code and origin station while keeping the actual destination station number and commodity code from the shipment
THEN
The crossing table lookup is performed with maximum wildcard criteria to attempt finding any applicable broker assignment for the shipment
Context: A broker lookup is being performed with maximum wildcard criteria
GIVEN
A broker lookup is being performed with maximum wildcard criteria
Applied to: Set Wildcard for Shipper CHOP
WHEN
The system needs to set the shipper CHOP code parameter for the crossing table lookup
THEN
The shipper CHOP code is set to the Canadian broker wildcard value instead of the actual shipper CHOP from the shipment
Context: A broker lookup is being performed with maximum wildcard criteria and the shipper CHOP has been set to wildcard
GIVEN
A broker lookup is being performed with maximum wildcard criteria and the shipper CHOP has been set to wildcard
Applied to: Set Wildcard for Origin Station
WHEN
The system needs to set the origin station parameter for the crossing table lookup
THEN
The origin station is set to the Canadian broker wildcard value instead of the actual origin station number from the shipment
Context: A broker lookup is being performed with wildcard shipper CHOP and origin station values
GIVEN
A broker lookup is being performed with wildcard shipper CHOP and origin station values
Applied to: Keep Destination Station from Shiproot
WHEN
The system sets the destination station parameter for the crossing table lookup
THEN
The destination station is set to the actual destination road number from the shipment root data, formatted as 'ROAD' plus the 3-digit road number
Context: A broker lookup is being performed with wildcard shipper CHOP and origin station values and actual destination station
GIVEN
A broker lookup is being performed with wildcard shipper CHOP and origin station values and actual destination station
Applied to: Keep Commodity Code from Shipcomm
WHEN
The system sets the commodity code parameter for the crossing table lookup
THEN
The commodity code is set to the actual STCC code from the shipment commodity data
Context: All crossing table lookup parameters have been set with wildcard shipper CHOP, wildcard origin station, actual destination station, and actual commodity code
GIVEN
All crossing table lookup parameters have been set with wildcard shipper CHOP, wildcard origin station, actual destination station, and actual commodity code
Applied to: Execute Crossing Table Lookup with GCCCROS2
WHEN
The system executes the crossing table lookup
THEN
The GCCCROS2 program is called with the configured parameters to search for applicable broker assignment data
Context: The crossing table lookup with maximum wildcard criteria has been executed
GIVEN
The crossing table lookup with maximum wildcard criteria has been executed
Applied to: Broker Data Found?
WHEN
The system evaluates the lookup result
THEN
If the return code indicates data was found, the broker data is considered successfully retrieved, otherwise the lookup is considered unsuccessful
Applied to: Return Success - Broker Data Retrieved
WHEN
The lookup result indicates that broker data was found
THEN
The broker lookup process is marked as successful and the retrieved broker data is available for use
Applied to: Continue to Next Search Strategy
WHEN
The lookup result indicates that no broker data was found
THEN
The system continues with the next step in the broker assignment process since all crossing table lookup attempts have been exhausted
R-GCCCCADD-cbl-02962 (+9) File: GCCCCADD.cbl Generate Shipper Required Field Errors Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Shipper Required Field Errors':
  • Context - a record with sequence number is being processed for validation:
    For Is this Shipper Record? SEQ = 0001:
    When the system checks if this is a shipper or consignee record, then if sequence number equals 0001 or 0002, proceed with comprehensive validation, otherwise skip validation.
  • Context - a shipper or consignee record is being validated and all address and contact fields are empty:
    For Shipper Name Empty?:
    When the entity name field is empty or spaces, then generate error message indicating entity name is required.
  • Context - an entity record has a name but address, city, state, postal or contact information exists:
    For Shipper Address Empty?:
    When the address field is empty or spaces, then generate error message indicating address is required.
  • Context - an entity record has address data populated:
    For Shipper City Empty?:
    When the city field is empty or spaces, then generate error message indicating city is required.
    For Shipper Country Empty?:
    When the country field is empty or spaces, then generate error message indicating country is required.
  • Context - an entity record has country code of canada, usa, or mexico and address data exists:
    For Shipper State Empty?:
    When the state/province field is empty or spaces, then generate error message indicating state/province is required.
  • Context - an entity record has a postal code provided and address data exists:
    For Shipper Postal Empty?:
    When the postal code length is less than 3 characters, then generate error message indicating minimum length of 3 characters required.
  • Context - a required field validation has failed for an entity record:
    For Generate Error: Shipper Name Required:
    When the system needs to communicate the validation failure, then generate appropriate error message based on the specific missing field (name, address, city, state, postal, country).
  • Context - a validation error has been generated and message index is less than 10:
    For Add Error to Message Array:
    When the system needs to store the error for user notification, then add the error message to the message array, increment message index, and clear temporary message fields.
  • Context - one or more validation errors have been detected during record processing:
    For Set Return Error Flag:
    When the system completes validation and needs to indicate failure status, then set the return status to error to indicate validation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A record with sequence number is being processed for validation
GIVEN
A record with sequence number is being processed for validation
Applied to: Is this Shipper Record? SEQ = 0001
WHEN
The system checks if this is a shipper or consignee record
THEN
If sequence number equals 0001 or 0002, proceed with comprehensive validation, otherwise skip validation
Context: A shipper or consignee record is being validated and all address and contact fields are empty
GIVEN
A shipper or consignee record is being validated and all address and contact fields are empty
Applied to: Shipper Name Empty?
WHEN
The entity name field is empty or spaces
THEN
Generate error message indicating entity name is required
Context: An entity record has a name but address, city, state, postal or contact information exists
GIVEN
An entity record has a name but address, city, state, postal or contact information exists
Applied to: Shipper Address Empty?
WHEN
The address field is empty or spaces
THEN
Generate error message indicating address is required
Context: An entity record has address data populated
GIVEN
An entity record has address data populated
Applied to: Shipper City Empty?
WHEN
The city field is empty or spaces
THEN
Generate error message indicating city is required
Applied to: Shipper Country Empty?
WHEN
The country field is empty or spaces
THEN
Generate error message indicating country is required
Context: An entity record has country code of Canada, USA, or Mexico and address data exists
GIVEN
An entity record has country code of Canada, USA, or Mexico and address data exists
Applied to: Shipper State Empty?
WHEN
The state/province field is empty or spaces
THEN
Generate error message indicating state/province is required
Context: An entity record has a postal code provided and address data exists
GIVEN
An entity record has a postal code provided and address data exists
Applied to: Shipper Postal Empty?
WHEN
The postal code length is less than 3 characters
THEN
Generate error message indicating minimum length of 3 characters required
Context: A required field validation has failed for an entity record
GIVEN
A required field validation has failed for an entity record
Applied to: Generate Error: Shipper Name Required
WHEN
The system needs to communicate the validation failure
THEN
Generate appropriate error message based on the specific missing field (name, address, city, state, postal, country)
Context: A validation error has been generated and message index is less than 10
GIVEN
A validation error has been generated and message index is less than 10
Applied to: Add Error to Message Array
WHEN
The system needs to store the error for user notification
THEN
Add the error message to the message array, increment message index, and clear temporary message fields
Context: One or more validation errors have been detected during record processing
GIVEN
One or more validation errors have been detected during record processing
Applied to: Set Return Error Flag
WHEN
The system completes validation and needs to indicate failure status
THEN
Set the return status to error to indicate validation failure
R-GCCCCADD-cbl-02972 (+9) File: GCCCCADD.cbl Generate Consignee Required Field Errors Merged 10 Rules
Validation Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Generate Consignee Required Field Errors':
  • Context - a record with sequence number is being processed:
    For Is this Consignee Record? SEQ = 0002:
    When the system checks if the record sequence equals 0002, then the system identifies this as a consignee record and proceeds with consignee-specific validation.
  • Context - a consignee record is being validated:
    For All Consignee Fields Empty? Name, Address, City/State/Postal:
    When the consignee name is spaces and address data is spaces and city/state/postal data is spaces and contact data is spaces, then the system identifies this as a completely empty consignee record requiring all mandatory field error messages.
  • Context - a consignee record with empty mandatory fields is being processed:
    For Generate Consignee Name Required Error GCCS-E-GEN-CONSIGNEE-REQ:
    When the consignee name field is spaces, then the system generates a consignee required error message using error code gccs-e-gen-consignee-req.
    For Generate Address Required Error GCCS-E-GEN-REQUIRED-N301:
    When the address field is spaces, then the system generates an address required error message using error code gccs-e-gen-required-n301.
    For Generate City Required Error GCCS-E-GEN-REQUIRED-N401:
    When the city field is spaces, then the system generates a city required error message using error code gccs-e-gen-required-n401.
    For Generate State Required Error GCCS-E-GEN-REQUIRED-N402:
    When the state/province field is spaces, then the system generates a state required error message using error code gccs-e-gen-required-n402.
    For Generate Postal Required Error GCCS-E-GEN-REQUIRED-N403:
    When the postal code field is spaces, then the system generates a postal code required error message using error code gccs-e-gen-required-n403.
    For Generate Country Required Error GCCS-E-GEN-REQUIRED-N404:
    When the country field is spaces, then the system generates a country required error message using error code gccs-e-gen-required-n404.
  • Context - error messages have been generated for missing consignee fields:
    For Add Error Messages to Message Array:
    When the message index is less than 10, then the system adds each error message to the message array and increments the message index.
  • Context - validation errors have been generated and added to the message collection:
    For Set Return Error Flag:
    When error messages exist for the consignee record, then the system sets the return status to error to indicate validation failure.
👨‍💻 Technical ACs (Gherkin)
Context: A record with sequence number is being processed
GIVEN
A record with sequence number is being processed
Applied to: Is this Consignee Record? SEQ = 0002
WHEN
The system checks if the record sequence equals 0002
THEN
The system identifies this as a consignee record and proceeds with consignee-specific validation
Context: A consignee record is being validated
GIVEN
A consignee record is being validated
Applied to: All Consignee Fields Empty? Name, Address, City/State/Postal
WHEN
The consignee name is spaces AND address data is spaces AND city/state/postal data is spaces AND contact data is spaces
THEN
The system identifies this as a completely empty consignee record requiring all mandatory field error messages
Context: A consignee record with empty mandatory fields is being processed
GIVEN
A consignee record with empty mandatory fields is being processed
Applied to: Generate Consignee Name Required Error GCCS-E-GEN-CONSIGNEE-REQ
WHEN
The consignee name field is spaces
THEN
The system generates a consignee required error message using error code GCCS-E-GEN-CONSIGNEE-REQ
Applied to: Generate Address Required Error GCCS-E-GEN-REQUIRED-N301
WHEN
The address field is spaces
THEN
The system generates an address required error message using error code GCCS-E-GEN-REQUIRED-N301
Applied to: Generate City Required Error GCCS-E-GEN-REQUIRED-N401
WHEN
The city field is spaces
THEN
The system generates a city required error message using error code GCCS-E-GEN-REQUIRED-N401
Applied to: Generate State Required Error GCCS-E-GEN-REQUIRED-N402
WHEN
The state/province field is spaces
THEN
The system generates a state required error message using error code GCCS-E-GEN-REQUIRED-N402
Applied to: Generate Postal Required Error GCCS-E-GEN-REQUIRED-N403
WHEN
The postal code field is spaces
THEN
The system generates a postal code required error message using error code GCCS-E-GEN-REQUIRED-N403
Applied to: Generate Country Required Error GCCS-E-GEN-REQUIRED-N404
WHEN
The country field is spaces
THEN
The system generates a country required error message using error code GCCS-E-GEN-REQUIRED-N404
Context: Error messages have been generated for missing consignee fields
GIVEN
Error messages have been generated for missing consignee fields
Applied to: Add Error Messages to Message Array
WHEN
The message index is less than 10
THEN
The system adds each error message to the message array and increments the message index
Context: Validation errors have been generated and added to the message collection
GIVEN
Validation errors have been generated and added to the message collection
Applied to: Set Return Error Flag
WHEN
Error messages exist for the consignee record
THEN
The system sets the return status to error to indicate validation failure
R-GCCCCADD-cbl-02982 (+4) File: GCCCCADD.cbl Extract City Name from Address String Merged 5 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract City Name from Address String':
  • Context - an address string containing city, state/province, and postal code in concatenated format:
    For Move Address String to Work Area:
    When the system processes the address for customs manifest creation, then the city name component is extracted and moved to the city name field.
  • Context - an address string containing city, state/province, and postal code information:
    For Extract State/Province Code:
    When the address is being processed for customs manifest, then the state/province code is extracted and assigned to the appropriate field.
    For Extract Postal Code:
    When the address is being processed for customs manifest creation, then the postal code is extracted and assigned to the postal code field.
  • Context - a city name has been extracted from an address string:
    For City Name >= 2 Characters?:
    When the city name length is validated, then if the city name has fewer than 2 characters, a minimum length error message is generated.
  • Context - a state/province code has been extracted from an address string:
    For Extract State/Province Code:
    When the country determination process is executed, then the corresponding country code is retrieved from the state-country table and assigned to the country field.
👨‍💻 Technical ACs (Gherkin)
Context: An address string containing city, state/province, and postal code in concatenated format
GIVEN
An address string containing city, state/province, and postal code in concatenated format
Applied to: Move Address String to Work Area
WHEN
The system processes the address for customs manifest creation
THEN
The city name component is extracted and moved to the city name field
Context: An address string containing city, state/province, and postal code information
GIVEN
An address string containing city, state/province, and postal code information
Applied to: Extract State/Province Code
WHEN
The address is being processed for customs manifest
THEN
The state/province code is extracted and assigned to the appropriate field
Applied to: Extract Postal Code
WHEN
The address is being processed for customs manifest creation
THEN
The postal code is extracted and assigned to the postal code field
Context: A city name has been extracted from an address string
GIVEN
A city name has been extracted from an address string
Applied to: City Name >= 2 Characters?
WHEN
The city name length is validated
THEN
If the city name has fewer than 2 characters, a minimum length error message is generated
Context: A state/province code has been extracted from an address string
GIVEN
A state/province code has been extracted from an address string
Applied to: Extract State/Province Code
WHEN
The country determination process is executed
THEN
The corresponding country code is retrieved from the state-country table and assigned to the country field
R-GCCCCADD-cbl-02987 (+5) File: GCCCCADD.cbl Extract State/Province Code from Address String Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract State/Province Code from Address String':
  • Context - a shipper address is stored in shpr-addr(2) as a concatenated string containing city, state/province, and postal code:
    For Move Address String to WS-ADDRESS:
    When the system processes shipper address information for customs record creation, then the concatenated address string is moved to ws-address for parsing into individual components.
  • Context - an address string has been loaded into ws-address for parsing:
    For Extract City Name from Address & Extract State/Province Code from Address & Extract Postal Code from Address:
    When the system extracts address components for customs documentation, then the city name component is extracted from ws-address and assigned to ws-city-name, then moved to gccs-n401-city-name and the state/province code component is extracted from ws-address and assigned to ws-state-prov-code, then moved to gccs-n402-state-prov-cde and the postal code component is extracted from ws-address and assigned to ws-postal-code, then moved to gccs-n403-postal-cde.
  • Context - a state/province code has been extracted from an address string:
    For Move Parsed Components to Output Fields:
    When the system needs to determine the corresponding country for customs purposes, then the system searches the tb-state-country table using the state/province code as key and assigns the matching country code to ws-country, then moves it to gccs-n404-country-cde.
  • Context - a consignee address is stored in cons-data(4) as a concatenated string containing city, state/province, and postal code:
    For Move Address String to WS-ADDRESS:
    When the system processes consignee address information for customs record creation, then the concatenated address string is moved to ws-address for parsing into individual components.
👨‍💻 Technical ACs (Gherkin)
Context: A shipper address is stored in SHPR-ADDR(2) as a concatenated string containing city, state/province, and postal code
GIVEN
A shipper address is stored in SHPR-ADDR(2) as a concatenated string containing city, state/province, and postal code
Applied to: Move Address String to WS-ADDRESS
WHEN
The system processes shipper address information for customs record creation
THEN
The concatenated address string is moved to WS-ADDRESS for parsing into individual components
Context: An address string has been loaded into WS-ADDRESS for parsing
GIVEN
An address string has been loaded into WS-ADDRESS for parsing
Applied to: Extract City Name from Address & Extract State/Province Code from Address & Extract Postal Code from Address
WHEN
The system extracts address components for customs documentation
THEN
The city name component is extracted from WS-ADDRESS and assigned to WS-CITY-NAME, then moved to GCCS-N401-CITY-NAME AND The state/province code component is extracted from WS-ADDRESS and assigned to WS-STATE-PROV-CODE, then moved to GCCS-N402-STATE-PROV-CDE AND The postal code component is extracted from WS-ADDRESS and assigned to WS-POSTAL-CODE, then moved to GCCS-N403-POSTAL-CDE
Context: A state/province code has been extracted from an address string
GIVEN
A state/province code has been extracted from an address string
Applied to: Move Parsed Components to Output Fields
WHEN
The system needs to determine the corresponding country for customs purposes
THEN
The system searches the TB-STATE-COUNTRY table using the state/province code as key and assigns the matching country code to WS-COUNTRY, then moves it to GCCS-N404-COUNTRY-CDE
Context: A consignee address is stored in CONS-DATA(4) as a concatenated string containing city, state/province, and postal code
GIVEN
A consignee address is stored in CONS-DATA(4) as a concatenated string containing city, state/province, and postal code
Applied to: Move Address String to WS-ADDRESS
WHEN
The system processes consignee address information for customs record creation
THEN
The concatenated address string is moved to WS-ADDRESS for parsing into individual components
R-GCCCCADD-cbl-02993 (+5) File: GCCCCADD.cbl Extract Postal Code from Address String Merged 6 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Extract Postal Code from Address String':
  • Context - an address field contains concatenated address information:
    For Extract City Name Component:
    When the address field is moved to a work area for parsing, then the city name component is extracted and stored in the city name field.
  • Context - an address field contains concatenated address information with city name already extracted:
    For Extract State/Province Code:
    When the address parsing continues to the state/province component, then the state or province code is extracted and stored in the state/province code field.
  • Context - an address field contains concatenated address information with city and state already extracted:
    For Extract Postal Code Component:
    When the address parsing continues to the postal code component, then the postal code is extracted and stored in the postal code field.
  • Context - a postal code has been extracted from an address field:
    For Validate Postal Code Length:
    When the postal code length is validated, then the system determines if the postal code meets the minimum 5 character requirement.
  • Context - a postal code has been validated and found to be shorter than 5 characters:
    For Pad with Periods to 5 chars:
    When the postal code padding process is executed, then the postal code is padded with periods to reach exactly 5 characters in length.
  • Context - a postal code has been extracted and processed (padded if necessary):
    For Store Parsed Postal Code:
    When the postal code storage process is executed, then the processed postal code is stored in the target postal code field.
👨‍💻 Technical ACs (Gherkin)
Context: An address field contains concatenated address information
GIVEN
An address field contains concatenated address information
Applied to: Extract City Name Component
WHEN
The address field is moved to a work area for parsing
THEN
The city name component is extracted and stored in the city name field
Context: An address field contains concatenated address information with city name already extracted
GIVEN
An address field contains concatenated address information with city name already extracted
Applied to: Extract State/Province Code
WHEN
The address parsing continues to the state/province component
THEN
The state or province code is extracted and stored in the state/province code field
Context: An address field contains concatenated address information with city and state already extracted
GIVEN
An address field contains concatenated address information with city and state already extracted
Applied to: Extract Postal Code Component
WHEN
The address parsing continues to the postal code component
THEN
The postal code is extracted and stored in the postal code field
Context: A postal code has been extracted from an address field
GIVEN
A postal code has been extracted from an address field
Applied to: Validate Postal Code Length
WHEN
The postal code length is validated
THEN
The system determines if the postal code meets the minimum 5 character requirement
Context: A postal code has been validated and found to be shorter than 5 characters
GIVEN
A postal code has been validated and found to be shorter than 5 characters
Applied to: Pad with Periods to 5 chars
WHEN
The postal code padding process is executed
THEN
The postal code is padded with periods to reach exactly 5 characters in length
Context: A postal code has been extracted and processed (padded if necessary)
GIVEN
A postal code has been extracted and processed (padded if necessary)
Applied to: Store Parsed Postal Code
WHEN
The postal code storage process is executed
THEN
The processed postal code is stored in the target postal code field
R-GCCCCADD-cbl-02999 (+10) File: GCCCCADD.cbl Lookup CM Table with Destination Station Number Merged 11 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup CM Table with Destination Station Number':
  • Context - a cm table lookup operation is requested:
    For Initialize Table Access Parameters:
    When the system begins the lookup process, then all table access parameters are cleared and initialized to spaces.
  • Context - cm table lookup parameters are initialized:
    For Set Function Code to GU:
    When the system prepares for table access, then the function code is set to gu for unique record retrieval.
  • Context - table access function code is set to gu:
    For Set Table ID to 'CM':
    When the system specifies which table to access, then the table id is set to 'cm' to identify the correct lookup table.
  • Context - destination station number exists in shipment root data:
    For Convert Destination Station Number to Numeric:
    When the system prepares the search key for cm table lookup, then the destination station number is converted to numeric format and stored in working storage.
  • Context - destination station number is converted to numeric format:
    For Set Station Number as Search Key:
    When the system sets up the search criteria for cm table, then the numeric station number is assigned as the sequence id search key.
  • Context - all cm table lookup parameters are configured with station number as search key:
    For Call GCCTBIO Table Access:
    When the system executes the table access call, then gcctbio is invoked with the configured parameters to perform the lookup.
  • Context - cm table lookup has been executed:
    For Lookup Successful?:
    When the system checks the lookup result status, then the return flag is evaluated to determine if lookup was successful.
  • Context - cm table lookup completed successfully:
    For Move Table Data to GCSTBRTCM:
    When the system processes the returned table data, then the table segment data is moved to gcstbrtcm structure for further processing.
  • Context - cm table data is successfully loaded into gcstbrtcm:
    For Extract Port Manifest Information:
    When the system processes the cm table information, then port manifest upon data is extracted from the cm table record.
  • Context - port manifest information is extracted from cm table data:
    For Set Sub-location Code from CM Data:
    When the system processes the manifest information, then sub-location code is set from the cm table sub-location code field.
  • Context - cm table lookup was unsuccessful:
    For Clear Sub-location Code:
    When the system handles the lookup failure, then sub-location code is cleared to spaces.
👨‍💻 Technical ACs (Gherkin)
Context: A CM table lookup operation is requested
GIVEN
A CM table lookup operation is requested
Applied to: Initialize Table Access Parameters
WHEN
The system begins the lookup process
THEN
All table access parameters are cleared and initialized to spaces
Context: CM table lookup parameters are initialized
GIVEN
CM table lookup parameters are initialized
Applied to: Set Function Code to GU
WHEN
The system prepares for table access
THEN
The function code is set to GU for unique record retrieval
Context: Table access function code is set to GU
GIVEN
Table access function code is set to GU
Applied to: Set Table ID to 'CM'
WHEN
The system specifies which table to access
THEN
The table ID is set to 'CM' to identify the correct lookup table
Context: Destination station number exists in shipment root data
GIVEN
Destination station number exists in shipment root data
Applied to: Convert Destination Station Number to Numeric
WHEN
The system prepares the search key for CM table lookup
THEN
The destination station number is converted to numeric format and stored in working storage
Context: Destination station number is converted to numeric format
GIVEN
Destination station number is converted to numeric format
Applied to: Set Station Number as Search Key
WHEN
The system sets up the search criteria for CM table
THEN
The numeric station number is assigned as the sequence ID search key
Context: All CM table lookup parameters are configured with station number as search key
GIVEN
All CM table lookup parameters are configured with station number as search key
Applied to: Call GCCTBIO Table Access
WHEN
The system executes the table access call
THEN
GCCTBIO is invoked with the configured parameters to perform the lookup
Context: CM table lookup has been executed
GIVEN
CM table lookup has been executed
Applied to: Lookup Successful?
WHEN
The system checks the lookup result status
THEN
The return flag is evaluated to determine if lookup was successful
Context: CM table lookup completed successfully
GIVEN
CM table lookup completed successfully
Applied to: Move Table Data to GCSTBRTCM
WHEN
The system processes the returned table data
THEN
The table segment data is moved to GCSTBRTCM structure for further processing
Context: CM table data is successfully loaded into GCSTBRTCM
GIVEN
CM table data is successfully loaded into GCSTBRTCM
Applied to: Extract Port Manifest Information
WHEN
The system processes the CM table information
THEN
Port manifest upon data is extracted from the CM table record
Context: Port manifest information is extracted from CM table data
GIVEN
Port manifest information is extracted from CM table data
Applied to: Set Sub-location Code from CM Data
WHEN
The system processes the manifest information
THEN
Sub-location code is set from the CM table sub-location code field
Context: CM table lookup was unsuccessful
GIVEN
CM table lookup was unsuccessful
Applied to: Clear Sub-location Code
WHEN
The system handles the lookup failure
THEN
Sub-location code is cleared to spaces
R-GCCCCADD-cbl-03010 (+9) File: GCCCCADD.cbl Lookup MC Table with Port Manifest Upon Merged 10 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup MC Table with Port Manifest Upon':
  • Context - a cm table lookup has been completed successfully and returned a port manifest upon value:
    For Initialize Table Search Parameters:
    When the system needs to perform an mc table lookup using the cm port manifest upon value, then the system initializes table search parameters by clearing all search keys and flags.
  • Context - an mc table lookup operation is being prepared:
    For Set Function Code to GU:
    When the system needs to specify the database operation type, then the system sets the function code to gu for retrieving a unique record.
  • Context - a table lookup operation is being configured:
    For Set Table ID to MC:
    When the system needs to specify which table to search, then the system sets the table id to mc to target the manifest customs table.
  • Context - a cm table lookup has returned a port manifest upon value:
    For Use CM Port Manifest Upon as Search Key:
    When the system performs an mc table lookup, then the system uses the cm port manifest upon value as the search key for the mc table.
  • Context - all mc table search parameters have been configured:
    For Execute GCCTBIO Call:
    When the system executes the table lookup, then the system calls gcctbio with the configured search parameters.
  • Context - an mc table lookup has been executed:
    For Search Successful?:
    When the system evaluates the lookup result, then the system checks if the return flag indicates successful completion.
  • Context - an mc table lookup has completed successfully:
    For Move Table Segment to GCSTBRTMC:
    When the system processes the successful lookup result, then the system moves the returned table segment data to the mc table structure.
  • Context - an mc table record has been successfully retrieved and moved to the mc structure:
    For Extract Sub-Location Code from MC Record:
    When the system processes the mc record data, then the system extracts the sub-location code from the mc record.
  • Context - a sub-location code has been extracted from an mc table record:
    For Set Sub-Location Code to GCCC Structure:
    When the system updates the customs cargo control information, then the system assigns the extracted sub-location code to the gccc structure.
  • Context - an mc table lookup has failed:
    For Set Sub-Location Code to Spaces:
    When the system handles the lookup failure, then the system sets the sub-location code to spaces as a default value.
👨‍💻 Technical ACs (Gherkin)
Context: A CM table lookup has been completed successfully and returned a port manifest upon value
GIVEN
A CM table lookup has been completed successfully and returned a port manifest upon value
Applied to: Initialize Table Search Parameters
WHEN
The system needs to perform an MC table lookup using the CM port manifest upon value
THEN
The system initializes table search parameters by clearing all search keys and flags
Context: An MC table lookup operation is being prepared
GIVEN
An MC table lookup operation is being prepared
Applied to: Set Function Code to GU
WHEN
The system needs to specify the database operation type
THEN
The system sets the function code to GU for retrieving a unique record
Context: A table lookup operation is being configured
GIVEN
A table lookup operation is being configured
Applied to: Set Table ID to MC
WHEN
The system needs to specify which table to search
THEN
The system sets the table ID to MC to target the manifest customs table
Context: A CM table lookup has returned a port manifest upon value
GIVEN
A CM table lookup has returned a port manifest upon value
Applied to: Use CM Port Manifest Upon as Search Key
WHEN
The system performs an MC table lookup
THEN
The system uses the CM port manifest upon value as the search key for the MC table
Context: All MC table search parameters have been configured
GIVEN
All MC table search parameters have been configured
Applied to: Execute GCCTBIO Call
WHEN
The system executes the table lookup
THEN
The system calls GCCTBIO with the configured search parameters
Context: An MC table lookup has been executed
GIVEN
An MC table lookup has been executed
Applied to: Search Successful?
WHEN
The system evaluates the lookup result
THEN
The system checks if the return flag indicates successful completion
Context: An MC table lookup has completed successfully
GIVEN
An MC table lookup has completed successfully
Applied to: Move Table Segment to GCSTBRTMC
WHEN
The system processes the successful lookup result
THEN
The system moves the returned table segment data to the MC table structure
Context: An MC table record has been successfully retrieved and moved to the MC structure
GIVEN
An MC table record has been successfully retrieved and moved to the MC structure
Applied to: Extract Sub-Location Code from MC Record
WHEN
The system processes the MC record data
THEN
The system extracts the sub-location code from the MC record
Context: A sub-location code has been extracted from an MC table record
GIVEN
A sub-location code has been extracted from an MC table record
Applied to: Set Sub-Location Code to GCCC Structure
WHEN
The system updates the customs cargo control information
THEN
The system assigns the extracted sub-location code to the GCCC structure
Context: An MC table lookup has failed
GIVEN
An MC table lookup has failed
Applied to: Set Sub-Location Code to Spaces
WHEN
The system handles the lookup failure
THEN
The system sets the sub-location code to spaces as a default value
R-GCCCCADD-cbl-03020 (+8) File: GCCCCADD.cbl Lookup RF Table with Consignee CHOP and Station Merged 9 Rules
Action Rules (from EDI)
👔 Business Narrative
Business Logic Rules for 'Lookup RF Table with Consignee CHOP and Station':
  • Context - a customs manifest processing request is initiated:
    For Initialize RF Table Search Parameters:
    When the system prepares to lookup customer bonded status in the rf table, then the rf table search parameters are cleared and initialized to empty values.
  • Context - shipment root data contains consignee chop information:
    For Set Consignee CHOP from Shipment:
    When the system prepares rf table lookup parameters, then the consignee chop from shipment root is assigned to the rf table consignee chop search field.
  • Context - destination station number is available from customs manifest data:
    For Set Station Number from Destination:
    When the system prepares rf table lookup parameters, then the destination station number is assigned to the rf table station search field.
  • Context - a table lookup operation is being configured:
    For Set Table ID to 'RF':
    When the system needs to search the rf table for customer bonded status, then the table identifier is set to 'rf' to specify the registered facility table.
  • Context - rf table search parameters are properly configured with consignee chop and station number:
    For Execute RF Table Search:
    When the system executes the rf table lookup, then the table lookup is performed using the gcctbio service with the specified search criteria.
  • Context - an rf table lookup has been executed:
    For RF Record Found?:
    When the system evaluates the lookup results, then if the return flag indicates 'successful', the rf record is considered found, otherwise it is not found.
  • Context - an rf table record has been successfully found and retrieved:
    For Retrieve Sub-location Code from RF Record:
    When the system processes the rf record data, then the sub-location code is extracted from the rf record and assigned to the customs manifest sub-location code field.
  • Context - an rf table record has been successfully found for the consignee and station combination:
    For Set Customer Bonded Indicator to TRUE:
    When the system updates the customer bonded status, then the customer bonded indicator is set to true indicating the customer has bonded facility status.
  • Context - no rf table record was found for the consignee and station combination:
    For Set Customer Bonded Indicator to FALSE:
    When the system updates the customer bonded status, then the customer bonded indicator is set to false indicating the customer does not have bonded facility status.
👨‍💻 Technical ACs (Gherkin)
Context: A customs manifest processing request is initiated
GIVEN
A customs manifest processing request is initiated
Applied to: Initialize RF Table Search Parameters
WHEN
The system prepares to lookup customer bonded status in the RF table
THEN
The RF table search parameters are cleared and initialized to empty values
Context: Shipment root data contains consignee CHOP information
GIVEN
Shipment root data contains consignee CHOP information
Applied to: Set Consignee CHOP from Shipment
WHEN
The system prepares RF table lookup parameters
THEN
The consignee CHOP from shipment root is assigned to the RF table consignee CHOP search field
Context: Destination station number is available from customs manifest data
GIVEN
Destination station number is available from customs manifest data
Applied to: Set Station Number from Destination
WHEN
The system prepares RF table lookup parameters
THEN
The destination station number is assigned to the RF table station search field
Context: A table lookup operation is being configured
GIVEN
A table lookup operation is being configured
Applied to: Set Table ID to 'RF'
WHEN
The system needs to search the RF table for customer bonded status
THEN
The table identifier is set to 'RF' to specify the Registered Facility table
Context: RF table search parameters are properly configured with consignee CHOP and station number
GIVEN
RF table search parameters are properly configured with consignee CHOP and station number
Applied to: Execute RF Table Search
WHEN
The system executes the RF table lookup
THEN
The table lookup is performed using the GCCTBIO service with the specified search criteria
Context: An RF table lookup has been executed
GIVEN
An RF table lookup has been executed
Applied to: RF Record Found?
WHEN
The system evaluates the lookup results
THEN
If the return flag indicates 'SUCCESSFUL', the RF record is considered found, otherwise it is not found
Context: An RF table record has been successfully found and retrieved
GIVEN
An RF table record has been successfully found and retrieved
Applied to: Retrieve Sub-location Code from RF Record
WHEN
The system processes the RF record data
THEN
The sub-location code is extracted from the RF record and assigned to the customs manifest sub-location code field
Context: An RF table record has been successfully found for the consignee and station combination
GIVEN
An RF table record has been successfully found for the consignee and station combination
Applied to: Set Customer Bonded Indicator to TRUE
WHEN
The system updates the customer bonded status
THEN
The customer bonded indicator is set to TRUE indicating the customer has bonded facility status
Context: No RF table record was found for the consignee and station combination
GIVEN
No RF table record was found for the consignee and station combination
Applied to: Set Customer Bonded Indicator to FALSE
WHEN
The system updates the customer bonded status
THEN
The customer bonded indicator is set to FALSE indicating the customer does not have bonded facility status