× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Mike,

You're first question isn't worded right.
I think you mean "Can I sort a data structure array using one of its
subfields as a key, using SORTA?"  
-Answer: NO

Your second question for a faster CLEAR opcode is a good one. At fist glance
someone might suggest moving *BLANK or *ALLX'00' into the entire data
structure. But that's probably not a good idea when you have character and
numeric subfields in the same data structure.

A faster way might be to create a second data structure and simply move it
into the one being cleared. If I remember right, CLEAR moves *BLANKS and
*ZEROS (metaphorically speaking) into each subfield individually. Hence the
lengthy CLEAR time.

If you do this:

D MYDS          DS           INZ  DIM(5000)
D  sf1                  7P0
D  sf2                 10A

  
D clearDS       DS           LIKEDS(MYDS) INZ


C           eval   MYDS(1) = ClearDS

It could be "faster" for an individual element. 

I don't know if MOVE works with data structure arrays when it comes to MOVE
REPEAT, as follows:

 C           MOVE    ClearDS      MYDS

But if it does, then you can clear a little faster than the individual
subfield clears that occur with the CLEAR opcode.
-Bob


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of mikesoucy1262@xxxxxxxx
Sent: Wednesday, December 08, 2004 1:01 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Questions about DS arrays


I have a couple of questions about data structure arrays.

1.  Can an individual field within a data structure array be sorted using
the BIF %SUBARR and the SORTA op code?

2.  What is the best way to clear or initialize a large data structure array
(over 5000 elements)?  I have found that using the CLEAR opcode takes a long
time.

Thanks,

Mike Soucy
mikesoucy1262@xxxxxxxx

________________________________________________________________
Juno Gift Certificates
Give the gift of Internet access this holiday season.
http://www.juno.com/give

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