10 PRINT "PROGRAM FILE 93: READ AND DATA STATEMENTS FOR STRING DATA."
20 PRINT "    ANSI STANDARD 3.2, 5.2, 14.2, 14.4"
30 PRINT
40 PRINT "SECTION 93.1: READ AND DATA STATEMENTS FOR STRING DATA"
50 PRINT
60 PRINT "THIS SECTION TESTS THE ABILITY TO PICK UP STRING (CHARACTER)"
70 PRINT "DATA USING THE READ STATEMENT. VARIOUS SYNTACTIC VARIATIONS"
80 PRINT "ARE TESTED, ESPECIALLY FOR DATA FORMATS."
90 PRINT
100 PRINT "PLEASE NOTE THAT THIS ROUTINE IS STRONGLY DEPENDENT"
110 PRINT "ON THE CORRECT OPERATION OF THE STRING COMPARISON"
120 PRINT "FEATURE. IF THAT FEATURE IS INCORRECT, THIS ROUTINE"
130 PRINT "WILL LIKELY GIVE INVALID RESULTS."
140 PRINT
150 PRINT "THE VALUES FROM THE DATA STATEMENT ARE COMPARED TO THOSE"
160 PRINT "ASSIGNED TO STRING VARIABLES. THE EXPECTED AND ACTUAL"
170 PRINT "RESULTS ARE DISPLAYED, AND AN ERROR COUNT MAINTAINED."
180 PRINT "THE READ STATEMENT IS USED WITH SEVERAL VARIABLES IN"
190 PRINT "THE VARIABLE LIST."
200 PRINT
210 PRINT "                BEGIN TEST"
220 PRINT
230 LET I=0
240 LET F=0
250 READ N
255 IF N=0 THEN 1200
260 LET I=I+1
270 LET I$="#"
280 LET J$="#"
290 LET K$="#"
300 LET L$="#"
310 ON I GOTO 410,420,430,440,450,460,470,480,490,500,510
410 LET I$="A"
411 LET J$="B"
412 LET K$="C"
413 LET L$="D"
414 GOTO 600
420 LET I$="EF"
421 LET J$="GHI"
422 LET K$="JKLM"
423 GOTO 600
430 LET I$="ABCDEFGHIJKLM"
431 LET J$="NOPQRSTUVWXYZ"
432 LET K$="0123456789"
433 LET L$="+.   -"
434 GOTO 600
440 LET I$="EIGHTEEN POSITIONS"
441 GOTO 600
450 LET I$="ABC"
451 LET J$="DEF"
452 LET K$="GHI"
453 LET L$="2.1E3"
454 GOTO 600
460 LET I$="ABC   "
461 LET J$="   DEF   "
462 LET K$="   GHI"
463 GOTO 600
470 LET I$="A   B"
471 LET J$="C   D"
472 GOTO 600
480 LET I$="A  B"
481 LET J$="  C  D  "
482 LET K$="E  F"
483 GOTO 600
490 LET I$="A"
491 LET J$="B,C"
492 LET K$=""
493 LET L$="D"
494 GOTO 600
500 LET I$="ABCDEFGHIJKLM"
501 LET J$="NOPQRSTUVWXYZ"
502 LET K$="0123456789"
503 GOTO 600
510 LET I$="!#$%&'()*+,-"
511 LET J$="./:;<=>?^_"
512 GOTO 600
600 REM COMPARAND VALUES INITIALIZED
630 LET A$="#"
640 LET B$="#"
650 LET C$="#"
660 LET D$="#"
670 ON N GOTO 710,720,730,740
710 READ A$
715 GOTO 800
720 READ A$,B$
725 GOTO 800
730 READ A$,B$,C$
735 GOTO 800
740 READ A$,B$,C$,D$
745 GOTO 800
800 REM TEST VALUES NOW SET
810 IF A$<>I$ THEN 900
820 IF B$<>J$ THEN 900
830 IF C$<>K$ THEN 900
840 IF D$<>L$ THEN 900
850 LET S=0
860 GOTO 910
900 LET S=1
910 ON N GOTO 920,930,940,950
920 LET B$=""
925 LET J$=""
930 LET C$=""
935 LET K$=""
940 LET D$=""
945 LET L$=""
950 REM NOW SET UP FOR PRINT
960 PRINT
970 PRINT
980 PRINT "SHOULD BE: ***";I$;J$;K$;L$;"***"
990 PRINT "ACTUAL:    ***";A$;B$;C$;D$;"***"
1000 IF S=0 THEN 1100
1010 PRINT "TEST FAILED"
1020 LET F=F+1
1030 GOTO 250
1100 PRINT "TEST OK"
1110 GOTO 250
1200 PRINT
1210 PRINT
1220 IF F=0 THEN 1270
1230 PRINT "*** TEST FAILED: ";F;" CASE(S) HANDLED IMPROPERLY. ***"
1240 GOTO 1300
1270 PRINT "*** TEST PASSED ***"
1300 PRINT
1310 PRINT "                  END TEST"
1320 PRINT
1330 PRINT "END PROGRAM 93"
2010 DATA 4,"A",B,"C",D
2020 DATA 3,EF,"GHI",JKLM
2030 DATA 4,ABCDEFGHIJKLM,NOPQRSTUVWXYZ,0123456789,+.   -
2040 DATA 1,EIGHTEEN POSITIONS
2050 DATA 4,ABC   ,   DEF   ,   GHI,2.1E3
2060 DATA 3,"ABC   ","   DEF   ","   GHI"
2070 DATA 2,  A   B  ,  C   D
2080 DATA 3,  A  B  ,  "  C  D  "  ,  E  F
2090 DATA 4,A,"B,C","",  D
2100 DATA 3,"ABCDEFGHIJKLM","NOPQRSTUVWXYZ","0123456789"
2110 DATA 2,"!#$%&'()*+,-","./:;<=>?^_"
2120 DATA 0
2130 END
