|
Gosh I know that, and knew that when I responsed too. Didn't see it. This is just another example of what needs to change in V5R3 or sooner. EVERY programmer, without exception, that I've seen code this type of stuff, assumes that READ and READE return a %FOUND() condition rather than %EOF(). %EOF may be important, but %FOUND is how we logically think it should be coded. I sure hope Hans & Barbara get a chance to "enhance" this in V5.3 and also get to PTF it back to V3R2. (Just kidding about the PTF thing). -Bob Cozzi > > The correct built in function to determine when READE does not get a > hit is > %eof. For example: > > eval kfline = 0 > filekey15 setll file15 > if %equal > filekey15 reade file15 > dow not %eof > eval kf_line = kf_line + 1 > filekey15 reade file15 > enddo > endif > > Mel Rothman > Mel Rothman, Inc. > > > Terry@xxxxxxxxxx wrote: > > > > > > > > > > > Not knowing what FILEKEY15 key lists consists of makes this a > guess, but > > assuming it's something like > > FILEKEY15 klist > > kfld SomeKey > > kfld kf_line > > and assuming the line number field name in the file is kf_line... > > > > I'd suggest trying something like: > > > > EVAL kf_line - *HIVAL > > filekey15 setgt file15 > > SomeKey readpe file15 > > if %found(file15) > > eval kf_line = kf_line + 1 > > else > > eval kfline = 1 > > endif > > > > > > Terry Richardson > > V(Document link: Bookmarks (6))ermont Information Processing, Inc. > > terry@xxxxxxxxxx > > > > > > > > > fkany@averittexpr > > > ess.com > > > Sent by: > To > > rpg400-l-bounces@ RPG400-L@xxxxxxxxxxxx > > > midrange.com > cc > > > > > > Subject > > 11/20/2003 11:34 %EQUAL in a DOU loop > > > AM > > > > > > > > > Please respond to > > > RPG programming > > > on the AS400 / > > > iSeries > > > <rpg400-l@midrang > > > e.com> > > > > > > > > > > > > > > > > > > > Hello, > > > > The program seems to crash in the routine below. I know that > there aren't > > any records with 999 lines of notes. I'm thinking that maybe the > program > > keeps looping. > > Am I missing something in the code below that would cause this > routine to > > keep looping? > > > > The program crashes with this message, "Receiver value too small > to hold > > result. > > The target for a numeric operation is too small to hold the result" > > > > Thanks, > > > > Frank > > > > C EVAL KF_LINE = 1 > > * > > * Set File Pointer > > C FILEKEY15 SETLL FILE15 > > * > > * Notes Records Exist in File > > C IF %EQUAL(FILE15) > > * > > * Find New Line # for Note # > > C DOU NOT %EQUAL(FILE15) > > C FILEKEY15 SETLL FILE15 > > * > > C IF NOT %EQUAL(FILE15) > > C LEAVE > > C ENDIF > > * > > C IF %EQUAL(FILE15) > > C EVAL KF_LINE = KF_LINE + 1 > > C ENDIF > > * > > C ENDDO > > > > > _______________________________________________ > 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.
As an Amazon Associate we earn from qualifying purchases.
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.