3-MAY-83 Current File Commands GenRad, Inc. 300 Baker Ave. Concord, MA. 01742 Author: Stephen Klein The current file commands are commands which keep track of the "current file" so that it is not necessary to specify the file if a series of commands all operate on the same file. Included are current file versions of commonly used DCL commands, commands for traversing the directory tree, and current file versions of text processing tools developed at GR. The current file is stored in the logical name "cf". The command "CF" will display the current file. The current file is a full file specification less the version number (i.e. device:[directory]filename.type). The device and directory portions of the current file are, for all practical purposes, the default directory - as opposed to what VMS thinks the default directory is (as indicated by the SHOW DEFAULT command). Therefore, when the default directory is changed, the corresponding fields in the current file string need to be changed as well, which is why commands for maintaining the default directory are included as part of this package. The following is a general description of how these commands operate. If a command is given which requires a filespec as an argument, but the filespec is omitted completely, the current file is used. If a partial filespec is given (for example, only the extension), the current file is used to supply the missing fields; i.e. the input is defaulted against the current file. Another general rule is that the output file is made the new current file. Commands which need only one filespec (create, type, edit, ...) are processed as follows: If no filespec is specified, the current file is used. If a partial filespec is given, the complete filespec is constructed by using the current file for defaults. If a full filespec is given, it is used, and the current file is ignored. The output file becomes the new "current file". Commands which need a source and destination filespec (copy, append, rename, ...) operate as follows: At least one partial filespec must be specified. If one partial filespec is given, it is assumed to refer to the output (or destination) file. The complete output filespec is constructed by defaulting against the current file. The current file is used as the input file. If one complete filespec is given, it is used as the output file; input is taken from the current file. If two partial or complete filespecs are given, the first is used as the input, the second as the output. The input is defaulted against the current file. THEN the output is defaulted against the input file. The output file then becomes the current file. Filters (such as detab and reformat) are an inbetween case in that they require an input and an output, however, they can do something meaningful even if given only one filespec (i.e. create a new version of the file). Filters behave as follows: If no files are specified, the current file is used for input and a new version is created for output. If one filespec is given, it is defaulted against the current file and then used for both input and output (i.e. a new version). It then becomes the current file. If two filespecs are given (input and output), the input file is defaulted against the current file, then the output takes its defaults from the input file. The output file becomes the current file. There are some exceptions! For example, the DIFFERENCES command already has a sensible way of applying defaults, so user input is almost passed straight through. The only processing is to default P1 against the current file to insure that the first filespec is complete. Also no defaulting is done to arguments which refer to multiple files. In all cases (except dif), the output file is made the new current file, so that it is easy to refer to in the next operation. Note that simply referring to a file in a directory other than the default directory effectively makes this other directory the default! For this reason, the logical names "df", "scdf", and "srdf" all keep track of where VMS thinks your default directory is. These logical names are maintained by the commands that set the default directory (sd, up, dd, ml, to). For example, what used to be "COPY SR:[XXX.YYY]FOO.DAT *" would now be "CP SR:[XXX.YYY]FOO.DAT DF:". If "*" was used with the CP command, the file would be copied into the directory it is already in! Example: $ CR FOO.TXT ! create a file called foo.txt this is foo.txt ! enter data. $ T ! type the current file this is foo.txt ! VMS types FOO.TXT $ re .DAT ! rename it with a new extension Current file = SR:[384.SRK]FOO.DAT ! informative message Command line Function "CF" Display the current file "CR [filespec]" Create a file and make it the current file. "T [filespec]" Type a file. "CCOUNT [filespec]" Count columns in a file. (useful in conjunction with the reformatter). "E [filespec]" Edit a file. By default, the DCL command EDIT is used which invokes raw EDT. To invoke a customized version of EDT, the symbol CFEDI must be defined. To recover from a crash, re-issue the original command. It will notice the presence of the journal file and ask if you want to recover. Read SR:[TOOLS.EDTMACRO]SAMPLEEDT.COM for more information on recovery. "TEC [filespec]" Teco a file. By default, TECO is used. The symbol CFTEC must be defined to invoke a customized TECO. "CWL [infile [outfile]]" Count characters, words, and lines in a file. "CWL" uses the current file for input and the terminal for output. "CWL infile" still uses the terminal for output. Note: if an output file is specified, it does NOT become the current file. The input file always becomes the current file. "DETAB [infile] [outfile] [-Ttabsize] [-Mmargin]" Convert tabs to spaces. If no files are given, the current file is used for input and output. If one file is given, it is used for output and the current file is used for input. The defaults are for a tabsize of 8 spaces, and no left margin (equivalent to -T8 -M0). "REFORMAT [infile [outfile]] [