We have a CL program which creates an email and sends it off.  What it 
basically does is:
1-Display all user profiles to an output file.
2-Query this output file.  Selecting user profiles with a maximum amount 
of storage <> nomax.  Computes how close to this maximum they are and 
creates a printout.
3-Creates an email out by combining a standard header file, some subject 
lines and then the spool file.

One of the problems is, that on RARE occasions the wrong spool file is 
grabbed.  Not only is the spool file name different, but the spool file 
was originated outside of this job.  Can't figure out how that could 
happen.
Message was generated:
CPA5305-Message . . . . :   Record not added. Member MESSAGE is full. (C I 
9999) 
Cause . . . . . :   The maximum size has been reached for member MESSAGE 
file
  MESSAGE in library QTEMP.

Job is submitted to batch.

Spool file I thought it would copy is QPQUPRFIL from job 
422347/ROB/MAXSTORAGE.  Spool file it did copy was QSYSPRT from job 
305863/BACKUP/BACKUP.

Thus, an email that normally has only a couple of lines, had the entire 
contents of a 1,162 printout in it's text.




/* Group Dekko Services, LLC                                        */
/* ALL RIGHTS RESERVED.                                             */
/*                                                                  */
/* This program will ...                                            */
/*                                                                  */
/*                                                                  */
/* Modification log:                                                */
/* 08/10/99 by R.Berendt, CDP   GDS,LLC                             */
/*          Created                                                 */
/*                                                                  */
/*                                                                  */
PGM

    DCL  &APOS        *CHAR   1  /* Apostrophe                       */
    DCL  &SQLSTMT     *CHAR 200  /* SQL statement                    */
    DCL  &SYSTEM      *CHAR   8  /* System name                      */

             CHGVAR     VAR(&APOS) VALUE(X'7D')

    /*     +
     | Retrieving network attributes     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Retrieving network attributes.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             RTVNETA    SYSNAME(&SYSTEM)

    /*     +
     | Refresh the list of users.     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Refreshing the list of users.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
       DSPUSRPRF USRPRF(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/USERS)

    /*     +
     | Create the spool file of users     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Creating the spool file of users.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             RUNQRY     QRY(MAXSTORAGE)

    /*     +
     | Copy the spool file into a disk file     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Copying the spool file into a disk file.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             DLTF       FILE(QTEMP/SPOOL)
             MONMSG     MSGID(CPF2105) /* File not found */
             CRTPF      FILE(QTEMP/SPOOL) RCDLEN(150)
             CPYSPLF    FILE(QPQUPRFIL) TOFILE(QTEMP/SPOOL) +
                          SPLNBR(*LAST)

    /*     +
     | Merge the heading file and the spool file     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Merging the heading file and the spool file.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             DLTF       FILE(QTEMP/MESSAGE)
             MONMSG     MSGID(CPF2105) /* File not found */
             CRTPF      FILE(QTEMP/MESSAGE) RCDLEN(150)
             CPYF       FROMFILE(MAXSTORAGE) +
                          TOFILE(QTEMP/MESSAGE) MBROPT(*ADD) +
                          FMTOPT(*NOCHK)
    /*     +
     | Append system name to end of subject line.     +
     | UPDATE QTEMP/MESSAGE     +
     |        SET MESSAGE=SUBSTR(MESSAGE,1,66) CONCAT ' - '     +
     |            CONCAT &SYSTEM     +
     |        WHERE SUBSTR(MESSAGE,1,7)='Subject'     +
    */
             CHGVAR     VAR(&SQLSTMT) VALUE('UPDATE QTEMP/MESSAGE +
                          SET MESSAGE=SUBSTR(MESSAGE,1,66) CONCAT +
                          ' *CAT &APOS *CAT ' - ' *CAT &APOS *CAT +
                          ' CONCAT ' *CAT &APOS *CAT &SYSTEM *CAT +
                          &APOS *CAT ' WHERE +
                          SUBSTR(MESSAGE,1,7)=' *CAT &APOS *CAT +
                          'Subject' *CAT &APOS)
             RUNSQL     REQUEST(&SQLSTMT)
    /*     +
     | Insert system name.     +
    */
             CHGVAR     VAR(&SQLSTMT) VALUE('INSERT INTO +
                          QTEMP/MESSAGE VALUES(' *TCAT &APOS *TCAT +
                          &SYSTEM *TCAT &APOS *TCAT ')')
             RUNSQL     REQUEST(&SQLSTMT)
             CPYF       FROMFILE(QTEMP/SPOOL) TOFILE(QTEMP/MESSAGE) +
                          MBROPT(*ADD) FMTOPT(*NOCHK)

    /*     +
     | Ensure that working directory exists, and working file does not.   
+
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Ensuring that working directory exists and working file doesnt'   
+
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             MD         DIR('/qtemp')
             MONMSG     MSGID(CPFA0A0)
             DEL        OBJLNK('/qtemp/maxstg.txt')
             MONMSG     MSGID(CPFA0A9)

    /*     +
     | Send the file to the selected users     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Sending the file to the selected users.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             IF         COND(&SYSTEM *NE 'GDISYS') THEN(DO)
             SNDEMAIL10 FILE(MESSAGE) LIB(QTEMP) MBR(MESSAGE) +
                          STMF('/qtemp/maxstg.txt') +
                          ORIGINATOR(ROB@xxxxxxxxx) +
                          RECIPIENT( +
                                    (ROB@xxxxxxxxx)    +
                                    (PEGGY@xxxxxxxxx)  +
                                    (TROYM@xxxxxxxxx)  +
                                    (KEVINR@xxxxxxxxx) +
                                   )
             ENDDO
             ELSE       CMD(DO)
             SNDEMAIL10 FILE(MESSAGE) LIB(QTEMP) MBR(MESSAGE) +
                          STMF('/qtemp/maxstg.txt') +
                          ORIGINATOR(ROB@xxxxxxxxx) +
                          RECIPIENT( +
                                    (ROB@xxxxxxxxx)    +
                                    (PEGGY@xxxxxxxxx)  +
                                    (KEVINR@xxxxxxxxx) +
                                   )
             ENDDO
    /*     +
     | Delete spool file     +
    */
       SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA( +
       'Deleting the spool file.'     +
                   ) TOPGMQ(*EXT) MSGTYPE(*STATUS)
             DLTSPLF    FILE(QPQUPRFIL) SPLNBR(*LAST)


END:

             ENDPGM


Rob Berendt
-- 
"They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety." 
Benjamin Franklin 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.