Skip to content

BI890 RPG36

The BI890.rpg36.txt is an RPG/400 (RPG III) program named BI890, designed for the Brandford Order Entry / Invoices system on an IBM AS/400 (iSeries) platform. It serves as a "Ship to Master File Maintenance Screen" program, providing an interactive interface for maintaining and inquiring about ship-to master records, including customer, address, product, and accessorial/marks data. The program uses a display file with multiple screen formats to handle user interactions. Below, I will explain the process steps, business rules, tables used, and external programs called, based on the provided RPG source code.

Process Steps

The program follows a structured flow to manage ship-to master records, organized into subroutines and screen formats. The steps are inferred from the provided code, focusing on the input/output specifications, arrays, and subroutines like FILARA and GETSUP.

  1. Initialization:
  2. Parameters: The program is called via the OCL program BI890.ocl36.txt with parameters (e.g., '?9?' for library identifier, 'INQ' for inquiry mode), though not explicitly defined in the RPG code.
  3. File Setup: Opens input files (SHIPTO, ARCUST, ARCUPR, GSPROD, GSTABL, BICONT) and the display file (SCREEN) with workstation support.
  4. Arrays and Data Structures:
    • COM: 14 elements, 40 characters each, for messages.
    • S4HD: 2 elements, 31 characters each, for screen 4 headers.
    • NOT: 2 elements, 20 characters each, for notes status descriptions.
    • CSPR, SCPR: 24 elements, 4 characters each, for ship-to product codes.
    • PRCD: 16 elements, 4 characters each, for product codes from GSTABL.
    • PRDS: 16 elements, 30 characters each, for product descriptions.
    • CNTY: 16 elements, 1 character each, for container type (JB04).
    • GLCD: 16 elements, 1 character each, for gallons to bill (net/gross).
    • STNO: 16 elements, 20 characters each, for stock numbers.
    • PFRC: 16 elements, 1 character each, for freight codes.
    • PSFR: 16 elements, 1 character each, for separate freight flags.
    • PCAF: 16 elements, 1 character each, for calculate freight flags.
  5. Screen Formats:

    • BI890S01: Input screen for company (CO), customer (CUST), and ship-to (SHIP).
    • BI890S02: Maintenance screen for ship-to details (name, address, product codes, etc.).
    • BI890S04: Product pricing screen (displays PRCD, PRDS, GLCD, etc.).
    • BI890S05: Accessorial/marks screen (order marks, invoice marks, dispatch info, etc.).
  6. Open Database and Display Files:

  7. Opens SHIPTO (2048 bytes, keyed by CSKEY), ARCUST (384 bytes), ARCUPR (80 bytes, keyed by company, customer, ship-to, container type), GSPROD (512 bytes, keyed by product code), GSTABL (256 bytes), and BICONT (256 bytes) for input.
  8. Opens SCREEN as a workstation file with support for roll keys (KINFSR ROLLSR) and information data structure (KINFDS INFDS).

  9. Screen Processing (BI890S01):

  10. Displays the initial input screen (BI890S01) to capture:
    • CO (company, 2 digits).
    • CUST (customer, 6 digits).
    • SHIP (ship-to, 3 digits).
    • COCUST (company/customer key, 8 digits).
    • SCKEY (screen key, 11 digits).
  11. Validates input fields (e.g., CO, CUST, SHIP) against BICONT, ARCUST, and SHIPTO.
  12. Displays error messages (e.g., "INVALID CUSTOMER NUMBER", "SHIP TO NOT FOUND") if validation fails.

  13. Ship-to Record Retrieval:

  14. Chains to SHIPTO using CSKEY (company, customer, ship-to) to retrieve ship-to details.
  15. Populates fields like CSNAME, CSADR1-4, CSZIP5, CSMILS, CSSTAT, CSALTO, CSPR01-24 (product codes), CSSBKP, CSDLOC, CSBCUS, CSBCSH, CSBMCU, CSRRCO, CSCOON, CSCTY, CSEXPO, CSFOB, CSCTST, CSCSZP, CSLONG, CSLATT, etc.
  16. If the record is deleted (CSDEL = 'D'), displays "THIS SHIP TO WAS PREVIOUSLY DELETED" and allows reactivation ("PREVIOUS SHIP TO WAS REACTIVATED").

  17. Fill Product Arrays (FILARA Subroutine):

  18. All Products (if SCPRYN ≠ 'Y'):
    • Reads GSPROD records for the company (TPCONO = CO) where TPSELL = 'Y'.
    • Populates PRCD (product code), PRDS (description), and chains to ARCUPR to retrieve GLCD (gallons to bill), STNO (stock number), PFRC (freight code), PSFR (separate freight), and PCAF (calculate freight).
    • Limits to 16 products (X up to 17, breaking at 17).
  19. Selected Products (if SCPRYN = 'Y'):
    • Uses SCPR (screen product codes, 24 elements) from BI890S02.
    • Chains to GSPROD for each SCPR value to retrieve TPDESC (description).
    • Chains to ARCUPR to retrieve GLCD, STNO, PFRC, PSFR, PCAF.
    • Limits to 15 products (X up to 15).
  20. Sets *IN84 if products are found (X > 0).
  21. Stores container type (CNTY) as blank (JB04).

  22. Accessorial/Marks Processing (GETSUP Subroutine):

  23. Moves SHIPTO fields to screen fields for display on BI890S05:
    • CSOMK1-4 (order marks), CSIMK1-2 (invoice marks), CSDSP1-4 (dispatch info), CSBMK1-4 (bill of lading marks), CSFRNM (freight bill name), CSFRA1-3 (freight bill address), CSNOTE (note status), CSCSID (customer ship-to ID).
  24. Previously stored in BBSHSP (now obsolete, DC01).

  25. Screen Maintenance (BI890S02):

  26. Displays ship-to details (CSNAME, CSADR1-4, CSCTST, CSSTAT, CSCSZP, CSMILS, CSEXPO, CSFOB, CSCOON, CSSBKP, CSDLOC, CSBCUS, CSBCSH, CSBMCU, CSRRCO, CSCTY, CSLONG, CSLATT, CSITLO, CSITTK, CSDTLO, CSDTTK, CSROUT, CSRDAY, CSRCMX, CSSVFE).
  27. Allows updates to these fields in maintenance mode.
  28. Displays messages (MSG3, MSG4) for errors or status.

  29. Product Pricing Screen (BI890S04):

  30. Displays product codes (PRCD), descriptions (PRDS), gallons to bill (GLCD, 'N' for net, 'G' for gross), stock numbers (STNO), freight codes (PFRC), separate freight (PSFR), and calculate freight (PCAF).
  31. Displays customer (CUST), ship-to (SHIP), and name (NAME).
  32. Shows header (S4HEAD) with billing instructions.

  33. Accessorial/Marks Screen (BI890S05):

  34. Displays order marks (OMK1-4), invoice marks (IMK1-2), dispatch info (DSP1-4), bill of lading marks (BMK1-4), freight bill details (FRNM, FRA1-3), note status (NOTE), and customer ship-to ID (CSID).
  35. Displays error message (MSG1) if needed.

  36. External Program Calls:

    • Calls BB800E (DC02) for ship-to accessorial/marks inquiry.
    • Calls BI907AC (JB05) to view ARCUPR records instead of using BI890S04.
    • Calls BI9002 for customer ship-to address file maintenance (JB01).
  37. Program Termination:

    • Closes all files and ends when the user exits (e.g., F3 key, KG indicator).

