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:
- Program Declaration:
-
PGM: Declares the start of the CL program, indicating no parameters are passed. -
Split EFT Reports (SFASPLIT):
- Executes the
SFASPLITcommand four times to split spool files in theEFTEMALOTQoutput 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
EFTEMALOTQfor the report namedAR EFT EMAIL SPLIT 1. - Assigns the SpoolFlex name
EFT EMAIL 1and output nameAR EFT EMAIL SPLIT 1. CMBSEL(*NO): Does not combine selections (processes each report individually).- Moves the split files to the
EFTEMALQSVoutput queue. - Repeats for
AR EFT EMAIL SPLIT 2,3, and4, with corresponding SpoolFlex names (EFT EMAIL 2,3,4).
-
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. -
Convert to PDF (FFAEDOC):
- Executes the
FFAEDOCcommand four times to convert split spool files in theEFTSPLITQoutput queue to PDFs:FFAEDOC EDOCNM(ARGAREFTSTMT) SELOUTQ(EFTSPLITQ) SFSNM('EFT EMAIL 1'):- Converts spool files with SpoolFlex name
EFT EMAIL 1inEFTSPLITQto PDFs namedARGAREFTSTMT. - Repeats for
EFT EMAIL 2,3, and4.
-
MONMSG MSGID(SF00136): Handles errors (e.g., no spool files) to ensure continued execution. -
Distribute Reports (SFARDST):
-
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
ARCUFMXviaAR137EandAR137B).
- Distributes the processed EFT reports (named
-
Move Split Files (SFAMOVE):
- Executes the
SFAMOVEcommand four times to move split spool files fromEFTSPLITQtoEFTSPLTQSV:SFAMOVE OUTQ(QUSRSYS/EFTSPLITQ) SFSNM('EFT EMAIL 1') TOOUTQ(QUSRSYS/EFTSPLTQSV):- Moves spool files with SpoolFlex name
EFT EMAIL 1fromEFTSPLITQtoEFTSPLTQSV. - Repeats for
EFT EMAIL 2,3, and4.
-
MONMSG MSGID(SF00136): Handles errors to ensure continued execution. -
Clear Output Queues:
CLROUTQ OUTQ(EFTEMALOTQ): Clears theEFTEMALOTQoutput queue to remove processed spool files.-
CLROUTQ OUTQ(EFTSPLITQ): Clears theEFTSPLITQoutput queue to ensure no residual spool files remain. -
Send Notification Email (SFAEML):
-
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.COMandLMIDLA@AMREF.COM, fromMGREENBERG@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.
- Sends an email to
-
Program Termination:
ENDPGM: Ends the CL program.
Business Rules¶
The AR137TC CL program enforces the following business rules:
- Spool File Processing:
- Processes four sets of EFT reports (
AR EFT EMAIL SPLIT 1to4) fromEFTEMALOTQ, corresponding to the four printer files (LIST1toLIST4) generated byAR137B. -
Splits reports into individual documents without combining selections (
CMBSEL(*NO)). -
PDF Conversion:
- Converts split spool files in
EFTSPLITQto PDFs namedARGAREFTSTMTfor distribution. -
Processes each SpoolFlex name (
EFT EMAIL 1to4) separately. -
Error Handling:
-
Monitors for SpoolFlex errors (
SF00136) and continues execution, ensuring robustness even if some spool files are missing. -
Output Queue Management:
- Moves split files to
EFTEMALQSVandEFTSPLTQSVfor organization and archiving. -
Clears
EFTEMALOTQandEFTSPLITQafter processing to maintain a clean environment. -
Notification:
-
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. -
Environment Consistency:
- 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:
- EFTEMALOTQ:
- Type: Output queue.
-
Purpose: Contains EFT report spool files (
LIST1toLIST4) generated byAR137B. -
EFTSPLITQ:
- Type: Output queue.
-
Purpose: Holds split spool files (
EFT EMAIL 1to4) for PDF conversion. -
EFTEMALQSV:
- Type: Output queue.
-
Purpose: Stores split spool files after processing by
SFASPLIT. -
EFTSPLTQSV:
- Type: Output queue.
- 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):
- SFASPLIT:
-
Splits spool files into individual documents for processing.
-
FFAEDOC:
-
Converts spool files to PDFs for distribution.
-
SFARDST:
-
Distributes the converted PDFs, likely using email addresses from
ARCUFMX. -
SFAMOVE:
-
Moves split spool files to a save queue.
-
SFAEML:
- 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).