GSDT12 RPG36
The provided document, GSDT12.rpg36.txt
, is an RPG (Report Program Generator) program for the IBM System/36 environment (or AS/400 in compatibility mode), named GSDT12
. It is invoked by the OCL script GSDT12.ocl36.txt
, which is called by SA505C.ocl36.txt
with parameter 'G'
within the PRICES.ocl36.txt
workflow, part of the PRICEGEN.clp
pricing generation process for blended lubes. The program processes date-related data, likely prompting for or calculating a date range for the Customer Shipping Analysis Report, and updates the Local Data Area (LDA) with start and end dates (FRDT8
, TODT8
). Below, I will explain the process steps, business rules, tables used, and external programs called, despite the truncation in the document.
Process Steps of the RPG Program¶
- File Definitions:
- Input File:
ARCONT
(Input Primary,IP
, 256 bytes, indexed with 2-byte key, disk): Contract master file, mapped to?9?ARCONT
(e.g.,AARCONT
), shared mode .
-
User Data Structure (UDS):
YY
(124–125): Year (YY) for start date.MM
(126–127): Month (MM) for start date.DD
(128–129): Day (DD) for start date.NWYY
(130–131): Year (YY) for end date.NWMM
(132–133): Month (MM) for end date.NWDD
(134–135): Day (DD) for end date.FRDT8
(175–182): Start date (CYMD, CCYYMMDD).TODT8
(183–190): End date (CYMD, CCYYMMDD).Y2KCEN
(509–510): Century for Y2K compliance.Y2KCMP
(511–512): Company-specific century.
-
Input Specifications:
- ARCONT (record type
NS 01
):ACDEL
(1): Delete code (indicates if the record is active or deleted).
-
UDS Fields:
- Input fields (
YY
,MM
,DD
,NWYY
,NWMM
,NWDD
) likely set by user input or prior programs. - Output fields (
FRDT8
,TODT8
) store calculated start and end dates in CYMD format.
- Input fields (
-
Calculation Specifications:
- Initialization:
TIME TIMDAT
: Gets system time (TIMDAT
, 12 digits, YYMMDDHHMMSS).MOVELTIMDAT SYTIME
: Moves time toSYTIME
(6 digits, HHMMSS).MOVE TIMDAT SYDATE
: Moves date toSYDATE
(6 digits, YYMMDD).SYDATE MULT 10000.01 SYDYMD
: ConvertsSYDATE
to YMD format with century (CCYYMMDD).MOVELSYDATE NWMM
: Moves month toNWMM
.MOVE SYDATE NWYY
: Moves year toNWYY
.Z-ADDSYDATE MDY
: MovesSYDATE
toMDY
(6 digits, MMDDYY).EXSR GETDT
: Calls theGETDT
subroutine to calculate dates.
- GETDT Subroutine:
- Calculates the end date (
TODT8
) based on the start date (FRDT8
or inputYY
,MM
,DD
). - Logic for end date calculation:
- If
DD = 1
:- If
MM = 12
: SetsNWYY = YY + 1
,NWMM = 1
. - Else: Increments
MM
by 1. - Sets
DD = 1
.
- If
- Sets
NWDD
based on month:- For months 1, 3, 5, 7, 8, 10, 12:
NWDD = 31
. - For month 2:
NWDD = 29
(no leap year check shown in provided code). - For months 4, 6, 9, 11:
NWDD = 30
.
- For months 1, 3, 5, 7, 8, 10, 12:
- Formats dates:
MOVEL20 FRDT8
: Sets century to 20 forFRDT8
(Y2K compliance).MOVEL20 TODT8
: Sets century to 20 forTODT8
.MOVELYY FRDT4
: BuildsFRDT4
(YYYYMM).MOVE MM FRDT4
: Adds month toFRDT4
.MOVELFRDT4 FRDT6
: BuildsFRDT6
(YYYYMMDD).MOVE DD FRDT6
: Adds day toFRDT6
.MOVE FRDT6 FRDT8
: FinalizesFRDT8
(CCYYMMDD).- Similar steps for
TODT8
usingNWYY
,NWMM
,NWDD
.
- Calculates the end date (
-
Finalization:
SETON LR
: Sets Last Record indicator to end processing.
-
Output Specifications:
- No explicit output file writes; updates are made to the LDA (
FRDT8
,TODT8
) for use by subsequent programs (e.g.,SA505C
,SA505X
).
Business Rules¶
- Purpose: Calculates or validates a date range for the Customer Shipping Analysis Report, setting
FRDT8
(start date) andTODT8
(end date) in the LDA, likely based on user input (YY
,MM
,DD
) or system date, usingARCONT
for company-specific context. - Date Calculation:
- Uses system date (
SYDATE
) as a baseline. - Calculates end date (
TODT8
) as the last day of the same or next month, depending on input:- If start day is 1, sets end date to the first day of the next month.
- Assigns
NWDD
based on month (31 for January, March, May, July, August, October, December; 29 for February; 30 for April, June, September, November).
- Formats dates in CYMD (CCYYMMDD) with century hardcoded as 20 for Y2K compliance.
- Y2K Compliance:
- Handles century (
Y2KCEN
,Y2KCMP
) to ensure correct date formatting. - Hardcodes century as 20, indicating processing for post-2000 dates.
- Context: Called by
SA505C.ocl36.txt
with parameter'G'
, initializing date parameters for filtering sales data inSA505X
,SA505C
, and subsequent programs. - Output: Updates LDA fields
FRDT8
andTODT8
, used by other programs for date range filtering (e.g.,KYFRDT
,KYTODT
inSA505C
,SA505X
).
Tables (Files) Used¶
- ARCONT (
?9?ARCONT
): - Access: Input Primary (
IP
), shared mode. - Purpose: Contract master file, likely used to validate company-specific data or provide context, though no specific fields are processed in the provided code.
External Programs Called¶
- None: The
GSDT12
program does not call external programs. It uses the internalGETDT
subroutine for date calculations.
Additional Notes¶
- Context: Invoked by
GSDT12.ocl36.txt
withinSA505C.ocl36.txt
, setting date parameters for the Customer Shipping Analysis Report workflow, part ofPRICES.ocl36.txt
. - System/36 Environment: Uses RPG II/III syntax, likely on AS/400.
- Truncation: The document is truncated, but key sections (
F
,I
,C
) provide sufficient detail. Missing code likely includes additional validation or user prompting logic. - Error Handling: Minimal error handling; relies on System/36 for file errors and assumes valid input in the LDA.
- Relation to Other Programs: Provides
FRDT8
andTODT8
forSA505C
,SA505X
, and others, ensuring consistent date filtering across the workflow. - Y2K Considerations: Hardcodes century as 20, which may limit processing for dates before 2000 or after 2099.
If you have the RPG source code for SA505E
, SA505J
, or SA505L
, or need further analysis of the pricing workflow, please provide those details! Let me know if you have additional questions or files to share.