VMS Help CLOSE, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1.$ OPEN/READ INPUT_FILE TEST.DAT $ READ_LOOP: $ READ/END_OF_FILE=NO_MORE INPUT_FILE DATA_LINE . . . $ GOTO READ_LOOP $ NO_MORE: $ CLOSE INPUT_FILE The OPEN command in this example opens the file TEST.DAT and assigns it the logical name of INPUT_FILE. The /END_OF_FILE qualifier on the READ command requests that, when the end-of- file (EOF) is reached, the command interpreter should transfer control to the line at the label NO_MORE. The CLOSE command closes the input file. 2.$ @READFILE <Ctrl/Y> $ STOP $ SHOW LOGICAL/PROCESS . . . "INFILE" = "_DB1" "OUTFILE" = "_DB1" $ CLOSE INFILE $ CLOSE OUTFILE In this example, pressing Ctrl/Y interrupts the execution of the command procedure READFILE.COM. Then, the STOP command stops the procedure. The SHOW LOGICAL/PROCESS command displays the names that currently exist in the process logical name table. Among the names listed are the logical names INFILE and OUTFILE, assigned by OPEN commands in the procedure READFILE.COM. The CLOSE commands close these files and deassign the logical names.
|