IBM Support

Program to Display All Mail on a System to File

Troubleshooting


Problem

This document contains an example CL program that will put a list of all incoming mail in file QGPL/ALLMAILIN and all outgoing mail into QGPL/ALLMAILOUT.

Resolving The Problem

The following is an example CL program that will put a list of all incoming mail in file QGPL/ALLMAILIN and all outgoing mail into QGPL/ALLMAILOUT.

Example
             PGM
             DCLF       FILE(QSYS/QAOSDIRX) RCDFMT(OSDIRX)
             DSPDIRE    OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPDIRE) +
                          DETAIL(*FULL) OUTFILFMT(*TYPE3) OUTDTA(*ALL)
             OVRDBF     FILE(QAOSDIRX) TOFILE(QTEMP/DSPDIRE)
             DLTF       FILE(QGPL/ALLMAILIN)
              MONMSG     MSGID(CPF0000)
             DLTF       FILE(QGPL/ALLMAILOUT)
              MONMSG     MSGID(CPF0000)
 LOOP:       RCVF       RCDFMT(OSDIRX)
             MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(DONE))
             IF COND(&DXUSRP *NE '          ') THEN(+
             DO)
             SBMJOB     CMD(QRYDST OPTION(*IN) USRID(*CURRENT) +
                          OUTFILE(QGPL/ALLMAILIN) OUTMBR(*FIRST +
                          *ADD) STATUS(*ALL)) JOB(&DXUSRP) +
                          JOBQ(*LIBL/QBATCH) USER(&DXUSRP) +
                          SYSLIBL(*SYSVAL) CURLIB(*CRTDFT) +
                          INLLIBL(*SYSVAL) LOGCLPGM(*YES) HOLD(*yes)
              MONMSG     MSGID(CPF0000)
             SBMJOB     CMD(QRYDST OPTION(*OUT) USRID(*CURRENT) +
                          DLTSTS(*NO) OUTFILE(QGPL/ALLMAILOUT) +
                          OUTMBR(*FIRST *ADD)) JOB(&DXUSRP) +
                          JOBQ(*LIBL/QBATCH) USER(&DXUSRP) +
                          SYSLIBL(*SYSVAL) CURLIB(*CRTDFT) +
                          INLLIBL(*SYSVAL) LOGCLPGM(*YES) HOLD(*yes)
              MONMSG     MSGID(CPF0000)
             ENDDO
              GOTO LOOP
 DONE:       ENDPGM

When you are done, you must decide when you want to release these jobs to run. You can decide to run these jobs at a later time or to run them now.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

15764940

Document Information

Modified date:
18 December 2019

UID

nas8N1018082