Skip to content

List of Use Cases Implemented in the Call Stack

The call stack consists of three RPG programs: BB935P, BB935, and BB9354, which together manage product code cross-reference entries in a billing system. Below are the identified use cases based on the functionality provided by these programs:

  1. Browse and Filter Product Cross-Reference Entries (BB935P):
  2. Description: Allows users to view a list of product cross-reference records (BBPRXY) in a subfile, with filtering options by company, XRef set, product XRef, product, container, and quantity. Supports toggling between including/excluding deleted records.
  3. Actions: Browse records, reposition based on filters, select records for further actions (create, change, delete, display).
  4. Modes: Maintenance (MNT) for selecting actionable options; Inquiry (INQ) for view-only access.

  5. Create a New Product Cross-Reference Entry (BB935P → BB935):

  6. Description: Enables creation of a new product cross-reference record by specifying company, XRef set, and product XRef in the footer (option 1) or selecting option 1 on the subfile, then entering details in a single-record screen.
  7. Actions: Validates inputs, ensures record doesn’t exist or isn’t deleted, and writes a new record to BBPRXY.

  8. Change an Existing Product Cross-Reference Entry (BB935P → BB935):

  9. Description: Allows modification of an existing, non-deleted product cross-reference record by selecting option 2 on the subfile or footer, then editing fields (e.g., product, container, quantity) in a single-record screen.
  10. Actions: Validates inputs, updates the record if changed, and confirms the update.

  11. Delete a Product Cross-Reference Entry (BB935P → BB9354):

  12. Description: Marks an active product cross-reference record as deleted (BXDEL = 'D') by selecting option 4 on the subfile or footer, with a confirmation window.
  13. Actions: Verifies record existence, updates BXDEL, and confirms deletion.

  14. Reactivate a Deleted Product Cross-Reference Entry (BB935P → BB9354):

  15. Description: Reactivates a deleted product cross-reference record (BXDEL = 'D' to BXDEL = 'A') by selecting option 4 on a deleted record in the subfile, with a confirmation window.
  16. Actions: Verifies record is deleted, updates BXDEL, and confirms reactivation.

  17. Display a Product Cross-Reference Entry (BB935P → BB935):

  18. Description: Views details of a product cross-reference record in a read-only single-record screen by selecting option 5 on the subfile.
  19. Actions: Retrieves and displays record details without allowing edits.

  20. Prompt for Valid Field Values (BB935P, BB935):

  21. Description: Provides lookup functionality for fields like XRef set, product, and container to ensure valid entries during browsing or maintenance.
  22. Actions: Calls external programs (LGSTABL, LGSPROD, LGSCNTR1) to retrieve valid codes and descriptions.

These use cases cover the core functionality of browsing, managing, and validating product cross-reference entries, with BB935P handling the list interface, BB935 managing record-level create/change/display, and BB9354 focusing on delete/reactivate operations.


Functional Requirements: Product Cross-Reference Management Function

Overview

The ProductXRefManagement function manages product cross-reference records in a billing system, supporting creation, modification, deletion, reactivation, and display of records in the BBPRXY file, with validation against related master files (BICONT, GSPROD, GSCNTR1, GSTABL). It processes inputs programmatically, replacing interactive screen logic with a single function call, and operates in Maintenance (MNT) or Inquiry (INQ) mode.

Inputs

  • Company Code (P$CO, numeric): Identifies the company (validated against BICONT).
  • XRef Set (P$XSET, 6 chars): Cross-reference set identifier (validated against GSTABL for type BBXSET).
  • Product XRef (P$PXRC, 20 chars): Product cross-reference identifier.
  • Product Code (BXPROD, variable length): Product identifier (validated against GSPROD).
  • Container Code (BXCNTR, variable length): Container identifier (validated against GSCNTR1).
  • Quantity Type (BXQTTY, 1 char): Indicates quantity type ('Y' or 'N'; optional, validation commented out in original code).
  • Operation (OPERATION, string): Specifies action (CREATE, CHANGE, DELETE, REACTIVATE, DISPLAY).
  • Mode (P$MODE, 3 chars): MNT for edit operations, INQ for view-only.
  • File Group (P$FGRP, 1 char): Z or G for file library overrides (e.g., test vs. production).
  • Filter Options (for browse, optional):
  • Include Deleted (INCLUDE_DEL, boolean): True to include deleted records (BXDEL = 'D'), false to exclude.
  • Position Filters (company, XRef set, product XRef, product, container, quantity): For browsing records.

Outputs

  • Return Flag (P$FLAG, 1 char): Indicates result:
  • 1: Successful create or change.
  • D: Successful deletion.
  • A: Successful reactivation.
  • 0: No action or failure.
  • Error Messages (list of strings): Validation or processing errors.
  • Record Data (for DISPLAY or BROWSE, struct): Returns fields (company, XRef set, product XRef, product, container, quantity, descriptions, deletion status) for one or multiple records.
  • Company Name (BCNAME, variable length): Retrieved from BICONT.
  • Product Description (TPDESC, variable length): Retrieved from GSPROD.
  • Container Description (TCDESL, variable length): Retrieved from GSCNTR1.

