BB9055 RPGLE
The RPGLE program BB9055, titled "Print Carrier Code Listing," is a component of a billing and invoicing system designed to generate a printed report of carrier ID records. It is called by the main program BB905P (as described in the first query) to produce a listing of carrier IDs sorted by company number and carrier ID. Below, I’ll explain the process steps, business rules, database tables used, and external programs called by BB9055.
Process Steps of the RPGLE Program (BB9055)¶
The program reads the bbcaid file and outputs a formatted report to the qsysprt printer file, including headers and detail lines for each carrier ID record. It handles file overrides and overflow conditions to ensure proper report formatting. Here’s a detailed breakdown of the process steps:
- Program Initialization (
*inzsrSubroutine): - Receives Input Parameter: Accepts one parameter,
p$fgrp, which specifies the file group (ZorG) for database file overrides. - Sets Headers: Initializes the report header (
c$hdr1) with the first element of thehdrarray ("Carrier Id Listing By Co#/Carrier Id"). - Sets Overflow Flag: Sets
prtovr = *onto trigger the printing of headers at the start. - Opens Database Tables: Calls
opntblto apply file overrides and open thebbcaidfile. -
Initializes Date/Time: Uses a time conversion data structure (
t#time) to capture the current date and time for the report header. -
Open Database Tables (
opntblSubroutine): - Applies File Overrides: Based on the
p$fgrpparameter (ZorG), executesOVRDBFcommands to override thebbcaidfile to the appropriate library (e.g.,gbbcaidorzbbcaid). -
Opens File: Opens the
bbcaidfile for input. -
Print Listing (
prtlistSubroutine): - Opens Printer File: Calls
openprtfto set up and open theqsysprtprinter file. - Main Processing Loop:
- Reads records from
bbcaidsequentially until the end of the file (*inlr = *on). - For each record:
- Checks for overflow by calling
ovrflo. - Prints a detail line (
dtl01) containing the company number (cico), carrier ID (cicaid), carrier name (cicanm), EIN (ciein), Fuel Facs ID (ciffid), and deletion status (cidel).
- Reads records from
-
Closes Printer File: Calls
closprtfto closeqsysprtand clean up overrides. -
Process Overflow (
ovrfloSubroutine): - Checks Overflow Indicator: If
*inof(overflow indicator) is*on, setsprtovr = *onand activates indicators*in81to*in85for header formatting. -
Prints Headers: If
prtovr = *on, prints the header format (hdr01) and resetsprtovr = *off. -
Open Printer File (
openprtfSubroutine): - Sets Printer Overrides: Combines the first two elements of the
ovrarray to configure the printer file with specific attributes (e.g., page size of 68 lines by 164 characters, 8 lines per inch, 15 characters per inch, overflow at line 62, output queue*JOB, hold and save options). - Executes Override: Calls
QCMDEXCto apply theOVRPRTFcommand. -
Opens Printer File: Opens
qsysprtfor output. -
Close Printer File (
closprtfSubroutine): - Closes Printer File: Closes
qsysprt. -
Deletes Override: Applies the
DLTOVRcommand fromovr(03)usingQCMDEXCto remove the printer file override. -
Program Termination:
- The program ends after printing all records, with no explicit file closure in the mainline (handled in
closprtf).
Report Format¶
- Header (
hdr01): - Line 1: "American Refining Group" (left), report title (
c$hdr1, centered), page number (right). - Line 2: Job name (
ps#jobn), program name (ps#pgm), date (t#mdcy, right). - Line 3: User ID (
ps#usr), file group (p$fgrp), time (t#hms, right). - Line 4: Separator line (
str, 164 characters). - Line 5: Column headers ("Co", "Carr Id", "Carrier Name", "Ein #", "Fuel Facs #", "Del").
- Line 6: Separator line (
str). - Detail (
dtl01): - Prints one line per
bbcaidrecord with fields:cico(company),cicaid(carrier ID),cicanm(carrier name),ciein(EIN),ciffid(Fuel Facs ID),cidel(deletion status).
Business Rules¶
- Report Content:
- The report lists all carrier ID records from the
bbcaidfile, sorted by company number and carrier ID (implied by the file’s key structure). -
Includes all records, regardless of deletion status (
cidel), allowing visibility of both active and inactive carriers. -
Formatting:
- The report is formatted for a page size of 68 lines by 164 characters, with 8 lines per inch and 15 characters per inch.
- Overflow occurs at line 62, triggering header reprinting.
-
The output is held (
HOLD(*YES)) and saved (SAVE(*YES)) in the job’s output queue (OUTQ(*JOB)). -
File Overrides:
- The
bbcaidfile is overridden to the appropriate library (gbbcaidorzbbcaid) based on thep$fgrpparameter. -
Printer file overrides ensure consistent formatting and output handling.
-
No User Interaction:
-
The program is non-interactive, running to completion without user input after being called with the
p$fgrpparameter. -
Error Handling:
- No explicit error handling is implemented for file operations or printing, assuming the calling program (
BB905P) handles errors. - Relies on the system’s default error handling for file I/O and printer operations.
Database Tables Used¶
The program interacts with the following database file:
1. bbcaid:
- Input-only file containing carrier ID records.
- Key fields: Likely cico (company) and cicaid (carrier ID), though not explicitly used in the program (sequential read).
- Fields printed: cico (company), cicaid (carrier ID), cicanm (carrier name), ciein (EIN), ciffid (Fuel Facs ID), cidel (deletion status).
External Programs Called¶
The program calls the following external program:
1. QCMDEXC:
- Executes file override commands (OVRDBF for bbcaid, OVRPRTF and DLTOVR for qsysprt) in the opntbl, openprtf, and closprtf subroutines.
- Parameters: dbov## (override command string), dbol## (length of command, 80 or 160).
Additional Notes¶
- Non-Interactive Nature: Unlike
BB905P,BB905, andBB9054, which use display files for user interaction,BB9055is a batch-style program focused solely on generating a printed report. - Printer File Configuration: The use of
PAGESIZE(68 164),LPI(8),CPI(15), andOVRFLW(62)ensures a compact, readable report format suitable for wide paper or spooled output. - No Revisions: The program has no listed revisions, indicating stable functionality since its creation in 2013.
- Minimal Indicators: Unlike other programs in the suite,
BB9055uses only the overflow indicator (*inof) and indicators*in81to*in85for header formatting, reflecting its simple output-driven design.
This program complements the carrier ID management suite by providing a reporting function, enabling users to review all carrier ID records in a printed format. Let me know if you need further clarification or additional details!