Skip to content

BB9564 RPG36

The provided document is an RPG III (or RPG/36) program, BB9564.rpg36.txt, called conditionally from the OCL program BB9564.ocl36.txt when SWITCH2 is set to 1 in the main OCL program BB956P.ocl36.txt. This program is part of the rack pricing update process and is responsible for displaying new product information on a screen for user review. Below is an explanation of the process steps, business rules, tables (files) used, and any external programs called.


Process Steps of the RPG Program BB9564

The BB9564 program is an interactive program that reads new product data from the NEWPROD file, displays it on a screen for user review, and handles user interactions (e.g., cancellation). Here’s a step-by-step breakdown of the process:

  1. File and Data Structure Definitions:
  2. Files:
    • SCREEN: A workstation file (CP, 1024 bytes) for user interaction, using the format BB9564S1.
    • NEWPROD: Input file (IF, 32 bytes, no key specified) containing new product or pricing data.
  3. Data Structures:

    • DCO: Array of 10 elements, each 35 characters, intended for customer names but not used in this program.
    • DCS: Array of 10 elements, each 6 digits, intended for customer numbers but not used.
    • DCQ: Array of 10 elements, each 2 characters, for company numbers (XXCONO).
    • DCL: Array of 10 elements, each 3 characters, for location codes (XXLOC).
    • DCP: Array of 10 elements, each 4 characters, for product codes (XXPROD).
    • DCC: Array of 10 elements, each 3 characters, for container codes (XXCNTR).
    • DCU: Array of 10 elements, each 3 characters, for units of measure (XXUNMS).
    • MSG: Array of 1 element, 40 characters, for error messages (e.g., "NO NEW PRODUCTS FOR CUSTOMER CREATED").
    • UDS (User Data Structure):
    • KYDATE (positions 105-110): Date input.
    • KYMO (positions 105-106): Month portion of the date.
    • KYYR (positions 109-110): Year portion of the date.
    • KYCO (positions 114-115): Company number.
    • KYJOBQ (position 120): Job queue code.
    • KYCANC (positions 129-134): Cancel flag.
    • KYCUST (positions 201-206): Customer number.
    • ADDREC (position 207): Flag to indicate record addition.
    • Y2KCEN (positions 509-510): Century for Y2K handling (e.g., 19 for 1900s).
    • Y2KCMP (positions 511-512): Comparison year for Y2K logic (e.g., 80).
  4. Initialization:

  5. MOVEL*BLANKS MSG40 40: Clears the MSG40 field (40 characters) to blanks.
  6. SETOF 505152: Turns off indicators 50, 51, 52.
  7. SETOF 535455: Turns off indicators 53, 54, 55.
  8. SETOF 56: Turns off indicator 56.
  9. SETOF 8190: Turns off indicators 81 and 90 to reset the program state.
  10. C 09 SETON 81: If indicator 09 is on (initial run), sets indicator 81 to trigger screen output.

  11. Handle Cancel Condition:

  12. C KG SETOF 0109:
    • If the KG indicator is on (likely set by the workstation file when the user presses a cancel key), clears indicators 01 and 09.
  13. C KG MOVEL'CANCEL' KYCANC:
    • Sets the KYCANC field to 'CANCEL'.
  14. C KG SETON LR:
    • Sets the Last Record (LR) indicator to terminate the program.
  15. C KG GOTO END:

    • Jumps to the END tag to exit the program.
  16. Main Processing (S1 Subroutine):

  17. C 09 EXSR S1:
    • If indicator 09 is on (initial run), executes the S1 subroutine.
  18. S1 Subroutine:

    • EXSR NEWPRD: Calls the NEWPRD subroutine to load and display new product data.
    • Ends with ENDS1.
  19. Load New Product Information (NEWPRD Subroutine):

  20. Purpose: Reads records from NEWPROD and populates arrays for display on the screen.
  21. Steps:

    • MOVEL*BLANKS DCO: Clears the DCO array (though not used for output in this program).
    • Z-ADD1 X 20: Initializes index X to 1.
    • Z-ADD00000001 LOWVAL 80: Sets LOWVAL to a low value (00000001) for positioning in NEWPROD.
    • C LOWVAL SETLLNEWPROD: Sets the lower limit for NEWPROD file access.
    • Reads NEWPROD records in a loop (READ NEWPROD 10):
    • If end-of-file is reached (10 = 1), jumps to ENDONE.
    • Moves fields to arrays:
      • XXCONO to DCQ,X (company number).
      • XXLOC to DCL,X (location code).
      • XXPROD to DCP,X (product code).
      • XXCNTR to DCC,X (container code).
      • XXUNMS to DCU,X (unit of measure).
    • Increments X and continues until 10 records are processed (X COMP 10) or no more records are available (GOTO AGNONE).
    • ENDONE: Ends the loop.
    • SETON 81: Sets indicator 81 to trigger screen output.
    • Ends the subroutine.
  22. Screen Output:

  23. OSCREEN D 81:

    • Displays the screen format BB9564S1 when indicator 81 is on.
    • Outputs fields:
    • Screen title: "CUSTOMER RACK PRICING ADDING NEW PRODUCTS".
    • DCQ (company numbers array) at position 61.
    • DCL (location codes array) at position 91.
    • DCP (product codes array) at position 131.
    • DCC (container codes array) at position 161.
    • DCU (units of measure array) at position 191.
    • MSG40 (error message) at position 231.
    • ADDREC (add record flag) at position 41.
  24. Program Termination:

  25. If the S1 subroutine is executed (09 = 1), the program processes the NEWPRD subroutine and displays the screen.
  26. If the cancel condition is met (KG = 1), the program jumps to END.
  27. The END tag marks the program’s termination point.

Business Rules

The BB9564 program enforces the following business rules: 1. Display New Products: - Reads up to 10 records from NEWPROD and displays their company number, location, product code, container code, and unit of measure on the screen. - The screen is intended for user review of new pricing data added in previous steps (e.g., by BB9563). 2. Cancel Handling: - If the user cancels (via a function key setting KG), sets KYCANC to 'CANCEL' and exits. 3. No Data Case: - If no records are found in NEWPROD, the screen may display the error message "NO NEW PRODUCTS FOR CUSTOMER CREATED" (stored in MSG). 4. Purpose: - Provides a user interface to review new product pricing data before further processing (e.g., updating PRCTUM in subsequent programs). - Does not perform updates or validations, focusing solely on displaying data.


Tables (Files) Used

The program interacts with the following files: 1. Input File: - NEWPROD: Contains new product or pricing data with fields: - XXCONO (positions 1-2): Company number. - XXLOC (positions 3-5): Location code. - XXPROD (positions 6-9): Product code. - XXCNTR (positions 10-12): Container code. - XXUNMS (positions 13-15): Unit of measure. 2. Workstation File: - SCREEN: Display file for user interaction, using format BB9564S1 to show new product data and messages. 3. Note: - The OCL program BB9564.ocl36.txt specifies PRCTUM as an input file, but it is not referenced in the RPG program, suggesting it may be used implicitly (e.g., for validation in a later step) or the RPG program does not fully utilize it.


External Programs Called

The BB9564 program does not call any external programs. It performs all processing within its own logic using the NEWPRD and S1 subroutines and file I/O operations.


Summary

The BB9564 RPG program is an interactive program that reads new product pricing data from NEWPROD, populates arrays with up to 10 records, and displays the data (company number, location, product code, container code, and unit of measure) on a screen using the BB9564S1 format. It supports user cancellation and displays an error message if no new products are found. The program uses the NEWPROD and SCREEN files, with PRCTUM specified in the OCL but not used in the RPG logic. No external programs are called.