Skip to content

BB802I RPGLE

The BB802I RPGLE program is a component of the Customer Orders and Invoicing system, designed to populate a work file (BB802W) with canceled order detail data from the BB802IQF file, which is a logical file joining BBCND (canceled order details), BBCNH (canceled order headers), and BBCNOR (canceled order reasons). It is called by the BB802C CLP program in CND mode (canceled order detail processing) and is noted as being cloned from BB802B with modifications for canceled orders. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.


Process Steps of the BB802I RPG Program

The program reads records from the BB802IQF file, processes them based on a level break (L1), and adds records to the BB802W work file. The steps focus on data transfer with no user interaction. Here’s a breakdown of the key process steps:

  1. Initialization (*inzsr Subroutine):
  2. Purpose: Sets up the program environment and initializes variables.
  3. Actions:

    • Receives the input parameter: p$fgrp (1 character, file group: 'G' or 'Z').
    • Defines a key list (klwrk) for accessing the work file BB802W, using fields: bdco (company), bocust (customer), bdordn (order number), and boinvn (invoice number).
  4. Main Processing Loop:

  5. Purpose: Reads BB802IQF records and processes them based on a level break.
  6. Actions:

    • Reads BB802IQF records sequentially, with level break indicators (L1) set on fields bdco (company), bocust (customer), bdordn (order number), and boinvn (invoice number).
    • When the level break indicator *inl1 is on, executes the updwrkf subroutine to process the record.
  7. Update Work File (updwrkf Subroutine):

  8. Purpose: Adds records to the BB802W work file based on BB802IQF data.
  9. Actions:

    • Uses the klwrk key list (bdco, bocust, bdordn, boinvn) to check if a matching record exists in BB802W using SETLL (sets *in99 if no match).
    • If no matching record exists (*in99 = *off), chains to BB802W to verify existence (*in99 = *on if not found).
    • If the record does not exist (*in99 = *on):
    • Clears the BB802W record format (bb802wpf).
    • Maps fields from BB802IQF to BB802W:
      • w1cobdco (company)
      • w1custbocust (customer)
      • w1ord#bdordn (order number)
      • w1inv#boinvn (invoice number)
      • w1shipboship (ship-to code)
      • w1pordbopord (purchase order)
      • w1slmnboslmn (salesman)
      • w1cridbortg1 (carrier ID)
      • w1carnbocar (carrier name)
      • w1sdatborqd8 (request date)
      • w1frcdbofrcd (freight code)
      • w1sfrtbosfrt (ship freight)
      • w1cafrbocafr (carrier freight)
      • w1cacdbocacd (carrier code)
      • w1cnrsbccnrs (cancel reason)
      • w1locbdloc (location)
      • w1prodbdprod (product)
      • w1cntrbdcntr (container)
      • w1umbdum (unit of measure)
      • w1qtybdqty (quantity)
      • w1oori'C' (canceled order origin indicator)
      • Additional fields (per jk01):
      • w1tkbybotkby (taken by)
      • w1rushborush (rush order flag)
      • w1gpbybogpby (group by)
      • w1racdboracd (reason code)
      • w1mulobomulo (multi-order flag)
      • w1mlcdbomlcd (multi-code)
      • w1tolobotolo (total order)
      • w1lodaboloda (load date)
      • w1lovobolovo (load volume)
    • Writes the new record to BB802W (write bb802wpf).
    • If a matching record exists (*in99 = *off), no update is performed (implicitly skips to the next record).
  10. Program Termination:

  11. Purpose: Completes processing and exits.
  12. Actions:
    • Ends the program after processing all BB802IQF records, closing files implicitly (as BB802IQF and BB802W are defined with ip and uf respectively).

Business Rules

  1. Work File Population:
  2. The program adds records to BB802W from BB802IQF (joining BBCND, BBCNH, and BBCNOR) for canceled order details, using the invoice number (boinvn) as a key component.
  3. Only adds new records if no matching record exists in BB802W (based on bdco, bocust, bdordn, boinvn).

  4. Level Break Processing:

  5. Processes BB802IQF records on a level break (L1) defined by bdco (company), bocust (customer), bdordn (order number), and boinvn (invoice number).
  6. Ensures records are processed only when the level break occurs, optimizing performance.

  7. Field Mapping:

  8. Maps fields from BB802IQF, combining detail data (BBCND: e.g., bdloc, bdprod, bdqty) and header data (BBCNH: e.g., bopord, boslmn, borqd8) with cancel reason (bccnrs from BBCNOR).
  9. Includes additional fields added in revision jk01 (w1tkby, w1rush, w1gpby, etc.) to support enhanced inquiry capabilities.
  10. Sets w1oori = 'C' to indicate the record originates from a canceled order.

  11. File Group Handling:

  12. Relies on p$fgrp ('G' or 'Z') set by BB802C to access the correct library (GBBCND, GBBCNH, GBBCNOR or ZBBCND, ZBBCNH, ZBBCNOR) via overrides in the CLP.

  13. Data Integrity:

  14. Uses SETLL and CHAIN to ensure no duplicate records are written to BB802W.
  15. Clears the record format before writing to prevent residual data.

  16. Cloned from BB802B:

  17. The program is cloned from BB802B (which processes open order details from BBORDD/BBORDH) but adapted for canceled order details (BBCND/BBCNH).
  18. Key differences include:

    • Uses BB802IQF instead of BB802BQF.
    • Adds w1cnrs (cancel reason) to BB802W.
    • Sets w1oori = 'C' instead of 'O'.
    • Includes w1qty and w1um directly (not as a revision, unlike BB802B where they were added in jk01).
  19. Revision-Specific Rules:

  20. jk01: Added fields to BB802W (w1tkby, w1rush, w1gpby, w1racd, w1mulo, w1mlcd, w1tolo, w1loda, w1lovo) to capture additional canceled order data (e.g., taken by, rush flag, load volume).

Tables Used

The program accesses the following database files:

  1. BB802IQF: Logical file (input primary, ip), joins BBCND (canceled order details), BBCNH (canceled order headers), and BBCNOR (canceled order reasons), containing fields like bdco, bocust, bdordn, boinvn, bdloc, bdprod, bccnrs, etc.
  2. BB802W: Work file (update file, uf), stores processed inquiry data in QTEMP with fields like w1co, w1cust, w1ord#, w1inv#, w1cnrs, w1qty, etc.

External Programs Called

The program does not call any external programs. It operates independently, relying on file I/O operations and the environment set up by BB802C (e.g., file overrides and open query).


Additional Notes

  • Indicator Usage: Uses *inl1 for level break processing and *in99 for file access control (SETLL and CHAIN operations).
  • Field Prefixes: Uses w1 prefix for BB802W fields, aligning with the work file structure.
  • Key List: The klwrk key list ensures unique identification of records in BB802W using bdco, bocust, bdordn, and boinvn.
  • Context: Called by BB802C in CND mode (canceled order detail processing), where BB802IQF is queried with a selection string (QRYSLT) to filter records.
  • Efficiency: The program uses a simple, non-interactive approach, focusing on data transfer to the work file, with no user interface or message handling.
  • Relation to BB802B: As a clone of BB802B, it follows a similar structure but is tailored for canceled order details, with the addition of the cancel reason field (w1cnrs) and a different origin indicator (w1oori = 'C').

This program is a critical backend component of the inquiry system, ensuring that canceled order detail data is efficiently transferred to the BB802W work file for further processing by the BB802 inquiry interface.