Skip to content

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:

  1. Initialization (*inzsr Subroutine):
  2. Receives Input Parameter:
    • p$fgrp: File group ('Z' or 'G' for library selection, though not used in file overrides for bb945w in this version).
  3. Sets report headers:
    • c$hdr1: "Freight Maintenance GL Error Listing".
    • c$hdr2: "Missing G/L Freight Accounts".
  4. Sets the overflow indicator (prtovr = *on) to ensure the header is printed initially.
  5. Initializes date and time fields using the system timestamp (t#time) for report formatting.

  6. Open Database Tables (opntbl Subroutine):

  7. Executes a file override for bb945w to point to QTEMP/BB945W (per revision JK01, 07/24/2021) using QCMDEXC.
  8. Opens the bb945w file (update file, user-opened).

  9. Print Listing (prtlist Subroutine):

  10. Calls openprtf to open the printer file qsysprt and apply overrides.
  11. Reads all records from bb945w until the last record (*inlr = *on).
  12. 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)
  13. Calls closprtf to close the printer file after all records are processed.

  14. Handle Overflow (ovrflo Subroutine):

  15. Checks the overflow indicator (*inof) from the printer file.
  16. If overflow occurs (*inof = *on):
    • Sets prtovr = *on to trigger header printing.
    • Sets indicators 81–85 (*in(81) = '11111') for formatting.
  17. If prtovr = *on:

    • Prints the report header (hdr01).
    • Resets prtovr to *off.
  18. Open Printer File (openprtf Subroutine):

  19. Constructs and executes printer file overrides using QCMDEXC:
    • Overrides QSYSPRT with PAGESIZE(68 164), LPI(8), CPI(15), OVRFLW(62), OUTQ(FRTOUTQ), FORMTYPE(FRGL), HOLD(*YES), SAVE(*YES).
  20. Opens the qsysprt printer file.

  21. Close Printer File (closprtf Subroutine):

  22. Closes the qsysprt printer file.
  23. Executes a DLTOVR command to delete the printer file override using QCMDEXC.

  24. Program End:

  25. The program does not explicitly close files or set *inlr = *on at the top level, as this is handled within the prtlist subroutine for qsysprt, and bb945w 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.

  1. Data Formatting:
  2. Dates (qfstdt, qfexdt) are converted from CCYYMMDD to MMDDYY format for readability in the report.
  3. The report includes specific fields from BB945W to help identify problematic records, such as company, customer, carrier, and contract details.

  4. Printer Formatting:

  5. 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)).
  6. Overflow is triggered at line 62 (OVRFLW(62)), prompting a new page with headers.
  7. The report is sent to the FRTOUTQ output queue with form type FRGL, held (HOLD(*YES)), and saved (SAVE(*YES)) for later retrieval.

  8. Header Information:

  9. 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.
  10. File Override:

  11. Per revision JK01 (07/24/2021), the bb945w file is overridden to use QTEMP/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.