Skip to content

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:

  1. Program Declaration:
  2. PGM: Declares the start of the CLP program. No parameters are specified, indicating it does not expect input parameters.

  3. Process Spool File for CSR Notification (CREMAL):

  4. 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 the CREMAL printer file generated by the RPG program for CSR and Accounts Receivable (A/R) notifications.
    • OUTQ(CSROUTQ): Directs the processed spool file to the CSROUTQ 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.
  5. MONMSG MSGID(SF00136): Monitors for the error message SF00136 (likely a SpoolFlex-specific error, e.g., spool file not found or processing failure) and ignores it, allowing the program to continue execution.

  6. Distribute Spool File for CSR Notification:

  7. 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).
  8. Distribute Additional Spool File for CSR Notification:

  9. SFARDST RDSNM('ORDER CREDIT STATUS3') MVTOOUTQ(DLTOUTQ):

    • Parameters:
    • RDSNM('ORDER CREDIT STATUS3'): Processes a secondary report, possibly an additional copy or variant of the CREMAL spool file.
    • MVTOOUTQ(DLTOUTQ): Moves the spool file to the DLTOUTQ 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.
  10. Process Spool File for Salesman Notification (SMEMAL):

  11. SFASPLIT RSPNM('ORDER CREDIT STATUS2') OUTQ(SLMNOUTQ) MVTOOUTQ(*DELETE):

    • Parameters:
    • RSPNM('ORDER CREDIT STATUS2'): Specifies the report name for the SMEMAL printer file, which contains salesman notifications.
    • OUTQ(SLMNOUTQ): Directs the processed spool file to the SLMNOUTQ 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.
  12. Commented-Out Distribution for Salesman Notification:

  13. /* 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 the JUNKOUTQ output queue, possibly for testing or archiving, with error monitoring for SF00136.
    • Purpose: Likely a deprecated or test configuration that was disabled to streamline the process.
  14. Program Termination:

  15. ENDPGM: Marks the end of the CLP program, completing the execution.

Business Rules

  1. Email Notification Trigger:
  2. 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).
  3. It is only called when the environment parameter ?9? equals G in the OCL program, suggesting it is specific to a test or specific operational environment.

  4. Spool File Processing:

  5. Spool files (CREMAL and SMEMAL) are processed using SFASPLIT to convert them into email-compatible formats.
  6. The processed spool files are sent to specific output queues (CSROUTQ for CSR/A/R, SLMNOUTQ for salesman) configured for email delivery.
  7. Original spool files are deleted after processing (MVTOOUTQ(*DELETE)) to prevent duplication and reduce storage.

  8. Additional Notification Handling:

  9. A secondary spool file (ORDER CREDIT STATUS3) is distributed to DLTOUTQ, possibly for additional recipients or archival purposes.
  10. The commented-out distribution to JUNKOUTQ suggests flexibility in routing salesman notifications, though it is currently disabled.

  11. Error Handling:

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

  13. Purpose:

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