Skip to content

BB9541 RPG36

The provided document, BB9541.rpg36.txt, is an RPG (Report Program Generator) program for IBM System/3x or AS/400 systems, called by the OCL program BB954P.ocl36.txt. It serves as a preprocessing step for creating a temporary customer list file (BB954S) from the customer master file (PRCTUM) for the rack pricing update process. Below, I’ll explain the process steps, business rules, tables (files) used, and any external programs called.

Process Steps of the RPG Program

The RPG program BB9541 is designed to read customer records from the PRCTUM file, filter them, and write valid records to the BB954S file. Here’s a detailed breakdown of the process steps:

  1. File Definitions:
  2. PRCTUM: Input file (64 bytes, indexed with an 18-byte key, access path AI, disk-based). This is the customer master file containing customer and product data.
  3. BB954S: Update file (9 bytes, indexed with an 8-byte key, access path AI, disk-based). This is a temporary file used to store the filtered customer list.
  4. OCL Syntax:

    1
    2
    FPRCTUM  IP  F  64  64 18AI     2 DISK
    FBB954S  UF  F   9   9  8AI     2 DISK                      A
    

  5. Input Specifications:

  6. PRCTUM:
    • PCDEL (position 1): Delete flag ('D' indicates a deleted record).
    • PCCONO (positions 2–3): Company number.
    • PCCUST (positions 4–9): Customer number.
    • PCKEY (positions 2–9): Composite key (company number + customer number).
    • PCPROD (positions 10–13): Product code.
    • PCCNTR (positions 14–16): Container code.
    • PCUNMS (positions 17–19): Unit of measure.
  7. BB954S:
    • PSDEL (position 1): Delete flag ('A' for active records, as written by this program).
    • PSCONO (positions 2–3): Company number.
    • PSCUST (positions 4–9): Customer number.
  8. OCL Syntax:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    IPRCTUM  NS  01
    I                                        1   1 PCDEL
    I                                        2   30PCCONO
    I                                        4   90PCCUST
    I                                        2   90PCKEY
    I                                       10  13 PCPROD
    I                                       14  16 PCCNTR
    I                                       17  19 PCUNMS
    IBB954S  NS
    I                                        1   1 PSDEL
    I                                        2   30PSCONO
    I                                        4   90PSCUST
    

  9. Main Processing Logic:

  10. The program processes records from PRCTUM (indicated by NS 01, meaning primary file processing in the RPG cycle).
  11. For each record in PRCTUM:
    • Check for Existing Record: Uses the PCKEY (company number + customer number) to perform a CHAIN operation on BB954S to check if the record already exists.
    • Write to BB954S: If the record does not exist in BB954S (indicator 99 is on, meaning no match found), the program writes a new record to BB954S using the EXCPT operation.
  12. Output to BB954S:
    • Sets PSDEL to 'A' (indicating an active record).
    • Copies PCCONO (company number) to PSCONO.
    • Copies PCCUST (customer number) to PSCUST.
  13. OCL Syntax:

    1
    2
    3
    4
    5
    6
    C   01      PCKEY     CHAINBB954S               99
    C   01 99             EXCPT
    OBB954S  EADD
    O                                    1 'A'
    O                         PCCONO     3
    O                         PCCUST     9
    

  14. End of Processing:

  15. The RPG cycle automatically processes all records in PRCTUM until the end of the file. No explicit loop or termination logic is defined, as the RPG cycle handles this inherently.

Business Rules

The RPG program BB9541 enforces the following business rules:

  1. Filter Out Deleted Records:
  2. Records in PRCTUM marked with PCDEL = 'D' are not explicitly filtered in the code, but the program assumes valid records (since no condition checks PCDEL). It’s likely that the OCL program or prior steps ensure only non-deleted records are processed.

  3. Unique Customer Records:

  4. The program checks for existing records in BB954S using PCKEY (company number + customer number). If a record already exists (indicator 99 off), it skips writing to avoid duplicates.

  5. Active Record Marking:

  6. All records written to BB954S are marked with PSDEL = 'A', indicating they are active and valid for further processing (e.g., by BB954P or BB9542).

  7. Data Mapping:

  8. Only the company number (PCCONO) and customer number (PCCUST) are copied from PRCTUM to BB954S. Other fields like PCPROD, PCCNTR, and PCUNMS are defined but not used in this program, suggesting they may be relevant for filtering in other programs or steps.

Tables (Files) Used

The RPG program uses the following files: 1. PRCTUM: Customer master file (64 bytes, indexed), containing company and customer data, product codes, container codes, and units of measure. Used as the primary input file. 2. BB954S: Temporary customer list file (9 bytes, indexed), used to store unique company and customer number pairs marked as active ('A'). Used as an update file (input/output).

External Programs Called

The RPG program BB9541 does not explicitly call any external programs. It is invoked by the OCL program BB954P.ocl36.txt as part of the preprocessing step to generate the BB954S file, which is then used by other programs (BB954P, BB9542) in the workflow.

Summary

The RPG program BB9541 is a preprocessing step in the rack pricing update process, responsible for creating a temporary customer list (BB954S) from the customer master file (PRCTUM). It: - Reads records from PRCTUM. - Checks for duplicate records in BB954S using the composite key (PCKEY). - Writes unique, active records to BB954S with company and customer numbers. - Enforces business rules to ensure unique records and marks them as active. - Uses two files: PRCTUM (input) and BB954S (update). - Does not call external programs but is part of the OCL-driven workflow.

This program sets the stage for subsequent steps, such as validation in BB954P and pricing updates in BB9542, by providing a filtered list of valid customers.