Skip to content

BB9541 RPG36

The provided document is an RPG III (or RPG/36) program, BB9541.rpg36.txt, called from the OCL program BB956P.ocl36.txt. This program preprocesses data from a customer master file to create a customer list for rack price updates. Below is an explanation of the process steps, business rules, tables used, and any external programs called.


Process Steps of the RPG Program BB9541

The RPG program BB9541 reads records from the PRCTUM file, processes them based on specific conditions, and writes to the BB954S file (aliased as ?9?BB956S in the OCL program). Here’s a step-by-step breakdown of the process:

  1. File Definitions:
  2. Input File (PRCTUM):
    • Defined as an input primary file (IP) with a record length of 64 bytes, 18-byte key, and accessed via direct access (AI) on disk.
    • Fields include:
    • PCDEL (position 1): Delete flag ('D' for delete).
    • PCCONO (positions 2-3): Company number.
    • PCCUST (positions 4-9): Customer number.
    • PCKEY (positions 2-9): Composite key (company + customer number).
    • PCPROD (positions 10-13): Product code.
    • PCCNTR (positions 14-16): Container code.
    • PCUNMS (positions 17-19): Unit of measure.
  3. Update File (BB954S):

    • Defined as an update file (UF) with a record length of 9 bytes, 8-byte key, and accessed via direct access (AI) on disk.
    • Fields include:
    • PSDEL (position 1): Delete flag ('D' for delete).
    • PSCONO (positions 2-3): Company number.
    • PSCUST (positions 4-9): Customer number.
  4. Main Processing Logic:

  5. The program operates in the RPG fixed logic cycle for a primary file (PRCTUM):
    • Reads each record from PRCTUM automatically as part of the cycle.
    • Processes records with indicator 01 (set when a valid record is read from PRCTUM).
  6. Chain Operation:
    • C 01 PCKEY CHAINBB954S 99:
    • For each PRCTUM record, the program uses the PCKEY (company number + customer number) to search for a matching record in BB954S.
    • If a matching record is found, indicator 99 is turned off (99 = 0). If no match is found, indicator 99 is turned on (99 = 1).
  7. Exception Output:

    • C 01 99 EXCPT:
    • If no matching record is found in BB954S (99 = 1) and a valid PRCTUM record is read (01 = 1), the program executes an exception output to write a new record to BB954S.
  8. Output to BB954S:

  9. OBB954S EADD:

    • Defines an exception output operation (EADD) to add a new record to BB954S.
    • The output record contains:
    • Position 1: Hard-coded value 'A' (likely an "active" or "add" flag, as opposed to 'D' for delete).
    • Positions 2-3: PCCONO (company number from PRCTUM).
    • Positions 4-9: PCCUST (customer number from PRCTUM).
  10. Program Termination:

  11. The RPG cycle continues until all PRCTUM records are processed.
  12. The program ends when no more records are available in PRCTUM.

Business Rules

The business logic of BB9541 is focused on creating a customer list for rack price updates, with the following rules: 1. Input Validation: - Reads records from the PRCTUM file, which contains customer data including company number, customer number, product code, container code, and unit of measure. - Only processes records with a valid PCKEY (company number + customer number).

  1. Duplicate Check:
  2. For each PRCTUM record, checks if a record with the same PCKEY already exists in BB954S.
  3. If a record exists (99 = 0), no action is taken (the record is skipped to avoid duplicates).

  4. Record Creation:

  5. If no matching record is found in BB954S (99 = 1), a new record is created with:
    • An 'A' flag to indicate an active or added record.
    • The company number (PCCONO) and customer number (PCCUST) from PRCTUM.
  6. The output file BB954S is used to store a unique list of company/customer combinations.

  7. Delete Flag Handling:

  8. The PCDEL field in PRCTUM (delete flag) is not explicitly used in the logic, suggesting that records marked for deletion ('D') are still processed unless filtered elsewhere (e.g., in the calling OCL or another program).

  9. Purpose:

  10. The program creates a deduplicated customer list (BB954S) containing only company and customer numbers, likely used downstream in the rack pricing update process (e.g., by BB956P or other programs in the OCL).

Tables (Files) Used

The program interacts with the following files: 1. Input File: - PRCTUM: Customer master file containing company number, customer number, product code, container code, unit of measure, and a delete flag. 2. Update/Output File: - BB954S (aliased as ?9?BB956S in the OCL): Output file containing a deduplicated list of company/customer combinations with an active flag ('A').


External Programs Called

The BB9541 program does not call any external programs. It operates independently, performing file I/O and processing within its own logic.


Summary

The BB9541 RPG program preprocesses the PRCTUM customer master file to create a deduplicated customer list in the BB954S file (aliased as ?9?BB956S in the OCL). It reads each PRCTUM record, checks for duplicates in BB954S using the PCKEY (company + customer number), and writes new records with an 'A' flag if no match is found. The business rules ensure a unique list of company/customer pairs for use in subsequent rack pricing updates. The program uses two files (PRCTUM and BB954S) and does not call any external programs.