Skip to content

AR137TC CLP

The AR137TC.clp.txt is a CL (Control Language) program used in IBM i (AS/400) systems, invoked by the AR137.ocl36.txt OCL script as part of the EFT (Electronic Funds Transfer) draft notice filtering process. This program automates the creation, splitting, and emailing of EFT draft notification PDFs using the SpoolFlex toolset. Below, I’ll explain the process steps, business rules, tables (files) used, and external programs called, providing a clear and concise analysis.

Process Steps of the AR137TC CL Program

The AR137TC CL program processes EFT reports generated by prior steps (e.g., AR137B) in the output queues, splits them into individual documents, converts them to PDFs, and emails them to specified recipients. Here’s a step-by-step breakdown of its execution:

  1. Program Declaration:
  2. PGM: Declares the start of the CL program, indicating no parameters are passed.

  3. Split EFT Reports (SFASPLIT):

  4. Executes the SFASPLIT command four times to split spool files in the EFTEMALOTQ output queue into individual documents:
    • SFASPLIT RSPNM('AR EFT EMAIL SPLIT 1') OUTQ(EFTEMALOTQ) SFSNM('EFT EMAIL 1') OUTNM('AR EFT EMAIL SPLIT 1') CMBSEL(*NO) MVTOOUTQ(EFTEMALQSV):
    • Splits spool files in EFTEMALOTQ for the report named AR EFT EMAIL SPLIT 1.
    • Assigns the SpoolFlex name EFT EMAIL 1 and output name AR EFT EMAIL SPLIT 1.
    • CMBSEL(*NO): Does not combine selections (processes each report individually).
    • Moves the split files to the EFTEMALQSV output queue.
    • Repeats for AR EFT EMAIL SPLIT 2, 3, and 4, with corresponding SpoolFlex names (EFT EMAIL 2, 3, 4).
  5. MONMSG MSGID(SF00136): Monitors for SpoolFlex error messages (e.g., no spool files found) and continues execution if an error occurs, ensuring the program doesn’t halt on missing files.

  6. Convert to PDF (FFAEDOC):

  7. Executes the FFAEDOC command four times to convert split spool files in the EFTSPLITQ output queue to PDFs:
    • FFAEDOC EDOCNM(ARGAREFTSTMT) SELOUTQ(EFTSPLITQ) SFSNM('EFT EMAIL 1'):
    • Converts spool files with SpoolFlex name EFT EMAIL 1 in EFTSPLITQ to PDFs named ARGAREFTSTMT.
    • Repeats for EFT EMAIL 2, 3, and 4.
  8. MONMSG MSGID(SF00136): Handles errors (e.g., no spool files) to ensure continued execution.

  9. Distribute Reports (SFARDST):

  10. SFARDST RDSNM('AR EFT EMAIL') CMBSEL(*NO):

    • Distributes the processed EFT reports (named AR EFT EMAIL) without combining selections.
    • Likely triggers SpoolFlex to prepare the PDFs for emailing based on customer email addresses (from ARCUFMX via AR137E and AR137B).
  11. Move Split Files (SFAMOVE):

  12. Executes the SFAMOVE command four times to move split spool files from EFTSPLITQ to EFTSPLTQSV:
    • SFAMOVE OUTQ(QUSRSYS/EFTSPLITQ) SFSNM('EFT EMAIL 1') TOOUTQ(QUSRSYS/EFTSPLTQSV):
    • Moves spool files with SpoolFlex name EFT EMAIL 1 from EFTSPLITQ to EFTSPLTQSV.
    • Repeats for EFT EMAIL 2, 3, and 4.
  13. MONMSG MSGID(SF00136): Handles errors to ensure continued execution.

  14. Clear Output Queues:

  15. CLROUTQ OUTQ(EFTEMALOTQ): Clears the EFTEMALOTQ output queue to remove processed spool files.
  16. CLROUTQ OUTQ(EFTSPLITQ): Clears the EFTSPLITQ output queue to ensure no residual spool files remain.

  17. Send Notification Email (SFAEML):

  18. SFAEML TOADR(BZOLKOS@AMREF.COM) TOADR2((LMIDLA@AMREF.COM)) FRMADR(MGREENBERG@AMREF.COM) SUBJECT('EFT Notices sent to Customers') MESSAGE('Menu Option 11 to Send EFT notices to Customers was run.'):

    • Sends an email to BZOLKOS@AMREF.COM and LMIDLA@AMREF.COM, from MGREENBERG@AMREF.COM.
    • Subject: “EFT Notices sent to Customers”.
    • Message: “Menu Option 11 to Send EFT notices to Customers was run.”
    • Notifies administrators that the EFT notice process has completed.
  19. Program Termination:

  20. ENDPGM: Ends the CL program.

