411
Chapter 7, IBASIC Controller
PROGram Subsystem
Example of querying the value of a string array whose name is known but whose cur-
rent size is unknown
05 OPTION BASE 1
10 DIM Temp$[5000] !This will hold 5000 characters
20 DIM Temp_array$(50)[200]!Temp array: 50 elements of 200 character
30 OUTPUT 714;"PROG:STR? Array" !Query the desired array
40 ENTER 714;Temp$ !Enter the values into a temporary string variable
50 N=0 !Initialize array pointer
60 EPEAT !Start loop to take values from string and put in array
70 N=N+1 !Increment array pointer
80 Pos_comma=POS(Temp$,",") !Find comma separator
90 Temp_array$(N)=Temp$[2,Pos_comma-2] !Put value into array
100 Temp$=Temp$[Pos_comma+1] !Remove value from temporary string
110 UNTIL POS(Temp$,",")=0 !Check for last value in temporary string
120 Temp_array$(N+1)=Temp$[2,LEN(Temp$)-1]!Put last value in array
130 END
The above example assumes that the total number of characters in the dimensioned size of
the IBASIC string array named Array is smaller than the dimensioned size of the string
variable named Temp$. Also, the maximum length of any element in the IBASIC string ar-
ray Array must be less than or equal to 200 characters.
:WAIT
The :WAIT command stops the Test Set from executing any commands or
queries received through GPIB until after the IBASIC program exits the RUN
state; that is, the program is either PAUSED or STOPPED.