×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Can you DIM the DS and forget about the MODS all together?

"Array Data Structures

An "Array Data Structure" is a data structures defined with keyword DIM. An array data structure is like a multiple-occurrence data structure, except that the index is explicitly specified, as with arrays."
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/books/c092508602.htm


Timothy Adair wrote:
I've searched the archives and can't find an answer on this. How do you do a Lookup in a multiple-occurrence data structure. This is my first one and I can't seem to find a (good) solution.

Here's my DS:

D Record ds occurs(2000)
D Comp# 4 0
D Prod# 7 0
D CurDat 8 0
D CurPrc 7 4
D Status 1
D GL# 7 0

I am populating this with an SQL cursor loop, and doing Order By the last field, GL#. Now I need to be able to do some kind of lookup on the GL# field and return the element number that gets the hit.

I know I can do something funky, like do a loop that checks each occurrence of the GL# field, or pull the GL# field out of the DS and make it its own array (both ugly), but isn't there a built-in function for this? I tried %lookup but that doesn't compile if it's not an array.

Help? (TIA.)

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.