----- Original Message -----
From: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
To: "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, November 14, 2003 3:48 PM
Subject: RE: Sharing variables between procedures


> 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)

Everybody knows you're trying to avoid EVAL; MOVE rules the world! (Sorry,
couldn't resist).

I think you need a different eval:

C                   eval      pMYFILE = %addr(Buffer)
C     Key           chain     MYFILE
C                   return    %found(MYFILE)

This is almost the same as what you originally did, but you lose the pointer
in the prototype.

Joep Beckeringh


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