Registry Number Script Example

Recall the script shown at the beginning of this section:

\* Display CAS RNs in the Registry file on STN.

=> FILE REGISTRY

=> DIS 50-00-0

=> DIS 7777-77-7

=> LOG Y

It does its job but is not very flexible. For example, what if you have long list of CAS Registry Numbers instead of just a few? Use the OPEN, READ, IF, and CLOSE statements to process a file of Registry Numbers.

\* STN Express script to read list of RNs from a file

\* and display information for each Registry Number.

\* Open the data file for reading. There is one RN on

\* each line.

OPEN <rnlist.txt>/R

=> file registry

\* Process all the RNs in the file

@readloop

  \* Read an RN from the data file.

  READ _rn

  \* If an RN was read, send a DISPLAY command to STN.

  IF (_$filerror = 0) BEGIN

    \* Display the requested substance

    => dis _rn

    GOTO @readloop

  END

\* Close the input file

CLOSE

=>

EXIT

Copyright © 2017 American Chemical Society. All Rights Reserved.