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 (G
orZ
). -
Purpose: The parameter determines whether the work file is created from the
DATA
library (forG
) orDATADEV
library (forZ
), reflecting different environments (e.g., production vs. development). -
Clear Work File (
CLRPFM
): - Step: Executes the
CLRPFM
command to clear the physical fileBB955W
in theQTEMP
library. - 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 theDO
block 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
CRTDUPOBJ
to create a duplicate of theBB955W
file from theDATA
library 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
CRTDUPOBJ
to create a duplicate ofBB955W
from theDATADEV
library 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
QTEMP
if it doesn’t exist, tailored to the specified file group. -
Program Termination:
- Step: Ends the program with
ENDPGM
at thePGMEND
label. -
Purpose: Returns control to the calling program (
BB955
). -
Commented-Out Testing Section:
- Step: A commented-out section references clearing
BB955W
inDRCLIB
and 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
: BB955AC
is called fromBB955
(part 1,sf1f07
subroutine) to clear or recreate theBB955W
work file after updates are applied tobbprce
. The parameterp$fgrp
fromBB955
maps to&P$FGRP
inBB955AC
, determining the source library (DATA
orDATADEV
).- The work file is used by
BB955
to 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$fgrp
inBB955
, passed toBB955AC
as&P$FGRP
). - The OCL checks for the
27X132
display condition, ensuringBB955
(and thusBB955AC
) only runs in a compatible environment. - Context in
GB730P
: BB955AC
does not directly interact withGB730P
, butBB955W
may be used to stage data thatGB730P
queries historically viabbprcehx
when called for history inquiries (F9 inBB955
).- Process Flow:
- The OCL calls
BB955
, which processes rack price data usingBB955W
. BB955
callsBB955AC
to clear or createBB955W
inQTEMP
, ensuring a clean work file for each session.- After updates,
BB955
logs changes tobbprceh
(viawritehist
), andGB730P
can 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 (DATA
for production,DATADEV
for development), replacingARGDEV
andARGDEVTEST
. - 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 ofBB955W
depends onBB955
’s logic, which is partially truncated in the providedBB955.rpgle
files.
Summary¶
- Process Steps:
- Receive
&P$FGRP
parameter. - Attempt to clear
BB955W
inQTEMP
. - If not found, create
BB955W
fromDATA
(ifG
) orDATADEV
(if notG
) with constraints and triggers disabled. - End the program.
- Business Rules: Clear or create
BB955W
inQTEMP
based on the file group, handle errors robustly, and ensure session-specific data isolation. - Tables Used:
BB955W
(work file inQTEMP
, sourced fromDATA
orDATADEV
). - 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!