Skip to content

BB9054 RPGLE

The RPGLE program BB9054, titled "Carrier Code Entry InActivate/ReActivate," is a component of a billing and invoicing system designed to handle the inactivation or reactivation of carrier ID records. It is called by the main program BB905P (as described in the first query) to perform the specific task of toggling the status of a carrier ID between active and inactive states. Below, I’ll explain the process steps, business rules, database tables used, and external programs called by BB9054.

Process Steps of the RPGLE Program (BB9054)

The program manages a window-based interface (actwdw) to allow users to inactivate or reactivate a carrier ID record. It operates on the bbcaid file and, for specific cases, the gstabl file, and checks for dependencies in the apveny file. Here’s a detailed breakdown of the process steps:

  1. Program Initialization (*inzsr Subroutine):
  2. Receives Input Parameters: The program accepts four parameters:
    • p$co: Company number.
    • p$caid: Carrier ID.
    • p$fgrp: File group (Z or G for database file overrides).
    • p$flag: Return flag to indicate the outcome (I for inactivated, A for reactivated, or E for error).
  3. Initializes Fields: Moves input parameters to display file fields (f$co, f$caid), sets up message handling fields (dspmsg, m@pgmq, m@key), and initializes the window processing flag (winagn = *on).
  4. Defines Key Lists: Sets up klcaid (for bbcaid access with f$co, f$caid) and klapveny (for apveny access with f$co, f$caid).

  5. Open Database Tables (opntbl Subroutine):

  6. Applies File Overrides: Based on the p$fgrp parameter (Z or G), executes OVRDBF commands to override the database files (apveny, bbcaid, gstabl) to the appropriate library (e.g., gapveny or zapveny).
  7. Opens Files: Opens the database files apveny (input-only), bbcaid (update/add), and gstabl (update/add).

  8. Retrieve Data (rtvdta Subroutine):

  9. Chains to bbcaid: Uses the key list klcaid (f$co, f$caid) to retrieve the carrier ID record.
  10. Sets Display Based on Status:

    • If the record exists (*in99 = *off):
    • Inactive Record (cidel = 'I'): Sets the header to "Carrier Id Entry ReActivate" (hdr(01)), sets the function key label to F22=ReActivate (fky(01)), and activates indicator *in72 (likely for display formatting, e.g., blue color).
    • Active Record (cidel ≠ 'I'):
      • Checks if the carrier ID exists in the vendor file (apveny) using klapveny.
      • Sets the header to "Carrier Id Entry InActivate" (hdr(02)), sets the function key label to F23=InActivate (fky(02)), and activates indicator *in73.
      • Note: The check for vendor linkage setting p$flag = 'E' is commented out (per revision jb01), allowing inactivation even if linked to a vendor.
  11. Process Window (prcwdw Subroutine):

  12. Main Processing Loop:

    • Displays Message Subfile: If dspmsg = *on, calls wrtmsg to display messages; otherwise, writes msgclr to clear the message area.
    • Displays Window: Executes EXFMT actwdw to display the inactivation/reactivation window.
    • Clears Messages and Indicators: Clears the message subfile if needed and resets error indicators (*in50 to *in69).
    • Processes User Input:
    • F12 (Exit): Sets winagn = *off to exit the loop.
    • F22 (ReActivate) or F23 (InActivate): Calls winedt to validate input, and if no errors (*in50 = *off), calls winupd to update the database and exits the loop.
    • Other Inputs (e.g., Enter): Calls winedt to validate input.
  13. Edit Window Input (winedt Subroutine):

  14. Calls chkact to perform activity checks (currently empty, indicating no specific validation is implemented).

  15. Check Activity (chkact Subroutine):

  16. Placeholder for pre-inactivation checks, but no logic is implemented, suggesting validation may occur elsewhere or was deemed unnecessary.

  17. Update Database from Window Input (winupd Subroutine):

  18. ReActivate (F22):
    • Chains to bbcaid using klcaid.
    • If the record exists and is inactive (cidel = 'I'), sets cidel = 'A', updates bbcaidpf, sets p$flag = 'A', and calls updtables to update gstabl if needed.
  19. InActivate (F23):

    • Chains to bbcaid using klcaid.
    • If the record exists and is not inactive (cidel ≠ 'I'), sets cidel = 'I', updates bbcaidpf, sets p$flag = 'I', and calls updtables.
  20. Update gstabl Table (updtables Subroutine):

  21. For company 10, updates the gstabl file:

    • Chains to gstabl using type (BBCAID) and p$caid.
    • If found, updates tbdel with p$flag (A or I) and updates gstablpf.
  22. Message Handling:

  23. Add Message (addmsg): Sends messages to the program message queue using QMHSNDPM, sets dspmsg = *on.
  24. Write Message Subfile (wrtmsg): Displays the message subfile (msgctl) with *in49.
  25. Clear Message Subfile (clrmsg): Clears messages using QMHRMVPM. Note: The code to save/restore rcdnam and pagrrn is commented out, as no subfile is used.

  26. Program Termination:

    • Closes all files and sets *inlr = *on to end the program.

