Main Page | Report this Page
Computers Forum Index  »  Computer - Databases - Pick  »  converting a "list" to a dynamic array...
Page 1 of 1    

converting a "list" to a dynamic array...

Author Message
drdanny...
Posted: Fri Jul 31, 2009 9:31 pm
Guest
is there a way to convert an active list to a dynamic array in d3?

thanks!
 
Peter McMurray...
Posted: Sat Aug 01, 2009 2:52 am
Guest
010 DGLIST = NOVAL
011 EXECUTE 'SSELECT DESCS WITH PREFIX "DG" BY CODE'CAPTURING OUTPUT
RETURING ERRORS
012 LOOP
013 READNEXT ID ELSE ID = AM
014 WHILE ID NE AM DO
015 DGLIST<-1> = FIELD(ID,"*",2)
016 REPEAT
Peter McMurray

"drdanny" <drdanny2007 at (no spam) gmail.com> wrote in message
news:e1efb786-0f13-4326-886b-163d178b374a at (no spam) u16g2000pru.googlegroups.com...
Quote:
is there a way to convert an active list to a dynamic array in d3?

thanks!
 
Ross Ferris...
Posted: Sat Aug 01, 2009 3:45 am
Guest
On Aug 1, 7:31 am, drdanny <drdanny2... at (no spam) gmail.com> wrote:
Quote:
is there a way to convert an active list to a dynamic array in d3?

thanks!

Assuming the list has been generated outside of the program, the
following works just fine on D3 7.5

SELECT TO MYVAR

MYVAR is now an attribute delimited variable .... you can

CONVERT at (no spam) AM to at (no spam) VM

or whatever to change as required

HTH
 
Tony Gravagno...
Posted: Sat Aug 01, 2009 8:20 am
Guest
I think Ross nailed it. If the list is not generated outside the
program then look at the RTNLIST options on EXECUTE. Be careful with
those lists, they're sort of "mostly" dynamic arrays, and while they
can be treated as such for most purposes you need to test to be sure.

Note that D3 also supports Ultimate-style EXECUTE, which is quite
powerful.

Finally, if the list isn't always active and you're trying to pull a
save-list into a dynamic array, just read it from the pointer-file:

OPEN 'PF' TO PF ELSE STOP
READ LIST FROM PF,'LISTNAME' ; * voilą!

Be careful when doing this with lists that are huge. The suggestion
that Ross made would be much better for large lists.

HTH
T

Ross Ferris wrote:

Quote:
On Aug 1, 7:31 am, drdanny wrote:
is there a way to convert an active list to a dynamic array in d3?

thanks!

Assuming the list has been generated outside of the program, the
following works just fine on D3 7.5

SELECT TO MYVAR

MYVAR is now an attribute delimited variable .... you can

CONVERT at (no spam) AM to at (no spam) VM

or whatever to change as required

HTH
 
Peter McMurray...
Posted: Sun Aug 02, 2009 4:46 am
Guest
Hi
I actually use all the options mentioned so far with a proviso re Tony's
warning re BIG lists. Any big dynamic array is a killer if not used with
extreme care. I seem to remember U2 having a pointer facility but manual is
elsewhere. In D3 avoid like the plague. The trick I use is

TRY
001 OPEN '','DEBTCON' TO DEBTF ELSE STOP
002 EXECUTE "SSELECT DEBTCON BY SORTNAME
003 CHK = SYSTEM(11)
004 IF CHK < 1 THEN STOP
005 DIM BIGLIST(CHK+1)
006 MAT BIGLIST = ""
007 SELECT DEBTF TO BIGUN
008 MATPARSE BIGLIST FROM BIGUN
009 FOR A = 1 TO CHK
010 CRT BIGLIST(A)
011 NEXT A
It really depends what you want to use it for.
Peter McMurray
"Tony Gravagno" <address.is.in.posts at (no spam) removethis.com.invalid> wrote in
message news:a6g7755ss3viedg4dfaba64dtbr7qdevad at (no spam) 4ax.com...
Quote:
I think Ross nailed it. If the list is not generated outside the
program then look at the RTNLIST options on EXECUTE. Be careful with
those lists, they're sort of "mostly" dynamic arrays, and while they
can be treated as such for most purposes you need to test to be sure.

Note that D3 also supports Ultimate-style EXECUTE, which is quite
powerful.

Finally, if the list isn't always active and you're trying to pull a
save-list into a dynamic array, just read it from the pointer-file:

OPEN 'PF' TO PF ELSE STOP
READ LIST FROM PF,'LISTNAME' ; * voilą!

Be careful when doing this with lists that are huge. The suggestion
that Ross made would be much better for large lists.

HTH
T

Ross Ferris wrote:

On Aug 1, 7:31 am, drdanny wrote:
is there a way to convert an active list to a dynamic array in d3?

thanks!

Assuming the list has been generated outside of the program, the
following works just fine on D3 7.5

SELECT TO MYVAR

MYVAR is now an attribute delimited variable .... you can

