Skip to content

BB935P

Process Steps

This RPGLE program (BB935P) is an interactive display program for managing "Product Code Reference Entries" in a billing system. It uses a subfile (SFL1) to list and manipulate cross-reference entries from the BBPRXY file. The program operates in two modes: 'MNT' (maintenance, allowing create/change/delete) or 'INQ' (inquiry only). It also supports file group overrides ('G' or 'Z') for data segregation (e.g., production vs. test environments).

The high-level flow is: 1. Initialization (*INZSR subroutine): - Receives entry parameters: p$mode (MNT/INQ) and p$fgrp (G/Z). - Sets up work fields, keys, message handling, and date/time stamps. - Defines key lists for file access (e.g., KLSFL1 for chaining to BBPRXY). - Prepares subfile parameters (e.g., page size of 28 records).

  1. Open Database Tables (OPNTBL subroutine):
  2. Applies database file overrides using QCMDEXC based on p$fgrp:
    • For 'G': Overrides to files like GBICONT, GBBPRXY, etc.
    • For 'Z': Overrides to files like ZBICONT, ZBBPRXY, etc.
  3. Opens all files (input-only, some with keys).

  4. Process Subfile (SRSFL1 subroutine):

  5. Clears and initializes the message subfile.
  6. Sets initial subfile mode (folded/unfolded) and filters (e.g., exclude deleted entries by default).
  7. Enables global field protection if in 'INQ' mode.
  8. Repositions the file cursor based on user filters (company, xref set, product xref, product, container, quantity).
  9. Loads the subfile with records (SF1LOD subroutine):
    • Clears subfile if needed.
    • Edits control fields (e.g., validates company via BICONT).
    • Positions and reads records from BBPRXYRD (renamed BBPRXY) using SETLL/READE.
    • Applies filters (e.g., skip deleted if toggled off, match on product/container/quantity if specified).
    • Formats each subfile line (SF1FMT: populates fields, looks up descriptions from GSPROD and GSCNTR1).
    • Applies color coding (SF1COL: blue for deleted entries).
    • Writes up to 28 records per page.
  10. Displays the subfile control and command line.
  11. Handles user input in a loop until exit (F3):

    • Processes function keys: F3 (exit), F4 (field prompting), F5 (refresh), F8 (toggle deleted filter), F10 (position to control), Page Down (load next page).
    • Validates and processes direct access options (1=create, 2=change, 4=delete, 5=display) entered in the control area (SF1DIR subroutine).
    • On Enter: Reads changed subfile records (SF1PRC/SF1CHG) and processes selected options (calls external programs).
    • Repositions subfile on filters or after actions (SF1REP).
    • Handles errors/messages (e.g., invalid company, duplicate entries).
  12. End of Program:

  13. Closes all files.
  14. Sets INLR = ON and returns.

Throughout, the program uses message subfiles for errors/confirmations (e.g., via ADDMSG, WRTMSG, CLRMSG subroutines, calling QMHSNDPM/QMHRMVPM APIs). Cursor positioning and subfile navigation ensure user-friendly interaction (e.g., SFLRCDNBR for paging).

Business Rules

  • Access Modes:
  • 'MNT': Allows create (opt 1), change (opt 2), delete/reactivate (opt 4).
  • 'INQ': Read-only; fields protected (*IN70 on), options like create/change disabled.

  • Record Existence and Validation:

  • Company must exist in BICONT; invalid company triggers error 'ERR0010'.
  • For create (opt 1): Requires xref set and product xref; checks for duplicates (error 'ERR0101' if exists and active, or notes if deleted).
  • For change/delete: Cannot modify/delete already deleted records (errors like 'ERR0000' with custom messages).
  • Direct access (options in control area): Validates before processing; e.g., must specify values for create.

  • Deleted Records Handling:

  • Records marked 'D' in BXDEL field.
  • F8 toggles include/exclude deleted (default exclude).
  • Deleted records shown in blue (*IN72).
  • Delete (opt 4) marks as 'D' (or reactivates to blank); cannot change deleted records.

  • Filtering and Positioning:

  • Subfile can be filtered by company, xref set (from GSTABL), product xref, product (from GSPROD), container (from GSCNTR1), quantity.
  • Positioning uses SETLL on BBPRXYRD keys (company + xref set + product xref).
  • Refresh (F5) clears filters and reloads.

  • Prompting (F4):

  • Prompts for xref set (calls LGSTABL), product (LGSPROD), container (LGSCNTR1).

  • Error Handling:

  • Uses message IDs (e.g., 'ERR0103' for missing values) from GSMSGF.
  • Displays in message subfile; clears on refresh.
  • No internet/package installs; relies on pre-installed libraries (e.g., numpy not relevant here as it's RPG).

  • Other:

  • Subfile folded/unfolded toggle (not user-controlled; initial folded).
  • Confirmations for actions (e.g., "Code X/Y has been created").
  • No direct file updates in this program; delegates to called programs.

Tables Used

The program uses the following physical/logical files (all input-only except the display file). Overrides apply based on p$fgrp ('G' or 'Z' prefixes files accordingly). All are keyed except where noted.

File Name Description Usage Key Fields (if applicable)
BB935PD Display file (workstation) with subfile SFL1. CF (control format) E (external). SFILE for subfile. N/A (display file).
BICONT Company master file. IF E K (keyed). USROPN. Company (BCCONO assumed).
BBPRXY Product cross-reference file. IF E K. USROPN. Company (BXCONO), Xref Set (BXXSET), Product Xref (BXPXRC).
GSTABL General table file (for xref sets). IF E K. USROPN. Table Type (TBTYPE, e.g., 'BBXSET'), Table Code (TBCODE).
GSPROD Product master file. IF E K. USROPN. Company (TPCONO assumed), Product (TPPROD).
GSCNTR1 Container master file. IF E K. USROPN. Container Code (TCCODE assumed).
BBPRXYRD Renamed record format of BBPRXY (BBPRXRPF to BBPRXRPR). IF E K. USROPN. Same as BBPRXY (used for reading to avoid format conflicts).

External Programs Called

The program calls the following external programs/modules (via CALL opcode) for specific actions. Parameters are passed as listed (e.g., company, xref set, mode).

Program Name Description When Called Key Parameters
BB935 Detail maintenance/display program for product xref entries. Opt 1 (create), 2 (change), 5 (display). Mode 'MNT' or 'INQ'. Company, Xref Set, Product Xref, Mode, File Group, Return Flag.
BB9354 Delete/reactivate program for product xref entries. Opt 4 (delete). Company, Xref Set, Product Xref, File Group, Return Flag.
LGSTABL Prompt/lookup for table codes (xref sets). F4 on C1XSET field. Xref Set Type ('BBXSET'), Code (returned), File Group.
LGSPROD Prompt/lookup for products. F4 on C1PROD field. Company, Product (input/output), File Group.
LGSCNTR1 Prompt/lookup for containers. F4 on C1CNTR field. Container (input/output), File Group.
QMHSNDPM System API to send program messages. ADDMSG subroutine (for errors/confirmations). Message ID, File, Data, Length, Type, Queue, Stack Count, Key, Error Code.
QMHRMVPM System API to remove program messages. CLRMSG subroutine. Queue, Stack Count, Key, Remove Option, Error Code.
QCMDEXC System API to execute commands (file overrides). OPNTBL subroutine. Command String, Length.