Business Rules

The program enforces the following business rules:

  1. Inactivation/Reactivation:
  2. A carrier ID can be toggled between inactive (cidel = 'I') and active (cidel = 'A') states using F23 and F22, respectively.
  3. Inactivation is allowed even if the carrier ID is linked to a vendor in apveny (revision jb01, 06/05/2024, comments out the error flag p$flag = 'E').

  4. Database Consistency:

  5. Updates the cidel field in bbcaid to reflect the inactivation (I) or reactivation (A) status.
  6. For company number 10, synchronizes the tbdel field in gstabl with the p$flag value to maintain consistency.

  7. Vendor Linkage:

  8. Previously, inactivation was blocked if the carrier ID was linked to a vendor in apveny (would set p$flag = 'E' and exit). This restriction was removed (revision jb01), allowing inactivation regardless of vendor linkage.

  9. User Interface:

  10. Displays a window (actwdw) with dynamic headers and function key labels based on the record’s status:
    • Inactive records show "Carrier Id Entry ReActivate" and F22=ReActivate.
    • Active records show "Carrier Id Entry InActivate" and F23=InActivate.
  11. Uses indicators *in72 (for inactive) and *in73 (for active) for display formatting.

  12. Error Handling:

  13. Minimal validation is performed (chkact is empty), relying on the calling program (BB905P) for input validation.
  14. Uses a message subfile to display errors or confirmations, though no specific error messages are defined in the provided code (only a placeholder com(01)).

Database Tables Used

The program interacts with the following database files: 1. bbcaid: - Update/add file for carrier ID records. - Key fields: cico (company), cicaid (carrier ID). - Key field modified: cidel (deletion/inactivation status, set to A or I). 2. apveny: - Input-only file to check for vendor linkage. - Key fields: Likely f$co (company) and f$caid (carrier ID), based on klapveny. 3. gstabl: - Update/add file for company 10, storing carrier ID status. - Key fields: tbtype (BBCAID), tbcode (carrier ID). - Field updated: tbdel (set to A or I).

External Programs Called

The program calls the following external programs: 1. QCMDEXC: - Executes file override commands (OVRDBF) in the opntbl subroutine. - Parameters: dbov## (override command string), dbol## (length of command). 2. QMHSNDPM: - Sends messages to the program message queue in the addmsg subroutine. - Parameters: m@id, m@msgf, m@data, m@l, m@type, m@pgmq, m@scnt, m@key, m@errc. 3. QMHRMVPM: - Clears messages from the message subfile in the clrmsg subroutine. - Parameters: m@pgmq, m@scnt, m@rmvk, m@rmv, m@errc.

Additional Notes

  • Window-Based Interface: Unlike BB905P (subfile-based) or BB905 (format-based), BB9054 uses a single window (actwdw) for a simple inactivation/reactivation action.
  • Function Keys:
  • F12: Exits the program.
  • F22: Reactivates an inactive carrier ID.
  • F23: Inactivates an active carrier ID.
  • Indicators: Consistent with BB905P, indicators control screen errors (*in50 to *in69), input protection (*in70 to *in79), and display formatting (*in72, *in73).
  • Revision:
  • jb01 (06/05/2024): Removed the restriction preventing inactivation of carrier IDs linked to vendors, allowing such actions without requiring AP (Accounts Payable) intervention.
  • Minimal Validation: The chkact subroutine is empty, suggesting that validation is handled by the calling program or not required.

This program is a focused utility for toggling carrier ID status, complementing the broader functionality of BB905P and BB905. It ensures database consistency and provides a user-friendly interface for status changes. Let me know if you need further clarification or additional details!