Skip to content

GL210 RPG36

The GL210.rpg36.txt RPG program is called by the main OCL program (likely BB600.ocl36.txt) within the invoice posting workflow on an IBM System/36 environment. Its primary function is to create general ledger (G/L) detail table entries by processing records from the GLDETLTR file and writing them to the GLDETL file. It uses the GLCONT file for control data and generates detailed G/L entries for accounting purposes. The program handles transaction amounts, discounts, and various identifiers to ensure accurate G/L integration. Below is a detailed explanation of the process steps, business rules, tables used, and external programs called.


Process Steps of the GL210 RPG Program

The GL210 program reads records from GLDETLTR, processes them to create G/L detail entries, and writes them to GLDETL. It uses GLCONT for control information and includes detailed fields for transaction tracking.

  1. File Initialization:
  2. The program opens the following files:
    • Input Files:
    • GLDETLTR: Primary input file (IPE), 512 bytes per record, disk-based. Contains G/L transaction records.
    • GLCONT: Input file (IC), 256 bytes, 2-byte alternate index, disk-based. Contains G/L control data.
    • Output File:
    • GLDETL: Output file (O), 132 bytes, add capability (A), disk-based. Stores G/L detail entries.
  3. Defines record format for GLDETLTR (NS 01):

    • ADCO (7–8, 47–48, 49–50): Company number (multiple positions, likely for different contexts).
    • ADCUST (9–14): Customer number.
    • COCUST (9–14): Combined company and customer number.
    • ADINV# (15–21): Invoice number.
    • ADMISC (22–26): Transaction amount (8 digits, 2 decimals, packed).
    • ADDISC (27–30): Transaction discount (5 digits, 1 decimal, packed).
    • ADGLCR (31–38): G/L credit amount.
    • ADGLDR (39–46): G/L debit account.
    • ADGLC6 (32–37): G/L credit amount (alternate format, 5 digits, 2 decimals).
    • ADGLD6 (40–45): G/L debit account (alternate format, 5 digits, 3 decimals).
    • ADJRDT (52–57): Journal date.
    • ADNAME (51–75): Customer name.
    • ADSHIP (76–78): Ship-to code.
    • ADORDN (79–84): Order number.
    • ADSRN (85–87): Sales representative number.
    • ADIND8 (88–95): Invoice date (8 digits).
    • ADSHD8 (96–103): Ship date (8 digits).
    • ADSLMN (104–105): Salesman number.
    • ADDSEQ (106–108): Detail sequence number.
    • ADITEM (109–121): Item number.
    • ADLOC (109–111): Location code.
    • ADPROD (109–121): Product code.
    • ADTANK (122–125): Tank code.
    • ADCNTR (126–128): Container code.
    • ADTAXC (129–132): Tax code.
  4. Record Processing (GLDETLTR):

  5. Reads each record from GLDETLTR sequentially using the RPG cycle (NS 01).
  6. Chains to GLCONT using a 2-byte alternate index to retrieve control data (e.g., company-specific G/L settings, CRCO).

  7. G/L Detail Entry Creation:

  8. Writes records to GLDETL using exception output (E) specifications at lines 31 or 33:

    • Common Fields:
    • 'A': Entry type (position 1).
    • CRCO: Company number (from GLCONT).
    • KYJRNL: Journal number.
    • DORC: Debit or credit indicator.
    • CRAMT: Credit amount (packed).
    • ADJRD8: Journal date (8 digits).
    • ADPGM: Program name (likely GL210).
    • SYDT: System date.
    • RCTY: Record type.
    • ADINV#: Invoice number.
    • ADCUST: Customer number.
    • ADSHIP: Ship-to code.
    • ADORDN: Order number.
    • ADSRN: Sales representative number.
    • ADIND8: Invoice date.
    • ADSHD8: Ship date.
    • ADSLMN: Salesman number.
    • ADDSEQ: Detail sequence number.
    • ADLOC: Location code.
    • ADPROD: Product code.
    • ADTANK: Tank code.
    • ADCNTR: Container code.
    • ADTAXC: Tax code.
    • Line 31:
    • Uses CRACCT (credit account from GLCONT).
    • Writes credit-related entries.
    • Line 33:
    • Similar to line 31 but may handle different account or amount types (e.g., debit entries).
    • Includes a constant '0000' at position 19 for reference or padding.
  9. Cycle Completion:

  10. Processes all GLDETLTR records, generating G/L detail entries in GLDETL.
  11. Terminates after processing, closing all files.

