FR712C CLP
The CLP program FR712C is a control program called by FR711PC to build a work file and generate the Freight Out Reconciliation Report sorted by carrier/routing. It is structurally similar to FR711C but focuses on producing a report sorted by carrier rather than location. 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 (FR712C)¶
The program receives parameters from FR711PC, creates or clears a temporary work file, populates it with data, 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 'C' for carrier/routing since this program is called when sorting by carrier).&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 (
FR712W) in theQTEMPlibrary for multi-user capability. -
Actions:
- Checks if
FR712Wexists inQTEMPusingCHKOBJ. - If the file does not exist (
CPF9801message), creates a duplicate ofFR712WusingCRTDUPOBJ: - If
&P$FGRP = 'G', copiesFR712Wfrom theDATAlibrary (revised fromARGDEVinJK01). - If
&P$FGRP = 'Z', copiesFR712Wfrom theDATADEVlibrary (revised fromARGDEVTESTinJK01). - The duplicate is created in
QTEMPwith constraints (CST(*NO)) and triggers (TRG(*NO)) disabled. - Clears the
FR712Wfile inQTEMPusingCLRPFMto ensure it is empty (revised inJK01to explicitly referenceQTEMP/FR712W). - Overrides the
FR712Wfile to point toQTEMP/FR712WusingOVRDBFfor subsequent operations (revised inJK01).
- Checks if
-
Build Work File:
- Purpose: Populates the temporary work file with data for the report.
-
Actions:
- Calls the program
FR712A, passing six parameters:&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SELMO, and&P$FGRP. FR712Ais responsible for querying the necessary data (likely fromgglcont/ginlocorzglcont/zinlocbased on&P$FGRP) and writing it toFR712W, with data organized for sorting by carrier.
- Calls the program
-
Call Print Program:
- Purpose: Generates the Freight Out Reconciliation Report using the data in the work file.
-
Actions:
- Calls the program
FR712B, passing all seven parameters:&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SORT,&P$SELMO, and&P$FGRP. FR712Buses the data inFR712Wto produce the report, sorted by carrier/routing (as&P$SORT = 'C').
- Calls the program
-
Program Termination:
- Purpose: Ends the program after processing.
- Actions:
- The program ends with
ENDPGMafter callingFR712AandFR712B.
- The program ends with
Business Rules¶
- Work File Management:
- The temporary work file
FR712Wis 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 toFR712WinFR712AandFR712Bpoint 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
FR712AandFR712Bto 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 byFR712A(e.g.,gglcont/ginlocfor 'G',zglcont/zinlocfor 'Z'). -
Sort Option:
-
The program assumes
&P$SORT = 'C'(sort by carrier/routing), as it is called byFR711PConly when this condition is met. The&P$SORTparameter is passed toFR712Bto ensure the report is sorted appropriately. -
Error Handling:
-
The program handles the case where
FR712Wdoes not exist inQTEMPby creating it. Other errors (e.g., file access issues) are not explicitly handled in this program and are likely managed byFR712AorFR712B. -
Revision History:
JB01(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(08/30/21): Updated library references toDATAandDATADEV, and explicitly overrodeFR712WtoQTEMP/FR712W.
Tables Used¶
- Work File:
FR712W: A temporary physical file in theQTEMPlibrary, used to store data for the report. It is created by copying from:DATA/FR712Wif&P$FGRP = 'G'.DATADEV/FR712Wif&P$FGRP = 'Z'.
-
The file is cleared before use and overridden to ensure
FR712AandFR712Baccess theQTEMPcopy. -
No Direct Data File Access:
FR712Cdoes not directly access data files likegglcont,ginloc,zglcont, orzinloc. These are likely accessed byFR712Ato populateFR712W, as set up by the overrides inFR711P.
External Programs Called¶
- FR712A: Called to build the work file
FR712Wby querying data based on the provided parameters (&P$CO,&P$RDAT,&P$LOC,&P$CAID,&P$SELMO,&P$FGRP). - FR712B: Called to generate the Freight Out Reconciliation Report from the data in
FR712W, using all seven parameters. - System Commands:
CHKOBJ: Checks for the existence ofFR712WinQTEMP.CRTDUPOBJ: Creates a duplicate ofFR712WinQTEMPif it does not exist.CLRPFM: Clears theFR712Wfile inQTEMP.OVRDBF: Overrides theFR712Wfile to point toQTEMP/FR712W.
Additional Notes¶
- Purpose:
FR712Cacts as a coordinator, managing the creation and population of a temporary work file and invoking the print program to produce the report sorted by carrier/routing. - Multi-User Support: The use of
QTEMP(revisionJB01) ensures that each job has its own instance ofFR712W, 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
FR712AandFR712Brather than submitting them as batch jobs. - Comparison with
FR711C:FR712Cis nearly identical toFR711Cin structure, differing only in the work file (FR712Wvs.FR711W), the called programs (FR712A/FR712Bvs.FR711A/FR711B), and the sort order (carrier vs. location).
This program efficiently sets up the environment for generating the Freight Out Reconciliation Report sorted by carrier, leveraging a temporary work file and specialized programs for data processing and printing.