Skip to content

BI947 OCL

The provided document, BI947.ocl36.txt, is an Operation Control Language (OCL) program for an IBM System/36 or AS/400 environment. It is designed to print a "Freight Table Master File by Carrier ID" and is likely the main processing step called by the previously analyzed BI947P.ocl36.txt and BI947P.rpg36.txt. Below, I’ll explain the process steps, business rules, external programs called, and tables/files used.


Process Steps of the OCL Program

The OCL program orchestrates the preparation, sorting, and processing of data to generate a freight table report sorted by carrier ID. Here’s a step-by-step breakdown of the process:

  1. Initial File Cleanup:
  2. IF DATAF1-?9?FRTRAT DELETE ?9?FRTRAT,F1: Deletes the file ?9?FRTRAT (likely a temporary or output file) if it exists, where ?9? is a parameter (e.g., a library name).
  3. IF DATAF1-?9?BICUFRO DELETE ?9?BICUFRO,F1: Deletes the file ?9?BICUFRO if it exists.
  4. CLRPFM ?9?FR947XL: Clears the physical file ?9?FR947XL, preparing it for new data.

  5. Set Local Variables for Sorting:

  6. IF ?L'111,3'?/CO LOCAL OFFSET-1,DATA-'IAC': If the parameter at position 111 (length 3) equals 'CO', sets a local variable at offset 1 to 'IAC' (likely a sort control value for company-specific processing).
  7. ELSE LOCAL OFFSET-1,DATA-'I*C': Otherwise, sets the variable to 'I*C' (for all companies or a different sort mode).
  8. IF ?L'123,3'?/SEL LOCAL OFFSET-4,DATA-'O COAC': If the parameter at position 123 (length 3) equals 'SEL', sets a local variable at offset 4 to 'O COAC' (indicating selective carrier processing).
  9. ELSE LOCAL OFFSET-4,DATA-'O*CO*C': Otherwise, sets it to 'OCOC' (for all carriers).

  10. Sort Input Data:

  11. LOAD #GSORT: Loads the system sort utility (#GSORT) to sort the input file.
  12. FILE NAME-INPUT,LABEL-?9?BICUFR,DISP-SHR: Specifies the input file ?9?BICUFR (shared read mode).
  13. FILE NAME-OUTPUT,LABEL-?9?BI947S,RECORDS-999000,EXTEND-999000,RETAIN-J: Defines the output file ?9?BI947S with a capacity of 999,000 records, extensible by 999,000, and retained as a job file.
  14. RUN with sort specifications:
    • HSORTR 20A 3X 640 N: Defines a sort header with a 20-byte ascending sort key, 3 control fields, and a maximum record length of 640 bytes, with no sequence checking (N).
    • Sort keys:
    • ?L'4,3'? 16 21NEC?L'126,6'?: Sorts on a 3-byte field (likely company number) and a 6-byte field (carrier ID) if non-blank.
    • Multiple similar lines check carrier IDs at positions 132, 138, 144, 150, 156, 162, 168, 174, and 180.
    • Inclusion criteria (I*):
    • I C 1NECD: Includes records where position 1 is not 'D' (not deleted).
    • ?L'1,3'? 2 3EQC?L'114,2'?, etc.: Includes records matching company numbers at positions 114, 116, or 118.
    • Output control (O*):
    • IOC 1NECD: Outputs records where position 1 is not 'D'.
    • Matches company numbers as above.
    • Field definitions (FNC, FDC):
    • FNC 2 3 COMPANY #: Company number (positions 2–3).
    • FNC 16 21 CARRIER ID: Carrier ID (positions 16–21).
    • FNC 4 9 CUSTOMER #: Customer number (positions 4–9).
    • FNC 10 12 SHIP TO #: Ship-to number (positions 10–12).
    • FNC 13 15 LOCATION: Location (positions 13–15).
    • FDC 1 256, FDC 257 512, FDC 513 640: Copies full record segments (1–256, 257–512, 513–640).
  15. END: Completes the sort operation.

  16. Run the Report Program:

  17. LOAD BI947: Loads the RPG program BI947 for report generation.
  18. File definitions:
    • BICUFR,LABEL-?9?BI947S: The sorted file from the previous step.
    • ARCUST,LABEL-?9?ARCUST,DISP-SHRRM: Customer master file (shared read mode).
    • BICONT,LABEL-?9?BICONT,DISP-SHRRM: Freight table master file.
    • GSTABL,LABEL-?9?GSTABL,DISP-SHRRM: General table file.
    • BBCAID,LABEL-?9?BBCAID,DISP-SHRRM: Carrier ID file.
    • SHIPTO,LABEL-?9?SHIPTO,DISP-SHRRM: Ship-to file.
    • FR947XL,LABEL-?9?FR947XL,DISP-SHR: Output file for the report.
    • Additional files for MBBFR1:
    • GSUMCV, BBCFSH, BBCFSD1, BBNDFI2, BBRCSC2: Likely used by MBBFR1 for additional data (e.g., summary, freight, or customer data).
  19. RUN: Executes the BI947 program with the specified files.

  20. Cleanup:

  21. SWITCH 00000000: Resets all job switches to zero.
  22. LOCAL BLANK-*ALL: Clears all local variables, ensuring a clean job exit.

