|
>You can't read an externally described file into a field, so the following won't work: Who says you can't? >From the V5R2 ILERPG reference, section "what's new..." v Data-structure result for externally-described files A data structure can be specified in the result field when using I/O operations for externally-described files. This was available only for program-described files prior to V5R2. Using a data structure can improve performance if there are many fields in the file. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 11/14/2003 09:48 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx> cc Subject RE: Sharing variables between procedures > From: Joep Beckeringh > > BTW, while I was wondering why you were complicating things with pointers, > I noticed that according to the prototype your procedure returns a pointer > as well. But the rest of the coding suggests that is a typo. You're of course correct, Joep. Thanks for pointing that out. > In RPG parameter passing is by reference unless specified otherwise. Since > you can only specify CONST and VALUE, VALUE is the only way to not pass by > reference. That is why you need to pass a pointer by value (otherwise the > pointer to the pointer would be passed). True, but there's a slight problem with I/O. You can't read an externally described file into a field, so the following won't work: FMYFILE UF A E K DISK DmyDS E DS EXTNAME(MYFILE) BASED(pMYFILE) PReadMYFILE B export D PI N d Key like(MYKEY) value d Buffer likeds(myDS) C Key chain MYFILE Buffer C return %found(MYFILE) P e This syntax is invalid. The only way I could find to make it work requires an EVAL, which is what I'm trying to avoid: d Key like(MYKEY) value d Buffer likeds(myDS) C Key chain MYFILE C if %found C eval Buffer = myDS C endif C return %found(MYFILE) As far as I know, there's no way in RPG to specific a parameter to use the EXTNAME or LIKEREC parameter. Maybe you can do it somehow in V5R2, I don't know. Joe _______________________________________________ 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.