ZR lets you go to a buffer containing a particular file. If the file is already in a buffer, FRED puts you in that buffer. If the file has not been read into a buffer, FRED creates a new buffer and reads in the file. Using ZR, you do not have to remember the name of the buffer that contains a particular file.
More precisely, ZR begins by creating a new buffer with an unused buffer name. ZR creates buffer names consisting of a single letter (e.g. b(a), b(b), etc.). Once it has exhausted the single letter buffer names, it uses names that are a space followed by a number, as in b( 0), b( 1), b( 2), and so on.
Next, ZR tries to access the specified file for reading. If this fails, FRED gives you an error message and nothing else happens. You will be left in the new buffer.
If FRED can access the file, ZR next checks to see if there is a buffer whose associated filename matches the full name of the accessed file. (FRED has to access the file before file names can be compared because FRED can only find out the full name of a file after it has been accessed.)
If the name of the accessed file matches the file name associated with another buffer, FRED goes to that buffer. FRED also deletes the new buffer that was temporarily created.
If the name of the accessed file does not match any other buffer file name, FRED reads the contents of the file into the newly created buffer.
At the end of the ZR command, FRED deaccesses permanent files if they were not in the AFT to begin with. Files that were previously in the AFT are left there.
As an example, suppose you say
If this file has previously been read into a buffer, FRED will go to that buffer; if the file has not been read into a buffer, FRED will create a new buffer and read in the file.
When ZR actually reads a file, it prints statistics in the same format that the R command uses. If ZR simply changes to a buffer already containing a file, it prints statistics about the new buffer in the same format that the F command uses.
Note that ZR has most of the features of the R command. You cannot specify an address for ZR, but you can say
(which prints out statistics for the read operation, even if it is executed from a buffer). You can also say
which will try to access one file after another until it succeeds in one. This is the file name that it will attempt to match with the files associated with other buffers. If you specify line ranges with ZR, as in
the operation will work, but FRED will never match the specified file name with existing buffer file names. Therefore, this will always leave you in a new buffer.
Copyright © 1998, Thinkage Ltd.