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:
- File and Data Structure Definitions:
- Files:
SCREEN
: A workstation file (CP
, 1024 bytes) for user interaction, using the formatBB9564S1
.NEWPROD
: Input file (IF
, 32 bytes, no key specified) containing new product or pricing data.
-
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).
-
Initialization:
MOVEL*BLANKS MSG40 40
: Clears theMSG40
field (40 characters) to blanks.SETOF 505152
: Turns off indicators50
,51
,52
.SETOF 535455
: Turns off indicators53
,54
,55
.SETOF 56
: Turns off indicator56
.SETOF 8190
: Turns off indicators81
and90
to reset the program state.-
C 09 SETON 81
: If indicator09
is on (initial run), sets indicator81
to trigger screen output. -
Handle Cancel Condition:
C KG SETOF 0109
:- If the
KG
indicator is on (likely set by the workstation file when the user presses a cancel key), clears indicators01
and09
.
- If the
C KG MOVEL'CANCEL' KYCANC
:- Sets the
KYCANC
field to'CANCEL'
.
- Sets the
C KG SETON LR
:- Sets the Last Record (
LR
) indicator to terminate the program.
- Sets the Last Record (
-
C KG GOTO END
:- Jumps to the
END
tag to exit the program.
- Jumps to the
-
Main Processing (
S1
Subroutine): C 09 EXSR S1
:- If indicator
09
is on (initial run), executes theS1
subroutine.
- If indicator
-
S1 Subroutine:
EXSR NEWPRD
: Calls theNEWPRD
subroutine to load and display new product data.- Ends with
ENDS1
.
-
Load New Product Information (
NEWPRD
Subroutine): - Purpose: Reads records from
NEWPROD
and populates arrays for display on the screen. -
Steps:
MOVEL*BLANKS DCO
: Clears theDCO
array (though not used for output in this program).Z-ADD1 X 20
: Initializes indexX
to 1.Z-ADD00000001 LOWVAL 80
: SetsLOWVAL
to a low value (00000001) for positioning inNEWPROD
.C LOWVAL SETLLNEWPROD
: Sets the lower limit forNEWPROD
file access.- Reads
NEWPROD
records in a loop (READ NEWPROD 10
): - If end-of-file is reached (
10 = 1
), jumps toENDONE
. - Moves fields to arrays:
XXCONO
toDCQ,X
(company number).XXLOC
toDCL,X
(location code).XXPROD
toDCP,X
(product code).XXCNTR
toDCC,X
(container code).XXUNMS
toDCU,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 indicator81
to trigger screen output.- Ends the subroutine.
-
Screen Output:
-
OSCREEN D 81
:- Displays the screen format
BB9564S1
when indicator81
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.
- Displays the screen format
-
Program Termination:
- If the
S1
subroutine is executed (09 = 1
), the program processes theNEWPRD
subroutine and displays the screen. - If the cancel condition is met (
KG = 1
), the program jumps toEND
. - 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.