GS9284 RPGLE
Process Steps of the RPG Program (GS9284)¶
The program GS9284 is an interactive RPG III program designed to handle the InActivate or ReActivate operations for Product/Container entries on an IBM i (AS/400) system. It is called from another program (e.g., GS928P, as referenced in the query) and operates on a single Product/Container record identified by input parameters (company, product, container). The program displays a window (ACTWDW) to confirm the InActivate or ReActivate action, updates the GSPRCT file accordingly, and returns a status flag to the caller. It uses a simple user interface with no subfile, focusing solely on toggling the ptdel
field between 'A' (active) and 'I' (inactive).
The high-level process flow is as follows:
- Initialization (*INZSR Subroutine):
- Receives entry parameters:
p$co
(company),p$prod
(product code),p$cntr
(container code),p$fgrp
(file group: 'G' or 'Z' for file overrides), andp$flag
(output flag to indicate action: 'I' for InActivate, 'A' for ReActivate). - Moves input parameters to display fields (
f$co
,f$prod
,f$cntr
). - Sets up work fields, key lists (for chaining to GSPRCT), and message handling fields.
- Initializes the window loop flag (
winagn
= *ON) and message queue fields. - Defines constants for function keys: F12 (exit), F22 (ReActivate), F23 (InActivate).
-
Prepares date validation parameters (though unused in this code).
-
Open Database Tables (OPNTBL Subroutine):
- Applies file overrides using QCMDEXC based on
p$fgrp
(e.g., overrides to GSPRCT as GGS for 'G' or ZGS for 'Z'). -
Opens the GSPRCT file (update/add mode with USROPN).
-
Retrieve Data (RTVDTA Subroutine):
- Chains to GSPRCT using the passed keys (
f$co
,f$prod
,f$cntr
). - If the record is found (IN99=OFF):
- If
ptdel
= 'I' (inactive), sets the window header to "Product/Cntr Entry ReActivate" (hdr(01)
), function key label to "F22=ReActivate" (fky(01)
), and enables F22 (IN72=ON). - Otherwise (active), sets the window header to "Product/Cntr Entry InActivate" (
hdr(02)
), function key label to "F23=InActivate" (fky(02)
), and enables F23 (IN73=ON).
- If
-
No action if the record is not found (no error message; proceeds to display window).
-
Process Window (PRCWDW Subroutine - Main Processing Loop):
- Enters a loop controlled by
winagn
:- Displays the message subfile if errors/messages exist (WRTMSG subroutine); otherwise, clears it (MSGCLR).
- Displays the window format (EXFMT ACTWDW).
- Clears the message subfile if displayed (CLRMSG subroutine).
- Clears error indicators (IN50-IN69).
- Processes user input:
- F12: Exits the loop (
winagn
= *OFF), effectively canceling the operation. - F22 or F23:
- Calls WINEDT (which invokes CHKACT, though CHKACT is empty/no-op).
- If no errors (IN50=OFF), updates the database (WINUPD subroutine) and exits the loop.
- Other (e.g., ENTER): Calls WINEDT (no-op since CHKACT is empty), loops again.
-
Loops until F12 or a successful F22/F23 action.
-
Edit Window Input (WINEDT and CHKACT Subroutines):
- WINEDT calls CHKACT, but CHKACT is empty (no validation logic implemented).
-
No input fields are validated in the window; the program relies on the function key pressed (F22/F23).
-
Update Database (WINUPD Subroutine):
- Processes based on the function key:
- F22 (ReActivate):
- Chains to GSPRCT.
- If record found and
ptdel
= 'I', setsptdel
= 'A' (active), updates the record, and setsp$flag
= 'A'. - No action if not found or not inactive.
- F23 (InActivate):
- Chains to GSPRCT.
- If record found and
ptdel
≠ 'I', setsptdel
= 'I' (inactive), updates the record, and setsp$flag
= 'I'. - No action if not found or already inactive.
-
No error messages are added if the chain fails or the status is inappropriate.
-
Error and Message Handling:
- Uses ADDMSG to send messages to the program message queue (QMHSNDPM), though no messages are explicitly added in this code.
- WRTMSG writes the message subfile; CLRMSG clears it (using QMHRMVPM).
-
No specific error handling (e.g., for invalid records or failed updates).
-
Program End:
- Closes all files.
- Sets INLR = ON and returns (with
p$flag
indicating 'A', 'I', or unchanged if no action).
The program is minimal, focusing solely on toggling the active/inactive status of a Product/Container record via a confirmation window. It assumes the calling program (e.g., GS928P) validates the record’s existence and appropriateness before calling.
Business Rules¶
- Purpose:
- Toggles the
ptdel
field in GSPRCT between 'A' (active) and 'I' (inactive) based on user action (F22 for ReActivate, F23 for InActivate). -
Returns a flag (
p$flag
) to indicate the action taken: 'A' for ReActivate, 'I' for InActivate, or unchanged (blank) if no update occurs. -
Validation Rules:
- No explicit input validation (CHKACT is empty; no checks on input fields or record state beyond
ptdel
). - For F22 (ReActivate): Only updates if the record exists and is currently inactive (
ptdel
= 'I'). - For F23 (InActivate): Only updates if the record exists and is not already inactive (
ptdel
≠ 'I'). -
No error messages for invalid scenarios (e.g., record not found or wrong status); simply skips the update.
-
Database Operations:
- Updates the
ptdel
field in GSPRCT; no other fields are modified. - No create or delete operations; only updates existing records.
-
Uses soft-delete logic (
ptdel
= 'I' for inactive, 'A' for active). -
User Interface Rules:
- Displays a confirmation window (ACTWDW) with dynamic headers and function key labels:
- If record is inactive: Shows "Product/Cntr Entry ReActivate" and enables F22.
- If active: Shows "Product/Cntr Entry InActivate" and enables F23.
- Function keys:
- F12: Cancels and exits without changes.
- F22: ReActivates the record (sets
ptdel
= 'A'). - F23: InActivates the record (sets
ptdel
= 'I').
-
No cursor positioning logic (commented out).
-
General:
- File overrides ensure data separation ('G' vs. 'Z' groups, likely for different environments/companies).
- Assumes the calling program provides valid keys and checks for record validity.
- No auditing/timestamps (e.g., no user or date updates in the record).
- Minimal error handling; relies on caller for feedback (e.g., GS928P adds confirmation messages like "has been InActivated").
Tables (Files) Used¶
The program uses the following files, overridden based on p$fgrp
(to GGS for 'G' or ZGS for 'Z'):
- GS9284D: Display file (CF - control format, E - external). Used for the confirmation window (ACTWDW) and message subfile.
- GSPRCT: Primary file (UF A - update full procedural with add, E - externally described, K - keyed). Used for chaining and updating the
ptdel
field.
All files are opened with USROPN and shared access controlled via overrides. No additional validation files (e.g., BICONT, GSPROD, GSCNTR1) are used, unlike GS928 or GS928P.
External Programs Called¶
The program does not call any external RPG or custom programs. It only uses system utilities (via CALL):
- QCMDEXC: Executes override commands for file redirection (GSPRCT to GGS or ZGS).
- QMHSNDPM: Sends messages to the program message queue (though no messages are sent in this code).
- QMHRMVPM: Removes messages from the program message queue.
No additional programs (e.g., for prompting or validation) are called, making this a lightweight, focused utility for status toggling.