INDIRECT COMMAND FILE PROCESSING FOR RT-11 V4.0 Indirect Command File Processing For RT-11 V4.0 TABLE OF CONTENTS 1.0 Introduction . . . . . . . . . . . . . . . . . . . . . . 1 2.0 Patching the System . . . . . . . . . . . . . . . . . . 2 2.1 Patching IND . . . . . . . . . . . . . . . . . . . 2 2.2 Patching the Keyboard Monitor . . . . . . . . . . . 3 3.0 Operating Instructions . . . . . . . . . . . . . . . . . 5 3.1 Using IND . . . . . . . . . . . . . . . . . . . . . 5 3.1.1 /T Switch . . . . . . . . . . . . . . . . . 5 3.1.2 /D Switch . . . . . . . . . . . . . . . . . 5 3.1.3 /N Switch . . . . . . . . . . . . . . . . . 5 3.2 The IND Command . . . . . . . . . . . . . . . . . . 5 4.0 Symbol and Processing Protocols . . . . . . . . . . . . 7 4.1 Special Symbols . . . . . . . . . . . . . . . . . . 7 4.2 Numeric and String Symbols . . . . . . . . . . . . 9 4.2.1 Numeric Symbols and Expressions . . . . . . 9 4.2.2 String Symbols, Substrings, and Expressions 10 4.3 Symbol Value Substitution . . . . . . . . . . . . . 10 4.4 Multi-level Indirect Files . . . . . . . . . . . . 11 4.5 Parameter Passing . . . . . . . . . . . . . . . . . 11 5.0 Indirect Command File Directives . . . . . . . . . . . . 12 5.1 Defining Labels . . . . . . . . . . . . . . . . . . 12 5.2 Requesting Data from the Terminal . . . . . . . . . 13 5.2.1 .ASK Directive . . . . . . . . . . . . . . . 13 5.2.2 .ASKN Directive . . . . . . . . . . . . . . 13 5.2.3 .ASKS Directive . . . . . . . . . . . . . . 14 5.3 Symbol Data Manipulation Directives . . . . . . . . 15 5.3.1 .DEC/.INC Directives . . . . . . . . . . . . 15 5.3.2 .ERASE Directive . . . . . . . . . . . . . . 15 5.3.3 .PARSE Directive . . . . . . . . . . . . . . 15 5.3.4 .SETT/.SETF Directives . . . . . . . . . . . 16 5.3.5 .SETN Directive . . . . . . . . . . . . . . 16 5.3.6 .SETS Directive . . . . . . . . . . . . . . 17 5.4 Logical Control Directives . . . . . . . . . . . . 17 5.4.1 .BEGIN Directive . . . . . . . . . . . . . . 17 5.4.2 .END Directive . . . . . . . . . . . . . . . 18 5.4.3 .EXIT Directive . . . . . . . . . . . . . . 18 5.4.4 .GOSUB Directive . . . . . . . . . . . . . . 18 5.4.5 .GOTO Directive . . . . . . . . . . . . . . 19 5.4.6 .ONERR Directive . . . . . . . . . . . . . . 19 5.4.7 .RETURN Directive . . . . . . . . . . . . . 20 5.4.8 .STOP Directive . . . . . . . . . . . . . . 21 5.4.9 / Logical End-Of-File Directive . . . . . . 21 5.5 Logical Test Directives . . . . . . . . . . . . . . 21 5.5.1 .IF Directive . . . . . . . . . . . . . . . 21 5.5.2 .IFDF/.IFNDF Directives . . . . . . . . . . 22 5.5.3 .IFT/.IFF Directives . . . . . . . . . . . . 22 5.5.4 .TEST Directive . . . . . . . . . . . . . . 22 5.5.5 Compound Tests . . . . . . . . . . . . . . . 23 5.6 File Access Directives . . . . . . . . . . . . . . 23 5.6.1 .CHAIN Directive . . . . . . . . . . . . . . 23 i Indirect Command File Processing For RT-11 V4.0 5.6.2 .CLOSE Directive . . . . . . . . . . . . . . 23 5.6.3 .DATA Directive . . . . . . . . . . . . . . 24 5.6.4 .OPEN Directive . . . . . . . . . . . . . . 24 5.6.5 .OPENA Directive . . . . . . . . . . . . . . 25 5.6.6 .OPENR Directive . . . . . . . . . . . . . . 25 5.6.7 .READ Directive . . . . . . . . . . . . . . 25 5.6.8 .TESTFILE Directive . . . . . . . . . . . . 26 5.7 Enabling and Disabling Operating Modes . . . . . . 26 5.7.1 LOWERCASE Mode . . . . . . . . . . . . . . . 27 5.7.2 DATA Mode . . . . . . . . . . . . . . . . . 27 5.7.3 GLOBAL Mode . . . . . . . . . . . . . . . . 28 5.7.4 SUBSTITUTION Mode . . . . . . . . . . . . . 28 5.7.5 ESCAPE Mode . . . . . . . . . . . . . . . . 28 5.7.6 QUIET Mode . . . . . . . . . . . . . . . . . 28 Appendix A: Alphabetic Directive Listing . . . . . . . . . . 29 ii Indirect Command File Processing Page 1 For RT-11 V4.0 February 2, 1983 1.0 Introduction The RT-11 AUTOPATCH function uses a program called IND to emulate the RSX Indirect Command Processor. Some interest was expressed at the U.S. DECUS Symposium in using this pro- gram under RT-11 to do fancy indirect command files. However, in trying to do so, users have discovered that IND does not work apart from RT-11 AUTOPATCH. In the February, 1982 MINI-TASKER (the RT-11 SIG Newsletter from DECUS), John M. Crowell, of CROW4ELL, Ltd., published a set of patches that unlock IND from AUTOPATCH Revision D. This document gives the instructions for applying those patches, and also details the use of IND in the patched system. The patches detailed in Section 2.0 will create a version of IND that works under RT-11, and a version of RT-11 that will support a CCL IND command. These patches are effective for the SJ (with timer support), FB, and XM RT-11 monitors, and allow the use of all RSX command file directives except those that are RSX specific. The patched IND program does not work under TSX or TSX-Plus. No guarantee is made by Plessey Peripheral Systems, DECUS, or CROW4ELL, Ltd., as to the functionality of IND or the accu- racy of the statements contained in this document. No support of the products described is implied by this docu- ment, and no support will be given. Indirect Command File Processing Page 2 For RT-11 V4.0 February 2, 1983 2.0 Patching the System 2.1 Patching IND IND is locked to AUTOPATCH Revision D in two ways. The first is straightforward and rather obvious: IND automatically looks for the file SY:AUTOP.COM. The second lock is more subtle: IND checks for a double carriage return in the copy- right and disclaimer notice that heads up the AUTOP.COM file. This double carriage return would be invisible in any lis- tings of the file, but if this aberration is not present, IND refuses to process the file. The following command file disables the routine that checks for a double carriage return, and enables the subroutine that asks for input (a command file name and a switch) from the terminal. R SIPP IND.SAV/A/C 0 14512 45104 41515 53040 30460 33456 ^Z 15324 3310 ^Z 15346 3266 ^Z 21044 207 ^Z 25004 1142 ^Z 26250 427 ^Z 27266 165354 ^Y 14533 ^C Once IND has been patched, an operator may enter command files at the terminal in the following form: R IND filspec[/switch] [par1 par2 par3 . . . parn] Indirect Command File Processing Page 3 For RT-11 V4.0 February 2, 1983 (brackets not part of syntax) where filspec is the indirect command file to be proc- essed, with a default extension of .COM. switch is one of the valid IND switches described in Section 3.1. par1... are parameters to be passed to the indi- rect command file in the manner described in Section 4.5 It is also possible to use IND in a one line command, without parameters, thus: RUN IND filspec/switch If these two command forms are enough, the user may not want to apply the patch to the keyboard monitor which will enable the CCL command IND. Please Note: This patch is designed for the IND program that ___________ is supplied with AUTOPATCH Revision D. It does not work on other versions of IND. 2.2 Patching the Keyboard Monitor If the user wishes to use IND as a CCL command, this patch for the RT-11 keyboard monitor will enable it. Before apply- ing the patch, RT-11 should be patched by the current revision of AUTOPATCH. The patch consists of a series of commands to the TECO editor which alter KMON.MAC and KMOVLY.MAC so that the IND command is enabled. CAUTION: This patch will alter KMON.MAC and KMOVLY.MAC in _______ such a way that DEC supplied SLP patches to them will not work. SAVE THE ORIGINAL FILES!!! When DEC supplies a new __________________________ patch or a new version of AUTOPATCH, use it with the original files and re-apply these commands to the newly patched files. Edit the following into a file, IND.TXT: @EB/SRC:KMON.MAC/ @N/DEFALT COPY/@N/BF/ 0L@I/DEFALT IND$$ U$TIL /@N/PROG APL/ L@I/.IIF NE IND$$ PROG IND /@N/CMDTBL FOCAL/ L@I/.IIF NE IND$$ CMDTBL IND /@N/FLGTXT / L@I/.IIF NE IND$$ FLGTXT /@EC @EB/SRC:KMOVLY.MAC/ @N/SYNTAX FORMAT/ZJ12@I// Indirect Command File Processing Page 4 For RT-11 V4.0 February 2, 1983 @I/.IF NE IND$$ .SBTTL IND COMMAND SYNTAX IND PROMPT $FILEE SCALL GSWIT,<1> REQBLNK SCALL RINSPC,<1> EOLSEQ IND END SWITS IND SWIT DELETE 1 IND - D SWIT TRACE 1 IND - T SWIT NOEXEC 1 IND - N ENDNO NOS ENDS OVCMD IND ITBLE 1 OJSR PC,INITIT OJMP CMDEXE .ENDC /@N/BOOT$$/L @I/.SBTTL BOOT COMMAND /@N/SWTDEF/@S/.EVEN/0L @I/ SWTDEF FLGTXT SWTDEF FLGTXT SWTDEF FLGTXT /@EX Once this text file has been created, enter the following commands at the console: ASS ddu SRC R TECO ERIND.TXTAJ44XDHKMD Where ddu is the name of the device on which the source files ___ KMON.MAC and KMOVLY.MAC reside and represents an escape _____ (ASCII 27 decimal) character. After this command has execu- ted, a SYSGEN should be performed. Once the SYSGEN has been performed and a new monitor created, RT-11 will recognize an IND command of the form IND filspec/switch Indirect Command File Processing Page 5 For RT-11 V4.0 February 2, 1983 3.0 Operating Instructions 3.1 Using IND The use of IND is much like the use of any other RT-11 utili- ty. The user runs the program, and then enters the file to be processed, with one of the three optional switches. The format of this mode of operation is R IND filspec[/switch] [par1 par2 . . . parn] (brackets not part of syntax) where filspec is a file specification of the form _______ dev:filename.ext, switch is an optional switch, and par1 . . ______ ________ . are parameters to be passed to the indirect command file _ specified. Sections 3.1.1 through 3.1.3 describe the valid values for switch. ______ 3.1.1 /T Switch Using this switch causes each command line to be printed at the terminal as a comment before execution. This switch is useful as a debugging tool, as IND normally operates in a quiet mode, with no display of commands. 3.1.2 /D Switch This switch causes the command file to be deleted after ex- ecution. THIS SWITCH IS DANGEROUS!!! Don't use this switch ___________________________ unless absolutely sure that the command file will work and is __________ the function that is desired. A failure will be untraceable as the user will not know what commands were executed. 3.1.3 /N Switch This switch is possibly the most valuable debugging tool of all. When used, each command is printed at the terminal as a comment, and no execution takes place. It can thus be used ________________________ to show the flow of a command file before actually executing it, pointing out errors in chaining or jumping that might otherwise destroy data. 3.2 The IND Command If the patch described in Section 2.2 is applied to the key- board monitor, IND may be invoked as a CCL (Concise Command Language) command. This command is of the form IND filspec/switch where filspec has the same value as described in Section 3.1. _______ The switch, as in Section 3.1, has three possible values. ______ Indirect Command File Processing Page 6 For RT-11 V4.0 February 2, 1983 These switches are /TRACE, /DELETE, and /NOEXEC, and corres- ______ _______ _______ pond, respectively, to the switches described in Sections 3.1.1 through 3.1.3. Each of these switches may be abbrevi- ated by their first letter. The parameter passing feature of IND may not be used in this command. Indirect Command File Processing Page 7 For RT-11 V4.0 February 2, 1983 4.0 Symbol and Processing Protocols IND enables the user to define symbols. These symbols can then be tested and compared in order to control flow through the command file. They may also be substituted for RT-11 commands, data records for data files, indirect command file directives, or comments to be displayed on the terminal. Symbol names are ASCII strings from one to six characters in length. They must start with a letter (A - Z) or a dollar sign ($). The remaining characters may be alphanumeric or a dollar sign. There are three symbol types: logical, string, and numeric. A logical symbol has either a true or false value. A string symbol has as its value a string of ASCII characters with a length between zero and eighty characters inclusive. A nu- meric symbol can have a numeric value in the range of 0 to 65535 inclusive. The symbol can be defined to have either a decimal or octal value. The base of the value (octal or dec- imal) is relevant only when the symbol is substituted. A symbol's type is defined by the first assignment directive that assigns a value to the symbol. Subsequent assignments may assign a different value, but cannot redefine the symbol type. 4.1 Special Symbols IND automatically defines special symbols dependent upon spe- cific system characteristics and the replies to queries presented during command file execution. As with user- defined symbols, special symbols can be compared, tested, or substituted and have three types: logical, numeric, and string. All special symbols have a common format; angle brackets (<>) enclose their names, with the exception of the "passed parameter" symbols COMMAN and P0 through P9. Symbol Value ______ _____ Set to true if the last string entered in re- sponse to an .ASKS directive or tested with a .TEST directive contained only alphanumeric characters. An empty string also sets true. Lower case letters set to false. COMMAN Contains the entire command line passed by the keyboard monitor to IND. Assigned the current date in the format dd-mmm- _______ yy. __ Set to true if the answer to the last numeric query (.ASKN) was the default (a single car- riage return was entered). Indirect Command File Processing Page 8 For RT-11 V4.0 February 2, 1983 Set to true if the last .READ directive encountered an end-of-file. Set to true if the last .ASK directive was answered with an character (ASCII decimal 27, escape). Assigned the value of 0, 1, 2, or 4 depending on the exit status from the last RT-11 command executed. This symbol is modified to a value dependent on how the command completed: 0 Warning 1 Success 2 Error 4 Severe error Assigned the fully qualified file specification of the file last referred to by a .TESTFILE, .OPEN, .OPENA, .OPENR, .READ, .DATA or .ENABLE DATA directive. Assigned a value depending on the completion of the last I/O operation: 1 Operation successful 244 Invalid file specification 346 File not found 366 End-of-file encountered Set to true if the system on which IND is run- ning is mapped, false if system is unmapped. P0 Contains the indirect file name portion of the command line passed by the keyboard monitor to IND. P1 - P8 These eight symbols contain the values of the first eight parameters (including explicit nulls) passed to IND by the keyboard monitor. P9 Contains the remainder of the command line beyond the eighth parameter passed to IND by the keyboard monitor. Set to true if the last string entered in re- sponse to an .ASKS directive or tested with a .TEST directive contained only Radix-50 charac- ters. An empty string also sets true. Note that blanks are not RAD50 characters. Assigned the number, in octal, of free bytes in the internal symbol table of IND. Assigned the length of the string entered in response to the last .ASKS directive or the Indirect Command File Processing Page 9 For RT-11 V4.0 February 2, 1983 string tested by the last .TEST directive. Assigned the device mnemonic (two letters) of the user's system device (SY:). Assigned an octal number to represent the oper- ating system on which IND is running. The value 7 is for the RT-11 Single Job system. Assigned the unit number of the user's system device.