CONVERT at (no spam) AM to at (no spam) VM

or whatever to change as required

HTH
 
Martin Phillips...
Posted: Wed Aug 05, 2009 6:45 pm
Guest
Isn't READLIST a wonderful operation in systems that have it.

Transfering a list item by item has a square law in its performance.
The bigger the list, the more times you go round the loop and the
longer it takes to rebuild the string each time around.

Martin Phillips, Ladybridge Systems.
 
Tony Gravagno...
Posted: Sat Aug 08, 2009 12:41 am
Guest
Danny asked:
Quote:
how would ya'll quantify a "large list"?
Peter responded:
I raised this with PS/RD/TL many moons ago and was told that they would
consider 10,000 to be a very small array.

I took this off-list:
nospamNebula-RnD.com/blog/tech/mv/d3/2009/08/d3selectlist1.html

HTH

Tony Gravagno
Nebula Research and Development
TG at (no spam) remove.pleaseNebula-RnD.com
Nebula R&D sells mv.NET and other Pick/MultiValue products
worldwide, and provides related development services
remove.pleaseNebula-RnD.com/blog
Visit PickWiki.com! Contribute!
 
Peter McMurray...
Posted: Sat Aug 08, 2009 4:19 am
Guest
Hi
I omitted to mention that I also take into account the size of the expected
items when I DIM an Array. I believe that an array stills follows the
original rule of it being a contiguous block of 10 byte elements when first
dimensioned. I suspect that the ability to redimension, introduced with AP
if I remember correctly, probably simply adds an extension address in the
last bytes rather than moving the entire array to a new area and clearing
the old area,
If the data can be stored in the 10 bytes then that is what happens and is
therefore lightning fast. If it cannot be then an address is stored in the
array position to a separate variable. Obviously if one then starts to
populate the array piece by piece the memory will look like a Myer store
Ladies wear section 3 hours after the sale starts. However in the example I
gave of importing a flat file I DIM to size say 20,000 then MAT Array =
SPACE(132) thus getting the area setup for use and this is, as the chap
said, orders of magnitude faster.
In the case of 1 million records I would not even consider it for a couple
of reasons. First of all you will crash the memory limit and get a rude
message back unless you have got a squaddrillion frames allocated. Secondly
the whole issue will work a lot better with a sparse array aka a file. You
can use a simple number 1 to a zillion as the key and the true key as
attribute 1 or, as I do, you can use a complex key and incorporate salient
data in the item. It is the old thing of horses for courses.
One of the reasons I occasionally use MATBUILD is to pass a list to a
subroutine as an array element. I have a standard COMMON work area that
lends itself to this sort of handling.
Peter McMurray
"Tony Gravagno" <address.is.in.posts at (no spam) removethis.com.invalid> wrote in
message news:8boo75hqnh2bl1ccukrk03bsfqmkr3hbe9 at (no spam) 4ax.com...
Quote:
Danny asked:
how would ya'll quantify a "large list"?
Peter responded:
I raised this with PS/RD/TL many moons ago and was told that they would
consider 10,000 to be a very small array.

I took this off-list:
nospamNebula-RnD.com/blog/tech/mv/d3/2009/08/d3selectlist1.html

HTH

Tony Gravagno
Nebula Research and Development
TG at (no spam) remove.pleaseNebula-RnD.com
Nebula R&D sells mv.NET and other Pick/MultiValue products
worldwide, and provides related development services
remove.pleaseNebula-RnD.com/blog
Visit PickWiki.com! Contribute!
 
gogleBridge...
Posted: Thu Sep 10, 2009 8:59 pm
Guest
Several issues with "SELECT {filevar} TO dynamicVar"...

Interesting...
You know, I've always done a "SELECT dynamicArray to listVar", but not
the otherway around -- I like it! MY EASTER EGG for the YEAR! --
THANKS!

Of course, I had to test it, and interestingly found the following
side-effects, albeit non-critical:

First, despite your code example -- it appears that "SELECT TO" is
always using the default list (a bug in my book), rather than the list
associated with a filevariable. In your example, you used "SELECT
DEBTF TO BIGUN" -- which would have surprised me if the SELECT from
the EXECUTE statement would have been applied to the filevariable...
Your code appears to work because you EXECUTE a "sselect" statement
(which applys to the default list variable). Then the SELECT TO
scarfed the default-list and the compiler ignored the FILEVARIABLE
("DEBTF"). :(

Second, it's unfortunate that the "SELECT TO" statement requires a
SYSTEM(11) check ahead of its use (to handle the scenario when no
items are present) -- otherwise D3 will trap with a [B12] error --
File Has Not Been Opened. Too bad since SYSTEM(11) isn't free on AP
(especially for large lists), since SYSTEM(11) is no longer boolean in
AP and instead returns the count of items. I think the runtime should
be returnning an empty string.
 
 
Page 1 of 1    
All times are GMT
The time now is Sat Dec 05, 2009 2:09 am