Skip to content

AR418TC

The provided document is a Control Language Program (CLP) named AR418TC.clp.txt, which is called conditionally from the AR418.ocl36 OCL program when the parameter ?9? equals G. This CLP program is responsible for sending email notifications to customer service representatives (CSRs) and salesmen when the credit hold status of an order changes. Below, I will explain the process steps, business rules, tables used, and external programs called .


Process Steps of the AR418TC.clp Program

The CLP program automates the distribution of spooled files (reports) generated by the AR418 RPGLE program, specifically for email notifications related to order credit status changes. Here’s a step-by-step breakdown of the process:

  1. Program Start:
  2. The program begins with the PGM command, indicating the start of the CLP program. No parameters are defined, suggesting it relies on the environment set up by the calling OCL program.

  3. Process Spooled File for CSR Notification:

  4. SFASPLIT RSPNM('ORDER CREDIT STATUS') OUTQ(QUSRSYS/CSROUTQ) MVTOOUTQ(*DELETE):
    • Executes the SFASPLIT command to process a spooled file named 'ORDER CREDIT STATUS'.
    • Directs the output to the QUSRSYS/CSROUTQ output queue, which is likely configured for CSR email notifications.
    • The MVTOOUTQ(*DELETE) parameter indicates that the spooled file is deleted after processing.
  5. MONMSG MSGID(SF00136):

    • Monitors for the error message SF00136 (likely indicating the spooled file was not found or another error occurred during SFASPLIT).
    • If the error occurs, the program continues without interruption, ensuring robustness.
  6. Process Spooled File for Salesman Notification:

  7. SFASPLIT RSPNM('ORDER CREDIT STATUS2') OUTQ(SLMNOUTQ) MVTOOUTQ(*DELETE):
    • Processes a spooled file named 'ORDER CREDIT STATUS2'.
    • Directs the output to the SLMNOUTQ output queue, likely configured for salesman email notifications.
    • Deletes the spooled file after processing.
  8. MONMSG MSGID(SF00136):

    • Handles errors gracefully, allowing the program to continue if the spooled file is missing or an error occurs.
  9. Distribute CSR Notification:

  10. SFARDST RDSNM('ORDER CREDIT STATUS'):
    • Executes the SFARDST command to distribute the report data set named 'ORDER CREDIT STATUS'.
    • This likely sends the CSR notification (from the cremal file in AR418.rpgle) via email, based on the email addresses stored in bbcsr (CSR email, qqcrem).
  11. MONMSG MSGID(SF00136):

    • Handles errors if the report data set is not found or distribution fails.
  12. Commented-Out Distribution for Salesman Notification:

  13. The lines:

    1
    2
    /* SFARDST RDSNM('ORDER CREDIT STATUS2') MVTOOUTQ(JUNKOUTQ) */
    /* MONMSG MSGID(SF00136) */
    
    are commented out, indicating they are not currently executed. If uncommented, they would distribute the 'ORDER CREDIT STATUS2' report data set to the JUNKOUTQ output queue, likely for testing or debugging purposes.

  14. Distribute Additional Notification:

  15. SFARDST RDSNM('ORDER CREDIT STATUS3') MVTOOUTQ(DLTOUTQ):
    • Distributes a report data set named 'ORDER CREDIT STATUS3' to the DLTOUTQ output queue, with the spooled file deleted after processing.
    • This may correspond to an additional notification (possibly for a credit manager or another recipient).
  16. MONMSG MSGID(SF00136):

    • Handles errors if the report data set is not found or distribution fails.
  17. Program End:

  18. The ENDPGM command terminates the program after all commands are executed or errors are handled.