Business Rules

  1. File Preparation:
  2. Temporary/output files (?9?FRTRAT, ?9?BICUFRO, ?9?FR947XL) are cleared or deleted to ensure fresh data processing.
  3. Sort Criteria:
  4. Records are sorted by company number and carrier ID, with optional filtering by specific company numbers (KYCO1, KYCO2, KYCO3) and carrier IDs.
  5. Excludes deleted records (BCDEL ≠ 'D').
  6. Supports selective (SEL) or all (ALL) carrier processing based on KYALCS.
  7. Company Selection:
  8. If KYALCO = 'CO', processes specific companies; otherwise, processes all companies.
  9. Output File:
  10. The sorted data is written to ?9?BI947S, which is used as input for the BI947 program.
  11. Report Generation:
  12. The BI947 program generates the final report, using multiple files for cross-referencing (e.g., customer, carrier, ship-to data).

External Programs Called

  1. #GSORT: The system sort utility, used to sort the ?9?BICUFR file into ?9?BI947S based on company number, carrier ID, and other fields.
  2. BI947: The main RPG program that processes the sorted file (?9?BI947S) and generates the freight table report.
  3. MBBFR1 (implied): Not explicitly called in the OCL but referenced via file definitions, suggesting it may be invoked by BI947 for additional processing (e.g., freight calculations or summaries).

Tables/Files Used

  1. Input Files:
  2. ?9?BICUFR: Input freight table file for sorting (shared read).
  3. ?9?ARCUST: Customer master file (shared read).
  4. ?9?BICONT: Freight table master file (shared read).
  5. ?9?GSTABL: General table file (shared read).
  6. ?9?BBCAID: Carrier ID file (shared read).
  7. ?9?SHIPTO: Ship-to file (shared read).
  8. ?9?GSUMCV, ?9?BBCFSH, ?9?BBCFSD1, ?9?BBNDFI2, ?9?BBRCSC2: Additional files for MBBFR1 (shared read).

  9. Output Files:

  10. ?9?BI947S: Sorted output file from #GSORT (999,000 records, job-retained).
  11. ?9?FR947XL: Output file for the report (shared).
  12. ?9?FRTRAT, ?9?BICUFRO: Temporary files, deleted if they exist.

Summary

  • Process Steps:
  • Delete/clear temporary files (?9?FRTRAT, ?9?BICUFRO, ?9?FR947XL).
  • Set local variables for sort control based on KYALCO and KYALCS.
  • Sort ?9?BICUFR into ?9?BI947S using #GSORT, filtering out deleted records and selecting by company/carrier.
  • Run BI947 with sorted and master files to generate the report.
  • Reset switches and clear variables.
  • Business Rules:
  • Clear temporary files for fresh processing.
  • Sort by company number and carrier ID, excluding deleted records.
  • Support selective or all company/carrier processing.
  • Generate a report using multiple cross-referenced files.
  • External Programs:
  • #GSORT (sort utility).
  • BI947 (report generator).
  • MBBFR1 (implied, likely called by BI947).
  • Tables/Files:
  • Input: BICUFR, ARCUST, BICONT, GSTABL, BBCAID, SHIPTO, GSUMCV, BBCFSH, BBCFSD1, BBNDFI2, BBRCSC2.
  • Output: BI947S, FR947XL, FRTRAT, BICUFRO.

This OCL program coordinates the sorting and reporting process, leveraging BI947P for input validation and BI947 for final report generation. If you have the BI947 RPG code or additional details, I can provide further insights!