Business Rules

  1. Operation Modes:
  2. Supports inquiry and maintenance modes (based on INQ or MNT parameter from BI890P via OCL).
  3. Inquiry mode (*IN70) protects fields from updates.
  4. Maintenance mode allows updates to SHIPTO fields (e.g., CSNAME, CSADR1-4, CSPR01-24).

  5. Validation:

  6. Validates company (CO) against BICONT. If invalid, displays "INVALID CUSTOMER NUMBER" (message 9).
  7. Validates customer (CUST) against ARCUST. If invalid, displays "INVALID CUSTOMER NUMBER".
  8. Validates ship-to (SHIP) against SHIPTO. If not found, displays "SHIP TO NOT FOUND" (message 2).
  9. Prevents use of ship-to number 999 ("SHIPTO # 999 MAY NOT BE USED", message 13).
  10. Checks for deleted ship-to records (CSDEL = 'D') and allows reactivation ("PREVIOUS SHIP TO WAS REACTIVATED", message 10).
  11. Ensures file positioning does not exceed file limits ("END OF FILE REACHED", message 12; "BEGINNING OF FILE REACHED", message 14).

  12. Product Handling:

  13. Displays all sellable products (TPSELL = 'Y') from GSPROD or selected products from SCPR (up to 24).
  14. Retrieves pricing data (GLCD, STNO, PFRC, PSFR, PCAF) from ARCUPR for each product.
  15. Supports container type (CNTY) in ARCUPR key (JB04).

  16. Accessorial/Marks:

  17. Stores and displays order marks, invoice marks, dispatch info, bill of lading marks, and freight bill details (DC01, moved from BBSHSP to SHIPTO).
  18. Supports note status (CSNOTE, e.g., "RECORD IS DONE", "RECORD IS IN EXCEL").

  19. Navigation:

  20. Supports roll keys (*IN55) for scrolling through records.
  21. Uses function keys (e.g., F3 for exit, inferred from KG indicator).
  22. Allows direct access to ship-to records via CO, CUST, SHIP.

  23. Error Handling:

  24. Displays messages (MSG1, MSG2, MSG3, MSG4) on screens for validation errors or status updates.
  25. Uses COM array for predefined messages.

