BB955AC CLP
The provided document, BB955AC.clp.txt, is a CLP (Control Language Program) named BB955AC, which is called from the BB955 RPGLE program (itself invoked by the BB955.ocl36.txt OCL program) within the context of the "Rack Price File Maintenance" system. The purpose of BB955AC is to clear or create a work file (BB955W) in the QTEMP library, used as a temporary storage for rack price data during processing in BB955. Below, I’ll explain the process steps, business rules, tables used, and external programs called, integrating this with the context from BB955.rpgle (parts 1 and 2) and GB730P.rpgle.
Process Steps of the CLP Program (BB955AC)¶
The BB955AC program is a simple CLP designed to manage the work file BB955W in the QTEMP library. It takes a single parameter (&P$FGRP) to determine the source library for the file creation. Here are the detailed process steps:
- Program Declaration and Parameter:
- Step: Declares the program with a single parameter
&P$FGRP, a 1-character variable that specifies the file group (GorZ). -
Purpose: The parameter determines whether the work file is created from the
DATAlibrary (forG) orDATADEVlibrary (forZ), reflecting different environments (e.g., production vs. development). -
Clear Work File (
CLRPFM): - Step: Executes the
CLRPFMcommand to clear the physical fileBB955Win theQTEMPlibrary. - Purpose: Ensures the work file is empty before processing, preventing residual data from affecting
BB955’s operations. -
Error Handling: Monitors for message
CPF3142(file not found) usingMONMSG. If the file does not exist, proceeds to theDOblock to create it. -
Create Work File (
CRTDUPOBJ): - Step: If the file is not found (
CPF3142), checks the value of&P$FGRP:- If
&P$FGRP = 'G': - Executes
CRTDUPOBJto create a duplicate of theBB955Wfile from theDATAlibrary intoQTEMP, with constraints (CST(*NO)) and triggers (TRG(*NO)) disabled. - Monitors for messages
CPF5813(constraint error) andCPF7302(object already exists) to handle potential errors gracefully. - If
&P$FGRP ≠ 'G': - Executes
CRTDUPOBJto create a duplicate ofBB955Wfrom theDATADEVlibrary intoQTEMP, with the same constraints and trigger settings. - Monitors for the same error messages.
- If
-
Purpose: Creates a fresh copy of the work file in
QTEMPif it doesn’t exist, tailored to the specified file group. -
Program Termination:
- Step: Ends the program with
ENDPGMat thePGMENDlabel. -
Purpose: Returns control to the calling program (
BB955). -
Commented-Out Testing Section:
- Step: A commented-out section references clearing
BB955WinDRCLIBand jumping toPGMEND. - Purpose: Likely used for testing in a different environment (
DRCLIB) but is inactive in the production version.
Business Rules¶
The business rules for BB955AC are straightforward and focus on work file management:
- Work File Initialization: The BB955W file in QTEMP must be cleared or created before use in BB955 to ensure a clean slate for staging rack price data.
- File Group Selection:
- If &P$FGRP = 'G', the work file is sourced from the DATA library, typically for production data.
- If &P$FGRP ≠ 'G' (assumed to be Z), the work file is sourced from the DATADEV library, likely for development or test data.
- Error Handling: The program handles cases where the work file does not exist by creating it and ignores errors related to constraints or existing objects to ensure robust execution.
- Temporary Storage: The use of QTEMP ensures the work file is session-specific and automatically deleted when the job ends, maintaining data isolation.
- Revision Update (JK01): Replaces ARGDEV with DATA and ARGDEVTEST with DATADEV (as of 08/27/2021), aligning library names with current standards.
Tables Used¶
The program interacts with the following file:
1. BB955W: A physical file used as a temporary work file in the QTEMP library. It is either cleared (CLRPFM) or created (CRTDUPOBJ) from the DATA or DATADEV library, depending on &P$FGRP. This file is used by BB955 to stage rack price data before updating bbprce.
External Programs Called¶
No external programs are explicitly called in BB955AC. The program uses only CL commands:
- CLRPFM: Clears the BB955W file.
- CRTDUPOBJ: Creates a duplicate of the BB955W file in QTEMP.
- MONMSG: Monitors for specific error messages.
- IF/DO/ENDDO: Conditional logic for file group handling.
Integration with BB955, GB730P, and OCL¶
- Context in
BB955: BB955ACis called fromBB955(part 1,sf1f07subroutine) to clear or recreate theBB955Wwork file after updates are applied tobbprce. The parameterp$fgrpfromBB955maps to&P$FGRPinBB955AC, determining the source library (DATAorDATADEV).- The work file is used by
BB955to stage changes (e.g., insf1upd,updadlloc,addadlloc) before committing them tobbprce. - Context in OCL:
- The OCL program (
BB955.ocl36.txt) initiatesBB955, passing the'?9?'parameter, which likely influences the file group (p$fgrpinBB955, passed toBB955ACas&P$FGRP). - The OCL checks for the
27X132display condition, ensuringBB955(and thusBB955AC) only runs in a compatible environment. - Context in
GB730P: BB955ACdoes not directly interact withGB730P, butBB955Wmay be used to stage data thatGB730Pqueries historically viabbprcehxwhen called for history inquiries (F9 inBB955).- Process Flow:
- The OCL calls
BB955, which processes rack price data usingBB955W. BB955callsBB955ACto clear or createBB955WinQTEMP, ensuring a clean work file for each session.- After updates,
BB955logs changes tobbprceh(viawritehist), andGB730Pcan display these historical changes when invoked.
Additional Notes¶
- Purpose Clarification: Despite the comment in the CLP stating "CUSTOMER ORDER AND INVOICE INQUIRY," the program’s actual purpose aligns with rack price file maintenance, as it supports
BB955. The comment may be a documentation error or a remnant from a copied template. - Revision (
JK01): The update on 08/27/2021 standardizes library names (DATAfor production,DATADEVfor development), replacingARGDEVandARGDEVTEST. - Testing Section: The commented-out code suggests a previous testing setup in
DRCLIB, which is not active in the current version. - Truncation: The provided code is complete for
BB955AC, so no additional subroutines are missing. However, the full behavior ofBB955Wdepends onBB955’s logic, which is partially truncated in the providedBB955.rpglefiles.
Summary¶
- Process Steps:
- Receive
&P$FGRPparameter. - Attempt to clear
BB955WinQTEMP. - If not found, create
BB955WfromDATA(ifG) orDATADEV(if notG) with constraints and triggers disabled. - End the program.
- Business Rules: Clear or create
BB955WinQTEMPbased on the file group, handle errors robustly, and ensure session-specific data isolation. - Tables Used:
BB955W(work file inQTEMP, sourced fromDATAorDATADEV). - External Programs Called: None; uses only CL commands.
If you have additional code (e.g., missing BB955 subroutines like bldwrkf or writehist) or need further analysis of how BB955W is populated, please share them. I can also use DeepSearch to gather context on AS/400 CLP conventions or similar work file management programs if needed. Let me know how to proceed!