Business Rules

The AR137TC CL program enforces the following business rules:

  1. Spool File Processing:
  2. Processes four sets of EFT reports (AR EFT EMAIL SPLIT 1 to 4) from EFTEMALOTQ, corresponding to the four printer files (LIST1 to LIST4) generated by AR137B.
  3. Splits reports into individual documents without combining selections (CMBSEL(*NO)).

  4. PDF Conversion:

  5. Converts split spool files in EFTSPLITQ to PDFs named ARGAREFTSTMT for distribution.
  6. Processes each SpoolFlex name (EFT EMAIL 1 to 4) separately.

  7. Error Handling:

  8. Monitors for SpoolFlex errors (SF00136) and continues execution, ensuring robustness even if some spool files are missing.

  9. Output Queue Management:

  10. Moves split files to EFTEMALQSV and EFTSPLTQSV for organization and archiving.
  11. Clears EFTEMALOTQ and EFTSPLITQ after processing to maintain a clean environment.

  12. Notification:

  13. Sends a completion email to specified recipients (BZOLKOS@AMREF.COM, LMIDLA@AMREF.COM) from a fixed sender (MGREENBERG@AMREF.COM), ensuring stakeholders are informed of the process completion.

  14. Environment Consistency:

  15. Uses the ?9? library prefix (from the OCL script) to align with the environment-specific file and queue naming conventions.

Integration with AR137 OCL Script

The AR137TC CL program is invoked by the AR137.ocl36.txt script via // IF ?9?/G CALL AR137TC, executed conditionally when the environment parameter ?9? is ‘G’ (likely production). It processes the EFT reports generated by AR137B in the EFTEMALOTQ queue, splits them into individual PDFs, and prepares them for emailing using customer email addresses from ARCUFMX (via AR137E and AR137B). The program completes the EFT draft notice process by distributing notifications and notifying administrators.

Tables (Files) Used

The AR137TC CL program does not directly reference database files but interacts with output queues containing spool files:

  1. EFTEMALOTQ:
  2. Type: Output queue.
  3. Purpose: Contains EFT report spool files (LIST1 to LIST4) generated by AR137B.

  4. EFTSPLITQ:

  5. Type: Output queue.
  6. Purpose: Holds split spool files (EFT EMAIL 1 to 4) for PDF conversion.

  7. EFTEMALQSV:

  8. Type: Output queue.
  9. Purpose: Stores split spool files after processing by SFASPLIT.

  10. EFTSPLTQSV:

  11. Type: Output queue.
  12. Purpose: Stores moved split spool files after SFAMOVE.

External Programs Called

The program uses the following external SpoolFlex commands (not RPG programs but CL commands):

  1. SFASPLIT:
  2. Splits spool files into individual documents for processing.

  3. FFAEDOC:

  4. Converts spool files to PDFs for distribution.

  5. SFARDST:

  6. Distributes the converted PDFs, likely using email addresses from ARCUFMX.

  7. SFAMOVE:

  8. Moves split spool files to a save queue.

  9. SFAEML:

  10. Sends a notification email to administrators.

Summary

The AR137TC CL program finalizes the EFT draft notice process by splitting EFT reports from EFTEMALOTQ into individual documents, converting them to PDFs, distributing them (likely via email to customers), and moving processed files to save queues. It clears output queues and sends a completion email to administrators. The program ensures robust processing with error handling and supports the EFT notice distribution workflow.

Tables Used: None (uses output queues: EFTEMALOTQ, EFTSPLITQ, EFTEMALQSV, EFTSPLTQSV). External Programs Called: SFASPLIT, FFAEDOC, SFARDST, SFAMOVE, SFAEML (SpoolFlex CL commands).