AR880TC CLP
The provided CLP (Control Language Program) file, AR880TC.clp.txt
, is a program executed on an IBM AS/400 or iSeries system, called conditionally from the main OCL program AR880.ocl36.txt
when the environment parameter ?9?
equals G
. Its primary purpose is to send email notifications to Customer Service Representatives (CSRs) and salesmen when the credit hold status of an order changes. Below, I’ll explain the process steps, business rules, tables used, and external programs called.
Process Steps of the CLP Program¶
The AR880TC
program uses commands from a third-party tool (likely SpoolFlex or a similar product) to process and distribute spool files generated by the RPG program AR880.rpgle
(specifically, the CREMAL
and SMEMAL
printer files). The steps are as follows:
- Program Declaration:
-
PGM
: Declares the start of the CLP program. No parameters are specified, indicating it does not expect input parameters. -
Process Spool File for CSR Notification (CREMAL):
SFASPLIT RSPNM('ORDER CREDIT STATUS') OUTQ(CSROUTQ) MVTOOUTQ(*DELETE)
:- Command:
SFASPLIT
is a third-party command (likely from SpoolFlex) that splits or processes a spool file. - Parameters:
RSPNM('ORDER CREDIT STATUS')
: Specifies the report/spool file name to process, likely corresponding to theCREMAL
printer file generated by the RPG program for CSR and Accounts Receivable (A/R) notifications.OUTQ(CSROUTQ)
: Directs the processed spool file to theCSROUTQ
output queue, which is likely configured to send emails to CSRs.MVTOOUTQ(*DELETE)
: Deletes the original spool file after processing, preventing duplicate processing or storage.- Purpose: Converts the
CREMAL
spool file into an email format and sends it to the CSR/A/R recipients.
- Command:
-
MONMSG MSGID(SF00136)
: Monitors for the error messageSF00136
(likely a SpoolFlex-specific error, e.g., spool file not found or processing failure) and ignores it, allowing the program to continue execution. -
Distribute Spool File for CSR Notification:
-
SFARDST RDSNM('ORDER CREDIT STATUS')
:- Command:
SFARDST
is another third-party command for distributing spool files, likely as emails. - Parameters:
RDSNM('ORDER CREDIT STATUS')
: Specifies the report name (CREMAL
) to distribute.- Purpose: Ensures the processed spool file is emailed to the intended CSR recipients.
MONMSG MSGID(SF00136)
: Ignores any errors during distribution (e.g., if the spool file is missing).
- Command:
-
Distribute Additional Spool File for CSR Notification:
-
SFARDST RDSNM('ORDER CREDIT STATUS3') MVTOOUTQ(DLTOUTQ)
:- Parameters:
RDSNM('ORDER CREDIT STATUS3')
: Processes a secondary report, possibly an additional copy or variant of theCREMAL
spool file.MVTOOUTQ(DLTOUTQ)
: Moves the spool file to theDLTOUTQ
output queue, which is likely configured to delete or archive the file after distribution.- Purpose: Distributes an additional notification or copy, potentially to a different recipient or system, and cleans up the spool file.
MONMSG MSGID(SF00136)
: Ignores distribution errors.
-
Process Spool File for Salesman Notification (SMEMAL):
-
SFASPLIT RSPNM('ORDER CREDIT STATUS2') OUTQ(SLMNOUTQ) MVTOOUTQ(*DELETE)
:- Parameters:
RSPNM('ORDER CREDIT STATUS2')
: Specifies the report name for theSMEMAL
printer file, which contains salesman notifications.OUTQ(SLMNOUTQ)
: Directs the processed spool file to theSLMNOUTQ
output queue, likely configured for salesman email delivery.MVTOOUTQ(*DELETE)
: Deletes the original spool file after processing.- Purpose: Converts the
SMEMAL
spool file into an email format and sends it to the salesman. MONMSG MSGID(SF00136)
: Ignores processing errors.
-
Commented-Out Distribution for Salesman Notification:
-
/* SFARDST RDSNM('ORDER CREDIT STATUS2') MVTOOUTQ(JUNKOUTQ) */
:- This line is commented out, indicating it is not currently active.
- If enabled, it would distribute the
SMEMAL
spool file to theJUNKOUTQ
output queue, possibly for testing or archiving, with error monitoring forSF00136
. - Purpose: Likely a deprecated or test configuration that was disabled to streamline the process.
-
Program Termination:
ENDPGM
: Marks the end of the CLP program, completing the execution.
Business Rules¶
- Email Notification Trigger:
- The program is executed when an order’s credit hold status changes (authorized or unauthorized), as indicated by the spool files generated by the RPG program (
CREMAL
for CSR/A/R,SMEMAL
for salesman). -
It is only called when the environment parameter
?9?
equalsG
in the OCL program, suggesting it is specific to a test or specific operational environment. -
Spool File Processing:
- Spool files (
CREMAL
andSMEMAL
) are processed usingSFASPLIT
to convert them into email-compatible formats. - The processed spool files are sent to specific output queues (
CSROUTQ
for CSR/A/R,SLMNOUTQ
for salesman) configured for email delivery. -
Original spool files are deleted after processing (
MVTOOUTQ(*DELETE)
) to prevent duplication and reduce storage. -
Additional Notification Handling:
- A secondary spool file (
ORDER CREDIT STATUS3
) is distributed toDLTOUTQ
, possibly for additional recipients or archival purposes. -
The commented-out distribution to
JUNKOUTQ
suggests flexibility in routing salesman notifications, though it is currently disabled. -
Error Handling:
-
The program ignores errors (
SF00136
) during spool file processing or distribution, ensuring it completes even if a spool file is missing or processing fails. This prevents the program from halting due to minor issues. -
Purpose:
- The program ensures timely communication to CSRs and salesmen about order credit status changes, supporting the business process of credit management by automating notifications.
Tables (Files) Used¶
The CLP program does not directly reference database files or tables. Instead, it processes spool files generated by the RPG program AR880.rpgle
. The relevant spool files are:
1. CREMAL: Printer file containing CSR and A/R notifications, processed as ORDER CREDIT STATUS
and ORDER CREDIT STATUS3
.
2. SMEMAL: Printer file containing salesman notifications, processed as ORDER CREDIT STATUS2
.
No database files (tables) are directly accessed by this CLP program.
External Programs Called¶
The program uses two third-party commands, likely from a tool like SpoolFlex, which are treated as external programs: 1. SFASPLIT: Splits or processes spool files into email-compatible formats and directs them to specified output queues. 2. SFARDST: Distributes processed spool files, likely as emails, to recipients based on the output queue configuration.
These commands are not part of the standard IBM i command set and indicate the use of a third-party spool file management or email distribution tool.
Summary¶
The AR880TC.clp
program automates email notifications for CSR and salesman when an order’s credit hold status changes, processing spool files generated by the RPG program. It:
- Uses SFASPLIT
to process CREMAL
and SMEMAL
spool files into email formats, directing them to CSROUTQ
and SLMNOUTQ
.
- Distributes a secondary CREMAL
copy (ORDER CREDIT STATUS3
) to DLTOUTQ
.
- Deletes original spool files after processing to maintain system efficiency.
- Ignores errors to ensure robust execution.
- Is conditionally called in a specific environment (?9?=G
).
Tables Used: None (only spool files CREMAL
and SMEMAL
).
External Programs Called: SFASPLIT
, SFARDST
(third-party commands, likely from SpoolFlex).