$TO.COM v5.0 Author: Alan E. Feldman EThis is a SET DEFAULT program for use with Files-11 ODS-2 volumes. ItDoffers much more functionality than the DCL command SET DEFAULT doesCand fixes some of its bugs. It has features that save the user muchDtyping. I haven't tried it on ODS-5 volumes so I don't know how wellit would work on such volumes. FSpecial note to users of the previous release of TO.COM (v4.3-1): WithFthis new version, v5.0, both styles of logical names -- TO_n and HERE,ALAST, nBACK -- are implemented in the same file: TO.COM. The user?setting TO_BACK is used to choose the style. The out-of-the-boxEdefault is the TO_n style which follows the VMS naming convention. ToCswitch to the nBACK-style logical names, see the LOGICAL NAME STYLE section. CONTENTS: CONVENTION INSTALLATION QUICK START FORMAT DESCRIPTION  LOGICAL NAME RECALL STACK PARAMETERS  LOGICAL NAMES KEYWORDS PRECEDENCE # TWO-STEP NEW-DEFAULT FUNCTION USER OPTIONS STACK SIZE. PUT THE CURRENT DEFAULT IN YOUR DCL PROMPT BRIEF VS. VERBOSE OUTPUT LOGICAL NAME STYLE NEW IN V5.0 FEEDBACK *** CONVENTION *** CThe word 'default' is used in the sense of a device together with a directory. *** INSTALLATION *** DCopy TO.COM to your system and add the following to your LOGIN.COM:  $ TO :== @disk:[dir]TO.COM ' $ TO -INIT ! to initialize TO.COM CEnsure that both commands above have been run before using TO.COM. *** QUICK START *** AUse TO.COM as you would the SET DEFAULT command. After installingTO.COM (see above), run $ TO ? Ato get the 23-line quick-help page. This page summarizes the mostimportant aspects of TO.COM. *** FORMAT *** : $ TO [new-default] [save-old-def] [DCL-verification] 4Use "" as a placeholder for any skipped parameters. *** DESCRIPTION *** FWhen you run TO.COM it processes the old and new defaults, reports anyCproblems that it finds, and performs appropriate actions. If all is?well it will then set default to the new default; otherwise, anCappropriate error message is displayed. If the new default is good,FTO.COM checks if it matches an entry in the logical name recall stack.AIf it does, it reports the entry number of the first match found.CTO.COM then updates the logical name recall stack, displays it, and@displays your current default. Finally, if there was an error inEupdating the logical name recall stack and/or the new-default was not3set, TO.COM will let you know just before exiting. DIf you run TO.COM without any arguments, it will display the logicalDname recall stack and prompt you for a new default. (See the section4called LOGICAL NAME RECALL STACK for more details.) -TO.COM is designed for interactive use only. ETO.COM v5.0 is not fully compatible with the previous public release,v4.3-1. *Running TO -INIT repeatedly does no harm. "*** LOGICAL NAME RECALL STACK *** CWhenever you set default to a new default with TO.COM, it saves theDold default in slot 1 of the recall stack, assigns it to the logicalFname TO_1, bumps the other stack entries up one level, and assigns theBnew default to the logical name TO_0. By default, the logical name@recall stack holds up to nine previous defaults plus the current default. 8Stack entries are assigned the following logical names:  TO_0 - current default TO_1 - last default TO_2 - 2 defaults back . . TO_9 - 9 defaults backFYou can use these logical names in subsequent DCL commands or programsCto refer to previous defaults. You can use the logical name TO_0 toCmean the current default in subsequent DCL commands. This is betterAthan using SYS$DISK:[] because SYS$DISK:[] doesn't work when yourEdefault is something like SYS$STARTUP, and it's also less typing. TheBlogical name TO_0 is always your current default if you always useFTO.COM to change your default, even when TO.COM exits with an error orFbecause of a control-Y interrupt. You can use the logical name TO_HEREinstead of TO_0 if you prefer. BTwo auxiliary logical names are provided: TO_LOST and TO_SAVE. TheDTO_LOST slot is for saving defaults set by other programs that would@otherwise be "lost" when running TO.COM. The TO_SAVE slot is for<defaults saved with the auxiliary program SAVE_DEFAULT.COM. CRun TO.COM without any arguments to display the logical name recallFstack. To switch to one of the defaults listed, type the number of the?default and press Return. Alternatively, you can type any valid@default at the prompt according to the rules for the new-default parameter. ;TO.COM will display only stack entries that are not empty. Example: $ TO ,Enter 3 for TO_3 = DISK$DATA1:[FELDMAN]2Enter 2 for TO_2 = DISK$DATA1:[FELDMAN.CHECK]8Enter 1 for TO_1 = DISK$DATA1:[FELDMAN.UTI.GENERAL]MPress for TO_0 = DISK$DATA1:[FELDMAN.UTI.DEFAULT] ! (current default)Or enter new default: 2O=============================================================================== #Checking DISK$DATA1:[FELDMAN.CHECK] MATCH = 2 , TO_3 = DISK$DATA1:[FELDMAN]8 TO_2 = DISK$DATA1:[FELDMAN.UTI.GENERAL]8 TO_1 = DISK$DATA1:[FELDMAN.UTI.DEFAULT]G TO_0 = DISK$DATA1:[FELDMAN.CHECK] ! (current default) Your default is DISK$DATA1:[FELDMAN.CHECK] $FThe program TO.COM avoids duplicate entries in the logical name recallBstack. This holds true even if you specify different default-specsCthat refer to the same actual default. For example, a specific diskBcan be specified in several ways and one can have multiple logical$names pointing to the same default. =However, there are exceptions: Aliases that point to the sameFdirectory are treated as if they were distinct. Also, different searchBlist logical names that independently translate iteratively to theDsame list of equivalence names are not recognized as being identical by TO.COM. ARegardless, the same default-spec-string will not normally appearEtwice in the recall stack. One exception is when you abort TO.COM viaEcontrol-Y while it is updating the logical name recall stack. AnotherDexception is that the values of TO_LOST and TO_SAVE may by chance be-duplicated in the regular part of the stack. FTO.COM offers an alternate set of logical names for the recall stack:  HERE - current default LAST - last default 2BACK - 2 defaults back 3BACK - 3 defaults back . . 9BACK - 9 defaults back LOST - same as TO_LOST SAVE - same as TO_SAVECTo use these logical names instead of the default style TO_0, TO_1,A..., DEFINE the logical name TO_BACK to 1 (true). See the section/LOGICAL NAME STYLE for additional information. *** PARAMETERS *** P1: [new-default] CSpecify [disk:][directory], a logical_name, or a reserved keyword. B(You can also specify two defaults separated by a comma -- see the;section titled TWO-STEP NEW-DEFAULT FUNCTION for details.) FSpecifying [disk:][directory] takes you to that default. The directory$brackets are optional. For example,  $ TO USERDISK:FOO *is legal and takes you to USERDISK:[FOO]. DNB: TO.COM fills in missing directory brackets only when P1 is not a@logical name; i.e., logical names used with TO.COM must still beEdefined according to normal VMS RMS rules. Therefore, if you define alogical name thusly... $ DEFINE MYDIR USERDISK:FOO and then run  $ TO MYDIR Fthe FOO part would be interpreted by TO.COM as the name component of a5file-spec, not the directory portion. But if you run  $ TO USERDISK:FOO Bthe FOO portion of the string will be interpreted as the directoryspecification [FOO] !. *** LOGICAL NAMES *** DIf you specify a logical name, TO.COM performs iterative translation@and sets default to the result. Iterative translation stops whenFTO.COM reaches a concealed, a terminal, or a search list logical name.EIterative translation also stops, of course, when an equivalence name2is encountered that is not itself a logical name. EThe equivalence name (after iterative translation as specified above)>may contain any file-spec components except a node-spec. If itAcontains name, type, or version components, it is assumed to be aDfile-spec and TO.COM uses F$SEARCH to look for a matching file. If aCmatching file is found, the device and directory are extracted fromDthe F$SEARCH result. If a matching file is not found, the device and'directory are extracted using F$PARSE. EIf the logical name is a search list that points to various files andDnone of the files are found, TO.COM will set default to the disk and:directory extracted from the first file-spec in the list. <If the first translation of a logical name starts with the @Acharacter, the @ character is removed and TO.COM then looks for aCmatching file. This is useful for logical names like SYS$ANNOUNCE. *** KEYWORDS *** BYou can use the following reserved keywords for new-default (P1): D-8 thru -1: Go up minus that many directory levels. Example: TO -3is the same as TO [---] . B1 thru 9: Go to that entry in the logical name recall stack. (TheEupper limit of 9 assumes that the default stack size is set.) LeadingDzeros will cause TO.COM to interpret P1 as a directory-spec. See theAsection titled "LOGICAL NAME RECALL STACK" for more information. 6H, -HELP, or ?: Display the 23-line quick-help page. CL - Go to the TO_LOST default. If you use another program to changeCthe default, then run TO.COM to change the default, TO.COM will putFthe default set by the other program into the TO_LOST slot if it would"otherwise be lost from the stack. DS - Go to the saved default. This is the default that is assigned to?the logical name TO_SAVE by SAVE_DEFAULT.COM. When you are in aFdefault that you wish to save, run SAVE_DEFAULT.COM. (SAVE_DEFAULT.COM is supplied with this package.) FT - Go to the top level of the current directory tree. For example, if?your current default is disk:[AAA.BBB.CCC], this takes you to disk:[AAA]. D\ - This is equivalent to [000000]. It can be used with or without adisk-spec. Both   $ TO new-disk:\  and   $ TO \  are legal. A.. - Same as [-] and it can be used with or without a disk-spec. ~ (tilde) - Same as SYS$LOGIN . DNote: To set default to directories named [H], [L], [S], [T], or [n]Cwhere n is a positive integer .LE. the stack size, include at leastFone of the brackets. To set default to logical names H, L, S, T, or n,=include a trailing colon. See the PRECEDENCE section for more information. *** PRECEDENCE *** DIn the case of P1 containing no colons or brackets it is interpretedwith the following precedence: 0 reserved keywords, logical names, directories. EUse a trailing colon or a bracket to force the desired interpretationFif necessary. For example, to go to a directory named [2], you wouldErun TO 2] or TO [2], but not TO 2. TO.COM was designed this wayCwith the assumption that people don't normally use single-characterFdirectory names. But TO.COM can be easily modified to require a hyphen=before T, L, S, and H if desired. Edit the file and go to theE_CHECK_FOR_KEYWORDS subroutine and change "H", "L", "S", "T" to "-H",E"-L", "-S", "-T", respectively; and you can update the help screen atEthe bottom of the file to reflect your changes. Displaying the recallAbuffer will still show L and S, but you can fix that, too, in the_GET_NEW_PARAMS subroutine. &*** TWO-STEP NEW-DEFAULT FUNCTION *** BThe idea for this function was borrowed from a comp.os.vms post by'Hunter Goatley about his "SD program". Format: F$ TO default-1,default-2 ! go to default-1 and from there go to ) ! default2 4(There must be no spaces or tabs around the comma.) @This is useful when default-1 is a stack entry, logical name, orBkeyword which is "partly correct" and default-2 is an easy-to-typeC"correction". Basically, TO.COM goes to default-1, and then goes to=default-2 "from there". Note that relative directory-specs in@default-2 are relative to default-1 and not to the old default. Example: 6Your current default is DISK1:[USER], stack entry 3 is*DISK3:[HELLO.THERE], and you wish to go to#DISK3:[HELLO.THERE.MY.FRIEND]. Run  $ TO 3,.MY.FRIEND ?to accomplish this task. Note that in this example the relativeDdirectory-spec is relative to the value of stack entry 3, not to the=current default. Feel free to be creative with this feature. @P2: [save-def] - By default, TO.COM saves the old default in the<logical name recall stack. You can override this behavior byFspecifying N for this parameter in which case the old default will notbe saved in the recall stack. =P3: [DCL-verification] - Specify 1 or Y to enable DCL commandEverification. DCL verification will be restored to its previous state/upon exit. The default is no DCL verification. *** USER OPTIONS *** 5The following can be found near the top of the code: $!! *** User Settings ***M$ STACK_SIZE = 9 ! Total number of slots in logical name recall stack.I$ TO_PROMPT = 0 ! If true, set prompt string to current default. N$ TO_BRIEF = 0 ! If true, omit match value and outgoing recall stack.F$ TO_BACK = 0 ! If true, use old nBACK-style logical names. BThese are the out-of-the-box defaults for these features. Edit theCfile to change them if you wish. The last three can be overriden by<defining the logical names TO_PROMPT, TO_BRIEF, and TO_BACK,Crepsectively, to 0 (false) or 1 (true) as desired. Details follow. *** STACK_SIZE *** EIf you don't like the default size of 9 for the recall stack, you canBchange it by setting the STACK_SIZE symbol to a different positiveFinteger. You will find this symbol near the top of the file. Note thatFcertain minor things won't work as well with a stack size greater thanE9. For example, the supplemental command procedures that clear TO.COMDlogical names will work only for stack sizes of 9 or less. Note alsoCthat making the stack size very large may slow TO.COM considerably.CBetter stack manipulation algorithms would be needed in that case. 3*** PUT THE CURRENT DEFAULT IN YOUR DCL PROMPT *** FTO.COM can put the current default in your DCL prompt. Run the command $ DEFINE TO_PROMPT 1 Eto enable this feature. Note that if the default-spec of your current@default is longer than is longer than 31 characters, TO.COM willBtruncate it on the left. To disable this feature, either re-DEFINE@TO_PROMPT to 0 (false) or DEASSIGN it. In either case, finish byCrunning the DCL "SET PROMPT" command to clear the last default from the prompt. EThe out-of-the-box default for this feature is 0 (false). If you wantEto enable this feature without using the logical name, go to the User3Settings section at the top of the code and change  $ TO_PROMPT = 0 to  $ TO_PROMPT = 1 @. Note that the logical name takes precedence over this symbol. *** TO_BRIEF *** ?By default, TO.COM tells you which stack entry your new defaultFmatches if any. For example, if you type in a new-default that happensAto match stack entry 3, TO.COM will display "MATCH = 3". Also, byAdefault, TO.COM displays the full logical name recall stack afterDprocessing a new default. Define the logical name TO_BRIEF to "TRUE"?or "1" if you want TO.COM not to display the MATCH line and the>"outgoing" recall stack. Alternatively, you can set the symbolFTO_BRIEF near the top of the code to TRUE or 1 to make it the default.ENote that the logical name TO_BRIEF takes precedence over the initialvalue of the symbol TO_BRIEF. *** LOGICAL NAME STYLE *** AAs mentioned at the end of the LOGICAL NAME RECALL STACK section,>there are two styles of logical names available with TO.COM . .TO_n style: TO_0, TO_1, ..., TO_LOST, TO_SAVE6nBACK style: HERE, LAST, 2BACK, 3BACK, ..., LOST, SAVEBThe out-of-the-box default is the TO_n style. This follows the VMSAnaming convention which minimizes the risk of conflicting logical Enames. But the nBACK style is easier to use (in the author's opinion)rBand can be used if it does not conflict with logical names on yoursystem. FTo use the nBACK style, edit TO.COM. Near the top of the file you will'find the User Settings section. Change  $ TO_BACK = 0 to H $ TO_BACK = 1 C. Note that TO.COM also supports the logical name TO_BACK. Definingu>this logical name to 0 (false) or 1 (true) overrides the value<specified in the file. Additionally, if this logical name isDundefined, TO.COM will define it to be the value it is set to in theDfile. This is done in order to let SAVE_DEFAULT.COM know which styleEyou are using. This way, SAVE_DEFAULT.COM knows whether to assign the1current default to logical name SAVE or TO_SAVE. AIf you change from nBACK style TO_n style in the same interactive Csession, any nBACK-style logical names will be "left over" and willUAnot be updated further. If you want to clear these leftovers, runVD@CLEAR-NBACK-LNMS.COM. If you change from TO_n style to nBACK style,@no such problem arises as the TO_n logical names are always kept?current (the nBACK-style logical names are defined based on the>corresponding TO_n-style logical names when the nBACK style is enabled). Summary: o4TO_BACK = 0 ! Use TO_0, TO_1, ..., TO_LOST, TO_SAVE<TO_BACK = 1 ! Use HERE, LAST, 2BACK, 3BACK, ..., LOST, SAVEDRemember that the logical name has precedence over the symbol in theFUser Settings section in the file. Therefore, if you change the symbolEvalue in the file, be sure that the logical name is defined accordingdto your wishes. DIf for some reason you wish to deassign all logical names created by5TO.COM and SAVE_DEFAULT.COM, run @CLEAR-TO-LNMS.COM. O*** NEW IN v5.0 *** ,o User option to have default in DCL prompt3o Improved processing of the new-default parameteri7o Improved checking of the validity of the new default&o Improved error checking and control+o Both styles of logical names in one file o Some minor bugs fixed&o New keyword ~ (tilde) for SYS$LOGINo New supplementary programs *** FEEDBACK *** ?If you have any questions, comments, or problems with regard ton<TO.COM, please write the author at betaneptune\a\yahoo.com.