SET BUFFER
instruction: set the size of the variable area
Set Buffer number of kilobytes
The SET BUFFER command can be used inside a program to set the new size of the variable area. Simply follow the command with the number of kilobytes required, and you are recommended to increase this value by 5k at a time, until enough space has been reserved in the buffer area. It is important to note that the SET BUFFER command must be the very first instruction in your program, apart from any REM messages.
Arrays
It is often necessary to use a whole set of similar variables for something like a
table of football results or a catalogue for a record collection. Any set of variables can be grouped
together in what is known as an "array".
Supposing you have 100 titles in your record collection, and you need to tell AMOS Professional the size of the table of variables needed for your array. There is a special command for setting up this dimension.
DIM
instruction: dimension an array
Dim variable name(number,number,number...)
The DIM command is used to dimension an array, and the variables in your record collection table could be set up with a first line like this:
E> Dim ARTIST$(99),TITLE$(99),YEAR(99),PRICE#(99)
Each dimension in the table is held inside round brackets, and if there is more than one element in a dimension each number must be separated from the next by a comma.
Element numbers in arrays always start from zero, so your first and last entries might contain these variables:
E> ARTIST$(0)="Aaron Copeland" TITLE$(0)="Appalachian Spring" YEAR(0)=1944 PRICE#(0)=12.99 ARTIST$(99)="ZZ Top" TITLE$(99)="Afterburner" YEAR(99)=1985 PRICE#(99)=9.95
To extract elements from your array, you could then add something like this to your example program: