Skip to content

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:

  1. File Initialization:
  2. 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 per JB01).
    • 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 (per JB03).
    • 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 (replaced GSTABL per JK01).
    • Output File:
    • INTRIT: Output file (O), 752 bytes, add capability (A), disk-based. Monitoring file for transaction tracking (per JB05).
  3. The program defines an array SEP (82 elements, 2 bytes each) for internal use (purpose unclear from snippet).

  4. Record Processing (INTRAN):

  5. Reads each record from INTRAN sequentially using the RPG cycle (NS 01).
  6. Key fields extracted:
    • REC (1–192), REC2 (193–392), REC3 (393–592): Record segments (per JB01).
    • 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 (for INTZH).
  7. The program evaluates transaction dates and types to determine output file placement.

  8. Date-Based Splitting (per JB02):

  9. Compares the transaction date (ICTOD8 from INCONT, today’s date in YYYYMMDD format) with the last inventory balancing date (ICLDA8 from INCONT).
  10. 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).
  11. If today is not closed, transactions are written to INTSXX by default.

  12. Receipt Processing (per JB03):

  13. Transactions identified as receipts (based on ITREC# or other criteria) are written to INTZH for future holding, ensuring they are processed in a later balancing cycle.

  14. Output Processing:

  15. 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).
  16. INTZXX:
    • Writes zero-amount transactions (EADD WRIT2).
    • Includes same fields as INTSXX but with file name INTZXX.
  17. INTZH:
    • Writes receipt transactions (EADD WRITH).
    • Includes same fields as INTSXX but with file name INTZH and receipt number (ITREC#).
  18. 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.
  19. Supporting File Access:

  20. Chains to INCONT to retrieve control data (e.g., ICTOD8, ICLDA8, ICTCTM, ICLTMC).
  21. Chains to INFRMP for ramp data (e.g., ITFRM).
  22. Chains to INTANK for tank data using TAKEY.
  23. Chains to ARCUST for customer data.
  24. Chains to GSPROD for product data (replaced GSTABL per JK01).

  25. Cycle Completion:

  26. Processes all INTRAN records, matching with supporting files as needed.
  27. Writes to INTSXX, INTZXX, INTZH, and INTRIT based on conditions.
  28. Terminates after processing, closing all files.

Business Rules

  1. Transaction Splitting:
  2. 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 (per JB03).
  3. Date-Based Logic (per JB02):

  4. If today is closed (inventory balanced), transactions are split based on date:
    • Transactions on or before the last balancing date (ICLDA8) go to INTSXX.
    • Transactions after ICLDA8 go to INTZXX.
  5. If today is not closed, all transactions go to INTSXX.

  6. Future Holding Receipts (per JB03):

  7. Receipt transactions (identified by ITREC# or other criteria) are written to INTZH for deferred processing in a future balancing cycle.

  8. Delete Code Handling (per JB04):

  9. Sets the delete code to blank in INTSXX records to ensure they are treated as active.

  10. Transaction Monitoring (per JB05):

  11. Writes monitoring records to INTRIT for every transaction processed (INTSXX, INTZXX, INTZH).
  12. Includes error code ('E' or blank), sequence numbers, and control fields to track potential issues.

  13. Inventory Balancing:

  14. 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.

  15. Product Data Source (per JK01):

  16. Uses GSPROD instead of GSTABL for product data, improving data consistency.

  17. No Report Generation (per JB01):

  18. A report of records added to INTSXX was commented out, focusing solely on file processing.

  19. Error Handling:

  20. Assumes input files exist and contain valid data.
  21. No explicit error handling for file access or processing failures.

Tables (Files) Used

  1. INTRAN:
  2. Description: Inventory transaction file.
  3. Attributes: 592 bytes per record, primary input file (IP), 5-byte alternate index, disk-based.
  4. 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.
  5. Purpose: Contains inventory transactions to be split.
  6. Usage: Read sequentially to process transactions.

  7. INCONT:

  8. Description: Invoice control file.
  9. Attributes: 512 bytes per record, update file (UF), 2-byte alternate index, disk-based.
  10. Fields Used:
    • ICTOD8: Today’s date (YYYYMMDD).
    • ICTCTM: Current time.
    • ICLDA8: Last balancing date (YYYYMMDD).
    • ICLTMC: Last balancing time.
  11. Purpose: Provides control data for date-based splitting.
  12. Usage: Chained for date and time information.

  13. INTSXX:

  14. Description: Temporary file for non-zero amount transactions.
  15. Attributes: 592 bytes per record, input file (IF), 5-byte alternate index, add capability (A), disk-based.
  16. Fields Used: Same as INTRAN, plus SEQ1, DATYMD, SYTIME, BATCH#, and control fields.
  17. Purpose: Stores non-zero amount transactions for immediate processing.
  18. Usage: Written with EADD WRIT1, delete code set to blank (per JB04).

  19. INTZXX:

  20. Description: Temporary file for zero-amount transactions.
  21. Attributes: 592 bytes per record, input file (IF), 5-byte alternate index, add capability (A), disk-based.
  22. Fields Used: Same as INTRAN, plus SEQ2, DATYMD, SYTIME, BATCH#, and control fields.
  23. Purpose: Stores zero-amount or deferred transactions.
  24. Usage: Written with EADD WRIT2.

  25. INFRMP:

  26. Description: Invoice ramp file.
  27. Attributes: 128 bytes per record, input file (IF), 13-byte alternate index, disk-based.
  28. Fields Used: ITFRM (from location/ramp).
  29. Purpose: Provides ramp-related data for transactions.
  30. Usage: Chained for ramp validation.

  31. INTZH:

  32. Description: Future holding file for receipts.
  33. Attributes: 592 bytes per record, input file (IF), 5-byte alternate index, add capability (A), disk-based.
  34. Fields Used: Same as INTRAN, plus SEQH, ITREC#, DATYMD, SYTIME, BATCH#, and control fields.
  35. Purpose: Stores receipt transactions for future processing.
  36. Usage: Written with EADD WRITH (per JB03).

  37. INTANK:

  38. Description: Inventory tank file.
  39. Attributes: 512 bytes per record, update file (UF), 19-byte alternate index, disk-based.
  40. Fields Used: TAKEY (tank key).
  41. Purpose: Contains tank data for inventory validation.
  42. Usage: Chained for tank information.

  43. ARCUST:

  44. Description: Accounts receivable customer file.
  45. Attributes: 384 bytes per record, input file (IF), 8-byte alternate index, disk-based.
  46. Purpose: Provides customer data for transaction processing.
  47. Usage: Chained for customer validation.

  48. GSPROD:

  49. Description: Product master file.
  50. Attributes: 512 bytes per record, input file (IF), 6-byte alternate index, disk-based.
  51. Purpose: Contains product master data (replaced GSTABL per JK01).
  52. Usage: Chained for product details.

  53. 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 (per JB05).

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.