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



I thought about that but should the loop not catch that? I suppose now that 
I think about it would not, I guess I am still thinking in C where I move 
the record pointer BEFORE the end of the loop....nevermind your right and I 
am having a brain fart today.  Thanks for the assistance Rob.


On Thu, 22 Sep 2005 15:04:27 -0500, rob wrote
> As I suspected, you fetch, the fetch is unsuccessful the last time.  
> Yet you still do your MOVEs, calcs and WRITE. After your fetch you 
> need a ... C/END-EXEC C -->                  IF        SQLSTT=SqlStateOk
> C                   MOVE      CUSTNO        PRTCUSTNO
> C                   MOVE      CUSTNAME      PRTCUST 
> C                   MOVE      SALES         PRTSALES 
> C                   MOVE      COST          PRTCOST 
> C                   MOVE      MARGIN        PRTMARGIN
> C                   IF        SALES = 0 
> C                   EVAL      PRTPCT = 00.00 
> C                   ELSE 
> C                   EVAL      PRTPCT = MARGIN / SALES
> C                   ENDIF 
> C                   WRITE     DETAILLINE 
> C -->                  EndIf
> C                   ENDDO
> 
> Rob Berendt
> -- 
> Group Dekko Services, LLC
> Dept 01.073
> PO Box 2000
> Dock 108
> 6928N 400E
> Kendallville, IN 46755
> http://www.dekko.com
> 
> "Douglas W. Palme" <dpalme@xxxxxxxxxxx> 
> Sent by: rpg400-l-bounces@xxxxxxxxxxxx
> 09/22/2005 02:51 PM
> Please respond to
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> 
> To
> RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> cc
> 
> Fax to
> 
> Subject
> Re: Final record duplicating
> 
> Here is it Rob:
> 
> C                   IF        SqlStt = SqlStateOK
> C                   WRITE     HEADINGS 
> C                   DOW       SQLSTT = '00000' 
> C                   IF        *IN99 = *ON 
> C                   EVAL      *IN99 = *OFF 
> C                   WRITE     HEADINGS 
> C                   ENDIF 
> C/EXEC SQL 
> C+    FETCH RPTCURSOR 
> C+    INTO :CUSTNO, 
> C+         :CUSTNAME, 
> C+         :SALES, 
> C+         :COST, 
> C+         :MARGIN 
> C/END-EXEC 
> C                   MOVE      CUSTNO        PRTCUSTNO
> C                   MOVE      CUSTNAME      PRTCUST 
> C                   MOVE      SALES         PRTSALES 
> C                   MOVE      COST          PRTCOST 
> C                   MOVE      MARGIN        PRTMARGIN
> C                   IF        SALES = 0 
> C                   EVAL      PRTPCT = 00.00 
> C                   ELSE 
> C                   EVAL      PRTPCT = MARGIN / SALES
> C                   ENDIF 
> C                   WRITE     DETAILLINE 
> C                   ENDDO
> 
> On Thu, 22 Sep 2005 14:29:21 -0500, rob wrote
> > Guess we've got to see the loop logic.  There's a big difference between
> > 
> > dow sqlstt='00000';
> >   fetchSubprocedure();
> >   // guts of your program
> > EndDo;
> > 
> > and
> > dow sqlstt='00000';
> >   // guts of your program
> >   fetchSubprocedure();
> > EndDo;
> > 
> > Which is yet another reason why I do
> > dow fetchSubprocedure();
> >   // guts
> > EndDo;
> > 
> > Rob Berendt
> > -- 
> > Group Dekko Services, LLC
> > Dept 01.073
> > PO Box 2000
> > Dock 108
> > 6928N 400E
> > Kendallville, IN 46755
> > http://www.dekko.com
> > 
> > "Douglas W. Palme" <dpalme@xxxxxxxxxxx> 
> > Sent by: rpg400-l-bounces@xxxxxxxxxxxx
> > 09/22/2005 02:19 PM
> > Please respond to
> > RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> > 
> > To
> > "RPG Group" <rpg400-l@xxxxxxxxxxxx>
> > cc
> > 
> > Fax to
> > 
> > Subject
> > Final record duplicating
> > 
> > I am using embedded SQL for a detail report, and the very last 
> > record is duplicating itself when it is printed.  I am checking the 
> > '02000' SQLSTT status at the top of each loop run, and the write 
> > detailine should only be
> > 
> > included if the SQLSTT is equal to '02000'.
> > 
> > It appears that after it reads the last record of data the SQLSTT is 
> > not updating itself until the second reading which generates an EOF. 
> >  Am I correct and if so, suggestions on a workaround?
> > 
> > If you bought, it was hauled by a truck - somewhere, sometime.
> > 
> > -- 
> > This is the RPG programming on the AS400 / iSeries (RPG400-L)
> >  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> > subscribe, unsubscribe, or change list options, visit: 
> > http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> > L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> > review the archives at http://archive.midrange.com/rpg400-l.
> > 
> > -- 
> > This is the RPG programming on the AS400 / iSeries (RPG400-L)
> >  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> > subscribe, unsubscribe, or change list options, visit: 
> > http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> > L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> > review the archives at http://archive.midrange.com/rpg400-l.
> 
> If you bought, it was hauled by a truck - somewhere, sometime.
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
>  mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To 
> subscribe, unsubscribe, or change list options, visit: 
> http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-
> L-request@xxxxxxxxxxxx Before posting, please take a moment to 
> review the archives at http://archive.midrange.com/rpg400-l.


If you bought, it was hauled by a truck - somewhere, sometime.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.