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.
- Initialization:
- Parameters: The program is called via the OCL program
BI890.ocl36.txtwith parameters (e.g.,'?9?'for library identifier,'INQ'for inquiry mode), though not explicitly defined in the RPG code. - File Setup: Opens input files (
SHIPTO,ARCUST,ARCUPR,GSPROD,GSTABL,BICONT) and the display file (SCREEN) with workstation support. - 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 fromGSTABL.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.
-
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 (displaysPRCD,PRDS,GLCD, etc.).BI890S05: Accessorial/marks screen (order marks, invoice marks, dispatch info, etc.).
-
Open Database and Display Files:
- Opens
SHIPTO(2048 bytes, keyed byCSKEY),ARCUST(384 bytes),ARCUPR(80 bytes, keyed by company, customer, ship-to, container type),GSPROD(512 bytes, keyed by product code),GSTABL(256 bytes), andBICONT(256 bytes) for input. -
Opens
SCREENas a workstation file with support for roll keys (KINFSR ROLLSR) and information data structure (KINFDS INFDS). -
Screen Processing (
BI890S01): - 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).
- Validates input fields (e.g.,
CO,CUST,SHIP) againstBICONT,ARCUST, andSHIPTO. -
Displays error messages (e.g., "INVALID CUSTOMER NUMBER", "SHIP TO NOT FOUND") if validation fails.
-
Ship-to Record Retrieval:
- Chains to
SHIPTOusingCSKEY(company, customer, ship-to) to retrieve ship-to details. - 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. -
If the record is deleted (
CSDEL = 'D'), displays "THIS SHIP TO WAS PREVIOUSLY DELETED" and allows reactivation ("PREVIOUS SHIP TO WAS REACTIVATED"). -
Fill Product Arrays (
FILARASubroutine): - All Products (if
SCPRYN ≠ 'Y'):- Reads
GSPRODrecords for the company (TPCONO = CO) whereTPSELL = 'Y'. - Populates
PRCD(product code),PRDS(description), and chains toARCUPRto retrieveGLCD(gallons to bill),STNO(stock number),PFRC(freight code),PSFR(separate freight), andPCAF(calculate freight). - Limits to 16 products (
Xup to 17, breaking at 17).
- Reads
- Selected Products (if
SCPRYN = 'Y'):- Uses
SCPR(screen product codes, 24 elements) fromBI890S02. - Chains to
GSPRODfor eachSCPRvalue to retrieveTPDESC(description). - Chains to
ARCUPRto retrieveGLCD,STNO,PFRC,PSFR,PCAF. - Limits to 15 products (
Xup to 15).
- Uses
- Sets
*IN84if products are found (X > 0). -
Stores container type (
CNTY) as blank (JB04). -
Accessorial/Marks Processing (
GETSUPSubroutine): - Moves
SHIPTOfields to screen fields for display onBI890S05: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).
-
Previously stored in
BBSHSP(now obsolete, DC01). -
Screen Maintenance (
BI890S02): - 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). - Allows updates to these fields in maintenance mode.
-
Displays messages (
MSG3,MSG4) for errors or status. -
Product Pricing Screen (
BI890S04): - 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). - Displays customer (
CUST), ship-to (SHIP), and name (NAME). -
Shows header (
S4HEAD) with billing instructions. -
Accessorial/Marks Screen (
BI890S05): - 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). -
Displays error message (
MSG1) if needed. -
External Program Calls:
- Calls
BB800E(DC02) for ship-to accessorial/marks inquiry. - Calls
BI907AC(JB05) to viewARCUPRrecords instead of usingBI890S04. - Calls
BI9002for customer ship-to address file maintenance (JB01).
- Calls
-
Program Termination:
- Closes all files and ends when the user exits (e.g., F3 key,
KGindicator).
- Closes all files and ends when the user exits (e.g., F3 key,
Business Rules¶
- Operation Modes:
- Supports inquiry and maintenance modes (based on
INQorMNTparameter fromBI890Pvia OCL). - Inquiry mode (
*IN70) protects fields from updates. -
Maintenance mode allows updates to
SHIPTOfields (e.g.,CSNAME,CSADR1-4,CSPR01-24). -
Validation:
- Validates company (
CO) againstBICONT. If invalid, displays "INVALID CUSTOMER NUMBER" (message 9). - Validates customer (
CUST) againstARCUST. If invalid, displays "INVALID CUSTOMER NUMBER". - Validates ship-to (
SHIP) againstSHIPTO. If not found, displays "SHIP TO NOT FOUND" (message 2). - Prevents use of ship-to number 999 ("SHIPTO # 999 MAY NOT BE USED", message 13).
- Checks for deleted ship-to records (
CSDEL = 'D') and allows reactivation ("PREVIOUS SHIP TO WAS REACTIVATED", message 10). -
Ensures file positioning does not exceed file limits ("END OF FILE REACHED", message 12; "BEGINNING OF FILE REACHED", message 14).
-
Product Handling:
- Displays all sellable products (
TPSELL = 'Y') fromGSPRODor selected products fromSCPR(up to 24). - Retrieves pricing data (
GLCD,STNO,PFRC,PSFR,PCAF) fromARCUPRfor each product. -
Supports container type (
CNTY) inARCUPRkey (JB04). -
Accessorial/Marks:
- Stores and displays order marks, invoice marks, dispatch info, bill of lading marks, and freight bill details (DC01, moved from
BBSHSPtoSHIPTO). -
Supports note status (
CSNOTE, e.g., "RECORD IS DONE", "RECORD IS IN EXCEL"). -
Navigation:
- Supports roll keys (
*IN55) for scrolling through records. - Uses function keys (e.g., F3 for exit, inferred from
KGindicator). -
Allows direct access to ship-to records via
CO,CUST,SHIP. -
Error Handling:
- Displays messages (
MSG1,MSG2,MSG3,MSG4) on screens for validation errors or status updates. - Uses
COMarray 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!