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

Re: Reply to SQR Array Question.




	Thanks for your example John.  It was very helpful.  I went
back to a single field, and built it back up one field at a time and
it now works.  I had an error in one of my gets.  I was seperating
the get varibles with commas.  It never tripped and error, but that was
90% of the problem.  I hope someone else can learn from this stupid mistake.
The fresh perspective reassured me I was not trying the impossible.  

Thanks again,
Scott...

************************************************************
* Programmer / Analyst    |   Internet: maysa@oneonta.edu  *
* SICAS Center            |   SUNY Oneonta                 *
*                         |   Lee Hall                     *
* F:(607)436-2038         |   Oneonta, NY  13820           *
************************************************************

Scott,
   I needed to do the same type of things, ie: global arrays, local 
   procedures to manipulate them, and wrote a small test program to prove
   the concept before  continuing.  Since you didn't include all your source
   code, there may be something you did (or didn't do!?!) in calling the
   procedures that affected your results.  The sample program attached 
   will execute under SQR 2.4.2 and demonstrates:

     1) creating a global array
     2) inserting into it from a local procedure being passed the array index
	and data to insert
     3) getting and displaying data from the array within a local procedure 
	being passed the array index

  Hope this helps!
------------------------------------------------------------------------------
John Griffin                (205) 890-2401  |             A    TTTTTTT  SSSSS 
Advanced Technology Systems (ATS), Inc.     |           A   A     T     S    
4801 University Square, Suite 2             |           AaaaA     T     SSSSS 
Huntsville, AL  35816-3431                  |           A   A     T         S
johng@rmf41.usace.army.mil                  |           A   A     T     SSSSS 
------------------------------------------------------------------------------
Body-Part: 2; Text ------------------------------------------------------

begin-report
   do test-loc-array
end-report

begin-procedure test-loc-array

   create-array name=dummy size=10 field=a-field:char

   move 0 to #i
   move 'xxx' to $char-str

   do insert-array($char-str,#i)

   do display-array(#i)

end-procedure

begin-procedure insert-array($char-string,#index)

   put $char-string into dummy(#index) a-field 

end-procedure

begin-procedure display-array(#indx)

   display #indx 99
   get $a-string from dummy(#indx) a-field
   display 'contents of array ' noline
   display $a-string

end-procedure