Specifications

Chapter 9 129
Saving and Recalling Files
Sample Program
9. Saving and Recalling Files
Example 9-1 File save (file_sav.bas)
10 DIM File$[300],Inp_char$[30],Extension$[9],Par$[9]
20 INTEGER List_stat,Point,Content,Max_no
30 CLEAR SCREEN
40 ASSIGN @Agt4287a TO 717
50 !
60 OUTPUT @Agt4287a;":SOUR:LIST:STAT?"
70 ENTER @Agt4287a;List_stat
80 OUTPUT @Agt4287a;":CALC:EXAM:MEM:POIN?"
90 ENTER @Agt4287a;Point
100 !
110 ON ERROR GOTO Content_select
120 Content_select: !
130 PRINT "## Save Content Selection ##"
140 PRINT "Select Content"
150 PRINT " 1: State"
160 PRINT " 2: Screen"
170 PRINT " 3: Setup Table"
180 PRINT " 4: Comparator"
190 Max_no=4
200 IF List_stat=1 THEN
210 PRINT " 5: List Measurement Results"
220 Max_no=Max_no+1
230 END IF
240 IF Point>1 THEN
250 PRINT " "&VAL$(Max_no+1)&": Data for Statistical Analysis
(ASCII)"
260 PRINT " "&VAL$(Max_no+2)&": Data for Statistical Analysis
(Binary)"
270 Max_no=Max_no+2
280 END IF
290 PRINT ""
300 PRINT "Input 1 to "&VAL$(Max_no)
310 INPUT "Number?",Inp_char$
320 Content=IVAL(Inp_char$,10)
330 IF Content<1 OR Content>Max_no THEN Content_select
340 OFF ERROR
350 !
360 SELECT Content
370 CASE 1
380 Extension$=".sta"
390 CASE 2
400 Extension$=".bmp"
410 CASE 3
420 Extension$=".csv"
430 Par$="SET"
440 CASE 4
450 Extension$=".csv"
460 Par$="COMP"
470 CASE 5
480 Extension$=".csv"
490 IF Max_no=5 OR Max_no=7 THEN
500 Par$="LIST"
510 ELSE
520 Par$="LOG"
530 END IF
540 CASE 6
550 IF Max_no=7 THEN
560 Extension$=".csv"
570 Par$="LOG"
580 ELSE
590 Extension$=".dta"