|
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)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.