It's easy enough in C,PL/1 or REXX. Has RPG entered the seventies yet ?
Paul Newport
On the information super B road
DARRARY S 5 0 DIM(XXX)
DOccurs DS OCCUR(XXX)
D field1 1 5
Dfield2 6 10
C Z-add 1 x
5 0
C value lokup array,x
01 (equal test)
C if *in01 = *off
C z-add 1 x
C *blanks lokup array,x
01
C if *in01 = *on
c move value array,x
c endif
c endif
c x occur occurs
c move values
I hope this helps.
Jon Paris - jo...@vnet.ibm.com - AS/400 AD
Good idea. Now how do we dynamically allocate the array? Has IBM come
up with a *VARSIZE (now available for character variables) for
dimensioning arrrays, structures?
--
Thank You.
Regards
Dave Mahadevan.. mailto:maha...@fuse.net
With V3R7 RPG contains opcodes to allocate, reallocate and deallocate
storage. This in conjunction with pointers and based data structures
will allow you to dynamically size arrays.
Watch for an upcoming article in News/400 magazine where Julian
Monypenny describes this technique and provides code to show you how
it's done.
Gary Guthrie
Not exactly - although it's on the shopping list for future releases.
I use prototyped versions of malloc, realloc, and free to dynamically
allocate memory to a BASED array or MODS. You do have to keep control
of your maximum number of entries, but then I prefer to do that than
have RPG do it for me anyway.
I've also used the C sort and search functions against such structures
which works well.
You can also use the ILE dynamic memory APIs, User Spaces (great if
you want to allow an array to be shared between users)
or there's also direct RPG Opcode suppoet in V3R7 (ALLOC, etc.)
>Does ILE RPG support multi-dimensional arrays (eg FRED(10)(45)(456) would
>define a 10 by 45 by 456 3d array) and if so how ho you code for them ?
>It's easy enough in C,PL/1 or REXX. Has RPG entered the seventies yet ?
Ta for all the advice, I guess NO is the answer ;-)