AR418TC CLP
AR418TC – Test-Mode Email Distribution CLP (Control Language Program)
This is a short IBM i CL (Control Language) program that runs only in test mode (when ?9? = G in the OCL).
Its purpose: Clean up and distribute spool files generated by the AR418 RPG program during testing, specifically the email notification reports for order credit status changes.
It uses SFA (Spool File Automation) commands – a third-party spool management/email tool (likely FormFlex, CoolSpools, or similar) – to split, distribute, and delete test spool files so they don’t clutter production outqueues or send real emails.
Process Steps (Line-by-Line Execution)¶
| Step | CL Command | What It Does |
|---|---|---|
| 1 | SFASPLIT RSPNM('ORDER CREDIT STATUS') OUTQ(QUSRSYS/CSROUTQ) MVTOOUTQ(*DELETE) |
|
| → Finds all spool files named ORDER CREDIT STATUS in the CSROUTQ outqueue (Credit/AR team outqueue). | ||
| → Splits them (if multi-page or multi-copy). | ||
→ Moves the resulting files to *DELETE → deletes them immediately. |
||
| → Prevents test emails from going to real Credit staff. | ||
MONMSG MSGID(SF00136) |
Ignores error if no files found (SF00136 = "No spooled files meet the selection criteria") | |
| 2 | SFASPLIT RSPNM('ORDER CREDIT STATUS2') OUTQ(SLMNOUTQ) MVTOOUTQ(*DELETE) |
|
| → Same as above, but for ORDER CREDIT STATUS2 in SLMNOUTQ (Salesman outqueue). | ||
| → Deletes test salesman notification spool files. | ||
MONMSG MSGID(SF00136) |
Ignores "not found" | |
| 3 | SFARDST RDSNM('ORDER CREDIT STATUS') |
|
| → Distributes any remaining ORDER CREDIT STATUS reports (e.g., via email or fax) using predefined SFA rules. | ||
| → In test mode, this might go to test email addresses or a dummy outqueue. | ||
MONMSG MSGID(SF00136) |
Ignores if none to distribute | |
| 4 | (Commented out) SFARDST RDSNM('ORDER CREDIT STATUS2') ... |
|
| → Was used to distribute salesman version, now disabled. | ||
| 5 | SFARDST RDSNM('ORDER CREDIT STATUS3') MVTOOUTQ(DLTOUTQ) |
|
| → Distributes a third variant (possibly a summary or log). | ||
| → Then moves output to DLTOUTQ → a special outqueue that auto-deletes files after processing. | ||
MONMSG MSGID(SF00136) |
Ignores if not present |
Business Rules¶
| Rule | Explanation |
|---|---|
| Test-Only Execution | Only called when ?9?/G in OCL → ensures this cleanup/email logic never runs in production. |
| Prevent Accidental Emails | All test spool files in production outqueues (CSROUTQ, SLMNOUTQ) are deleted immediately via MVTOOUTQ(*DELETE). |
| Controlled Test Distribution | Uses SFARDST to send test emails only to safe destinations (e.g., developer inboxes) via SFA distribution rules. |
| Graceful Error Handling | MONMSG SF00136 on every command → program never fails if no test spool files exist. |
| Cleanup After Distribution | Final step moves distributed files to DLTOUTQ → ensures no lingering test reports. |
Files / Tables Used¶
- None – This is a spool file processing program.
It does not access any database files (PF/LF).
It only works with spool files in outqueues.
External Programs / Commands Called¶
| Command | Type | Purpose |
|---|---|---|
| SFASPLIT | SFA (Spool File Automation) command | Split and move/delete spool files |
| SFARDST | SFA command | Distribute (email/fax/print) spool files based on rules |
| MONMSG | Native CL command | Error monitoring |
SFA is not an IBM command – it’s from a third-party spool management product (common in IBM i shops for email-from-spool).
The specific product is likely FormFlex, CoolSpools, or Infor XA SpoolFlex (givenSFASPLITsyntax).
Summary – What AR418TC Actually Does¶
“After running AR418 in test mode, this CL program: 1. Deletes any test email spool files that landed in production outqueues (CSROUTQ, SLMNOUTQ)
2. Safely distributes test versions to developer/test email addresses
3. Cleans up everything so no trace remainsThis prevents test credit hold emails from accidentally going to real CSRs or salesmen while still allowing developers to verify the email layout and content.”
It’s a safety net – essential in environments where spool files trigger real emails.