BI944A RPG36
The provided document, BI944A.rpg36.txt, is an RPG (Report Program Generator) program for the IBM System/36 environment, named BI944A. It is invoked by the OCL script BI944B.ocl36.txt as part of the pricing generation process for blended lubes, initiated by PRICEGEN.clp. The program appears to process contract data from the BICONT file, setting up a key date (KYDAT8) based on the system date and handling century logic for year 2000 (Y2K) compliance. Below, I will explain the process steps, business rules, tables used, and external programs called .
Process Steps of the RPG Program¶
- File Definition:
-
The
Fspecification defines theBICONTfile:- Access: Input mode (
IF) with fixed-length records of 256 bytes. - Type: Disk file, likely a physical file.
- Indexing:
2AIindicates an indexed file with 2 keys for access. - Usage: The file is used for reading contract data, as indicated by the input mode and
READoperation.
- Access: Input mode (
-
Input Specifications:
- The
Ispecifications define the record format for theBICONTfile (record typeNS):BCDEL(1): Delete code (likely'D'for deleted records).BCCO(2–3): Company number.BCNAME(4–33): Company name.
- User Data Structure (
UDS):KYDAT8(333–340): An 8-digit field to store a key date (likely in CYMD format, e.g., CCYYMMDD).Y2KCEN(509–510): A 2-digit field for the century (e.g.,'19'for 1900s).Y2KCMP(511–512): A 2-digit field for comparison year (e.g.,'80'for Y2K pivot year).
-
These fields are used to manage date processing and Y2K logic.
-
Initialization:
Z-ADD00 BILIM 20: InitializesBILIM(a 2-digit field) to zero. This field is used as a record limit or counter for theSETLLoperation.BILIM SETLLBICONT: Positions the file pointer at the start of theBICONTfile (likely using the index) to prepare for reading records.-
READ BICONT 20: Reads the first record fromBICONT, setting indicator20if the end of file is reached or an error occurs. -
Date Processing and Y2K Logic:
Z-ADD*ZERO KYDAT8: InitializesKYDAT8to zero.UDATE MULT 10000.01 KYDAT6 60: Converts the system date (UDATE, typically in YYMMDD format) to a 6-digit field (KYDAT6) by multiplying by 10000.01. This operation is unusual and may be a workaround to format the date, though it could result in a value likeYYMMDD.00.Z-ADDKYDAT6 KYDAT8: MovesKYDAT6toKYDAT8(8 digits), likely to store the date in CYMD format.- Y2K century logic:
UYEAR IFGE Y2KCMP B2: Checks if the system year (UYEAR, 2 digits) is greater than or equal toY2KCMP(e.g.,'80').- If true:
Z-ADDY2KCEN UCN 20setsUCN(2 digits) toY2KCEN(e.g.,'19'for 1900s). - If false:
1 ADD Y2KCEN UCNincrementsY2KCENby 1 (e.g.,'19'becomes'20'for 2000s). MOVELUCN KYDAT8 80: Moves the century (UCN) into the first two digits ofKYDAT8, forming a full CYMD date (e.g.,19YYMMDDor20YYMMDD).
-
This logic ensures the date in
KYDAT8is Y2K-compliant by adding the correct century. -
Program Termination:
SETON LR: Sets the Last Record indicator (LR), signaling the end of the program. This ensures the program terminates after processing the date logic, likely because it only needs to set upKYDAT8for use by subsequent programs or processes.
Business Rules¶
- Purpose: The program processes the
BICONTfile to initialize a key date (KYDAT8) for use in the pricing generation process, ensuring Y2K-compliant date handling by determining the correct century (1900s or 2000s) for the system date. - Date Processing:
- The system date (
UDATE, YYMMDD) is converted to a Y2K-compliant 8-digit date (KYDAT8, CCYYMMDD). - The century is determined by comparing the system year (
UYEAR) to a pivot year (Y2KCMP, e.g.,'80'):- If
UYEAR≥Y2KCMP, useY2KCEN(e.g.,'19'for 1900s). - If
UYEAR<Y2KCMP, useY2KCEN + 1(e.g.,'20'for 2000s).
- If
- File Access: The program reads the
BICONTfile but does not modify it, suggesting it may validate the file’s existence or prepare for subsequent processing by other programs. - Context in Pricing Generation: As part of the
BI944Bprocess (withinPRICEGEN.clp),BI944Alikely sets up date parameters for contract-related pricing data, which are used by later programs (BI9443,BI9444,BI944) to populate?9?BICUAGPwith blended lubes pricing. - Minimal Record Processing: The program reads only one record from
BICONT(or positions the file pointer), indicating it may primarily serve to initializeKYDAT8rather than process all contract records.
Tables (Files) Used¶
- BICONT: The only file explicitly used in the program.
- Access: Input mode (
IF), shared read mode with record locking (DISP-SHRRMfrom the OCL script). - Purpose: Read contract data (company number, name, delete code) to position the file or validate its existence.
- Label:
?9?BICONT(e.g.,ABICONTif&P$GRP='A'fromPRICEGEN.clp).
External Programs Called¶
- None: The
BI944ARPG program does not explicitly call any external programs or subroutines within the provided code. It performs internal logic to set upKYDAT8and terminates.
Additional Notes¶
- Context with BI944B.ocl36: The
BI944Aprogram is invoked byBI944B.ocl36as the first program after clearing?9?BICUAGP. It likely prepares date parameters for subsequent steps in the blended lubes pricing process, using?9?BICONT(e.g.,ABICONT). - Y2K Compliance: The program’s focus on century logic reflects its design to handle dates around the year 2000 transition, ensuring correct century prefixes (e.g.,
19or20) for dates inKYDAT8. - Limited Functionality: The program’s minimal logic (reading one record, setting a date, and terminating) suggests it is a preparatory step, possibly validating the
BICONTfile or setting a global date parameter in the user data structure (UDS) for use by later programs. - System/36 Environment: The use of RPG II/III and OCL indicates a legacy System/36 environment, possibly running on an AS/400 in compatibility mode.
- Potential Issues: The
UDATE MULT 10000.01 KYDAT6operation is unusual and may not produce the expected result (e.g., converting YYMMDD to a usable format). It could be a typo or a System/36-specific convention, but typically,UDATEis already in YYMMDD format, and the multiplication may be unnecessary or incorrect. - Error Handling: The program lacks explicit error handling for file access or invalid data, relying on the System/36 environment or the calling OCL (
BI944B.ocl36) to manage errors.
If you have the RPG source code for BI9443, BI9444, BI944, or the remaining procedures (BI942E, PRICES), or need further analysis of how BI944A integrates with the pricing generation workflow, please provide those details! Let me know if you have additional questions or files to share.