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 (
JB01
andJK01
Revisions): - Purpose: Ensures the existence of a temporary work file (
FR711W
) in theQTEMP
library for multi-user capability. -
Actions:
- Checks if
FR711W
exists inQTEMP
usingCHKOBJ
. - If the file does not exist (
CPF9801
message), creates a duplicate ofFR711W
usingCRTDUPOBJ
: - If
&P$FGRP = 'G'
, copiesFR711W
from theDATA
library (revised fromARGDEV
inJK01
). - If
&P$FGRP = 'Z'
, copiesFR711W
from theDATADEV
library (revised fromARGDEVTEST
inJK01
). - The duplicate is created in
QTEMP
with constraints (CST(*NO)
) and triggers (TRG(*NO)
) disabled. - Clears the
FR711W
file inQTEMP
usingCLRPFM
to ensure it is empty (revised inJK01
to explicitly referenceQTEMP/FR711W
). - Overrides the
FR711W
file to point toQTEMP/FR711W
usingOVRDBF
for 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
. FR711A
is responsible for querying the necessary data (likely fromgglcont
/ginloc
orzglcont
/zinloc
based 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
. FR711B
uses the data inFR711W
to 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
ENDPGM
after callingFR711A
andFR711B
.
- The program ends with
Business Rules¶
- Work File Management:
- The temporary work file
FR711W
is created inQTEMP
to ensure multi-user capability (revisionJB01
). UsingQTEMP
provides 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
OVRDBF
command ensures that all references toFR711W
inFR711A
andFR711B
point to theQTEMP
copy. -
Month Selection (from revision
jb03
): - The
&P$SELMO
parameter 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
FR711A
andFR711B
to filter the data included in the work file and report. -
File Group:
-
The
&P$FGRP
parameter ('G' or 'Z') determines the source library for the work file and likely influences the data files used byFR711A
(e.g.,gglcont
/ginloc
for 'G',zglcont
/zinloc
for 'Z'). -
Sort Option:
-
The program assumes
&P$SORT = 'L'
(sort by location), as it is called byFR711PC
only when this condition is met. The&P$SORT
parameter is passed toFR711B
to ensure the report is sorted appropriately. -
Error Handling:
-
The program handles the case where
FR711W
does not exist inQTEMP
by creating it. Other errors (e.g., file access issues) are not explicitly handled in this program and are likely managed byFR711A
orFR711B
. -
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 toARGDEV
orARGDEVTEST
.jb03
(04/07/15): Added the&P$SELMO
parameter for month selection filtering.JK01
(07/22/21): Updated library references toDATA
andDATADEV
, and explicitly overrodeFR711W
toQTEMP/FR711W
.
Tables Used¶
- Work File:
FR711W
: A temporary physical file in theQTEMP
library, used to store data for the report. It is created by copying from:DATA/FR711W
if&P$FGRP = 'G'
.DATADEV/FR711W
if&P$FGRP = 'Z'
.
-
The file is cleared before use and overridden to ensure
FR711A
andFR711B
access theQTEMP
copy. -
No Direct Data File Access:
FR711C
does not directly access data files likegglcont
,ginloc
,zglcont
, orzinloc
. These are likely accessed byFR711A
to populateFR711W
, as set up by the overrides inFR711P
.
External Programs Called¶
- FR711A: Called to build the work file
FR711W
by 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 ofFR711W
inQTEMP
.CRTDUPOBJ
: Creates a duplicate ofFR711W
inQTEMP
if it does not exist.CLRPFM
: Clears theFR711W
file inQTEMP
.OVRDBF
: Overrides theFR711W
file to point toQTEMP/FR711W
.
Additional Notes¶
- Purpose:
FR711C
acts 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
FR711P
before being passed throughFR711PC
. - Execution Context: The program runs in the same job session as its caller, using direct calls to
FR711A
andFR711B
rather 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
).