Great idea Scott!
But remember, there is a lot of overhead in a procedure call (relative
to a straight, in-line opcode) so you will add to the time it takes to
retrieve the database records; if that's an issue with the code, the
you'd want to avoid wrapping it into a procedure.

Ah, yet another reason why the INLINE keyword is needed on Procedure
specs....

Bob Cozzi


> -----Original Message-----
> From: rpg400-l-admin@midrange.com
> [mailto:rpg400-l-admin@midrange.com] On Behalf Of Scott Klement
> Sent: Thursday, June 06, 2002 4:06 PM
> To: 'rpg400-l@midrange.com'
> Subject: RE: Resetting %EOF
>
>
>
> On Thu, 6 Jun 2002, Jim Langston wrote:
> >
> > I don't think there is a truly elegant way to do this in
> RPG, although
> > C has solved the problem with it's syntax:
> >
> > while ( read(somefile, somebuffer) != NULL )
> > {
> >
> > }
> >
> > which we don't seem to have (yet) in RPG.
> >
>
> You could do something very similar in RPG like this:
>
>
>      c                   dow       read_file(key1: key2: key3)
>      c         .. do stuff ..
>      c                   enddo
>
>      P read_file       B
>      D read_file       PI             1N
>      D    key1                       10A
>      D    key2                       10A
>      D    key3                       10A
>
>      c     klistb        klist
>      c                   kfld                    key1
>      c                   kfld                    key2
>      c                   kfld                    key3
>
>      c     klistb        reade     IN057P2
>      c                   return    %EOF(IN057P2)
>
>      P                 E
>
>
> Another way, of course, would be to call the functions from
> the C-runtime
> to read the file from an RPG program.   (And therefore make
> it work much
> the same way as the C language)
>
>
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L)
> mailing list To post a message email: RPG400-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
> or email: RPG400-L-request@midrange.com
> 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 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.