Tables (Files) Used

The program uses the following database files (tables): 1. SHIPTO: Ship-to master file (2048 bytes, keyed by CSKEY [company, customer, ship-to], input, supports add/update). - Fields: CSDEL, CSCO, CSCUST, CSSHIP, CSNAME, CSADR1-4, CSZIP5, CSMILS, CSSTAT, CSALTO, CSPR01-24, CSSBKP, CSDLOC, CSBCUS, CSBCSH, CSBMCU, CSRRCO, CSCOON, CSCTY, CSEXPO, CSFOB, CSCTST, CSCSZP, CSLONG, CSLATT, CSOMK1-4, CSIMK1-2, CSDSP1-4, CSBMK1-4, CSFRNM, CSFRA1-3, CSCSID, CSFCCD, CSNOTE, CSITLO, CSITTK, CSDTLO, CSDTTK, CSROUT, CSRDAY, CSRCMX, CSSVFE. 2. ARCUST: Customer master file (384 bytes, keyed, input). - Fields: ARDEL (delete flag). 3. ARCUPR: Customer pricing file (80 bytes, keyed by company, customer, ship-to, container type, input). - Fields: CPGLCD, CPCSTK, CPFRCD, CPSFRT, CPCAFR. 4. GSPROD: Product master file (512 bytes, keyed by product code, input). - Fields: TPCONO, TPSELL, TPPROD, TPDESC. 5. GSTABL: General system table (256 bytes, keyed, input). - Fields: Product codes (TBCODE at positions 12-13). 6. BICONT: Contract/company master file (256 bytes, keyed, input). - Used for company validation.

External Programs Called

The program calls the following external programs: 1. BB800E: Displays ship-to accessorial/marks inquiry (DC02, replacing BI8901). 2. BI907AC: Views ARCUPR records for pricing data (JB05, replacing BI890S04). 3. BI9002: Maintains customer ship-to addresses (JB01).

Summary

The BI890 program is an interactive tool for maintaining and inquiring about ship-to master records, supporting: - Input and validation of company, customer, and ship-to numbers. - Maintenance of ship-to details (name, address, product codes, accessorial/marks). - Display of product pricing (ARCUPR) and accessorial/marks data (BI890S05). - Integration with external programs (BB800E, BI907AC, BI9002) for additional functionality. - Robust validation (e.g., preventing ship-to 999, handling deleted records). - Multiple screen formats (BI890S01, BI890S02, BI890S04, BI890S05) for user interaction.

The program uses six files (SHIPTO, ARCUST, ARCUPR, GSPROD, GSTABL, BICONT) and supports both inquiry and maintenance modes, with revisions (e.g., DC01, JB04, JB05, MG06) enhancing functionality like address reformatting, container type support, and railcar weight tracking.

If you need further details or analysis of specific subroutines or related programs, please let me know!