[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] dynamic array size



All,

Unless things have changed in recent versions, arrays are created at compile 
time.  Therefore any dynamic declaration of the array must happen at compile 
time and can not be dependent upon any sql information.  There might be 
various ways to get around this, such as running an sql select in a script 
first and then passing that variable into the sqr.

Ultimately, I guess it boils town to cost-benefit.....  Is it really worth 
the effort to make something dynamic just so you can prove tricky stuff 
works? or is it easier/more resource efficient to determine the maximum size 
it could ever be and add 10 - 20 percent?  Given the speed of hardware and 
the cost of RAM, I am guessing the second is more cost effective.


hope this helps.

peace,
clark 'the dragon' willis



PSA: Salary <> Slavery. If you earn a salary, your employer is renting your 
services for 40 hours a week, not purchasing your soul. Your time is the 
only real finite asset that you have, and once used it can never be 
recovered, so don't waste it by giving it away.

I work to live; I don't live to work.

"Time is the coin of your life. It is the only coin you have, and only you 
can determine how it will be spent. Be careful lest you let other people 
spend it for you."

Carl Sandburg
(1878 - 1967)

----Original Message Follows----

I am not ruling out both (Richard & Jeff's) of your comments, but if we look 
at Dan's email which was posted in 2001, it looks like there is a 
possibility. Our sqr version is
with SQR for PeopleSoft/8.45.05.
-------------------------------------------------------------------------------------

--------------------------------------------------------------------------------

There is a kludge for this. Unfortunately it only works for certain
situations. You can use "ask" to get the array size. For instance we count
the rows in a specific table and then call the sqr that has the array in it
passing the row count as a parameter. Limited, but can be useful.

Good luck,
Dan



>
>
>For version 4.3 which I use, arrays are created before any code is
>executed so a dynamic sizing is not possible (in this version.)
>
>Richard Knapp
>Database Programmer/Analyst
>Institutional Research and Planning
>University of Missouri System
>573-882-8856
>knappr@umsystem.edu
>
>-----Original Message-----
>
>Hi,
>
>I need some advice from sqr experts. Thought it would be simple but
>having
>hardtime to resolve it.
>
>Issue:
>
>create-array name=BUs size=100
>      field=legal_entity:char
>
>I have to set above 100 as dynamic and I know the count before I create
>this
>array. So, I changed the above code as below:-
>
>select count(*) &cnt
>let #count = &cnt
>from abc_table
>   show 'count : ' #count
>
>create-array name=BUs size=#count
>      field=legal_entity:char
>
>After I changed the program, it is not recognizing the #count. I
>replaced
>with {#count} but not working. I looked at the old postings and looks
>like
>it can be resolved. Could you send some suggestions on this.
>
>Thanks in advance.
>Sony
>



_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users