× 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 ]
I have a file with a listing of all directory entries.  It has 3 fields
for directory, object and size.  I am trying to summarize that into a file
to total it by directory.  The summary file will have directory, size and
rundate.  The line in the following which is failing is the following:
     C/EXEC SQL
     C+ Select sum(ifslsiz) into :Dirsize
     C+ From ifslist
     C+ Where ifsldir like :Directory
     C/END-EXEC
This generates the following message in the joblog:  SQL0305-Indicator
variable required.  Frankly, I don't believe that I should be getting null
variables.  If I am doing this right it should be a guaranteed hit.
Complete source is as follows:
      /DEFINE HSpec
      /INCLUDE ROUTINES/QRPGLESRC,HSPEC
      /UNDEFINE HSpec



***************************************************************************
      * Program:      *
      *      *
      *      *
      * Modification log:      *
      * mm/dd/02 by R.Berendt, CCP    Group Dekko Services, LLC      *
      *          Created.      *
      *      *
      * Compilation instructions:      *
      *   (no special instructions this time.)      *
      *      *

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


      /DEFINE DSpec
      /INCLUDE ROUTINES/QRPGLESRC,SRVPGMCPY
     D dirlocal      e ds                  extname(dirlocal)
      /UNDEFINE DSpec

     C/EXEC SQL
     C+ Delete from dirlocal
     C+ Where rundate=current date
     C/END-EXEC

     C/EXEC SQL
     C+ Insert into dirlocal
     C+ (SELECT IFSLDIR,0,CURRENT DATE
     C+  FROM IFSLIST
     C+  WHERE IFSLDIR NOT LIKE '/%/%'
     C+  GROUP BY IFSLDIR)
     C/END-EXEC
      * at this point dirlocal has 73 records.
     C/EXEC SQL
     C+ Declare C1 cursor for
     C+ Select Directory
     C+ From dirlocal
     C/END-EXEC

     C/EXEC SQL
     C+ Open C1
     C/END-EXEC

     C/EXEC SQL
     C+ Fetch C1 into :Directory
     C/END-EXEC

      /free
       dow sqlcod=0;
        Directory=%trim(Directory) + '%';
        Dirsize=*zeros;
      /end-free

     C/EXEC SQL
     C+ Select sum(ifslsiz) into :Dirsize
     C+ From ifslist
     C+ Where ifsldir like :Directory
     C/END-EXEC
      * the above generated the SQL0305
      * Is it that I am using a sum into a host variable
      * defining my LIKE wrong
      * or what?

     C/EXEC SQL
     C+ Update dirlocal
     C+ Set dirsize=:dirsize
     C+ Where current of C1
     C/END-EXEC

     C/EXEC SQL
     C+ Fetch C1 into :Directory
     C/END-EXEC

      /free
       EndDo;
      /end-free

     C/EXEC SQL
     C+ Close C1
     C/END-EXEC

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

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.