home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / v / vsnbl220.zip / CAPITAL.SNO < prev    next >
Text File  |  1991-02-14  |  644b  |  24 lines

  1. *    CAPITAL.SNO
  2. *
  3. *    Sample program from Chapter 7 of the Tutorial
  4. *
  5. *  Trim input, attach data file to variable INFILE
  6.     &TRIM = 1
  7.     INPUT('INFILE', 1, , 'CAPITAL.DAT')        :F(ERR)
  8.  
  9. *  Read a line from file.  Start querying upon EOF
  10. READF    LINE = INFILE                    :F(QUERY)
  11.  
  12. *  Break out state and capital from line
  13.     LINE BREAK(',') . STATE LEN(1) REM . CAPITAL    :F(ERR)
  14.  
  15. *  Convert state name into a variable, and assign the
  16. *  capital city string to it.  Then read next line.
  17.     $STATE = CAPITAL                :(READF)
  18.  
  19. ERR    OUTPUT = 'Illegal data file'            :(END)
  20.  
  21. *  Read state name, access it as a variable
  22. QUERY    OUTPUT = $INPUT                    :S(QUERY)
  23. END
  24.