The call stack consists of the following programs, all part of the "Bradford Order Entry / Invoices" system for "Rack Price File Maintenance":
- BB955.ocl36.txt: The OCL (Operation Control Language) program that initiates the process, invoking
BB955. - BB955.rpgle (parts 1 and 2): The main RPGLE program that handles interactive rack price file maintenance, including viewing, updating, adding, and deleting records.
- BB955AC.clp: A CLP program called by
BB955to clear or create the work fileBB955WinQTEMP. - GB730P.rpgle: An RPGLE program called by
BB955(via F9) for displaying historical data of various files, includingbbprcehxfor rack price history.
Below, I’ll identify the use cases implemented by this call stack, then provide a function requirement document for each use case, assuming they are non-interactive functions that process inputs programmatically.
List of Use Cases¶
Based on the analysis of the provided programs, the call stack implements the following use cases:
- Maintain Rack Price Records (
BB955.rpgle): - Description: Allows for viewing, updating, adding, and deleting rack price records in the
bbprcefile, with support for up to 10 additional locations and validation against master files. Changes are staged inBB955Wand logged tobbprceh. - Components: Main logic in
BB955(srsfl1,sf1rep,sf1prc,sf1upd,sf1f07,updadlloc,addadlloc,sf1cte,sf1ctenew,sf1lodall), withBB955ACclearing/creatingBB955W. -
Key Features:
- Filter records by company, location, product, container, unit of measure, product class, status, dates, inactive status, rack price flag, and division.
- Update existing records or add new ones with a new effective date.
- Support for additional locations (
locarray). - Toggle display of deleted records and update permissions.
- Validate inputs against master files (
bicont,inloc,gsprod,gscntr1,gstabl). - Log changes to
bbprceh.
-
View Rack Price History (
GB730P.rpgle, called byBB955): - Description: Displays historical changes to rack price records (
bbprcehx) for a specific company, location, product, container, unit of measure, date, and time. - Components: Invoked via F9 in
BB955, usingGB730P’s subfile processing and parameter handling. -
Key Features:
- Query historical data based on parameters passed from
BB955. - Display history with formatted dates and user information.
- Support for multiple file types (e.g.,
BBPRCE,SHIPTO), with specific handling forBBPRCE.
- Query historical data based on parameters passed from
-
Manage Work File for Rack Price Processing (
BB955AC.clp): - Description: Clears or creates the
BB955Wwork file inQTEMPto stage rack price data before updatingbbprce. - Components: Called by
BB955(sf1f07) to ensure a clean work file. - Key Features:
- Clear existing
BB955Wor create it fromDATA(production) orDATADEV(development) based on the file group parameter. - Ensure session-specific data isolation in
QTEMP.
- Clear existing
Function Requirement Documents¶
Each use case is transformed into a non-interactive function that processes inputs programmatically, avoiding screen-based interaction. The requirements focus on business needs, process steps, and calculations, presented concisely.
Function Requirement Document: MaintainRackPriceRecords¶
Purpose¶
Programmatically maintain rack price records in the bbprce file, allowing updates, additions, or deletions based on provided inputs, with changes staged in BB955W and logged to bbprceh.
Inputs¶
- Company Number (
cono, 2 digits): Identifies the company. - Location (
loc, 3 chars): Primary location code. - Product (
prod, 4 chars): Product code. - Container (
cntr, 3 chars): Container code (000–999). - Unit of Measure (
unms, 3 chars): Unit of measure code. - Product Class (
prcl, 3 chars): Product class code. - Status (
stat, 3 chars): Filter status (ALL, CUR, FUT, CF). - From Date (
fmdy, 6 digits, MMDDYY): Start date filter. - To Date (
tmdy, 6 digits, MMDDYY): End date filter. - Inactive Status (
inac, 1 char): Blank (active), I (inactive, no orders), B (inactive, orders allowed). - No Rack Price (
rkrq, 1 char): Blank or N (no rack price). - Division (
dvsn, 1 char): Blank (all), R (refinery), L (blended lube). - Effective Date (
emdy, 6 digits, MMDDYY): Effective date for new records. - Additional Locations (
loc_array, array of 10 x 3 chars): Additional location codes. - Existing Quantities (
qt, array of 4 x 7 digits): Quantities for existing records. - Existing Prices (
pr, array of 4 x 9.4 packed): Prices for existing records. - New Quantities (
n_qt, array of 4 x 7 digits): Quantities for new records. - New Prices (
n_pr, array of 4 x 9.4 packed): Prices for new records. - New Minimum Quantity (
n_minq, 7 digits): Minimum quantity for new records. - New Inactive Status (
n_inac, 1 char): Inactive status for new records. - New Rack Price Flag (
n_rkrq, 1 char): Rack price flag for new records. - Action (
action, char): UPDATE, ADD, DELETE, RESTORE. - File Group (
fgrp, 1 char): G (production) or Z (development).
Outputs¶
- Status Code (char): SUCCESS or ERROR.
- Error Messages (array of strings): List of validation errors, if any.
- Updated Records (array of records): Details of updated/added/deleted records.
Process Steps¶
- Validate Inputs:
- Verify
conoexists inbicont, retrieving company name. - Verify
locexists ininloc, retrieving location name. - Verify
prodexists ingsprod, retrieving product description. - Verify
cntris 000–999 and exists ingscntr1, retrieving description. - Verify
unmsexists ingstabl(typeBIUNMS), retrieving description. - Verify
prcl(withcono) exists ingstabl(typePRODCL), retrieving description. - Validate
statas ALL, CUR, FUT, or CF. - Validate
fmdyandtmdyusingGSDTEDIT, converting to CYMD format. - Validate
inacas blank, I, or B. - Validate
rkrqas blank or N. - Validate
dvsnas blank, R, or L. - Validate
loc_arrayentries exist ininlocand are not equal toloc. - Validate
emdy(if provided) usingGSDTEDITand ensure non-zero ifloc_arrayis non-empty. - Validate
qt,pr,n_qt,n_pr,n_minq,n_inac,n_rkrqfor numeric/format consistency. -
Return ERROR with specific messages (e.g., "Invalid Company", "Must Enter Effective Date") if any validation fails.
-
Clear/Create Work File:
-
Call
BB955ACwithfgrpto clearBB955WinQTEMPor create it fromDATA(ifG) orDATADEV(ifZ). -
Build Work File:
- Filter
bbprcerecords based oncono,loc,prod,cntr,unms,prcl,stat,fmdy,tmdy,inac,rkrq,dvsn. - Exclude inactive records in
gsctum,gsctwt,gsumcv(treated as deleted perJB05). -
Write matching records to
BB955W. -
Process Action:
- UPDATE:
- Chain to
BB955Wusingcono,prod,cntr,unms,loc,date,time. - Update fields (
pr,qt,minq,rkrq,inac) if different from existing values. - Log changes to
bbprcehwith user and timestamp (revisionJK01). - Update
bbprceand additional locations (loc_array).
- Chain to
- ADD:
- Validate
emdyand non-empty fields (n_pr,n_qt,n_minq,n_rkrq,n_inac). - Add new records to
bbprceforcono,loc,prod,cntr,unms,emdy,time(default 0001 if not provided). - Add records for
loc_arrayentries. - Log changes to
bbprceh.
- Validate
- DELETE:
- Mark records in
bbprceas deleted (rkdel = 'D') for specified keys. - Log to
bbprceh.
- Mark records in
-
RESTORE:
- Restore deleted records (
rkdel = 'A') inbbprce. - Log to
bbprceh.
- Restore deleted records (
-
Return Results:
- Return SUCCESS with updated records or ERROR with error messages.
Business Rules¶
- All input fields must be validated against master files (
bicont,inloc,gsprod,gscntr1,gstabl). - Effective date (
emdy) is mandatory for ADD with additional locations. - Inactive records in
gsctum,gsctwt,gsumcvare treated as deleted (JB05). - Changes are logged to
bbprcehwith user and timestamp (JK01). - Prices are in U.S. dollars.
- Work file (
BB955W) is session-specific inQTEMP(jk04). - Support two file groups:
G(production,DATA) andZ(development,DATADEV).
Calculations¶
- Date Conversion: Use
GSDTEDITto convertfmdy,tmdy,emdy(MMDDYY) to CYMD format for storage. - Timestamp: Use system time (
ps#hms) for new records if not provided, defaulting to 0001 for ADD. - Quantity/Price Arrays: Ensure
qtandn_qtare 7 digits,prandn_prare 9.4 packed, and validate for ascending order or non-zero constraints (perBB955’scomarray).
Function Requirement Document: ViewRackPriceHistory¶
Purpose¶
Retrieve and return historical changes to rack price records from bbprcehx based on provided keys.
Inputs¶
- File Name (
file, 10 chars): Must beBBPRCE. - File Group (
fgrp, 1 char): G (production) or Z (development). - Company Number (
cono, 2 digits): Company identifier. - Location (
loc, 3 chars): Location code. - Product (
prod, 4 chars): Product code. - Container (
cntr, 3 chars): Container code. - Unit of Measure (
unms, 3 chars): Unit of measure code. - Date (
date, 8 digits, CYMD): Specific date of change (optional). - Time (
time, 4 digits): Specific time of change (optional).
Outputs¶
- Status Code (char): SUCCESS or ERROR.
- Error Messages (array of strings): List of validation errors, if any.
- History Records (array of records): Historical data including prices, quantities, user, and timestamp.
Process Steps¶
- Validate Inputs:
- Ensure
file = 'BBPRCE'. - Validate
fgrpas G or Z. - Verify
conoexists inbicont. - Verify
locexists ininloc. - Verify
prodexists ingsprod. - Verify
cntrexists ingscntr1. - Verify
unmsexists ingstabl(typeBIUNMS). - Validate
date(if provided) usingGSDTEDIT. - Validate
time(if provided) as 4 digits. -
Return ERROR with messages (e.g., "Cannot Enter both Sys And Program Id") if validation fails.
-
Apply File Overrides:
- If
fgrp = 'G', overridebbprcehxtogbbprcehx. -
If
fgrp = 'Z', overridebbprcehxtozbbprcehx. -
Retrieve History:
- Query
bbprcehxusingcono,loc,prod,cntr,unms,date,time(if provided). - Filter out inactive records in
gsctum,gsctwt,gsumcv(perJB05). -
Retrieve associated descriptions from
bicont,inloc,gsprod,gscntr1,gstabl. -
Format Output:
- Convert dates to MMDDYY format using
GSDTEDIT. - Include user (
USER##8) and timestamp for each change. - Return SUCCESS with history records.
Business Rules¶
- Only
BBPRCEhistory is retrieved (other files likeSHIPTOare supported but irrelevant here). - Input keys must match
bbprcehxrecords. - Inactive records in
gsctum,gsctwt,gsumcvare excluded. - File group determines library (
gbbprcehxorzbbprcehx). - Historical data includes audit fields (user, timestamp).
Calculations¶
- Date Conversion: Use
GSDTEDITto convertdate(CYMD) to MMDDYY for output.
Function Requirement Document: ManageWorkFile¶
Purpose¶
Clear or create the BB955W work file in QTEMP to stage rack price data for processing.
Inputs¶
- File Group (
fgrp, 1 char): G (production) or Z (development).
Outputs¶
- Status Code (char): SUCCESS or ERROR.
- Error Messages (array of strings): List of errors, if any.
Process Steps¶
- Validate Input:
- Ensure
fgrpis G or Z. -
Return ERROR if invalid.
-
Clear Work File:
-
Attempt to clear
BB955WinQTEMPusingCLRPFM. -
Create Work File (if needed):
- If
BB955Wnot found:- If
fgrp = 'G', createBB955WinQTEMPfromDATA/BB955Wwith no constraints or triggers. - If
fgrp = 'Z', create fromDATADEV/BB955W.
- If
-
Ignore errors for existing objects or constraints.
-
Return Results:
- Return SUCCESS or ERROR with messages.
Business Rules¶
BB955Wis session-specific inQTEMP.- Source library is
DATA(production) forG,DATADEV(development) forZ(JK01). - Errors (e.g., file not found) are handled gracefully.
Calculations¶
- None required.
Additional Notes¶
- Assumptions for Non-Interactive Functions:
- The functions replace
BB955’s interactive subfile processing (srsfl1,sf1lodall) with programmatic input validation and processing. - User interaction (e.g., F6, F8, F23) is replaced by explicit
actionparameters (UPDATE, ADD, DELETE, RESTORE). - Screen-based error messages (
comarray) are returned as output arrays. - Missing Code: The truncated
BB955andGB730Pcode limits details on subroutines likebldwrkf,writehist, andGB730P’s main logic. The use cases assume standard RPG behavior for work file population and history retrieval. - Integration:
MaintainRackPriceRecordscallsManageWorkFileto initializeBB955W.ViewRackPriceHistoryis invoked separately but uses the same file group and validation logic.- Business Context: The system manages rack prices for products in U.S. dollars, with support for multiple locations, audit logging, and environment-specific data (production vs. development).
If you have additional code or need refinements to these requirements (e.g., specific calculations or validation rules), please provide them. I can also use DeepSearch to clarify AS/400 conventions or expand on specific aspects. Let me know how to proceed!