Skip to content

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:

  1. Program Declaration and Parameter:
  2. Step: Declares the program with a single parameter &P$FGRP, a 1-character variable that specifies the file group (G or Z).
  3. Purpose: The parameter determines whether the work file is created from the DATA library (for G) or DATADEV library (for Z), reflecting different environments (e.g., production vs. development).

  4. Clear Work File (CLRPFM):

  5. Step: Executes the CLRPFM command to clear the physical file BB955W in the QTEMP library.
  6. Purpose: Ensures the work file is empty before processing, preventing residual data from affecting BB955’s operations.
  7. Error Handling: Monitors for message CPF3142 (file not found) using MONMSG. If the file does not exist, proceeds to the DO block to create it.

  8. Create Work File (CRTDUPOBJ):

  9. 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 the BB955W file from the DATA library into QTEMP, with constraints (CST(*NO)) and triggers (TRG(*NO)) disabled.
    • Monitors for messages CPF5813 (constraint error) and CPF7302 (object already exists) to handle potential errors gracefully.
    • If &P$FGRP ≠ 'G':
    • Executes CRTDUPOBJ to create a duplicate of BB955W from the DATADEV library into QTEMP, with the same constraints and trigger settings.
    • Monitors for the same error messages.
  10. Purpose: Creates a fresh copy of the work file in QTEMP if it doesn’t exist, tailored to the specified file group.

  11. Program Termination:

  12. Step: Ends the program with ENDPGM at the PGMEND label.
  13. Purpose: Returns control to the calling program (BB955).

  14. Commented-Out Testing Section:

  15. Step: A commented-out section references clearing BB955W in DRCLIB and jumping to PGMEND.
  16. 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 from BB955 (part 1, sf1f07 subroutine) to clear or recreate the BB955W work file after updates are applied to bbprce. The parameter p$fgrp from BB955 maps to &P$FGRP in BB955AC, determining the source library (DATA or DATADEV).
  • The work file is used by BB955 to stage changes (e.g., in sf1upd, updadlloc, addadlloc) before committing them to bbprce.
  • Context in OCL:
  • The OCL program (BB955.ocl36.txt) initiates BB955, passing the '?9?' parameter, which likely influences the file group (p$fgrp in BB955, passed to BB955AC as &P$FGRP).
  • The OCL checks for the 27X132 display condition, ensuring BB955 (and thus BB955AC) only runs in a compatible environment.
  • Context in GB730P:
  • BB955AC does not directly interact with GB730P, but BB955W may be used to stage data that GB730P queries historically via bbprcehx when called for history inquiries (F9 in BB955).
  • Process Flow:
  • The OCL calls BB955, which processes rack price data using BB955W.
  • BB955 calls BB955AC to clear or create BB955W in QTEMP, ensuring a clean work file for each session.
  • After updates, BB955 logs changes to bbprceh (via writehist), and GB730P 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), replacing ARGDEV and ARGDEVTEST.
  • 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 of BB955W depends on BB955’s logic, which is partially truncated in the provided BB955.rpgle files.

Summary

  • Process Steps:
  • Receive &P$FGRP parameter.
  • Attempt to clear BB955W in QTEMP.
  • If not found, create BB955W from DATA (if G) or DATADEV (if not G) with constraints and triggers disabled.
  • End the program.
  • Business Rules: Clear or create BB955W in QTEMP based on the file group, handle errors robustly, and ensure session-specific data isolation.
  • Tables Used: BB955W (work file in QTEMP, sourced from DATA or DATADEV).
  • 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!