Dynamic Array size !
Posted in 1999
Nayan Jain asked whether a 4GL array size can be set dynamically from a variable. Art S. Kagel and Jonathan Leffler said no dynamic arrays exist. Art suggested a reasonably sized array as a window onto a SCROLL cursor, refilled with FETCH ABSOLUTE. Bernhard Gramberg compared it to C; Douglas Wilson suggested Perl. Answered: not possible.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi all, I want to know if the array size in 4GL program can be defined dynamically ? like ... DEFINE p_count INTEGER DEFINE ARRAY gr_cust[p_count] OF RECORD LIKE customer.* with this if i have 5 customer in table the array will be of 5 records. else it can be 1000 tooo... TIA, Nayan Jain ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "A man is incomplete until he is married After that, he is finished. " -- Zsa Zsa Gabor
No dynamic arrays yet. You can declare a reasonable array and open the cursor used to fill it as a SCROLL cursor and then treat the array as a window into the select set. If the user wants to scroll outside the current window shift some rows around in the array use the FETCH ABSOLUTE to fetch the next partial or full window in that direction. If you write the windowing code carefully you can package it as a generic library function set and reuse it. I have. Art S. Kagel nayan jain wrote: > > Hi all, > > I want to know if the array size in 4GL program can be defined > dynamically ? > > like ... > > DEFINE p_count INTEGER > DEFINE ARRAY gr_cust[p_count] OF RECORD LIKE customer.* > > with this if i have 5 customer in table the array will be of 5 records. > else it can be 1000 tooo... > > TIA, > Nayan Jain ! > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > "A man is incomplete until he is married After that, he is finished. " > -- Zsa Zsa Gabor
nayan jain wrote: > I want to know if the array size in 4GL program can be defined > dynamically ? > > like ... > > DEFINE p_count INTEGER > DEFINE ARRAY gr_cust[p_count] OF RECORD LIKE customer.* > > with this if i have 5 customer in table the array will be of 5 > records. else it can be 1000 tooo... No. It has been considered, occasionally, but never implemented. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>
it is all like C. No variable array in C, as well no in 4GL nayan jain schrieb: > Hi all, > > I want to know if the array size in 4GL program can be defined > dynamically ? > > like ... > > DEFINE p_count INTEGER > DEFINE ARRAY gr_cust[p_count] OF RECORD LIKE customer.* > > with this if i have 5 customer in table the array will be of 5 records. > else it can be 1000 tooo... > > TIA, > Nayan Jain ! > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > "A man is incomplete until he is married After that, he is finished. " > -- Zsa Zsa Gabor
Another possibility depending on your needs, is perl. Arrays will grow to whatever will fit in memory. On Mon, 27 Sep 1999 19:03:19 +0200, Bernhard Gramberg <mail@gramberg.de> wrote: >it is all like C. No variable array in C, >as well no in 4GL > >nayan jain schrieb: > >> Hi all, >> >> I want to know if the array size in 4GL program can be defined >> dynamically ? >> >> like ... >> >> DEFINE p_count INTEGER >> DEFINE ARRAY gr_cust[p_count] OF RECORD LIKE customer.* >> >> with this if i have 5 customer in table the array will be of 5 records. >> else it can be 1000 tooo... >> >> TIA, >> Nayan Jain ! >> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >> >> "A man is incomplete until he is married After that, he is finished. " >> -- Zsa Zsa Gabor >