home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
snobol4
/
vsnobol4.arc
/
CAPITAL.SNO
< prev
next >
Wrap
Text File
|
1987-12-04
|
644b
|
24 lines
* CAPITAL.SNO
*
* Sample program from Chapter 7 of the Tutorial
*
* Trim input, attach data file to variable INFILE
&TRIM = 1
INPUT('INFILE', 1, , 'CAPITAL.DAT') :F(ERR)
* Read a line from file. Start querying upon EOF
READF LINE = INFILE :F(QUERY)
* Break out state and capital from line
LINE BREAK(',') . STATE LEN(1) REM . CAPITAL :F(ERR)
* Convert state name into a variable, and assign the
* capital city string to it. Then read next line.
$STATE = CAPITAL :(READF)
ERR OUTPUT = 'Illegal data file' :(END)
* Read state name, access it as a variable
QUERY OUTPUT = $INPUT :S(QUERY)
END