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:
- Initialization (
*inzsr
Subroutine): - Parameters: Receives input parameters:
p$co
: Company number.p$smid
: Salesman ID.p$fgrp
: File group (Z
orG
).p$flag
: Return flag to indicate the outcome (e.g.,I
for inactivated,A
for reactivated).
- Field Setup: Moves input parameters
p$co
andp$smid
to display file fields (f$co
,f$smid
). Initializeswinagn
to*on
to control the window processing loop, and sets up message handling fields (dspmsg
,m@pgmq
,m@key
). - Keylist: Defines
klslsm
keylist usingf$co
andf$smid
for database access. -
Date Validation: Defines a parameter list (
pld010
) for a potential date validation module (dtp010r
), though it is not used in the provided code. -
Open Database Tables (
opntbl
Subroutine): - File Overrides: Based on
p$fgrp
(G
orZ
), applies a database override fromovg
orovz
arrays to point to the correct file (gbbslsm
orzbbslsm
) using theQCMDEXC
program. -
File Open: Opens
bbslsm
in update/add mode (uf a
) withusropn
. -
Retrieve Data (
rtvdta
Subroutine): -
Record Retrieval: Chains to
bbslsm
usingklslsm
(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).
- If the record exists (
-
Process Window (
prcwdw
Subroutine): - Main Loop: Runs while
winagn = *on
:- Display Messages: If
dspmsg = *on
, callswrtmsg
to display the message subfile; otherwise, writesmsgclr
to clear the message area. - Display Window: Displays the
actwdw
window usingexfmt
. - Clear Messages: If
dspmsg = *on
, callsclrmsg
to clear the message subfile. - Clear Indicators: Clears error indicators (
*in50
–*in69
) usingzero20
. - 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 callschkact
). - If no errors (
*in50 = *off
), callswinupd
to update the database and setswinagn
to*off
to exit.
- Calls
- Other (e.g., Enter): Calls
winedt
to validate input but does not update the database.
- Display Messages: If
-
Cursor Positioning: Commented-out code suggests cursor location (
row
,col
) could be calculated fromcsrloc
, but it is not currently used. -
Edit Window Input (
winedt
Subroutine): -
Calls
chkact
to perform validation, thoughchkact
is currently empty, indicating no specific input validation is implemented. -
Check Activity (
chkact
Subroutine): -
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).
-
Update Database (
winupd
Subroutine): -
Processes based on the function key:
- F22 (ReActivate):
- Chains to
bbslsm
usingklslsm
. - If the record exists (
*in99 = *off
) and is inactive (smdel = 'I'
), setssmdel
toA
(active), updates the record (bbslsmpf
), and setsp$flag
toA
. - F23 (InActivate):
- Chains to
bbslsm
usingklslsm
. - If the record exists (
*in99 = *off
) and is not already inactive (smdel ≠ 'I'
), setssmdel
toI
(inactive), updates the record (bbslsmpf
), and setsp$flag
toI
.
-
Message Handling:
- addmsg: Sends messages to the program message queue using
QMHSNDPM
, settingdspmsg
to*on
. - wrtmsg: Writes the message subfile control (
msgctl
) with*in49
enabled. -
clrmsg: Clears the message subfile using
QMHRMVPM
. Commented-out code for saving/restoringrcdnam
andpagrrn
suggests it was planned but not needed for the window format. -
Program Exit:
- 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 thePROFOUNDUI(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
andBB928
. Notably,*in72
and*in73
control the display of reactivation/inactivation options. - Field Prefixes: Follows the same naming conventions as
BB928P
andBB928
(e.g.,f$
for display fields,p$
for input parameters,o$
for output parameters). - Integration with BB928P:
BB9284
is called byBB928P
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 inBB928P
) 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.