FR710C CLP
The CL program FR710C is a control language program that serves as a coordinator in the Freight Out Accrual Report process. It is called by FR710PC and is responsible for creating and managing a work file (FR710W), invoking a program (FR710A) to build the work file with report data, and then calling another program (FR710B) to print the report. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the FR710C Program¶
- Program Declaration and Parameter Definition:
- Purpose: Declares the program and its input parameters.
-
Steps:
- The program is defined with three input parameters:
&P$CO: A 2-character field for the company number.&P$RDAT: An 8-character field for the report date (inCCYYMMDDformat).&P$FGRP: A 1-character field for the file group ('G' or 'Z').
-
Create and Prepare Work File (
FR710W): - Purpose: Ensures the work file
FR710Wexists in theQTEMPlibrary and is ready for use. -
Steps:
- Check for Work File Existence:
- Uses
CHKOBJto check if theFR710Wfile exists in theQTEMPlibrary. - If the file does not exist (
CPF9801message ID), executes aDOblock to create it. - Create Work File:
- If
&P$FGRPis 'G', creates a duplicate of theFR710Wfile from theDATAlibrary intoQTEMPusingCRTDUPOBJwith constraints (CST(*NO)) and triggers (TRG(*NO)) disabled. - If
&P$FGRPis 'Z', creates a duplicate of theFR710Wfile from theDATADEVlibrary intoQTEMPwith the same settings. - Clear Work File:
- Clears the contents of the
FR710Wfile inQTEMPusingCLRPFMto ensure it is empty before new data is added. - Override Work File:
- Applies a database file override using
OVRDBFto ensure that references toFR710Wpoint to theQTEMP/FR710Wfile, making it specific to the job and user (multi-user capable, as per revisionJB01).
-
Build Work File:
- Purpose: Populates the
FR710Wwork file with data for the report. -
Steps:
- Calls the
FR710Aprogram, passing the parameters&P$CO,&P$RDAT, and&P$FGRP. - The
FR710Aprogram is responsible for retrieving and processing data based on the company number, report date, and file group, and writing it to theFR710Wfile.
- Calls the
-
Call Print Program:
- Purpose: Generates the Freight Out Accrual Report using the data in the work file.
-
Steps:
- Calls the
FR710Bprogram, passing the same parameters (&P$CO,&P$RDAT,&P$FGRP). - The
FR710Bprogram uses the data inFR710Wto produce the final report output.
- Calls the
-
Program Termination:
- Purpose: Ends the program cleanly.
- Steps:
- The
ENDPGMcommand terminates the program, returning control to the calling program (FR710PC).
- The
Business Rules¶
- Work File Management:
- The
FR710Wfile is created inQTEMP, a job-specific temporary library, to ensure multi-user capability (revisionJB01). This prevents conflicts when multiple users run the report simultaneously. - The source library for
FR710Wdepends on the&P$FGRPparameter:DATAfor 'G' andDATADEVfor 'Z' (revisionjK01), allowing the program to work with different data environments (e.g., production vs. development). - The work file is cleared before use to ensure no residual data affects the report.
- File Overrides:
- The
OVRDBFcommand ensures thatFR710Wreferences the job-specific copy inQTEMP, reinforcing multi-user support (revisionjK01). - Parameter Dependency:
- The program relies on the calling program (
FR710PC) to provide valid parameters (&P$CO,&P$RDAT,&P$FGRP), with no additional validation performed. - Data Processing:
- The
FR710Aprogram is responsible for data retrieval and processing, whileFR710Bhandles report formatting and output.FR710Cacts as a coordinator, ensuring the work file is properly set up before these steps. - Error Handling:
- The program handles the case where
FR710Wdoes not exist inQTEMPby creating it. However, it does not include explicit error handling for failures inFR710AorFR710B.
Tables Used¶
- FR710W: A work file created in the
QTEMPlibrary, used to store temporary data for the Freight Out Accrual Report. It is copied from either theDATAorDATADEVlibrary based on the&P$FGRPparameter ('G' or 'Z'). - The file is cleared (
CLRPFM) and overridden (OVRDBF) to ensure it is job-specific and empty before use. - No Direct Access to Other Tables: The
FR710Cprogram itself does not directly access other database files (e.g.,glcont,gglcont, orzglcont). Any such access is handled byFR710AorFR710B.
External Programs Called¶
- FR710A: Called to build the
FR710Wwork file by retrieving and processing data based on the company number, report date, and file group. - FR710B: Called to generate and print the Freight Out Accrual Report using the data in the
FR710Wfile. - CHKOBJ, CRTDUPOBJ, CLRPFM, OVRDBF (System Commands): These are system commands used to manage the
FR710Wfile: CHKOBJ: Checks ifFR710Wexists inQTEMP.CRTDUPOBJ: Creates a copy ofFR710WinQTEMPfrom the appropriate source library.CLRPFM: Clears the contents ofFR710W.OVRDBF: Overrides references toFR710Wto point toQTEMP/FR710W.
Additional Notes¶
- Revisions:
- JB01 (10/8/2011): Added multi-user capability by creating the work file in
QTEMP, ensuring each job has its own copy ofFR710W. - JB02 (6/6/2012): Updated the work file creation to copy from
ARGDEVorARGDEVTEST(later revised toDATAandDATADEV). - jK01 (8/30/2021): Replaced
ARGDEVwithDATAandARGDEVTESTwithDATADEV, and explicitly overrodeFR710WtoQTEMP/FR710Wto reinforce job-specific file usage. - Minimal Error Handling: The program handles the absence of
FR710Wbut does not include comprehensive error checking for the calls toFR710AorFR710B. - Role as Coordinator:
FR710Cis a lightweight program that orchestrates the report generation process by managing the work file and delegating data processing and printing toFR710AandFR710B, respectively.
This program ensures that the temporary work file is properly set up and that the report generation process is executed in the correct sequence, supporting multi-user environments and different data sources based on the file group.