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



Right.
I have maintained a std practice for myself as -


FETCH the first record.

// start the loop .. for e.g. while SQLCOD <> 00 .. or some EOF condition ..
MOVE stmts ....
FETCH the next record ....
// end of loop.

This takes care of empty file as well as the last record.

Hope this helps.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of rob@xxxxxxxxx
Sent: Friday, September 23, 2005 1:34 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Final record duplicating


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.



http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at netadmin@xxxxxxxxx and delete this mail. 
_____________________________________________________________________

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.