Skip to content

BB9284 RPGLE

The RPGLE program BB9284 is a specialized module within a billing and invoicing system, designed to handle the inactivation and reactivation of salesman ID entries. It is called by the main program BB928P (as referenced in the earlier document) to perform these specific operations. The program uses a display file (bb9284d) to present a window (actwdw) for user interaction and updates the salesman ID record status in the database. Below, I’ll explain the process steps, outline the business rules, list the database tables used, and identify any external programs called.

Process Steps of the BB9284 Program

The program is structured to display a window for confirming the inactivation or reactivation of a salesman ID record and update the database accordingly. It operates in a single mode, focusing on toggling the record’s status (smdel) between active (A) and inactive (I). Here’s a detailed breakdown of the process steps:

  1. Initialization (*inzsr Subroutine):
  2. Parameters: Receives input parameters:
    • p$co: Company number.
    • p$smid: Salesman ID.
    • p$fgrp: File group (Z or G).
    • p$flag: Return flag to indicate the outcome (e.g., I for inactivated, A for reactivated).
  3. Field Setup: Moves input parameters p$co and p$smid to display file fields (f$co, f$smid). Initializes winagn to *on to control the window processing loop, and sets up message handling fields (dspmsg, m@pgmq, m@key).
  4. Keylist: Defines klslsm keylist using f$co and f$smid for database access.
  5. Date Validation: Defines a parameter list (pld010) for a potential date validation module (dtp010r), though it is not used in the provided code.

  6. Open Database Tables (opntbl Subroutine):

  7. File Overrides: Based on p$fgrp (G or Z), applies a database override from ovg or ovz arrays to point to the correct file (gbbslsm or zbbslsm) using the QCMDEXC program.
  8. File Open: Opens bbslsm in update/add mode (uf a) with usropn.

  9. Retrieve Data (rtvdta Subroutine):

  10. Record Retrieval: Chains to bbslsm using klslsm (company and salesman ID) to retrieve the record.

    • If the record exists (*in99 = *off):
    • If smdel = 'I' (inactive), sets the display header (f$hdr) to "Salesman Id Entry ReActivate" (hdr(01)), function key label (f$fkyd) to "F22=ReActivate" (fky(01)), and *in72 to *on (indicating reactivation is available).
    • Otherwise, sets f$hdr to "Salesman Id Entry InActivate" (hdr(02)), f$fkyd to "F23=InActivate" (fky(02)), and *in73 to *on (indicating inactivation is available).
  11. Process Window (prcwdw Subroutine):

  12. Main Loop: Runs while winagn = *on:
    • Display Messages: If dspmsg = *on, calls wrtmsg to display the message subfile; otherwise, writes msgclr to clear the message area.
    • Display Window: Displays the actwdw window using exfmt.
    • Clear Messages: If dspmsg = *on, calls clrmsg to clear the message subfile.
    • Clear Indicators: Clears error indicators (*in50*in69) using zero20.
    • Process User Input:
    • F12 (Exit): Sets winagn to *off to exit the loop without changes.
    • F22 (ReActivate) or F23 (InActivate):
      • Calls winedt to validate input (which calls chkact).
      • If no errors (*in50 = *off), calls winupd to update the database and sets winagn to *off to exit.
    • Other (e.g., Enter): Calls winedt to validate input but does not update the database.
  13. Cursor Positioning: Commented-out code suggests cursor location (row, col) could be calculated from csrloc, but it is not currently used.

  14. Edit Window Input (winedt Subroutine):

  15. Calls chkact to perform validation, though chkact is currently empty, indicating no specific input validation is implemented.

  16. Check Activity (chkact Subroutine):

  17. Currently empty, likely intended for future validation of the salesman ID’s activity (e.g., checking if the record is linked to other data preventing inactivation).

  18. Update Database (winupd Subroutine):

  19. Processes based on the function key:

    • F22 (ReActivate):
    • Chains to bbslsm using klslsm.
    • If the record exists (*in99 = *off) and is inactive (smdel = 'I'), sets smdel to A (active), updates the record (bbslsmpf), and sets p$flag to A.
    • F23 (InActivate):
    • Chains to bbslsm using klslsm.
    • If the record exists (*in99 = *off) and is not already inactive (smdel ≠ 'I'), sets smdel to I (inactive), updates the record (bbslsmpf), and sets p$flag to I.
  20. Message Handling:

  21. addmsg: Sends messages to the program message queue using QMHSNDPM, setting dspmsg to *on.
  22. wrtmsg: Writes the message subfile control (msgctl) with *in49 enabled.
  23. clrmsg: Clears the message subfile using QMHRMVPM. Commented-out code for saving/restoring rcdnam and pagrrn suggests it was planned but not needed for the window format.

  24. Program Exit:

  25. Closes all files, sets *inlr to *on, and returns to the calling program (BB928P).

Business Rules

The program enforces the following business rules: 1. Record Status Toggle: - A salesman ID record can be toggled between active (smdel = 'A') and inactive (smdel = 'I') states. - Only inactive records can be reactivated (F22), and only non-inactive records can be inactivated (F23). 2. Record Existence: - The program checks if the salesman ID record exists in bbslsm before allowing status changes. - If the record does not exist or is in an invalid state (e.g., already inactive for F23), no update occurs. 3. User Interface: - The window (actwdw) displays a header and function key label based on the record’s current status: - Inactive records show "Salesman Id Entry ReActivate" with F22 enabled. - Active records show "Salesman Id Entry InActivate" with F23 enabled. - F12 allows the user to exit without changes. 4. Database Integrity: - Uses file overrides to select the correct database file (gbbslsm or zbbslsm) based on p$fgrp. - Updates only the smdel field in the bbslsm record, preserving other fields. 5. Return Flag: - Sets p$flag to A for reactivation or I for inactivation to inform the calling program (BB928P) of the outcome.

Database Tables Used

The program interacts with the following database file: 1. bbslsm: Primary file for salesman ID records, opened in update/add mode (uf a) with usropn. Used for reading and updating the record status (smdel).

External Programs Called

The program calls the following external program: 1. QCMDEXC: Executes the file override command for bbslsm. 2. QMHSNDPM: Sends messages to the program message queue for error or confirmation display. 3. QMHRMVPM: Removes messages from the program message queue.

Additional Notes

  • Display File: bb9284d is a workstation file using the PROFOUNDUI(HANDLER) for the user interface, with a single window format (actwdw) for inactivation/reactivation.
  • Indicators: Uses indicators (19, 21–79, 90–99) for screen control and message handling, consistent with BB928P and BB928. Notably, *in72 and *in73 control the display of reactivation/inactivation options.
  • Field Prefixes: Follows the same naming conventions as BB928P and BB928 (e.g., f$ for display fields, p$ for input parameters, o$ for output parameters).
  • Integration with BB928P: BB9284 is called by BB928P for option 4 (inactivate/reactivate) to toggle the status of a salesman ID record, returning a flag (p$flag) to indicate the result.
  • Empty Subroutine: The chkact subroutine is empty, suggesting that additional validation (e.g., checking for dependencies like vendor links in BB928P) was planned but not implemented.

This program is a focused module for toggling the active/inactive status of salesman ID records, complementing the broader functionality of BB928P and BB928 by providing a simple, user-driven interface for status changes.