Business Rules

  1. G/L Detail Entry Creation:
  2. Creates detailed G/L entries in GLDETL for each GLDETLTR record, including transaction amounts, discounts, and account information.
  3. Supports both credit and debit entries based on DORC and CRACCT.

  4. Detailed Transaction Tracking:

  5. Includes extensive transaction details (e.g., ADINV#, ADCUST, ADNAME, ADSHIP, ADORDN, ADSRN, ADIND8, ADSHD8, ADSLMN, ADDSEQ, ADLOC, ADPROD, ADTANK, ADCNTR, ADTAXC) for comprehensive G/L integration.

  6. Control Data:

  7. Uses GLCONT to retrieve company-specific G/L settings (e.g., CRCO, CRACCT) for accurate account mapping.

  8. No Validation or Filtering:

  9. Assumes all GLDETLTR records are valid and suitable for G/L entry creation.
  10. No explicit checks for amounts, dates, or account validity beyond chaining to GLCONT.

  11. No Error Handling:

  12. Assumes input files (GLDETLTR, GLCONT) exist and contain valid data, and GLDETL can be written without issues.

  13. Integration with G/L Workflow:

  14. Part of the invoice posting workflow, creating G/L detail entries to support financial reporting and general ledger updates.

Tables (Files) Used

  1. GLDETLTR:
  2. Description: G/L transaction file.
  3. Attributes: 512 bytes per record, primary input file (IPE), disk-based.
  4. Fields Used:
    • ADCO: Company number.
    • ADCUST: Customer number.
    • COCUST: Combined company and customer number.
    • ADINV#: Invoice number.
    • ADMISC: Transaction amount (8.2, packed).
    • ADDISC: Transaction discount (5.1, packed).
    • ADGLCR: G/L credit amount.
    • ADGLDR: G/L debit account.
    • ADGLC6: G/L credit amount (alternate).
    • ADGLD6: G/L debit account (alternate).
    • ADJRDT: Journal date.
    • ADNAME: Customer name.
    • ADSHIP: Ship-to code.
    • ADORDN: Order number.
    • ADSRN: Sales representative number.
    • ADIND8: Invoice date.
    • ADSHD8: Ship date.
    • ADSLMN: Salesman number.
    • ADDSEQ: Detail sequence number.
    • ADITEM: Item number.
    • ADLOC: Location code.
    • ADPROD: Product code.
    • ADTANK: Tank code.
    • ADCNTR: Container code.
    • ADTAXC: Tax code.
  5. Purpose: Contains G/L transaction records to be processed.
  6. Usage: Read sequentially to create G/L entries.

  7. GLCONT:

  8. Description: General ledger control file.
  9. Attributes: 256 bytes per record, input file (IC), 2-byte alternate index, disk-based.
  10. Fields Used:
    • CRCO: Company number.
    • CRACCT: Credit account.
  11. Purpose: Provides control data for G/L processing.
  12. Usage: Chained for company-specific settings.

  13. GLDETL:

  14. Description: General ledger detail file.
  15. Attributes: 132 bytes per record, output file (O), add capability (A), disk-based.
  16. Fields Used:
    • 'A': Entry type.
    • CRCO: Company number.
    • CRACCT: Credit account.
    • KYJRNL: Journal number.
    • DORC: Debit/credit indicator.
    • CRAMT: Credit amount (packed).
    • ADJRD8: Journal date (8 digits).
    • ADPGM: Program name.
    • SYDT: System date.
    • RCTY: Record type.
    • ADINV#, ADCUST, ADSHIP, ADORDN, ADSRN, ADIND8, ADSHD8, ADSLMN, ADDSEQ, ADLOC, ADPROD, ADTANK, ADCNTR, ADTAXC: Transaction details.
  17. Purpose: Stores detailed G/L entries for accounting.
  18. Usage: Written with exception output (lines 31, 33).

External Programs Called

The GL210 RPG program does not explicitly call any external programs. It is a self-contained program that processes input from GLDETLTR and GLCONT and writes to GLDETL.


Summary

The GL210 RPG program, called by the main OCL (e.g., BB600.ocl36.txt), creates G/L detail entries by: - Reading GLDETLTR records with transaction details. - Chaining to GLCONT for company-specific control data (e.g., CRCO, CRACCT). - Writing detailed G/L entries to GLDETL with credit/debit indicators, amounts, and extensive transaction metadata (e.g., invoice, customer, product, tank, tax). - Supporting both credit and debit entries based on DORC. - Terminating after processing all records.

Tables Used: GLDETLTR (G/L transactions), GLCONT (G/L control), GLDETL (G/L detail entries). External Programs Called: None.

This program supports the general ledger module of the invoice posting workflow by creating detailed G/L entries for accurate financial reporting and integration.