BB945C CLP
The CLP (Control Language Program) BB945C.clp
is part of the Bradford Order Entry/Invoices system and is designed to prepare a temporary work file (BB945W
) for customer freight maintenance by clearing or creating it in the QTEMP
library. It is called by another program (likely BB945.rpgle
) to ensure a clean work file before processing. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of BB945C.clp
¶
The program executes a straightforward sequence of commands to manage the BB945W
file in the QTEMP
library. The steps are:
- Receive Input Parameter:
-
The program accepts a single parameter,
&P$FGRP
, a 1-character value indicating the file group ('G' for production or another value for development/test). -
Clear Physical File (
CLRPFM
): - Attempts to clear the
BB945W
file in theQTEMP
library using theCLRPFM
command. -
This step removes all records from the existing
QTEMP/BB945W
file to prepare it for new data. -
Handle File Not Found (
MONMSG
): - Monitors for message ID
CPF3142
(file not found). -
If
BB945W
does not exist inQTEMP
, executes aDO
block to create it. -
Create Duplicate Object (
CRTDUPOBJ
): - Based on the value of
&P$FGRP
:- If
&P$FGRP = 'G'
: - Creates a duplicate of the
BB945W
file from theDATA
library (production) intoQTEMP
usingCRTDUPOBJ
. - Specifies
CST(*NO)
(no constraints) andTRG(*NO)
(no triggers) to simplify the copy. - If
&P$FGRP ≠ 'G'
: - Creates a duplicate of the
BB945W
file from theDATADEV
library (development/test) intoQTEMP
with the same options.
- If
-
Monitors for messages
CPF5813
(object already exists) andCPF7302
(object not created) to handle potential errors gracefully. -
Program End:
- Ends the program with
ENDPGM
, returning control to the calling program.
Business Rules¶
The program enforces the following business rules to ensure proper creation and initialization of the work file:
1. Temporary File Usage:
- The BB945W
file is created or cleared in the QTEMP
library, which is job-specific and automatically cleared when the job ends, ensuring data isolation.
- File Source Selection:
-
The source library for
BB945W
is determined by&P$FGRP
:- 'G': Uses the production library (
DATA
, per JK01 revision). - Other values: Uses the development/test library (
DATADEV
, per JK01 revision).
- 'G': Uses the production library (
-
Error Handling:
- If
BB945W
already exists inQTEMP
, it is cleared to ensure a fresh start. - If
BB945W
does not exist, it is created by copying from the appropriate library (DATA
orDATADEV
). -
Error messages (
CPF5813
,CPF7302
) during file creation are monitored and ignored to prevent program failure. -
Revision (JK01, 08/27/2021):
- Replaced library
ARGDEV
withDATA
andARGDEVTEST
withDATADEV
to align with updated library naming conventions.
Tables (Files) Used¶
The program interacts with the following file:
1. BB945W: Customer freight maintenance work file (physical file, cleared or created in QTEMP
).
- Source libraries:
- DATA
(production, for &P$FGRP = 'G'
).
- DATADEV
(development/test, for &P$FGRP ≠ 'G'
).
External Programs Called¶
The program does not explicitly call external programs but uses the following CL commands:
1. CLRPFM: Clears the BB945W
file in QTEMP
.
2. CRTDUPOBJ: Creates a duplicate of the BB945W
file in QTEMP
from DATA
or DATADEV
.
Summary¶
The BB945C.clp
program, called by another program (likely BB945.rpgle
), prepares the BB945W
work file in the QTEMP
library for customer freight maintenance. It clears the file if it exists or creates it by copying from the DATA
(production) or DATADEV
(development/test) library based on the &P$FGRP
parameter. The program ensures a clean work file for subsequent processing, with error handling to manage file creation issues. The revision (JK01, 08/27/2021) updated library names to DATA
and DATADEV
. The program is lightweight, using only CL commands and no external program calls beyond built-in system commands.