FR711C CLP
The CLP program FR711C is a control program called by FR711PC to build a work file and generate the Freight Out Reconciliation Report sorted by location. It orchestrates the creation of a temporary work file, populates it with data, and then calls a print program to produce the report. Below is an explanation of the process steps, business rules, tables used, and external programs called, based on the provided source code.
Process Steps of the CLP Program (FR711C)¶
The program receives parameters from FR711PC, creates or clears a temporary work file, builds data in the work file, and calls a print program to generate the report. Here are the detailed steps:
- Program Declaration and Parameter Receipt:
- Purpose: Defines the program and its input parameters.
-
Actions:
- Declares the program with seven input parameters:
&P$CO: Company code (2 characters).&P$RDAT: Report date (8 characters).&P$LOC: Location code (3 characters).&P$CAID: Carrier ID (6 characters).&P$SORT: Sort option (1 character, expected to be 'L' for location since this program is called when sorting by location).&P$SELMO: Month selection (1 character, added in revisionjb03).&P$FGRP: File group (1 character, 'G' or 'Z').
-
Create Work File (
JB01andJK01Revisions): - Purpose: Ensures the existence of a temporary work file (
FR711W) in theQTEMPlibrary for multi-user capability. -
Actions:
- Checks if
FR711Wexists inQTEMPusingCHKOBJ. - If the file does not exist (
CPF9801message), creates a duplicate ofFR711WusingCRTDUPOBJ: - If
&P$FGRP = 'G', copiesFR711Wfrom theDATAlibrary (revised fromARGDEVinJK01). - If
&P$FGRP = 'Z', copiesFR711Wfrom theDATADEVlibrary (revised fromARGDEVTESTinJK01). - The duplicate is created in
QTEMPwith constraints (CST(*NO)) and triggers (TRG(*NO)) disabled. - Clears the
FR711Wfile inQTEMPusingCLRPFMto ensure it is empty (revised inJK01to explicitly referenceQTEMP/FR711W). - Overrides the
FR711Wfile to point toQTEMP/FR711WusingOVRDBFfor subsequent operations (revised inJK01).
- Checks if
-
Build Work File:
- Purpose: Populates the temporary work file with data for the report.
-
Actions:
- Calls the program
FR711A, passing six parameters:&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SELMO, and&P$FGRP. FR711Ais responsible for querying the necessary data (likely fromgglcont/ginlocorzglcont/zinlocbased on&P$FGRP) and writing it toFR711W.
- Calls the program
-
Call Print Program:
- Purpose: Generates the Freight Out Reconciliation Report using the data in the work file.
-
Actions:
- Calls the program
FR711B, passing all seven parameters:&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SORT,&P$SELMO, and&P$FGRP. FR711Buses the data inFR711Wto produce the report, sorted by location (as&P$SORT = 'L').
- Calls the program
-
Program Termination:
- Purpose: Ends the program after processing.
- Actions:
- The program ends with
ENDPGMafter callingFR711AandFR711B.
- The program ends with
Business Rules¶
- Work File Management:
- The temporary work file
FR711Wis created inQTEMPto ensure multi-user capability (revisionJB01). UsingQTEMPprovides a unique, job-specific file instance, preventing conflicts between concurrent users. - The file is copied from either
DATA(for&P$FGRP = 'G') orDATADEV(for&P$FGRP = 'Z'), as updated in revisionJK01, ensuring the correct file structure is used based on the file group. - The file is cleared (
CLRPFM) before use to ensure no residual data affects the report. -
The
OVRDBFcommand ensures that all references toFR711WinFR711AandFR711Bpoint to theQTEMPcopy. -
Month Selection (from revision
jb03): - The
&P$SELMOparameter supports the following values, as defined inFR711P:M: Selected month only, including all (open and closed) records.O: Selected month, open records only.C: Selected month, closed records only.A: All open records from previous and selected months.- Blank: Previous month open records and selected month all records.
-
This parameter is passed to
FR711AandFR711Bto filter the data included in the work file and report. -
File Group:
-
The
&P$FGRPparameter ('G' or 'Z') determines the source library for the work file and likely influences the data files used byFR711A(e.g.,gglcont/ginlocfor 'G',zglcont/zinlocfor 'Z'). -
Sort Option:
-
The program assumes
&P$SORT = 'L'(sort by location), as it is called byFR711PConly when this condition is met. The&P$SORTparameter is passed toFR711Bto ensure the report is sorted appropriately. -
Error Handling:
-
The program handles the case where
FR711Wdoes not exist inQTEMPby creating it. Other errors (e.g., file access issues) are not explicitly handled in this program and are likely managed byFR711AorFR711B. -
Revision History:
JB01(10/08/2011): Made the work file multi-user capable by creating it inQTEMP.JB02(06/06/2012): Revised the source libraries for the work file toARGDEVorARGDEVTEST.jb03(04/07/15): Added the&P$SELMOparameter for month selection filtering.JK01(07/22/21): Updated library references toDATAandDATADEV, and explicitly overrodeFR711WtoQTEMP/FR711W.
Tables Used¶
- Work File:
FR711W: A temporary physical file in theQTEMPlibrary, used to store data for the report. It is created by copying from:DATA/FR711Wif&P$FGRP = 'G'.DATADEV/FR711Wif&P$FGRP = 'Z'.
-
The file is cleared before use and overridden to ensure
FR711AandFR711Baccess theQTEMPcopy. -
No Direct Data File Access:
FR711Cdoes not directly access data files likegglcont,ginloc,zglcont, orzinloc. These are likely accessed byFR711Ato populateFR711W, as set up by the overrides inFR711P.
External Programs Called¶
- FR711A: Called to build the work file
FR711Wby querying data based on the provided parameters (&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SELMO,&P$FGRP). - FR711B: Called to generate the Freight Out Reconciliation Report from the data in
FR711W, using all seven parameters. - System Commands:
CHKOBJ: Checks for the existence ofFR711WinQTEMP.CRTDUPOBJ: Creates a duplicate ofFR711WinQTEMPif it does not exist.CLRPFM: Clears theFR711Wfile inQTEMP.OVRDBF: Overrides theFR711Wfile to point toQTEMP/FR711W.
Additional Notes¶
- Purpose:
FR711Cacts as a coordinator, managing the creation and population of a temporary work file and invoking the print program to produce the report sorted by location. - Multi-User Support: The use of
QTEMP(revisionJB01) ensures that each job has its own instance ofFR711W, preventing conflicts in a multi-user environment. - Parameter Validation: The program assumes that input parameters are valid, as they are validated by
FR711Pbefore being passed throughFR711PC. - Execution Context: The program runs in the same job session as its caller, using direct calls to
FR711AandFR711Brather than submitting them as batch jobs. - Temporary File Management: The work file is created and cleared for each run, ensuring fresh data and avoiding residual data issues.
This program efficiently sets up the environment for report generation by managing the temporary work file and delegating data processing and printing to specialized programs (FR711A and FR711B).