× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Actually I was still having multiple problems so I trashed the CL and came
up with this.  The following works without a flaw, (actually I noticed a
flaw right when I pasted it but the 'const' saved my bacon):


      /DEFINE HSpec
      /INCLUDE ROUTINES/QRPGLESRC,HSPEC
      /UNDEFINE HSpec



***************************************************************************
      * Program: COUNTMSG-Count occurances of a message within a joblog.
  *
      * Original purpose was to find out how many tapes were used within a
     *
      * backup.      *
      *      *
      * Modification log:      *
      * 05/07/02 by R.Berendt, CCP    Group Dekko Services, LLC      *
      *          Created.      *
      *      *
      * Compilation instructions:      *
      *   (no special instructions this time.)      *
      *      *

***************************************************************************

      /DEFINE DSpec
     D CountMsg        PR                  extpgm('COUNTMSG')
     D  SearchMsg                     8a   const
     D  MsgCount                      3p 0

     D Alert           PR
     D Subject                       80a
     D Body                        2048a

      /INCLUDE ROUTINES/QRPGLESRC,SRVPGMCPY

     D CountMsg        PI      *ENTRY PLIST
     D  SearchMsg                     8a   const
     D  MsgCount                      3p 0

     D Body            s           2048a
     D Subject         s             80a

      /UNDEFINE DSpec

      /free
       MsgCount=*zeros;
       // Delete the file, if it is already there
       cmd='DLTF FILE(QTEMP/JOBLOG)';
       errorflag=system(cmd);
       Select;
       When errorflag=*zeros;
        // ran ok
       When errorcpf='CPF2105'; // object not found
        // This is ok.
       Other;  // oh crud!
        // Could be anything, including security
        Subject='Cannot attempt to count messages';
        Body=%trim(cmd) + ' ended with ' + ErrorCpf +
             ' <NL> ' + %trim(%EDITC(JOB_NUM:'X')) + '/' +
              %trim(USER) + '/' + %trim(JOB_NAME);
        alert(Subject:Body);
        return;
       EndSl;

       // Retrieve the joblog
       cmd='DSPJOBLOG OUTPUT(*OUTFILE) OUTFILE(QTEMP/JOBLOG)';
       errorflag=system(cmd);
       Select;
       When errorflag=*zeros;
        // ran ok
       Other;  // oh crud!
        // Could be anything
        Subject='Cannot attempt to count messages';
        Body=%trim(cmd) + ' ended with ' + ErrorCpf +
             ' <NL> ' + %trim(%EDITC(JOB_NUM:'X')) + '/' +
              %trim(USER) + '/' + %trim(JOB_NAME);
        alert(Subject:Body);
        return;
       EndSl;

       // Count the records
      /end-free
     C/EXEC SQL
     C+ Select count(*) into :MsgCount
     C+ From qtemp/joblog
     C+ Where qmhmid=:SearchMsg
     C/END-EXEC
      /free
       Select;
       When sqlcod=*zeros;  // ok
        // ok
       Other;
        Subject='Cannot attempt to count messages';
        Body=%trim(cmd) + ' ended with ' + ErrorCpf +
             ' <NL> ' + %trim(%EDITC(JOB_NUM:'X')) + '/' +
              %trim(USER) + '/' + %trim(JOB_NAME);
        alert(Subject:Body);
        return;
       EndSl;

       // Delete the file
       cmd='DLTF FILE(QTEMP/JOBLOG)';
       errorflag=system(cmd);

       *inlr=*on;
       return;
      /end-free

      /eject
     P Alert           B
     D Alert           PI
     D Subject                       80a
     D Body                        2048a

     D LocCmd          s                   like(cmd)

      /free
       LocCmd='SNDEMEMC SENDER('+apos+'GDIHQ@dekko.com' + apos + ' ' +
                                 apos+'ROUTINES / COUNTMSG'+apos+') '+
                       'SUBJECT(' + apos + %trim(subject) + apos + ') ' +
                       'MESSAGE(' + apos + %trim(Body) + apos + ') ' +
                       'GROUP(OPERATIONS)';
       errorflag=system(LocCmd);
       return;
      /end-free

     P Alert           E

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 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.