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



A very change thing going on with the SQL in my program:

Loop control for going through selected rows is as follows here:

         //
         exsr PosFile ;
         //
         DOU RowsFetched = 0 or SqlCode <> 0 ;
           exsr FetchNext ;
           For rx = 1 to RowsFetched ;
             Eval-Corr CS = MT(rx) ;
             //
             // .. Lots of code to process each row…
             //
           ENDFOR;
         EndDo;

         exsr CloseCK ;


Subroutine Posfile declares and opens cursor CK...


         //
         svkey = sv15x3ad + %char(sv15pudt) +
                 %editc(sv15ot:'X') + %editc(sv15pro:'X') ;
         EXEC SQL Declare CK Cursor for
            select
              CS154X4USR ,
              ….. <...list of columns...>
              CSDLTUSR
            from cs15p001
            where CSACTINA <> 'I'
              and ( : fleread in ('00', '01')  or
                    : fleread = '02' and current_user = CS15NADUSR or
                    : fleread = '03' and current_user = CS154X4USR )
              and (CS15OT <> 0 and CS15PRO <> 0)
              and (:SVKEY < CS15X3AD || char(CS15PUDT) ||
                            digits(CS15OT) || digits(CS15PRO))
            order by CS15X3AD, CS15PUDT, CS15OT, CS15PRO ;
            //
         exec sql Open CK ;
         //
       endsr ;


Then there is subroutine FetchNext:
         exec sql Fetch Next from CK for :Rows_To_Fetch rows
                  into :MT ;
         rowsFetched = SqlErrd(3) ;
         *in99 = (rowsfetched = 0) ;

What's going on is in the generated code from the SQL precompiler at the FETCH statement, pasted following from debug in the 5250 session running the program, copied below. At that first line (with the arrow indicating which one), before it executes, ROWS_TO_FETCH is equal to 1000 (one thousand). After it executes, SQLER5 is still equal to ZERO, even though ROWS_TO_FETCH is still 1000. 😮😮 Can somebody tell me how to fix this?

//*  exec sql Fetch Next from CK for :Rows_To_Fetch rows
//*           into :MT ;
   SQLER5 = ROWS_TO_FETCH;      <==========
   SQLER6 = -4;
   SQCALL000013(
        SQLCA
      : SQL_00043
      : MT
   );




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.