BB9451 RPGLE
The RPG program BB9451.rpgle
is designed to print a report from the work file BB945W
within the Bradford Order Entry/Invoices system. It generates a "Freight Maintenance GL Error Listing" report, specifically listing records with missing General Ledger (G/L) freight accounts. The program is called by another program (likely BB945.rpgle
) and produces a formatted report on the printer file QSYSPRT
. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of BB9451.rpgle
¶
The program operates through a series of subroutines to open files, print a report, and handle overflow conditions. The main steps are:
- Initialization (
*inzsr
Subroutine): - Receives Input Parameter:
p$fgrp
: File group ('Z' or 'G' for library selection, though not used in file overrides forbb945w
in this version).
- Sets report headers:
c$hdr1
: "Freight Maintenance GL Error Listing".c$hdr2
: "Missing G/L Freight Accounts".
- Sets the overflow indicator (
prtovr = *on
) to ensure the header is printed initially. -
Initializes date and time fields using the system timestamp (
t#time
) for report formatting. -
Open Database Tables (
opntbl
Subroutine): - Executes a file override for
bb945w
to point toQTEMP/BB945W
(per revision JK01, 07/24/2021) usingQCMDEXC
. -
Opens the
bb945w
file (update file, user-opened). -
Print Listing (
prtlist
Subroutine): - Calls
openprtf
to open the printer fileqsysprt
and apply overrides. - Reads all records from
bb945w
until the last record (*inlr = *on
). - For each record:
- Checks for page overflow (
ovrflo
subroutine). - Converts start date (
qfstdt
) and expiration date (qfexdt
) from CCYYMMDD to MMDDYY format (p$stmdy
,p$exmdy
) for display. - Prints a detail line (
dtl01
) containing: - Company (
qfcono
) - Customer number (
qfcust
) - Carrier ID (
qfcaid
) - Contract code (
qfcncd
) - Freight G/L number (
qffrgl
) - CACD code (
qfcacd
) - Ship-to (
qfship
) - Start date (
p$stmdy
) - Expiration date (
p$exmdy
) - Contract code from
gstabl
(qftcde
)
- Checks for page overflow (
-
Calls
closprtf
to close the printer file after all records are processed. -
Handle Overflow (
ovrflo
Subroutine): - Checks the overflow indicator (
*inof
) from the printer file. - If overflow occurs (
*inof = *on
):- Sets
prtovr = *on
to trigger header printing. - Sets indicators 81–85 (
*in(81) = '11111'
) for formatting.
- Sets
-
If
prtovr = *on
:- Prints the report header (
hdr01
). - Resets
prtovr
to*off
.
- Prints the report header (
-
Open Printer File (
openprtf
Subroutine): - Constructs and executes printer file overrides using
QCMDEXC
:- Overrides
QSYSPRT
withPAGESIZE(68 164)
,LPI(8)
,CPI(15)
,OVRFLW(62)
,OUTQ(FRTOUTQ)
,FORMTYPE(FRGL)
,HOLD(*YES)
,SAVE(*YES)
.
- Overrides
-
Opens the
qsysprt
printer file. -
Close Printer File (
closprtf
Subroutine): - Closes the
qsysprt
printer file. -
Executes a
DLTOVR
command to delete the printer file override usingQCMDEXC
. -
Program End:
- The program does not explicitly close files or set
*inlr = *on
at the top level, as this is handled within theprtlist
subroutine forqsysprt
, andbb945w
remains open until the program ends naturally.
Business Rules¶
The program enforces the following business rules to ensure accurate report generation:
1. Report Purpose:
- The report lists records from BB945W
that have missing G/L freight accounts, indicating errors in freight maintenance data.
- Data Formatting:
- Dates (
qfstdt
,qfexdt
) are converted from CCYYMMDD to MMDDYY format for readability in the report. -
The report includes specific fields from
BB945W
to help identify problematic records, such as company, customer, carrier, and contract details. -
Printer Formatting:
- The report uses a page size of 68 lines by 164 columns, with 8 lines per inch (
LPI(8)
) and 15 characters per inch (CPI(15)
). - Overflow is triggered at line 62 (
OVRFLW(62)
), prompting a new page with headers. -
The report is sent to the
FRTOUTQ
output queue with form typeFRGL
, held (HOLD(*YES)
), and saved (SAVE(*YES)
) for later retrieval. -
Header Information:
-
The report header includes:
- Company name ("American Refining Group").
- Report title ("Freight Maintenance GL Error Listing").
- Subtitle ("Missing G/L Freight Accounts").
- Job name, program name, user, file group (
p$fgrp
), date, time, and page number. - Column headers for company, customer number, carrier ID, contract code, freight G/L number, CACD code, ship-to, start date, expiration date, and contract code from
gstabl
.
-
File Override:
- Per revision JK01 (07/24/2021), the
bb945w
file is overridden to useQTEMP/BB945W
, ensuring the report processes a temporary work file specific to the job.
Tables (Files) Used¶
The program accesses the following files:
1. bb945w: Work file containing freight maintenance data (update file, user-opened, overridden to QTEMP/BB945W
).
2. qsysprt: Printer file for generating the report (output, user-opened, with overflow indicator *inof
).
External Programs Called¶
The program calls the following external program:
1. QCMDEXC: Executes file override commands for bb945w
and qsysprt
, and deletes the printer file override after printing.
Summary¶
The BB9451.rpgle
program, called by another program (likely BB945.rpgle
), generates a printed report from the BB945W
work file, listing records with missing G/L freight accounts. It formats the report with headers, detail lines, and proper date conversions, sending output to the FRTOUTQ
queue with specific formatting settings. The program handles page overflows and applies a file override to use QTEMP/BB945W
(per revision JK01, 07/24/2021). It is a straightforward utility program with no user interaction, focusing on producing a clear and structured error report for freight maintenance issues.