IN190 RPG36
The IN190.rpg36.txt
RPG program is called by the IN190.ocl36.txt
OCL program within the invoice posting workflow on an IBM System/36 environment. Its primary function is to split inventory transactions from the INTRAN
file into separate files based on transaction type and date: non-zero amount transactions (INTSXX
), zero-amount transactions (INTZXX
), and future holding receipts (INTZH
). It also generates monitoring records in INTRIT
to track processing. The program ensures that sales transactions are not applied to inventory until the next balancing cycle, supporting accurate inventory management. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.
Process Steps of the IN190 RPG Program¶
The IN190
program processes inventory transactions from INTRAN
, evaluates their dates and types, and directs them to appropriate output files (INTSXX
, INTZXX
, INTZH
, INTRIT
). It uses supporting files (INCONT
, INFRMP
, INTANK
, ARCUST
, GSPROD
) for validation and additional data. The program includes revisions to handle extended record lengths, date-based splitting, future holding receipts, and monitoring.
Process Steps:¶
- File Initialization:
- The program opens the following files:
- Input Files:
INTRAN
: Primary input file (IP
), 592 bytes per record, 5-byte alternate index (AI
), disk-based. Contains inventory transactions (record length increased from 192 to 592 perJB01
).INCONT
: Update file (UF
), 512 bytes, 2-byte alternate index, disk-based. Contains invoice control data.INTSXX
: Input file (IF
), 592 bytes, 5-byte alternate index, add capability (A
), disk-based. Temporary file for non-zero amount transactions.INTZXX
: Input file (IF
), 592 bytes, 5-byte alternate index, add capability (A
), disk-based. Temporary file for zero-amount transactions.INFRMP
: Input file (IF
), 128 bytes, 13-byte alternate index, disk-based. Contains invoice ramp data.INTZH
: Input file (IF
), 592 bytes, 5-byte alternate index, add capability (A
), disk-based. Future holding file for receipts (perJB03
).INTANK
: Update file (UF
), 512 bytes, 19-byte alternate index, disk-based. Contains inventory tank data.ARCUST
: Input file (IF
), 384 bytes, 8-byte alternate index, disk-based. Contains accounts receivable customer data.GSPROD
: Input file (IF
), 512 bytes, 6-byte alternate index, disk-based. Contains product master data (replacedGSTABL
perJK01
).- Output File:
INTRIT
: Output file (O
), 752 bytes, add capability (A
), disk-based. Monitoring file for transaction tracking (perJB05
).
-
The program defines an array
SEP
(82 elements, 2 bytes each) for internal use (purpose unclear from snippet). -
Record Processing (INTRAN):
- Reads each record from
INTRAN
sequentially using the RPG cycle (NS 01
). - Key fields extracted:
REC
(1–192),REC2
(193–392),REC3
(393–592): Record segments (perJB01
).ITCLPR
(7–15): Client product code.TAKEY
(7–25): Tank key for level 1 (L1
) matching.COLOPR
(7–15): Company/client operation code.ITSE#
(2–6): Sequence number.ITFRM
(position 147): From location or ramp.ITREC#
(position 81): Receipt number (forINTZH
).
-
The program evaluates transaction dates and types to determine output file placement.
-
Date-Based Splitting (per JB02):
- Compares the transaction date (
ICTOD8
fromINCONT
, today’s date in YYYYMMDD format) with the last inventory balancing date (ICLDA8
fromINCONT
). - If today is closed (i.e., inventory balanced):
- Transactions dated after the last balancing date are written to
INTZXX
(zero-amount transactions, deferred until next balancing). - Transactions dated on or before the balancing date are written to
INTSXX
(non-zero amount transactions, processed immediately).
- Transactions dated after the last balancing date are written to
-
If today is not closed, transactions are written to
INTSXX
by default. -
Receipt Processing (per JB03):
-
Transactions identified as receipts (based on
ITREC#
or other criteria) are written toINTZH
for future holding, ensuring they are processed in a later balancing cycle. -
Output Processing:
- INTSXX:
- Writes non-zero amount transactions (
EADD WRIT1
). - Sets delete code to blank (per
JB04
). - Includes record segments
REC
,REC2
,REC3
, sequence number (SEQ1
), from location (ITFRM
), date (DATYMD
), time (SYTIME
), program name (IN190
), file name (INTSXX
), batch number (BATCH#
), and control fields (ICTOD8
,ICTCTM
,ICLDA8
,ICLTMC
).
- Writes non-zero amount transactions (
- INTZXX:
- Writes zero-amount transactions (
EADD WRIT2
). - Includes same fields as
INTSXX
but with file nameINTZXX
.
- Writes zero-amount transactions (
- INTZH:
- Writes receipt transactions (
EADD WRITH
). - Includes same fields as
INTSXX
but with file nameINTZH
and receipt number (ITREC#
).
- Writes receipt transactions (
-
INTRIT (per JB05):
- Writes monitoring records for all transactions (
EADD WRIT1
,WRIT2
,WRITH
). - Includes additional fields for tracking: error code (
'E'
or blank), sequence numbers (SEQ1
,SEQ2
,SEQH
), and control fields. - Purpose: Monitors transactions for potential issues during processing.
- Writes monitoring records for all transactions (
-
Supporting File Access:
- Chains to
INCONT
to retrieve control data (e.g.,ICTOD8
,ICLDA8
,ICTCTM
,ICLTMC
). - Chains to
INFRMP
for ramp data (e.g.,ITFRM
). - Chains to
INTANK
for tank data usingTAKEY
. - Chains to
ARCUST
for customer data. -
Chains to
GSPROD
for product data (replacedGSTABL
perJK01
). -
Cycle Completion:
- Processes all
INTRAN
records, matching with supporting files as needed. - Writes to
INTSXX
,INTZXX
,INTZH
, andINTRIT
based on conditions. - Terminates after processing, closing all files.
Business Rules¶
- Transaction Splitting:
-
Splits
INTRAN
transactions into:INTSXX
: Non-zero amount transactions for immediate processing.INTZXX
: Zero-amount transactions or those dated after the last inventory balancing, deferred to the next cycle.INTZH
: Receipt transactions for future holding (perJB03
).
-
Date-Based Logic (per JB02):
- If today is closed (inventory balanced), transactions are split based on date:
- Transactions on or before the last balancing date (
ICLDA8
) go toINTSXX
. - Transactions after
ICLDA8
go toINTZXX
.
- Transactions on or before the last balancing date (
-
If today is not closed, all transactions go to
INTSXX
. -
Future Holding Receipts (per JB03):
-
Receipt transactions (identified by
ITREC#
or other criteria) are written toINTZH
for deferred processing in a future balancing cycle. -
Delete Code Handling (per JB04):
-
Sets the delete code to blank in
INTSXX
records to ensure they are treated as active. -
Transaction Monitoring (per JB05):
- Writes monitoring records to
INTRIT
for every transaction processed (INTSXX
,INTZXX
,INTZH
). -
Includes error code (
'E'
or blank), sequence numbers, and control fields to track potential issues. -
Inventory Balancing:
-
Ensures sales transactions are not applied to inventory until the next balancing cycle (typically after 7 AM or midnight the previous day), maintaining inventory accuracy.
-
Product Data Source (per JK01):
-
Uses
GSPROD
instead ofGSTABL
for product data, improving data consistency. -
No Report Generation (per JB01):
-
A report of records added to
INTSXX
was commented out, focusing solely on file processing. -
Error Handling:
- Assumes input files exist and contain valid data.
- No explicit error handling for file access or processing failures.
Tables (Files) Used¶
- INTRAN:
- Description: Inventory transaction file.
- Attributes: 592 bytes per record, primary input file (
IP
), 5-byte alternate index, disk-based. - Fields Used:
REC
(1–192),REC2
(193–392),REC3
(393–592): Record segments.ITCLPR
(7–15): Client product code.TAKEY
(7–25): Tank key.COLOPR
(7–15): Company/client operation code.ITSE#
(2–6): Sequence number.ITFRM
(147): From location/ramp.ITREC#
(81): Receipt number.
- Purpose: Contains inventory transactions to be split.
-
Usage: Read sequentially to process transactions.
-
INCONT:
- Description: Invoice control file.
- Attributes: 512 bytes per record, update file (
UF
), 2-byte alternate index, disk-based. - Fields Used:
ICTOD8
: Today’s date (YYYYMMDD).ICTCTM
: Current time.ICLDA8
: Last balancing date (YYYYMMDD).ICLTMC
: Last balancing time.
- Purpose: Provides control data for date-based splitting.
-
Usage: Chained for date and time information.
-
INTSXX:
- Description: Temporary file for non-zero amount transactions.
- Attributes: 592 bytes per record, input file (
IF
), 5-byte alternate index, add capability (A
), disk-based. - Fields Used: Same as
INTRAN
, plusSEQ1
,DATYMD
,SYTIME
,BATCH#
, and control fields. - Purpose: Stores non-zero amount transactions for immediate processing.
-
Usage: Written with
EADD WRIT1
, delete code set to blank (perJB04
). -
INTZXX:
- Description: Temporary file for zero-amount transactions.
- Attributes: 592 bytes per record, input file (
IF
), 5-byte alternate index, add capability (A
), disk-based. - Fields Used: Same as
INTRAN
, plusSEQ2
,DATYMD
,SYTIME
,BATCH#
, and control fields. - Purpose: Stores zero-amount or deferred transactions.
-
Usage: Written with
EADD WRIT2
. -
INFRMP:
- Description: Invoice ramp file.
- Attributes: 128 bytes per record, input file (
IF
), 13-byte alternate index, disk-based. - Fields Used:
ITFRM
(from location/ramp). - Purpose: Provides ramp-related data for transactions.
-
Usage: Chained for ramp validation.
-
INTZH:
- Description: Future holding file for receipts.
- Attributes: 592 bytes per record, input file (
IF
), 5-byte alternate index, add capability (A
), disk-based. - Fields Used: Same as
INTRAN
, plusSEQH
,ITREC#
,DATYMD
,SYTIME
,BATCH#
, and control fields. - Purpose: Stores receipt transactions for future processing.
-
Usage: Written with
EADD WRITH
(perJB03
). -
INTANK:
- Description: Inventory tank file.
- Attributes: 512 bytes per record, update file (
UF
), 19-byte alternate index, disk-based. - Fields Used:
TAKEY
(tank key). - Purpose: Contains tank data for inventory validation.
-
Usage: Chained for tank information.
-
ARCUST:
- Description: Accounts receivable customer file.
- Attributes: 384 bytes per record, input file (
IF
), 8-byte alternate index, disk-based. - Purpose: Provides customer data for transaction processing.
-
Usage: Chained for customer validation.
-
GSPROD:
- Description: Product master file.
- Attributes: 512 bytes per record, input file (
IF
), 6-byte alternate index, disk-based. - Purpose: Contains product master data (replaced
GSTABL
perJK01
). -
Usage: Chained for product details.
-
INTRIT:
- Description: Inventory transaction item monitoring file.
- Attributes: 752 bytes per record, output file (
O
), add capability (A
), disk-based. - Fields Used:
REC
,REC2
,REC3
,SEQ1
,SEQ2
,SEQH
,ITFRM
,ITREC#
,DATYMD
,SYTIME
,BATCH#
,ICTOD8
,ICTCTM
,ICLDA8
,ICLTMC
, error code ('E'
or blank). - Purpose: Tracks transactions for monitoring and debugging.
- Usage: Written with
EADD WRIT1
,WRIT2
,WRITH
(perJB05
).
External Programs Called¶
The IN190
RPG program does not explicitly call any external programs. It is a self-contained program that processes input from INTRAN
and supporting files and writes to output files.
Summary¶
The IN190
RPG program, called by IN190.ocl36.txt
, splits inventory transactions by:
- Reading INTRAN
transactions and matching with INCONT
, INFRMP
, INTANK
, ARCUST
, and GSPROD
.
- Splitting transactions based on date and type:
- Non-zero amount transactions to INTSXX
(delete code blank per JB04
).
- Zero-amount or post-balancing transactions to INTZXX
(per JB02
).
- Receipt transactions to INTZH
(per JB03
).
- Writing monitoring records to INTRIT
for all transactions (per JB05
).
- Using date comparisons (ICTOD8
vs. ICLDA8
) to defer transactions until the next inventory balancing cycle.
- Terminating after processing all records.
Tables Used: INTRAN
(input transactions), INCONT
(invoice control), INTSXX
(non-zero transactions), INTZXX
(zero-amount transactions), INFRMP
(ramp data), INTZH
(future receipts), INTANK
(tank data), ARCUST
(customer data), GSPROD
(product master), INTRIT
(monitoring).
External Programs Called: None.
This program ensures accurate inventory management by deferring sales transactions until the next balancing cycle and supporting receipt processing, with robust monitoring for troubleshooting.