Skip to content

BI9411 RPG36

The provided RPG program, BI9411.rpg36.txt, is an RPG III program for IBM System/36 or AS/400, invoked by the BI941.ocl36 OCL program. Its purpose is to update the customer sales agreement work file (BICUAGXX) by adding the salesman number from the customer master file (ARCUST). Below, I’ll explain the process steps, business rules, tables used, and external programs called.


Process Steps of the BI9411 RPG Program

The program reads records from the BICUAGXX file, retrieves the corresponding salesman number from the ARCUST file, and updates the BICUAGXX record with the salesman number. Here’s a detailed breakdown of the process steps:

  1. File and Data Structure Definitions (Lines 0002–0012):
  2. Header (H) Specification:
    • 064: Likely a program option or parameter.
    • Program name: BI9411.
  3. File Specifications (F):
    • BICUAGXX: Update file (258 bytes, disk) containing customer sales agreement data.
    • ARCUST: Input file (384 bytes, indexed, 8-byte key, 2 access paths) for customer master data.
  4. Input Specifications (I):
    • BICUAGXX (record format 01):
    • Fields: BACONO (company number, positions 2–3), BACUST (customer number, positions 4–9), BACOCUL1 (company/customer key, positions 2–9).
    • ARCUST:
    • Field: ARSLS# (salesman number, positions 263–264, 2 digits, zoned decimal).
  5. Comment:

    • Indicates the program updates the sales agreement file with the salesman number from the customer master.
  6. Calculation Specifications (C) (Lines 0013–0015):

  7. Processing Loop (for each BICUAGXX record, record format 01):

    • Chaining to ARCUST:
    • BACOCU (combined company/customer key, positions 2–9) is used to chain to the ARCUST file.
    • If no matching record is found, indicator 91 is set.
    • Update Logic:
    • If a matching ARCUST record is found (indicator 91 off), the program proceeds to update the BICUAGXX record.
  8. Output Specifications (O) (Lines 0016–0017):

  9. Output to BICUAGXX:

    • Record format D (update) is used when indicator 91 is off (matching ARCUST record found).
    • Updates position 258 (2 bytes) with ARSLS# (salesman number from ARCUST).
  10. Program Termination:

  11. The program ends after processing all BICUAGXX records, updating those with valid salesman numbers from ARCUST.

Business Rules

  1. Salesman Number Update:
  2. For each record in BICUAGXX, retrieve the salesman number (ARSLS#) from the ARCUST file using the company (BACONO) and customer (BACUST) as the key (BACOCU).
  3. Update the BICUAGXX record with the salesman number in position 258 only if a matching ARCUST record is found.

  4. Record Skipping:

  5. If no matching ARCUST record is found (indicator 91 on), the BICUAGXX record is not updated.

  6. Data Integrity:

  7. The program assumes BICUAGXX and ARCUST are properly formatted, with BACOCU (company/customer) matching the key structure of ARCUST.

Tables Used

The program uses the following files/tables: 1. BICUAGXX: - Update file containing customer sales agreement data. - Fields: BACONO (company number), BACUST (customer number), BACOCUL1 (company/customer key). - Updated with ARSLS# (salesman number) in position 258. 2. ARCUST: - Input file containing customer master data. - Field: ARSLS# (salesman number).


External Programs Called

  • None:
  • The BI9411 program does not call any external programs. It performs all processing internally, reading from ARCUST and updating BICUAGXX.

Summary

  • Process Steps:
  • Define files: BICUAGXX (update) and ARCUST (input).
  • For each BICUAGXX record:
    • Chain the company/customer key (BACOCU) to ARCUST.
    • If a matching ARCUST record is found, update BICUAGXX with the salesman number (ARSLS#) in position 258.
  • Terminate after processing all records.

  • Business Rules:

  • Update BICUAGXX records with salesman numbers from ARCUST based on company/customer key.
  • Skip records without a matching ARCUST entry.

  • Tables Used:

  • BICUAGXX, ARCUST.

  • External Programs Called:

  • None.

This program is a simple, focused utility that enriches the customer sales agreement data with salesman information, preparing it for further processing in the BI941 workflow.