List of Use Cases Implemented by the Program Call Stack¶
The RPGLE programs (BB929P
, BB929
, BB9294
, BB9295
) collectively form an interactive application for managing Customer Service Representative (CSR) IDs within the Billing and Invoicing system. The following use cases are implemented:
- List and Select CSR Records:
- Description: Users can view a subfile list of CSR records, filtered to include all records (active and inactive), and select records for further actions (create, change, inactivate/reactivate, display, or print).
- Program:
BB929P
-
Details: Displays a subfile with company number, CSR ID, name, email, and status. Users can position the list by company or CSR ID, refresh the list, or toggle between folded/unfolded views (though F8 is disabled in Profound UI). Supports direct access to create or modify records.
-
Create a New CSR Record:
- Description: Users can create a new CSR record by specifying company number, CSR ID, name, and email address.
- Program:
BB929
(called byBB929P
with option 1) -
Details: Validates that the company exists and the record does not already exist, then writes a new record with status
A
(active). -
Modify an Existing CSR Record:
- Description: Users can update the name or email address of an existing, active CSR record.
- Program:
BB929
(called byBB929P
with option 2) -
Details: Ensures the record is not inactive or deleted before allowing changes. Key fields (company, CSR ID) are protected.
-
Inactivate or Reactivate a CSR Record:
- Description: Users can toggle a CSR record's status between active (
A
) and inactive (I
). - Program:
BB9294
(called byBB929P
with option 4) -
Details: Allows reactivation (F22) if the record is inactive or inactivation (F23) if the record is active. Includes a placeholder for checking dependencies (e.g., vendor table), but no validation is implemented.
-
Display a CSR Record:
- Description: Users can view the details of a CSR record in read-only mode.
- Program:
BB929
(called byBB929P
with option 5) -
Details: Displays record details without allowing modifications.
-
Print a CSR ID Listing:
- Description: Users can generate a printed report of all CSR records, including company, CSR ID, name, email, and status.
- Program:
BB9295
(called byBB929P
with F15) - Details: Produces a formatted report with headers and detail lines, sent to a spooled printer file.
Function Requirement Document: CSR Record Management Function¶
CSR Record Management Function Requirements¶
Overview¶
The manageCSRRecord
function handles the creation, modification, inactivation, reactivation, and retrieval of Customer Service Representative (CSR) records in the Billing and Invoicing system. It processes inputs programmatically without screen interaction, updating or retrieving data from the bbcsr
file and validating against the bicont
file.
Inputs¶
- company (numeric): Company number.
- csrId (string): CSR ID.
- mode (string, enum:
CREATE
,UPDATE
,INACTIVATE
,REACTIVATE
,RETRIEVE
): Operation mode. - fileGroup (string, enum:
Z
,G
): File group for database library selection. - csrName (string, optional): CSR name (required for
CREATE
andUPDATE
). - email (string, optional): Email address (required for
CREATE
andUPDATE
).
Outputs¶
- status (string, enum:
SUCCESS
,ERROR
): Operation outcome. - flag (string, enum:
1
,A
,I
,E
, null): Return flag (1
for create/update success,A
for reactivation,I
for inactivation,E
for error, null for retrieval or failure). - message (string): Success or error message.
- record (object, optional): Retrieved CSR record details (for
RETRIEVE
mode).
Process Steps¶
- Validate File Group:
-
Ensure
fileGroup
isZ
orG
. If invalid, returnstatus=ERROR
,message="Invalid file group"
. -
Apply Database Overrides:
- Redirect
bbcsr
togbbcsr
(iffileGroup=G
) orzbcsr
(iffileGroup=Z
). -
Redirect
bicont
togbicont
orzbicont
accordingly. -
Validate Company:
-
Check if
company
exists inbicont
. If not, returnstatus=ERROR
,message="Invalid company number"
. -
Process by Mode:
- CREATE:
- Validate
csrName
andemail
are non-blank. If blank, returnstatus=ERROR
,message="CSR name and email required"
. - Check if record (
company
,csrId
) exists inbbcsr
. If exists, returnstatus=ERROR
,message="CSR ID already exists"
. - Write new record to
bbcsr
withcrdel=A
(active),crco=company
,crcrid=csrId
,crcrnm=csrName
,cremal=email
. - Return
status=SUCCESS
,flag=1
,message="CSR <csrId> created"
.
- Validate
- UPDATE:
- Validate
csrName
andemail
are non-blank. If blank, returnstatus=ERROR
,message="CSR name and email required"
. - Chain to
bbcsr
usingcompany
,csrId
. If not found orcrdel
isD
orI
, returnstatus=ERROR
,message="Cannot modify inactive or deleted record"
. - Update
bbcsr
withcrcrnm=csrName
,cremal=email
. - Return
status=SUCCESS
,flag=1
,message="CSR <csrId> updated"
.
- Validate
- INACTIVATE:
- Chain to
bbcsr
. If not found orcrdel=I
, returnstatus=ERROR
,message="Record not found or already inactive"
. - Check for dependencies (placeholder, not implemented). If dependencies exist, return
status=ERROR
,flag=E
,message="CSR <csrId> cannot be inactivated due to dependencies"
. - Update
bbcsr
withcrdel=I
. - Return
status=SUCCESS
,flag=I
,message="CSR <csrId> inactivated"
.
- Chain to
- REACTIVATE:
- Chain to
bbcsr
. If not found orcrdel<>I
, returnstatus=ERROR
,message="Record not found or not inactive"
. - Update
bbcsr
withcrdel=A
. - Return
status=SUCCESS
,flag=A
,message="CSR <csrId> reactivated"
.
- Chain to
- RETRIEVE:
- Chain to
bbcsr
. If not found, returnstatus=ERROR
,message="Record not found"
. - Return
status=SUCCESS
,record={company, csrId, csrName, email, status}
.
- Chain to
Business Rules¶
- Data Validation:
- Company number must exist in
bicont
. - CSR name and email must be non-blank for
CREATE
andUPDATE
. - CSR record must not exist for
CREATE
. - CSR record must be active (
crdel=A
) forUPDATE
orINACTIVATE
. -
CSR record must be inactive (
crdel=I
) forREACTIVATE
. -
Status Management:
- New records are created with
crdel=A
(active). - Inactivation sets
crdel=I
. Reactivation setscrdel=A
. -
Deleted records (
crdel=D
) cannot be modified. -
File Group:
-
fileGroup
determines the database library (Z
forzbcsr
/zbicont
,G
forgbbcsr
/gbicont
). -
Dependency Check:
-
Inactivation should check for dependencies (e.g., vendor table usage), but this is not implemented (returns
flag=E
if added). -
Error Handling:
- Returns descriptive error messages for invalid inputs, non-existent records, or invalid status changes.
Calculations¶
- No complex calculations are performed. The function primarily manages data validation, record retrieval, and updates to the
crdel
field.
Notes¶
- The function assumes programmatic input instead of interactive screen input, consolidating the logic of
BB929
,BB9294
, and part ofBB929P
. - The printing use case (
BB9295
) is excluded, as it requires a separate function for report generation. - The placeholder dependency check in
INACTIVATE
mode should be implemented to validate against related tables (e.g., vendor table).