[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

2181.0. "Simulate arrays in ALL-IN-1?" by SWETSC::WILHELMSSON () Sun Jan 31 1993 11:44

Hello,

This might be a stupid question but here it goes:

Is there a way to simulate data structures, like arrays and structs, in 
ALL-IN-1? The reason why I'm asking is that a customer of ours has written
a very large ALL-IN-1 application, where they are using thousands of local
symbols. These symbols are there to simulate arrays. Instead
of doing something like:

	for (n=1,n<100,n++)
	symbol[n] = tmp;

they have to do:

	GET #SYMBOL1 = #TMP
	GET #SYMBOL2 = #TMP
	GET #SYMBOL3 = #TMP
	...
	GET #SYMBOL100 = #TMP

The problem they are experiencing is that they get a very large amount of code,
which they think slows down the application.

Is there some way to simulate arrays in ALL-IN-1?

Regards,

Mats Wilhelmsson, Stockholm
T.RTitleUserPersonal
Name
DateLines
2181.1On-the-fly variable namesGANTRY::HULLDigital Services Delivery - MotownSun Jan 31 1993 15:5521
Unless the wizards in Engineering are hiding something from us there's no 
direct support for arrays in ALL-IN-1.  However, your coding style can be 
greatly simplified by building the temp variable names dynamically, ie:

get #cnt = 1
.label loop
	get oa$function = 'get #symbol_' #cnt ' = #somevalue'
	increment #cnt
	if #cnt > 100 then .goto exit_loop
	.goto loop
.label exit_loop


...the crucial line being the 3rd where you construct the variable name on 
-the-fly.  We did they for a massive multi-column boilerplate that had to be 
dynamically built to handle varying amounts of columnar data.  We even had it 
double-looped, for column and line-number (ie #sym_2_55).  works like a champ.
As you can see, you can drastically shorten up your code and make it more 
flexible at the same time.

	Al