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 (
*inzsrSubroutine): - Receives Input Parameter:
p$fgrp: File group ('Z' or 'G' for library selection, though not used in file overrides forbb945win 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 (
opntblSubroutine): - Executes a file override for
bb945wto point toQTEMP/BB945W(per revision JK01, 07/24/2021) usingQCMDEXC. -
Opens the
bb945wfile (update file, user-opened). -
Print Listing (
prtlistSubroutine): - Calls
openprtfto open the printer fileqsysprtand apply overrides. - Reads all records from
bb945wuntil the last record (*inlr = *on). - For each record:
- Checks for page overflow (
ovrflosubroutine). - 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
closprtfto close the printer file after all records are processed. -
Handle Overflow (
ovrfloSubroutine): - Checks the overflow indicator (
*inof) from the printer file. - If overflow occurs (
*inof = *on):- Sets
prtovr = *onto trigger header printing. - Sets indicators 81–85 (
*in(81) = '11111') for formatting.
- Sets
-
If
prtovr = *on:- Prints the report header (
hdr01). - Resets
prtovrto*off.
- Prints the report header (
-
Open Printer File (
openprtfSubroutine): - Constructs and executes printer file overrides using
QCMDEXC:- Overrides
QSYSPRTwithPAGESIZE(68 164),LPI(8),CPI(15),OVRFLW(62),OUTQ(FRTOUTQ),FORMTYPE(FRGL),HOLD(*YES),SAVE(*YES).
- Overrides
-
Opens the
qsysprtprinter file. -
Close Printer File (
closprtfSubroutine): - Closes the
qsysprtprinter file. -
Executes a
DLTOVRcommand to delete the printer file override usingQCMDEXC. -
Program End:
- The program does not explicitly close files or set
*inlr = *onat the top level, as this is handled within theprtlistsubroutine forqsysprt, andbb945wremains 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
BB945Wto 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
FRTOUTQoutput 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
bb945wfile 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.