ATO.COM v5.2 Author: Alan E. Feldman alanedfeldman\a\yahooEThis 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. *** NEW IN v5.2 *** 3o Wildcards are now supported in directory-specs. Bo Write and read the logical name recall stack to and from disk. 4o Some minor bug fixes and improved program logic. ;o New versions of the auxiliary programs SAVE_DEFAULT.COM,EDIR-MENU.COM, CLEAR-TO-LNMS.COM, CLEAR-NBACK-LNMS.COM, and OVER.COM. CONTENTS: CONVENTION INSTALLATION QUICK START FORMAT DESCRIPTION  LOGICAL NAME RECALL STACK PARAMETERS  P1 WILDCARDS LOGICAL NAMES KEYWORDS PRECEDENCE # TWO-STEP NEW-DEFAULT FUNCTION  P2 P3 USER OPTIONS STACK SIZE. PUT THE CURRENT DEFAULT IN YOUR DCL PROMPT BRIEF VS. VERBOSE OUTPUT LOGICAL-NAME STYLE 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 :== @TO.COM ' $ TO -INIT ! to initialize TO.COM Dwhere can be either disk:[dir] or a logical name pointingDto the location of TO.COM. Ensure that both commands above have beenrun before using TO.COM. *** QUICK START *** )After installing TO.COM (see above), run $ TO ? Ato get the 23-line quick-help page. This page summarizes the mostAimportant aspects of TO.COM. Then use TO.COM as you would the SETDEFAULT command. *** FORMAT *** : $ TO [new-default] [save-old-def] [DCL-verification] 4Use "" as a placeholder for any skipped parameters. *** DESCRIPTION *** AUse TO.COM as you would use the SET DEFAULT command. As you visitFdifferent defaults (directories), TO.COM automatically saves up to theDlast 9 defaults in its logical name recall stack. Run TO.COM withoutDany arguments to display the recall stack and enter interactive mode?from which you can select one of the stack entries, enter a new"default, or press Return to exit. TO.COM has features thato save you typing,o perform iterative logical name processingo deal with bad defaultsFeatures that save you typing: BDirectory brackets are optional -- let the program figure it out! >The logical name recall stack saves recently visited defaults.AReference stack entries via numbers inside TO.COM and via logicalnames outside of TO.COM. ?The logical name recall stack is efficient: it avoids duplicateentries in most cases. DThe logical name recall stack can now (as of v5.2) be written to and8read from disk, saving typing across terminal sessions. EAnother way that TO.COM saves you typing is with the two-step defaultBfunction. This is most useful if you can specify the first defaultEvery quickly via a recall-stack slot number or logical name, and thenCthe second default as a "correction" relative to the first. See the3TWO-STEP NEW-DEFAULT FUNCTION section for details. FThere are shortcut keys for MFD, SYS$LOGIN, top-level directory, and n levels up. 1Wildcard support allows you to use wildcards as a quasi--name-completion feature. $Iterative logical name translation: 0Iterative logical names are processed properly. Dealing with bad defaults: FTO.COM should not normally put you in a bad default. It should also beCable to recover from nearly any bad-default situation. (If for someDreason you need to go to a non-existent default, use the SET DEFAULT command.) In more detail: 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, anDappropriate error message is displayed. If the new default was 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 logicalAname recall stack and prompt you for a new default. (There is oneFexception to this: If you run TO.COM without any arguments and haven'tBinitialized TO.COM yet [by having run it with or without the -INIT>parameter], you get the HELP screen instead [but only once].) -TO.COM is designed for interactive use only. *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 useCTO.COM to change your default, even when TO.COM exits because of anDerror or 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 sameBdirectory are treated as if they were different directories. Also,@different search list logical names that independently translateDiteratively to the same list of equivalence names are not recognizedas 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 the9section titled TWO-STEP NEW-DEFAULT FUNCTION for details.DAdditionally, wildcards are allowed in the directory-spec -- see the/WILDCARDS section below for more information.) 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 a7file-spec, not the directory component. But if you run  $ TO USERDISK:FOO Bthe FOO portion of the string will be interpreted as the directoryspecification [FOO] !. *** WILDCARDS *** FYou can use wildcards in new-default. TO.COM uses F$SEARCH to look forE.DIR;1 files that match your wildcarded directory-spec. Each matchingDdirectory will be offered to the user as it is found. You can type Y$to accept, N to skip, or Q to quit. FNote that some wildcarded directory-specs may take a while to process.FAlso, directory-specs that have a trailing ellipsis are not supported.FYou can, however, use a trailing ...* instead. There is no significant'loss of functionality because of this. *** 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 fromAthe F$SEARCH result. If no matching file is 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. (TheDupper limit of 9 assumes that the stack is set to its default size.)DLeading zeros will cause TO.COM to interpret P1 as a directory-spec.;See the section 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. DR - Read the saved logical name recall stack from disk. The stack is"read from SYS$LOGIN:TO_STACK.DAT. 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]. EW - Write the logical name recall stack to disk. The stack is writtento SYS$LOGIN:TO_STACK.DAT. 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 . BNote: To set default to directories named [H], [L], [R], [S], [T],F[W], or [n] where n is a positive integer .LE. the stack size, includeFat least one of the brackets. To set default to logical names H, L, R,CS, T, W, or n, include a trailing colon. See the PRECEDENCE sectionfor more information. *** PRECEDENCE *** DIn the case of P1 containing no colons or brackets it is interpretedwith the following precedence: . reserved keywords, logical names, directoriesEUse 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-characterAdirectory names. If you wish to modify TO.COM to require a hyphenDbefore the single-letter keyword you'll have to check for and removeFany leading hyphen just before the statement GOSUB _CHECK_FOR_KEYWORDS<and skip this GOSUB command if there was no leading hyphen. &*** 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 inFdefault-2 are relative to default-1 and not to the old default, which,8of course, is precisely what makes this feature useful. 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. DP2: [save-old-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. dN$ 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 theDfile to change them if you wish. The last three can be overridden by<defining the logical names TO_PROMPT, TO_BRIEF, and TO_BACK,Crespectively, to 0 (false) or 1 (true) as desired. Details follow. i*** STACK_SIZE *** aEIf you don't like the default size of 9 for the recall stack, you canpBchange it by setting the STACK_SIZE symbol to a different positiveFinteger. You will find this symbol near the top of the file. Note thatEmaking the stack size very large may slow TO.COM considerably. Better<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 Cto enable this feature. Note that if your current default is longerBAthan is longer than 31 characters, TO.COM will truncate it on the*Fleft. To disable this feature, either re-DEFINE TO_PROMPT to 0 (false)For DEASSIGN it. In either case, finish by running the DCL "SET PROMPT"3command 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 Usero3Settings section at the top of the code and change o $ TO_PROMPT = 0 to T $ 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 defaulteFmatches if any. For example, if you type in a new-default that happensAto match stack entry 3, TO.COM will display "MATCH = 3". Also, byCAdefault, TO.COM displays the full logical name recall stack aftereDprocessing a new default. Define the logical name TO_BRIEF to "TRUE"Aor "1" if you want TO.COM to *not* display the MATCH line and theO>"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.DNote that the logical name TO_BRIEF takes precedence over the symbol TO_BRIEF. *** LOGICAL-NAME STYLE *** oAAs 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)cBand 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 e $ TO_BACK = 1 FNote that TO.COM also supports the logical name TO_BACK. Defining thisFlogical name to 0 (false) or 1 (true) overrides the value specified inFthe file. Additionally, if this logical name is undefined, TO.COM willCdefine it to be the value it is set to in the file. This is done inBorder to let SAVE_DEFAULT.COM know which style you are using. ThisDway, SAVE_DEFAULT.COM knows whether to assign the current default tological name SAVE or TO_SAVE. AIf you change from nBACK style TO_n style in the same interactiveeCsession, any nBACK-style logical names will be "left over" and willMAnot be updated further. If you want to clear these leftovers, runbD@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 keptDcurrent while the nBACK-style logical names are defined based on the>corresponding TO_n-style logical names when the nBACK style is enabled. s Summary: t5TO_BACK = 0 ! Use TO_0, TO_1, ..., TO_LOST, TO_SAVE w=TO_BACK = 1 ! Use HERE, LAST, 2BACK, 3BACK, ..., LOST, SAVE dDRemember 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 accordingtto 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. e*** FEEDBACK *** .?If you have any questions, comments, or problems with regard toi9TO.COM, please write the author at betaneptune\a\yahoo orlalanedfeldman\a\yahoo. r