Skip to content

BB6001 CLP

The BB6001.clp.txt CLP (Control Language Program) is called by the main OCL program (likely BB600.ocl36.txt) within the invoice posting workflow on an IBM System/36 or AS/400 environment. Its primary function is to manage the copying and cleanup of invoice-related print output for distribution, specifically by copying spool files to an output queue and deleting the temporary output queue. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.


Process Steps of the BB6001 CLP Program

The BB6001 CLP program processes print output for invoices by copying spool files to a designated output queue and cleaning up temporary resources. It takes two parameters: a batch number (P$BAT) and a file group prefix (P$FGRP). The steps are as follows:

  1. Program Initialization:
  2. The program declares three variables:
    • P$BAT: A 2-character parameter for the batch number (e.g., ?20? from the OCL).
    • P$FGRP: A 1-character parameter for the file group prefix (e.g., ?9? from the OCL, often indicating the library or environment).
    • FILE: A 10-character variable to construct the temporary output queue name.
    • OUTQ: A 10-character variable to construct the target output queue name.
    • QDTAQ: A 1024-character variable (unused in the provided code, possibly reserved for future use or data queue operations).
  3. The program constructs:

    • FILE as &P$FGRP + 'INV' + &P$BAT + 'OUTQ' (e.g., if P$FGRP = 'G' and P$BAT = '01', then FILE = 'GINV01OUTQ').
    • OUTQ as &P$FGRP + 'INVOUTQ' (e.g., if P$FGRP = 'G', then OUTQ = 'GINVOUTQ').
  4. Copy Spool Files:

  5. The SFACOPY command copies spool files:
    • OUTQ(&FILE): Specifies the source output queue (QUSRSYS/&FILE, e.g., QUSRSYS/GINV01OUTQ).
    • PRTFNM(LISTINV): Targets spool files named LISTINV (likely generated by the BB600 RPG program for the Invoice Register).
    • CMBSEL(*NO): Does not combine spool files.
    • MVTOOUTQ(*SAME): Moves the spool files to the same output queue as the source (no change in location).
    • OUTTYP(*PRTF): Processes only printer files.
    • TOOUTQ(&OUTQ): Copies the spool files to the target output queue (e.g., GINVOUTQ).
  6. This step ensures that invoice-related print output is copied to a permanent output queue for further processing or distribution (e.g., by Spoolflex).

  7. Clear Temporary Output Queue:

  8. The CLROUTQ OUTQ(QUSRSYS/&FILE) command clears all spool files from the temporary output queue (QUSRSYS/&FILE).
  9. Monitored messages (MONMSG) handle potential errors:
    • CPF2105: Object not found.
    • CPF3357: Output queue not found.
    • CPF2207: Not authorized to object.
    • CPF2189: Output queue already cleared or not found.
  10. This step removes any remaining spool files in the temporary queue.

  11. Delete Temporary Output Queue:

  12. The DLTOUTQ OUTQ(QUSRSYS/&FILE) command deletes the temporary output queue (QUSRSYS/&FILE).
  13. The same error messages (CPF2105, CPF3357, CPF2207, CPF2189) are monitored to handle cases where the queue does not exist or cannot be deleted.
  14. This step cleans up the temporary output queue to free system resources.

  15. Program Termination:

  16. The program ends after copying spool files and cleaning up the temporary output queue.

Business Rules

  1. Dynamic Output Queue Naming:
  2. The program constructs the source (&FILE) and target (&OUTQ) output queue names dynamically using the P$FGRP (file group prefix) and P$BAT (batch number) parameters.
  3. This allows the program to handle batch-specific and environment-specific output queues (e.g., GINV01OUTQ for batch 01 in environment G).

  4. Spool File Management:

  5. Only spool files named LISTINV (Invoice Register output, likely from BB600) are copied to the target output queue (&OUTQ, e.g., GINVOUTQ).
  6. The CMBSEL(*NO) parameter ensures that spool files are copied individually, preserving their integrity for distribution.

  7. Integration with Spoolflex:

  8. The copied spool files in &OUTQ are likely processed by Spoolflex (a system for splitting, copying, and distributing output), as indicated by the broader context in BB600.ocl36.txt.
  9. The program supports the invoice posting workflow by preparing invoice print output for external distribution.

  10. Resource Cleanup:

  11. The temporary output queue (QUSRSYS/&FILE) is cleared and deleted after copying to prevent accumulation of unused spool files and queues.
  12. Error monitoring ensures robust execution even if the queue does not exist or is inaccessible.

  13. Error Handling:

  14. The program monitors for common errors (CPF2105, CPF3357, CPF2207, CPF2189) during queue clearing and deletion, ensuring that failures do not halt execution.

  15. No Data Modification:

  16. The program does not modify spool file content; it only manages their movement and cleanup.

Tables (Files) Used

The BB6001 CLP program does not directly interact with traditional database files (tables) but works with output queues, which are system objects used to manage spool files. The relevant objects are:

  1. &FILE (e.g., QUSRSYS/GINV01OUTQ):
  2. Description: Temporary output queue constructed from P$FGRP + 'INV' + P$BAT + 'OUTQ'.
  3. Purpose: Holds spool files named LISTINV generated by the Invoice Register (likely from BB600).
  4. Usage: Source for copying spool files; cleared and deleted after processing.

  5. &OUTQ (e.g., GINVOUTQ):

  6. Description: Target output queue constructed from P$FGRP + 'INVOUTQ'.
  7. Purpose: Receives copied LISTINV spool files for further processing or distribution (e.g., by Spoolflex).
  8. Usage: Destination for spool file copies.

External Programs Called

The BB6001 CLP program does not explicitly call any external programs. It relies on system commands (SFACOPY, CLROUTQ, DLTOUTQ) to perform its tasks.


Summary

The BB6001 CLP program, called by BB600.ocl36.txt, manages invoice-related print output by: - Constructing dynamic source (&FILE, e.g., QUSRSYS/GINV01OUTQ) and target (&OUTQ, e.g., GINVOUTQ) output queue names using batch (P$BAT) and file group (P$FGRP) parameters. - Copying LISTINV spool files from the temporary output queue to the target output queue using SFACOPY. - Clearing the temporary output queue with CLROUTQ. - Deleting the temporary output queue with DLTOUTQ. - Monitoring errors to ensure robust execution. - Terminating after cleanup.

Tables Used: None (operates on output queues &FILE and &OUTQ, not database files). External Programs Called: None.

This program supports the invoice posting workflow by preparing invoice print output for distribution (e.g., via Spoolflex) and cleaning up temporary resources, ensuring efficient system operation.