Process Steps

  1. Apply File Overrides:
  2. Use P$FGRP (Z or G) to override file libraries (BICONT, BBPRXY, GSPROD, GSCNTR1, GSTABL) for environment-specific access (e.g., ZBICONT vs. GBICONT).

  3. Validate Inputs:

  4. Company: Chain to BICONT to verify existence; retrieve BCNAME. Return error ERR0010 if not found.
  5. XRef Set (for CREATE, CHANGE, BROWSE): Chain to GSTABL (type BBXSET) to validate; return error if invalid.
  6. Product (if provided): Chain to GSPROD to verify existence; retrieve TPDESC. Return error ERR0010 if not found.
  7. Container (if provided): Chain to GSCNTR1 to verify existence; retrieve TCDESL. Return error ERR0010 if not found.
  8. Quantity Type (if provided, commented in original): Must be 'Y' or 'N'; return error "Invalid Response...? or ?" if invalid.
  9. Record Existence (for CHANGE, DELETE, REACTIVATE, DISPLAY): Chain to BBPRXY with key (P$CO, P$XSET, P$PXRC). Return error ERR0102 if not found.
  10. Create Checks: For CREATE, ensure record doesn’t exist (ERR0101) or isn’t deleted (ERR0108).

  11. Process Operation:

  12. BROWSE:
    • Position to records in BBPRXY using filters (company, XRef set, product XRef, product, container, quantity).
    • Exclude deleted records (BXDEL = 'D') unless INCLUDE_DEL is true.
    • Retrieve up to 28 records (page size); fetch descriptions from GSPROD and GSCNTR1.
    • Return list of records with fields and descriptions.
  13. CREATE (MNT mode):
    • Validate inputs; ensure P$XSET and P$PXRC are provided (ERR0103 if missing).
    • Write new record to BBPRXY with BXDEL = 'A', BXCONO = P$CO, BXXSET = P$XSET, BXPXRC = P$PXRC, and other fields.
    • Set P$FLAG = '1'.
    • Return confirmation message: "Code [XSET]/[PXRC] has been created".
  14. CHANGE (MNT mode):
    • Validate record is not deleted (BXDEL ≠ 'D'; error ERR0108).
    • Update BBPRXY record with new BXPROD, BXCNTR, BXQTTY if changed.
    • Set P$FLAG = '1'.
    • Return confirmation message: "Code [XSET]/[PXRC] has been changed".
  15. DELETE (MNT mode):
    • Validate record is active (BXDEL ≠ 'D').
    • Update BBPRXY setting BXDEL = 'D'.
    • Set P$FLAG = 'D'.
    • Return confirmation message: "Code [XSET]/[PXRC] has been deleted".
  16. REACTIVATE (MNT mode):
    • Validate record is deleted (BXDEL = 'D').
    • Update BBPRXY setting BXDEL = 'A'.
    • Set P$FLAG = 'A'.
    • Return confirmation message: "Code [XSET]/[PXRC] has been reactivated".
  17. DISPLAY (INQ mode):

    • Retrieve record from BBPRXY; fetch descriptions from GSPROD, GSCNTR1.
    • Return record data without updates.
  18. Error Handling:

  19. Return error messages for invalid inputs or failed operations.
  20. Clear messages after processing.

  21. Return Results:

  22. Output P$FLAG, error messages, and record data (single record for CREATE, CHANGE, DELETE, REACTIVATE, DISPLAY; list for BROWSE).

Business Rules

  • Modes:
  • MNT: Allows CREATE, CHANGE, DELETE, REACTIVATE. Validates and updates BBPRXY.
  • INQ: Allows DISPLAY, BROWSE. No updates; read-only.
  • Record Status:
  • BXDEL = 'D' marks a deleted record; BXDEL = 'A' marks an active record.
  • Cannot change deleted records (ERR0108).
  • Cannot create if record exists (ERR0101) or is deleted (ERR0108).
  • Validation:
  • Company must exist in BICONT (ERR0010).
  • XRef set must exist in GSTABL (type BBXSET).
  • Product must exist in GSPROD (ERR0010).
  • Container must exist in GSCNTR1 (ERR0010).
  • Quantity type (if enforced) must be 'Y' or 'N'.
  • Browse:
  • Filters by company, XRef set, product XRef, product, container, quantity.
  • Excludes deleted records unless specified.
  • Maximum 28 records per call.
  • Messages:
  • Confirmations for create, change, delete, reactivate.
  • Errors for invalid inputs or operations (e.g., ERR0101, ERR0102, ERR0103, ERR0108, ERR0010).
  • File Overrides:
  • P$FGRP (Z or G) determines library (e.g., ZBICONT vs. GBICONT).

Calculations

  • Message Length: For error/confirmation messages, calculate length using %len(%trim(m@data)) for QMHSNDPM.
  • Timestamp: Current date/time (T#CYMD) retrieved via TIME opcode but not used in updates.
  • Record Comparison: For CHANGE, compare saved record (SVDS) with updated fields (WKDS01) to detect changes before updating.