Skip to content

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:

  1. Receive Input Parameter:
  2. 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).

  3. Clear Physical File (CLRPFM):

  4. Attempts to clear the BB945W file in the QTEMP library using the CLRPFM command.
  5. This step removes all records from the existing QTEMP/BB945W file to prepare it for new data.

  6. Handle File Not Found (MONMSG):

  7. Monitors for message ID CPF3142 (file not found).
  8. If BB945W does not exist in QTEMP, executes a DO block to create it.

  9. Create Duplicate Object (CRTDUPOBJ):

  10. Based on the value of &P$FGRP:
    • If &P$FGRP = 'G':
    • Creates a duplicate of the BB945W file from the DATA library (production) into QTEMP using CRTDUPOBJ.
    • Specifies CST(*NO) (no constraints) and TRG(*NO) (no triggers) to simplify the copy.
    • If &P$FGRP ≠ 'G':
    • Creates a duplicate of the BB945W file from the DATADEV library (development/test) into QTEMP with the same options.
  11. Monitors for messages CPF5813 (object already exists) and CPF7302 (object not created) to handle potential errors gracefully.

  12. Program End:

  13. 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.

  1. File Source Selection:
  2. 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).
  3. Error Handling:

  4. If BB945W already exists in QTEMP, it is cleared to ensure a fresh start.
  5. If BB945W does not exist, it is created by copying from the appropriate library (DATA or DATADEV).
  6. Error messages (CPF5813, CPF7302) during file creation are monitored and ignored to prevent program failure.

  7. Revision (JK01, 08/27/2021):

  8. Replaced library ARGDEV with DATA and ARGDEVTEST with DATADEV 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.