Skip to content

BB1014 RPGLE

The BB1014.rpgle.txt document is an RPGLE (RPG IV) program called from the BB101.ocl36.txt OCL program in an IBM System/36 or AS/400 (now IBM i) environment. It is a shared component of the BB101, BB495, and BB500 programs, designed to retrieve location information from the INLOC file based on company and location codes. The program was last noted with a reminder to synchronize changes across all three programs (TLN-GSS, 12/06/99). Below is a detailed explanation of the process steps, business rules, tables (files) used, and external programs called.


Process Steps of the RPGLE Program

The BB1014 program retrieves and formats location data (name, phone number, and inventory type) from the INLOC file and returns it to the calling program via a parameter data structure. The steps are as follows:

  1. Program Initialization:
  2. The program defines the INLOC file as input-only (512 bytes, indexed, key length 5, starting at position 2).
  3. A parameter data structure PARMS4 is defined to receive and return data:
    • @4CONO (positions 1-2, 2 digits): Company number.
    • @4LOC (positions 3-5, 3 characters): Location code.
    • @4LINT (position 6, 1 character): Inventory type (e.g., '', 'D', 'P').
    • @4LOCN (positions 7-26, 20 characters): Location name.
    • @4LOCP (positions 27-40, 14 characters): Location phone number.
  4. A secondary data structure PHONE formats the phone number:
    • PARL (position 1, '('): Left parenthesis.
    • ILAREA (positions 2-4, 3 digits): Area code.
    • PARR (positions 5-6, ') '): Right parenthesis and space.
    • ILTEL3 (positions 7-9, 3 digits): Phone number prefix.
    • DASH (position 10, '-'): Hyphen.
    • ILTEL4 (positions 11-14, 4 digits): Phone number suffix.
  5. Input specifications for INLOC:

    • ILDEL (position 1, 1 character): Delete code ('D' for deleted).
    • ILCONO (positions 2-3, 2 digits): Company number.
    • ILLOC (positions 4-6, 3 characters): Location code.
    • ILNAME (positions 7-26, 20 characters): Location name.
    • ILTELE (positions 363-372, 10 digits): Telephone number.
    • ILAREA (positions 363-365, 3 digits): Area code.
    • ILTEL3 (positions 366-368, 3 digits): Phone number prefix.
    • ILTEL4 (positions 369-372, 4 digits): Phone number suffix.
    • ILINTY (position 458, 1 character): Inventory type.
  6. Parameter Input and Key Construction:

  7. Receives input parameters via PARMS4 (@4CONO, @4LOC) through the *ENTRY PLIST (line 0033).
  8. Constructs a 5-character key (LOCKEY) by combining @4CONO (company number) and @4LOC (location code, lines 0039-0040).

  9. Retrieve Location Information:

  10. Chains to the INLOC file using LOCKEY (company/location, line 0045).
  11. If no record is found (indicator 91):
    • Clears @4LOCN (location name), @4LOCP (phone number), and @4LINT (inventory type) to blanks (lines 0012, 0072, JB).
  12. If a record is found (N91):

    • Moves ILNAME to @4LOCN (location name, line 0012).
    • Checks if ILTELE (telephone number) is zero:
    • If zero, clears @4LOCP to blanks.
    • If non-zero, moves the formatted PHONE structure to @4LOCP (line JB).
    • Moves ILINTY to @4LINT (inventory type, line JB).
  13. Phone Number Formatting:

  14. Initializes the PHONE structure with formatting characters:
    • PARL = '(' (line 0034).
    • PARR = ') ' (line 0034).
    • DASH = '-' (line 0034).
  15. Populates ILAREA, ILTEL3, and ILTEL4 from INLOC when a record is found, creating a formatted phone number (e.g., (123) 456-7890).

  16. Program Termination:

  17. Sets the last record indicator (LR, line 0061) to exit the program.
  18. Returns the updated PARMS4 data structure (@4LOCN, @4LOCP, @4LINT) to the calling program.

Business Rules

The program enforces the following business rules:

  1. Location Record Existence:
  2. The program requires a valid company (@4CONO) and location (@4LOC) combination to exist in the INLOC file.
  3. If no record is found (indicator 91), the output fields (@4LOCN, @4LOCP, @4LINT) are cleared to blanks.

  4. Data Retrieval:

  5. Retrieves the location name (ILNAME), inventory type (ILINTY), and telephone number (ILTELE) from INLOC for valid records.
  6. Formats the telephone number into a standard format ((area) prefix-suffix) if non-zero; otherwise, returns blanks.

  7. Consistency Across Programs:

  8. Changes to BB1014 must be synchronized with BB495 and BB500 to ensure consistent location data retrieval across all three programs (TLN-GSS, 12/06/99).

  9. No Validation of Delete Code:

  10. The program does not explicitly check the ILDEL field (delete code) in INLOC, assuming the calling program handles validation of active records.

  11. No Error Messaging:

  12. The program does not generate or display error messages, relying on the calling program (BB101, BB495, or BB500) to handle invalid or missing data.

Tables (Files) Used

The program interacts with the following file:

  1. INLOC: Input-only file for inventory location data (512 bytes, indexed, key length 5, starting at position 2).
  2. Fields:
    • ILDEL (position 1, 1 character): Delete code.
    • ILCONO (positions 2-3, 2 digits): Company number.
    • ILLOC (positions 4-6, 3 characters): Location code.
    • ILNAME (positions 7-26, 20 characters): Location name.
    • ILTELE (positions 363-372, 10 digits): Telephone number (subfields: ILAREA, ILTEL3, ILTEL4).
    • ILINTY (position 458, 1 character): Inventory type (e.g., '', 'D', 'P').

External Programs Called

The BB1014 RPGLE program does not call any external programs. All processing is handled internally through file operations and data formatting.


Summary

The BB1014 RPGLE program, called from the BB101.ocl36.txt OCL program, retrieves location information (name, phone number, and inventory type) from the INLOC file for use in BB101, BB495, and BB500. It chains to INLOC using a company/location key, formats the phone number, and returns data via a parameter data structure. Business rules ensure valid records are retrieved and formatted, with changes requiring synchronization across related programs. The program interacts solely with the INLOC file and does not call external programs, relying on internal logic for all operations.