AR299 RPG36
The AR299.rpg36.txt
is an RPG (Report Program Generator) program for IBM System/36, invoked by the AR290.ocl36.txt
OCL program to generate a report summarizing the salesman code changes made by the preceding programs (AR290
, AR291
, AR294
, AR295
). Below is a detailed explanation of the process steps, business rules, tables/files used, and any external programs called.
Process Steps of the AR299 RPG Program¶
The AR299
RPG program reads the salesman change transaction file (ARSLST
), retrieves customer and salesman details, and produces a formatted report detailing the updates made across various files. Here’s a step-by-step breakdown:
- Initialization (Lines 0032–0039):
- ONCE Routine: Executes once at program start (controlled by
ONCE
flag set to1
).- Captures the current time (
TIMEX
, 12 digits) and moves it to: TIMEOF
(6 digits, HHMMSS) for the report header.DATE
(6 digits, likely MMDDYY or YYMMDD) for the report header.
- Captures the current time (
-
Purpose: Sets up timestamp data for the report header.
-
Main Processing Loop (Lines 0042–0057):
- Loop Control: Processes each record in the
ARSLST
file where the delete flag (ASDEL
) is not set (NCD
condition, record type01
). - Steps:
- Customer Lookup:
- Constructs a key (
ARKEY
, 8 bytes) using the company number (ASCO
) and customer number (ASCUST
) fromARSLST
. - Chains (searches) the
ARCUST
file usingARKEY
to retrieve the customer name (ARNAME
). - If the customer is not found (
10
indicator), setsARNAME
to'INVALID'
; otherwise, uses the retrieved name. - Salesman Description Lookup:
- Constructs a key (
SLKEY
, 12 bytes) by combining the literal'SLSMAN'
and the new salesman code (ASSLSN
) fromARSLST
. - Chains the
GSTABL
file (general table file) usingSLKEY
to retrieve the salesman description (TBDESC
). - If the salesman code is not found (
10
indicator), setsTBDESC
to'INVALID'
; otherwise, uses the retrieved description.
-
Purpose: Gathers customer and salesman details to include in the report, ensuring meaningful output even for invalid records.
-
Report Generation (Lines 0060–0124):
- Output Structure:
- Header Lines (Level
L1
, triggered by company number change or overflow): - Prints page number (
PAGE
), date (DATE
), and time (TIMEOF
). - Prints a title (
* SALESMAN CHANGE POST *
). - Prints decorative lines (
* * * * * * * * * * * *
) for formatting. - Prints column headers:
CO
,CUSTOMER #
,NAME
,SALESMAN OLD NEW
,BBORDR
,BBBOL
,BBORXX
,BBTRWS
,SA5FIL
,SA5DBB
,SA5BCM
,SA5SHP
,FRBINH
. - Detail Lines (Condition
01
): - For each
ARSLST
record:- Prints company number (
ASCO
), customer number (ASCUST
), customer name (ARNAME
), old salesman code (ASSLSO
), new salesman code (ASSLSN
), and salesman description (TBDESC
). - Prints update counts for each file:
ASBBO
(order headers),ASBBB
(bill of lading),ASORT
(batch orders),ASBBT
(invoice transactions),ASS5F
(sales analysis fixed),ASS5D
(sales analysis database),ASS5B
(sales analysis billing control),ASS5S
(shipping units, added in LT01),ASSFR
(freight bills, added in LT01).
- Prints company number (
- Header Lines (Level
- Purpose: Produces a detailed report summarizing the salesman code changes and the number of records updated in each file.
Business Rules¶
- Report Content:
- The report includes all non-deleted
ARSLST
records, detailing the company, customer, old and new salesman codes, and the number of records updated in each file. - Customer names are retrieved from
ARCUST
; if not found,'INVALID'
is displayed. -
Salesman descriptions are retrieved from
GSTABL
for the new salesman code; if not found,'INVALID'
is displayed. -
Grouping and Formatting:
- The report groups records by company number (
ASCO
, levelL1
), with headers printed on company change or page overflow (OF
). - Headers include page number, date, time, and column labels for clarity.
-
Decorative lines (
* * * * *
) enhance readability and separate sections. -
Error Handling:
- If a customer record is not found in
ARCUST
, the report indicates'INVALID'
for the customer name but still includes the record. -
If a salesman code is not found in
GSTABL
, the report indicates'INVALID'
for the salesman description. -
Audit and Verification:
- The report serves as an audit trail, showing the extent of updates across multiple files (
BBORDR
,BBBOL
,BBORXX
,BBTRWS
,SA5FIL
,SA5DBB
,SA5BCM
,SA5SHP
,FRBINH
). -
Update counts (
ASBBO
,ASBBB
, etc.) reflect the work done byAR290
,AR291
, andAR295
, providing a summary of changes. -
Data Integrity:
- Files are opened in input mode (
IP
,IF
) forARSLST
,ARCUST
, andGSTABL
, and output mode (O
) forARPRINT
, ensuring read-only access to data files and write-only to the printer file. - The program processes records sequentially, ensuring all non-deleted records are reported.
Tables/Files Used¶
The program interacts with the following files, as defined in the File Specification (F-spec) and used in processing:
1. ARSLST (Input, 256 bytes, Key: 8 bytes):
- Salesman change transaction file containing:
- Company number (ASCO
), customer number (ASCUST
), old salesman code (ASSLSO
), new salesman code (ASSLSN
).
- Update counts: ASBBO
(order headers), ASBBB
(bill of lading), ASORT
(batch orders), ASBBT
(invoice transactions), ASS5F
(sales analysis fixed), ASS5D
(sales analysis database), ASS5B
(sales analysis billing control), ASS5S
(shipping units, added in LT01), ASSFR
(freight bills, added in LT01).
2. ARCUST (Input, 384 bytes, Key: 8 bytes):
- Customer master file, used to retrieve the customer name (ARNAME
).
3. GSTABL (Input, 256 bytes, Key: 12 bytes):
- General table file, used to retrieve the salesman description (TBDESC
) for the new salesman code.
4. ARPRINT (Output, 164 bytes, Printer):
- Printer file for the report output, containing headers and detail lines.
External Programs Called¶
- None: The
AR299
RPG program does not call any external programs. It is a standalone program invoked by theAR290.ocl36.txt
OCL program and performs all processing internally.
Additional Notes¶
- File Modifications:
- LT01 (10/14/2011): Added fields
ASS5S
(shipping units) andASSFR
(freight bills) toARSLST
and included them in the report output. - Performance Considerations:
- The program processes
ARSLST
sequentially, which is efficient for small to medium datasets typical of System/36 applications. - The use of
CHAIN
for random access toARCUST
andGSTABL
may introduce minor overhead for large files but is necessary for retrieving names and descriptions. - Legacy Context:
- This RPG III program is designed for the IBM System/36 or AS/400, using fixed-format code with cycle-based processing.
- The report output uses a printer file (
ARPRINT
), with formatting controlled by Output Specifications (O-specs), typical for System/36 reports. - Role in OCL:
AR299
is called at the end of the OCL program to generate the final report, summarizing the results of all salesman code updates performed byAR290
,AR291
, andAR295
.- The OCL overrides the printer file to direct output to
QUSRSYS/SLSMCHANGE
(production) orQUSRSYS/TESTOUTQ
(testing).
This program provides a comprehensive audit trail of salesman code changes, ensuring transparency and verification of updates across the accounts receivable system’s files.