[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]]
==== Array exceeding 64K (AREV Specific) ====
=== At 21 OCT 1999 11:04:12PM Mark Ford wrote: ===
{{tag>"AREV Specific"}}
I am usig the V119 routine to sort an array. Under program control I build the array based on user input. The user can indicate 1 - 10 sort fields.
The record count is now 4,500 and this results in the array exceeding the 64k limit.
I would appreciate advice on how to reslove this.
Mark
----
=== At 22 OCT 1999 12:26AM Don Bakke wrote: ===
Mark,
V119 can be set up to sort arrays in external DOS files so it is possible to exceed the 64K barrier. The process is significantly more complex than a single V119 call (you will actually make various V119 calls this way) but the end result is still relatively fast. I believe SysKnowledge article R38 has some pseudo code for this.
dbakke@srpcs.com
[url=http://www.srpcs.com]SRP Computer Solutions[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
----
=== At 22 OCT 1999 01:15AM Steve Smith wrote: ===
You might have to OSBWRITE the array to file, soft the file via an external sort utility, then read it back in.
Another way might be to compress the strings to sort (say if your keys are all numeric). Let's say your keys have 4 digits, you can compress the key value with code like:
TINY.KEY=CHAR(KEY1,2):CHAR(KEY3,2)
Then sort,
Then uncompress with:
KEY =FMT(SEQ(TINY.KEY1,1),'R(0)#2'))
KEY := FMT(SEQ(TINY.KEY2,1),'R(0)#2'))
KEY=INT(KEY)
There are other similiar techniques, but this might give you some
ideas.
Another possibility is to place the keys in a non-delimited array, and write your own qsort routine based on elements at an offset, rather than at a certain field.
Another idea would be to write all the keys to a temp file & let AREV's sort statement handle it for you. The temp file could be located on a ramdisk for extra speed.
Steve
----
=== At 22 OCT 1999 11:48AM Mark Ford wrote: ===
Steve,
Thank you for the very helpful ideas.
Mark
----
=== At 22 OCT 1999 11:51AM Mark Ford wrote: ===
Thanks Don I'll checkout your suggestion.
Mark
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=3FC803421FA20680852568120010DD48|View this thread on the forum...]]