Business Rules

  1. Email Notification Trigger:
  2. The program is executed only when the ?9? parameter in the calling OCL program (AR418.ocl36) equals G, typically indicating a test or specific environment.
  3. It processes spooled files generated by the AR418 RPGLE program (cremal and smemal) to send email notifications when an order’s credit hold status changes (e.g., authorized, unauthorized, or placed on hold).

  4. Spooled File Management:

  5. Spooled files (ORDER CREDIT STATUS, ORDER CREDIT STATUS2, ORDER CREDIT STATUS3) are processed and deleted after distribution to prevent clutter in the output queues.
  6. The program uses specific output queues (QUSRSYS/CSROUTQ, SLMNOUTQ, DLTOUTQ) to route notifications to the appropriate recipients (CSRs, salesmen, or others).

  7. Error Handling:

  8. The program is designed to be robust, using MONMSG to catch errors (SF00136) and continue execution, ensuring that a failure in one step does not halt the entire process.

  9. Recipient Targeting:

  10. Notifications are sent to:
    • CSRs via QUSRSYS/CSROUTQ (using cremal file data, with email addresses from bbcsr).
    • Salesmen via SLMNOUTQ (using smemal file data, with email addresses from bbslsm).
    • An additional recipient or process via DLTOUTQ (possibly for credit managers or archival purposes).

Tables (Files) Used

The CLP program itself does not directly interact with database files (tables). Instead, it processes spooled files generated by the AR418 RPGLE program. However, based on the context of the calling programs (AR418.ocl36 and AR418.rpgle), the spooled files are derived from the following files:

  1. cremal:
  2. Type: Spooled file (printer file, 140 bytes).
  3. Purpose: Contains CSR notification data, including order details, customer information, and credit status (e.g., "RELEASED FROM CREDIT HOLD" or "PLACED ON CREDIT HOLD").
  4. Processed as 'ORDER CREDIT STATUS' in QUSRSYS/CSROUTQ.

  5. smemal:

  6. Type: Spooled file (printer file, 140 bytes).
  7. Purpose: Contains salesman notification data, similar to cremal.
  8. Processed as 'ORDER CREDIT STATUS2' in SLMNOUTQ.

  9. Unknown File for 'ORDER CREDIT STATUS3':

  10. Type: Spooled file (likely a printer file).
  11. Purpose: Likely contains additional notification data, possibly for a credit manager or archival process, sent to DLTOUTQ.
  12. Not explicitly defined in AR418.rpgle, suggesting it may be generated by another process or configuration.

No direct database files (e.g., bicont, bborcl, bbcsr, bbslsm, arcust, gscont) are accessed by AR418TC.clp. The data used in the spooled files originates from these files via the AR418 RPGLE program.


External Programs Called

The CLP program uses the following external commands, which are part of the IBM i (or System/36) operating system:

  1. SFASPLIT:
  2. Purpose: Splits or processes spooled files for distribution, likely part of a third-party or custom spooled file management tool (e.g., SpoolFlex, as mentioned in AR418.rpgle comments).
  3. Used to process 'ORDER CREDIT STATUS' and 'ORDER CREDIT STATUS2' spooled files.

  4. SFARDST:

  5. Purpose: Distributes report data sets, likely converting spooled files into email notifications or other output formats.
  6. Used to distribute 'ORDER CREDIT STATUS' and 'ORDER CREDIT STATUS3' (with 'ORDER CREDIT STATUS2' commented out).

No additional user-defined programs are called directly by AR418TC.clp.


Summary

The AR418TC.clp program is a lightweight CLP program called conditionally from AR418.ocl36 to handle email notifications for order credit status changes. It: - Processes spooled files (cremal, smemal, and an undefined file for 'ORDER CREDIT STATUS3') using SFASPLIT and SFARDST. - Routes notifications to CSRs (QUSRSYS/CSROUTQ), salesmen (SLMNOUTQ), and potentially others (DLTOUTQ). - Deletes spooled files after processing to maintain system cleanliness. - Includes robust error handling to ensure uninterrupted execution.

The program relies on the output generated by AR418.rpgle and does not directly access database files or call other user programs, focusing solely on spooled file distribution.