.PAPER SIZE 60,72 .LEFT MARGIN 9 .AUTOPARAGRAPH .FIGURE 15 .CENTER;Introduction to the RSX .CENTER;Indirect Command File Processor .FIGURE 7 .CENTER;- RX009 - .FIGURE 5 .CENTER;Thomas R. Wyant, III .CENTER;E. I. DuPont de Nemours .CENTER;Richmond, Virginia .FIGURE 5 .CENTER;December 10, 1990 .PAGE .HL1 Housekeeping .HL2 Abstract This paper presents a survey of the basic capabilities of the RSX Indirect Command Processor (ICP). A useful and efficient subset of the ICP directives is presented, some common misconceptions are addressed, and known bugs in the various implementations of the ICP are highlighted. Similarities to and differences from the P/OS and RT-11 ICPs will also be pointed out. .HL2 Goal The goal of this paper is to help the reader or listener to make efficient use of the RSX Indirect Command File Processor (ICP). .HL2 Caveats The current releases of all the operating systems are assumed. However, this paper should be useful as far back as: .LITERAL RSX-11M V3.2 RSX-11M+ V1.0 VAX-11 RSX V1.0 P/OS V1.0 RT-11 V5.0 (FB and XM) .END LITERAL Where there are differences between the Indirect Command File Processors of these systems (and I am aware of these differences) they are indicated. Command lines in examples are all for RSX MCR. I am not the final authority on the ICP in all its multifarious versions. Errors in research and transcription do occur. I apologize in advance for these, but assume no responsibility for their consequences. .HL2 Acknowlegement Allen A. Watson's paper, "Indirect Command Files for New RSX Users", presented at the Spring, 1983 DECUS US Symposium, was both an inspiration and a reference for this paper. .HL1 Background .HL2 Historical Perspective The RSX Indirect Command Processor (hereinafter known as the ICP) is the RSX system component that allows you to group MCR or DCL commands in a file and have them executed as a group. The same basic processor was put in P/OS when it was spun off from the RSX mainstream, and the same logic has within the last couple years been exported to RT-11. .HL2 Invoking the ICP To feed a command file to the ICP: .LIST "o" .LE;Under RSX: .LITERAL >@filename .END LITERAL (Default filetype is .CMD) .LE;Under P/OS: .LITERAL $ @filename .END LITERAL (Default filetype is .CMD) .LE;Under RT: .LITERAL . SET KMON IND . @filename or . IND @filename .END LITERAL (Default filetype is .COM) .END LIST In all cases the input is to a CLI prompt. "@filename" in response to some other prompt has nothing to do with the ICP. For example, .LITERAL PIP>@filename .END LITERAL feeds the file to PIP's own command processor. .HL2 Contents of an ICP file Each line of an ICP file is composed of one of the following: .LIST "o" .LE;An "external" comment: .LIST "-" .LE;Begins with ";". .LE;Is displayed when encountered (unless _.ENABLE QUIET is in effect). .LE;Has no other effect. .END LIST .LE;An "internal" comment: .LIST "-" .LE;Begins with ".;". .LE;Is not displayed when encountered. .LE;Has no other effect. .END LIST .LE;An ICP directive: .LIST "-" .LE;Begins with ".". .LE;Is interpreted and executed by the ICP. .LE;Most of this paper deals with these. .END LIST .LE;A CLI command: .LIST "-" .LE;Is any line that doesn't meet the above criteria. .LE;Is issued as a command to the current CLI, as though you typed it. If the current CLI can't handle it, that's your problem, not ICP's. .END LIST .END LIST Normally, only one of the above may appear on a line of an ICP file. The exceptions to this rule are: .LIST "o" .LE;Most ICP directives may be followed by an internal comment. The output directives are the major exception to this. .LE;The ICP conditional directives may be followed by a comment, a CLI command, or another ICP directive (including another conditional). .END LIST .HL2 Processing a line of an ICP file A record (line) in an ICP file is processed in the following steps: .LIST .LE;Read it. .LE;Perform symbol substitution (if enabled). .LE;Decide what category it falls in. If it's an ICP directive: .LIST .LE;Parse the first "word". .LE;Load the overlay that processes it (overlaid versions). .LE;Complete parsing. .LE;Execute. .END LIST .END LIST Why is this important? Because: .LIST "o" .LE;Symbol substitution occurs very early in the processing of a line. Many "LISP"-ish behaviors of the ICP are based on this. .LE;Many versions of the ICP are overlaid, so grouping like operations together can improve performance. .LE;Running an overlaid ICP off a floppy disk can require a good deal of patience. .END LIST .HL1 Symbols .HL2 What are Symbols? .LIST "o" .LE;They are named data stores used by the ICP. .LE;They are not accessible outside the ICP (though the ICP can make their VALUES available). .LE;Their names are 1-6 RAD50 characters (excluding "."), and MUST contain at least one non-numeric character. Note that: .LIST "-" .LE;Certain releases of the ICP have had trouble with embedded dollar signs, or with symbol names that begin with a numeric character. .LE;There are certain predefined Special Symbols, which are named according to the same convention, but have their names enclosed in "<>". These do not conflict with ordinary names. .END LIST .LE;They come in three flavors: .LIST "-" .LE;Logical (True of False). .LE;Numeric (16-bit integer values). .LE;String (0 to 132 bytes). .END LIST .LE;They can be assigned values: .LIST "-" .LE;By computation within the ICP. .LE;By querying the user. .LE;In special cases, by reference or on entry to the ICP. .END LIST .LE;Their values can be tested. .LE;They are normally local to the command file in which they were created. However, if you .ENABLE GLOBAL, symbols whose name begins with a "$" are available for the life of the ICP run. .END LIST .HL2 Logical Symbols .LIST "o" .LE;Take on the values TRUE or FALSE. .LE;Can be assigned values by: .LITERAL .SETT symbol ! sets it TRUE. .SETF symbol ! sets it FALSE. .SETL symbol expression .END LITERAL .LE;Logical expressions consist of logical symbols (including the Special Logical Symbols or ), connected by the following operators: .LITERAL ! (logical OR). & (logical AND). # (logical NOT) (RSX, P/OS). ^ (logical NOT) (RT). .END LITERAL Expressions are evaluated left to right, without regard for usual precedence of operators. Operations may be grouped with parentheses. .LE;Values can be tested by _.IFT, _.IFF, or .IF directives. These directives are discussed under "Control". .LE;Can take on values entered from your terminal, using the _.ASK directive. This directive is discussed under "Terminal I/O". .LE;Substitution yields "T" for TRUE, or "F" for FALSE. Substitution is discussed later in this section. .END LIST .HL2 Numeric Symbols .LIST "o" .LE;Take on 16-bit integer values. These are unsigned. Under RSX and P/OS, you can treat them as signed values if you .LITERAL .ENABLE OVERFLOW .END LITERAL .LE;Can be assigned values by: .LITERAL .SETN symbol expression .INC symbol ! Adds 1. .DEC symbol ! Subtracts 1. .SETT [mask] symbol ! RT-11 only .SETF [mask] symbol ! RT-11 only .END LITERAL The ".SETx [mask] symbol" operations set or clear the masked bits in the given numeric symbols. .LE;Numeric expressions consist of numeric symbols or constants, connected by the following operators: .LITERAL + (addition); - (subtraction); * (multiplication); / (integer division); ! (bitwise OR); & (bitwise AND); # (bitwise NOT) (RSX, P/OS); ^ (bitwise NOT) (RT). .END LITERAL Expressions are evaluated left to right, without regard for usual precedence of operators. Operations may be grouped with parentheses. .LE;Numeric constants are octal by default unless you append a decimal point, or unless you: .LITERAL .ENABLE DECIMAL ! (RSX,P/OS) .DISABLE OCTAL ! (RT) .END LITERAL .LE;Values can be tested by the _.IF directive. This directive is discussed under "Control". .LE;Can take on values entered from your terminal, using the _.ASKN directive. This directive is discussed under "Terminal I/O". .LE;The default radix of a symbol is decimal, unless the expression that computed its value consisted only of octal symbols and constants. This default radix can be changed by: .LITERAL .SETO symbol ! (set to octal); .SETD symbol ! (set to decimal). .END LITERAL .LE;Substitution yields the value of the symbol, in the current default radix of the symbol. Substitution is discussed later in this section. .END LIST .HL2 String Symbols .LIST "o" .LE;Take on the value of a 0-132 byte string. .LE;Can be assigned values by: .LITERAL .SETS symbol expression .END LITERAL If you _.DISABLE LOWERCASE, the string is uppercased before being assigned to the symbol. .LE;String expressions consist of string symbols, substrings, or constants, connected by the following operator: .LITERAL + (concatenation). .END LITERAL Expressions are evaluated left to right. Operations may NOT be grouped with parentheses, but then with only one operator, why would you need to? .LE;A string constant is constructed as follows: .LITERAL "this is a string constant" #so is this, for RSX and P/OS only# .END LITERAL The quoting character may not appear in the string constant. .LE;Substrings can be extracted by the construction: .LITERAL symbol[start:end] .END LITERAL which represents the bytes between the start and end positions, inclusive. Any valid numeric expression can be used for "start" and "end". Also, "*" can be used, representing the last character in the string. .LE;Values can be tested by the _.IF directive. This directive is discussed under "Control". .LE;Can take on values entered from your terminal, using the _.ASKS directive. This directive is discussed under "Terminal I/O". .LE;Substitution yields the bytes in the string. Substitution is discussed later in this section. .END LIST .HL2 Symbol Substitution .LIST "o" .LE;Occurs only when enabled by _.ENABLE SUBSTITUTION. Under P/OS and RT, substitution is enabled by default. Under RSX, it is disabled by default. .LE;Is called for by enclosing a symbol name in apostrophes. .LE;If you attempt substitution on an undefined symbol, an error occurs. .LE;Substitution in a line of an ICP file occurs BEFORE the line is parsed. Therefore it can occur anywhere in a line, and in any kind of line. .LE;Under RSX and P/OS, you can get format control by following the symbol name (within apostrophes) by a percent sign ("%") and one or more of the following: .LITERAL D (substitute decimal value); O (substitute octal value); Rn (right justify in "n" byte field); Ln (left justify in "n" byte field); Z (fill with leading zeros); S (signed value); C (do blank compression); X (substitute RAD50 string for number); V (substitute value for first byte, or a byte for value). .END LITERAL .END LIST Examples (all of which assume _.ENABLE SUBSTITUTION): .LIST "o" .LE;Assembling and task building an arbitrary module: .LITERAL .ASKS MODULE What module MAC 'MODULE'='MODULE' TKB @'MODULE'BLD .END LITERAL Effects: .LIST "-" .LE;You are prompted for the name of a module; .LE;That module is assembled and taskbuilt. .END LIST .LE;Inserting control characters: .LITERAL .SETN NJUNK 33 .SETS ESCAPE "'NJUNK%V'" .END LITERAL Effect: .LIST "-" .LE;String Symbol ESCAPE now contains an escape character. .END LIST .LE;Using format control to set the size of a field: .LITERAL .SETN NJUNK 1 PIP FILE.'NJUNK%R3Z'/LI .END LITERAL Effect: .LIST "-" .LE;A directory listing of file FILE.001 is produced. .END LIST .END LIST .HL2 Determining the Characteristics of Symbols .LIST "o" .LE;Finding out whether a symbol exists: .LITERAL .IFDF symbol ! If it's defined .IFNDF symbol ! If it's not. .END LITERAL Note that the line .LITERAL .IFDF symbol ;'symbol' .END LITERAL will result in an error if the symbol is undefined. The substitution is attempted BEFORE the line is parsed. .LE;Characteristics of a symbol: .LITERAL .TEST symbol .END LITERAL causes the following Special Symbol values to be set: .LIST " " .LE; .LIST "=" .LE;0 if the symbol is a Logical Symbol, .LE;2 if the symbol is a Numeric Symbol, .LE;4 if the symbol is a String Symbol; .END LIST .LE; .LIST "=" .LE; if octal (numeric and string only); .END LIST .LE; .LIST "=" .LE;Length of string (string symbols only); .END LIST .LE; .LIST "=" .LE; if (uppercase) alphanumeric (string symbols only); .END LIST .LE; .LIST "=" .LE; if a number (string symbols only); .END LIST .LE; .LIST "=" .LE; if a RAD50 string (string only). .END LIST .END LIST .END LIST .HL2 Manipulating Substrings .LIST "o" .LE;Finding substrings of a string: .LITERAL .TEST string1 string2 .END LITERAL returns the following Special Symbol value: .LIST " " .LE; .LIST "=" .LE;the position of first occurrence of string2 in string1, or 0 if it doesn't occur. .END LIST .END LIST Note that: .LIST "-" .LE;The strings may be either string constants or string symbols. .LE;Extracting substrings based on character position was discussed under String Symbols. .END LIST .LE;Substrings based on character locations: .LITERAL .PARSE string1 string2 symbol1 symbol2 ... .END LITERAL Takes string2 as a list of separators, and picks string1 apart. symbol1 gets everything up to the first separator, and so on. .LIST "-" .LE;If there are more symbols than separator characters in string2, the last separator character gets reused. .LE;If all separators do not occur IN ORDER in string1, symbols corresponding to the missing separators come back with the null string. .LE;Special Numeric Symbol contains the actual number of substrings processed by _.PARSE. This includes explicitly null substrings, but not symbols set null because _.PARSE could not find any more separators. .END LIST .END LIST For example: .LITERAL .PARSE "[,]" JUNK1 GROUP MEMBER JUNK2 .END LITERAL sets String Symbols JUNK1 and JUNK2 null, GROUP to your current UIC group, and MEMBER to your current UIC member. .HL1 Control .HL2 Conditional Directives .LIST "o" .LE;The general syntax of the Conditional Directive is .LITERAL .IFx condition statement .END LITERAL The "statement" (directive, CLI command, or whatever) is executed ONLY if the condition is satisfied. .LE;There are a number of cases of the conditional directive: .LITERAL Syntax Satisfied if: ------------------- ------------------ .IFT symbol symbol is true .IFF symbol symbol is false .IFDF symbol symbol defined .IFNDF symbol symbol not defined .IFLOA driver driver loaded .IFNLOA driver driver not loaded .IF symbol rel expr relation satisfied .IFINS task task installed .IFNINS task task not installed .IFACT task task active .IFNACT task task not active .IFT [mask] symbol numeric symbol has any masked bits set .IFF [mask] symbol numeric symbol has any masked bits clr .END LITERAL Note that: .LIST "-" .LE;The "task"-oriented conditionals are available only in RSX and P/OS. .LE;The "[mask]"-ed forms of the conditionals are available only under RT. .END LIST .LE;The following relations are valid in a _.IF directive: .LITERAL Satisfied if value of Syntax symbol is -------- ------------------------ = or EQ equal to expression <> or NE not equal to expression > or GT greater than expression < or LT less than expression >= or GE greater than or equal to expression <= or LE less than or equal to expression .END LITERAL The expression must be of the same type as the symbol. .LE;Tests can be connected using: .LIST " " .LE;_.OR - satisfied if either condition is met. .LITERAL .IFx condition .OR .IFx condition .END LITERAL .LE;_.AND - satisfied if both conditions are met. .LITERAL .IFx condition .AND .IFx condition .END LITERAL .LE;Parentheses after the first _.IFx group tests. .LITERAL .IFx .AND (.IFx .OR .IFx) .END LITERAL .END LIST .END LIST .HL2 Labels .LIST "o" .LE;Are used to identify locations as targets of _.GOTO or _.GOSUB directives. .LE;Are formed in the same way as symbol names but do not conflict with them. .LE;Must occur (at least) once in the same command file as all _.GOTOs or _.GOSUBs that refer to them, or you get an error. .LE;Need not be unique - but you can get "strange" results if they're not. .LE;Come in two flavors: .LIST "-" .LE;Standard labels: .LIST "." .LE;Defined by the syntax: .LITERAL .label: (more stuff on same line) .END LITERAL .LE;Are found by scanning the command file forward from the _.GOTO or _.GOSUB to the end of the file and then (if the file is on disk) rewinding and scanning forward to the _.GOTO or _.GOSUB directive; .LE;Substitution does not occur when scanning for labels. .END LIST .LE;Direct-access labels: .LIST "." .LE;Defined by the syntax .LITERAL .label: .END LITERAL with nothing else on the same line; .LE;Location is cached, and loaded directly when referenced by a _.GOTO or _.GOSUB directive; .LE;If cache fills, earliest defined label is dropped (ie: it reverts to being a standard label); .LE;Obviously, there are no direct-access labels if the command file is not on disk. .END LIST .END LIST .END LIST .HL2 Transfer of Control .LIST "o" .LE;"Standard" GO TO: .LIST "-" .LE;Syntax: .LITERAL .GOTO label .END LITERAL .LE;Unconditionally transfers control to the given label. .LE;The given label must occur in the same command procedure as the _.GOTO that refers to it. .END LIST .LE;"Computed" GO TO: .LIST "-" .LE;No explicit support for this. .LE;Can be implemented using symbol substitution and smart choice of labels, as in: .LITERAL .ENABLE SUBSTITUTION .SETN OPTION 0 .QUERY: .ASKS FILE Which file .ASKN [0:2] OPTION Which option .GOTO OPT'OPTION' .OPT0: .EXIT .OPT1: PIP 'FILE'/LI .GOTO QUERY .OPT2: PIP 'FILE'/SP .GOTO QUERY .END LITERAL .END LIST .LE;"Assigned" GO TO: .LIST "-" .LE;No explicit support for this. .LE;Can be implemented using symbol substitution and smart choice of labels, as in: .LITERAL .ENABLE SUBSTITUTION .SETS ASSIGN "LABEL1" . . . .GOTO 'ASSIGN' . . . .LABEL1: .END LITERAL .END LIST .END LIST .HL1 File I/O .HL2 Basic File Operations .LIST "o" .LE;Input directives: .LIST "-" .LE;To open an existing sequential file for input: .LITERAL .OPENR filename .END LITERAL .LE;To read the next sequential record into a String Symbol: .LITERAL .READ symbol .END LITERAL If the end of the file is encountered, Special Symbol is set , and the symbol's value is untouched. .END LIST .LE;Output directives: .LIST "-" .LE;To open a new sequential file for output: .BLANK;.INDENT +4 _.OPEN filename .BLANK By default this file has LIST (or __) implied carriage control. You can get other possibilities by modifying the special symbol _ as follows before opening the file: .LEFT MARGIN +4;.NOFILL _.SETN _ 0 ! No implied carriage control. _.SETN _ 1 ! FORTRAN implied carriage ctrl. _.SETN _ 2 ! LIST implied carriage control. .FILL;.LEFT MARGIN -4 .LE;To open an existing sequential file to append records to it: .LITERAL .OPENA filename .END LITERAL If the specified file does not exist, the effect is the same as _.OPEN. .LE;To write a line of text to a sequential file: .LITERAL .DATA text .END LITERAL .LE;To copy lines from the command procedure to a sequential file: .LITERAL .ENABLE DATA .END LITERAL causes all lines in the command procedure to be written to the output file, until a .LITERAL .DISABLE DATA .END LITERAL is encountered. Substitution is performed (if enabled) before the output lines are written. Note that: .LIST "." .LE;Labels in a _.ENABLE DATA block are recognized during a label search. This is a restriction. .LE;Some versions of the ICP don't recognize _.DISABLE DATA unless it is left justified in the record. .END LIST .END LIST .LE;Miscellaneous file I/O directives: .LIST "-" .LE;To close a file: .LITERAL .CLOSE .END LITERAL .LE;To close and delete a file (under RT only): .LITERAL .PURGE .END LITERAL .END LIST .LE;Restrictions: .LIST "-" .LE;There are no I/O directives for relative, indexed, or stream files. You can use RMSDES, RMSCNV, and RMSIFL to convert between these file organizations and sequential, if it is appropriate to your application. .LE;There is no way to read more than 132 bytes of any file record. .END LIST .END LIST .HL2 Miscellaneous Capabilities .LIST "o" .LE;To operate on multiple files: .LITERAL .END LITERAL All file I/O directives will take an optional File Number after the directive, but before any arguments. For example: .LITERAL .OPEN #1 KANGA.ROO .DATA #2 This data goes to File 2. .END LITERAL The File Number is a hash mark ("_#") and a number from 0-3. _#0 is the same as omitting the file number. You can, of course, generate the number by symbol substitution: .LITERAL .DATA #'FILENO' This data is written .DATA #'FILENO' to some file, but .DATA #'FILENO' which one is not .DATA #'FILENO' determined until the .DATA #'FILENO' ICP is run. .END LITERAL .LE;To determine file attributes (RSX only): .LITERAL .END LITERAL Special Symbol is loaded with the first 7 words of the FCS file descriptor block for the most recently _.OPENed file (as a string of decimal numbers, separated by commas). This includes such useful information as how big the file is, what its largest record is, and more. .END LIST .HL1 Terminal I/O .HL2 _.ASKx Operation .LIST "o" .LE;The _.ASKx directives are used to prompt for and validate symbol values. .LE;The _.ASKx directives always return either a valid value or some specific exception condition. .LE;Validation failure causes reprompting automatically. .LE;By default, entry of _^Z causes the ICP to exit. .LE;Syntax: .LITERAL .ASK [df:tm] Logical_symbol pmp .ASKN [lo:hi:df:tm] Numeric_symbol pmp .ASKS [lo:hi:df:tm] String_symbol pmp .END LITERAL Where: .LIST "-" .LE;lo = lowest valid value (_.ASKN) or lowest acceptable length (_.ASKS). .LE;hi = highest valid value (_.ASKN) or highest acceptable length (_.ASKS). .LE;df = default value. .LE;tm = timeout on question. .LIST "." .LE;Under RSX and P/OS, this can be disabled with the "_.DISABLE TIMEOUT" directive. .LE;Under RT, this will not work unless you have a system clock, and issue the "_.ENABLE TIMEOUT" directive. .END LIST .LE;pmp = prompt string. .END LIST .LE;All _.ASKx parameters are optional - except that "lo" and "hi" must be either both specified or both omitted. .LE;Trailing colons in parameter block can be omitted. If all parameters are omitted, the square brackets can be, too. .LE;If the default answer is taken, comes back TRUE. .LE;If the timeout expires, comes back TRUE. .LE;You can get uppercase conversion on a _.ASKS by issuing the "_.DISABLE LOWERCASE" directive. .END LIST .HL2 _.ASKx Exception Handling You don't get exceptions returned unless you _.ENABLE them. Exception conditions which can be trapped in this way are: .LIST "o" .LE;_.ENABLE ESCAPE .LIST "-" .LE;Causes the escape character to be a valid response for any _.ASKx directive. .LE;Special Symbol (and its synonym ) come back TRUE if an escape character is entered. .LE;This is generally used to break out of the normal logic sequence (eg - to print help text). .END LIST .LE;_.DISABLE CONTROL-Z (RSX, P/OS only) .LIST "-" .LE;Allows _^Z to be trapped by your command procedure. .LE;Special Symbol comes back TRUE when a Control/Z has been entered. .LE;This is generally used to break out of normal logic sequence (eg - SYSGEN), or with SET /SLAVE=TI: to create captive command procedures. .END LIST .END LIST The manual specifies that the default answer is returned for exceptions. Not all versions of ICP support this. .HL2 Miscellaneous Input You can also _.OPENR a terminal. This is the only way to do I/O to a terminal other than TI: (RSX, P/OS) or TT: (RT). .HL2 Output .LIST "o" .LE;By default: .LIST "-" .LE;Each _.ASKx displays: .LITERAL >* prompt [parameters]: (under RSX) $ * prompt [parameters]: (under P/OS) * prompt [parameters]: (under RT) .END LITERAL .LE;"External" comments display: .LITERAL >; comment text (under RSX) $ ; comment text (under P/OS) ; comment text (under RT) .END LITERAL .LE;CLI commands are displayed as: .LITERAL >Command (under RSX) $ Command (under P/OS) . Command (under RT) .END LITERAL .END LIST .LE;You can disable the extra stuff by issuing .LITERAL .DISABLE DISPLAY (Under RSX and P/OS) .DISABLE PREFIX,SUFFIX (Under RT) .END LITERAL If you do this: .LIST "-" .LE;Each _.ASKx displays: .LITERAL prompt .END LITERAL .LE;"External" comments display: .LITERAL comment text .END LITERAL .LE;CLI commands are displayed as: .LITERAL Command .END LITERAL .END LIST .LE;You can get rid of "External" comments and CLI commands completely by: .LITERAL .ENABLE QUIET .END LITERAL .LE;You can also (of course) _.OPEN a terminal for output. .END LIST .HL1 Modules .HL2 Internal .LIST "o" .LE;Modules internal to the current command file can be created by using the _.GOSUB - _.RETURN construction. .LE;Module entry syntax: .LITERAL .GOSUB label arguments .END LITERAL .LE;Argument passing: .LIST "-" .LE;The arguments are available in the reserved String Symbol COMMAN. .LE;This contains a literal copy of anything on the _.GOSUB command line after the label. .END LIST .LE;Module exit syntax: .LITERAL .RETURN .END LITERAL returns to the first line after the _.GOSUB directive. .END LIST For example: .LITERAL .ENABLE SUBSTITUTION .GOSUB STORE Arthur Dent .GOSUB STORE 6*9=42 .EXIT .STORE: ; The argument is "'COMMAN'". .RETURN .END LITERAL This displays (under RSX): .LITERAL >; The argument is "Arthur Dent". >; The argument is "6*9=42". >@ .END LITERAL .HL2 External .LIST "o" .LE;Other command files can be called just as though from the CLI prompt. .LIST "-" .LE;The module entry syntax is .LITERAL @file arguments .END LITERAL .LE;The arguments are loaded into reserved String Symbols as follows: .LIST "." .LE;COMMAN - Contains the entire invoking command line, uppercased and with blank compression. .LE;P0-P9 - Are loaded as though by: .LITERAL .PARSE COMMAN " " P0 P1 P2 P3 .... .END LITERAL .END LIST .LE;You can exit the module in two ways: .LIST "." .LE;Return to the calling module. The syntax is .LITERAL .EXIT status .END LITERAL Where "status" is a number to be returned to the caller in Special Symbol (the default being 1). If executed from the top level, the ICP is terminated and the status is returned to the parent task (if any). The end of the command procedure is equivalent to ".EXIT" .LE;Terminate the ICP. The syntax is .LITERAL .STOP .END LITERAL .END LIST .LE;You can pass results back to the caller in global symbols, or in Special String Symbol by: .LITERAL .SETS results .END LITERAL .END LIST .LE;You can also chain between command files: .LITERAL .CHAIN file .END LITERAL The only parameter passing is by global symbols, or (under RSX and P/OS only) by using .LITERAL .CHAIN file/LO .END LITERAL which causes all local symbols to be preserved in the new command file. .END LIST .HL1 External Environment .HL2 What Kind of System Are You On? .LIST "o" .LE;Your operating system type is encoded in Special Numeric Symbol (in octal), as follows: .LIST "=" .LE;0 for RSX-11D. .LE;1 for RSX-11M. .LE;2 for RSX-11S (nice trick!). .LE;3 for IAS. .LE;4 for RSTS (for expansion?). .LE;5 for AME, or VAX-11 RSX. .LE;6 for RSX-11M+. .LE;7 for RT-11 SJ. .LE;10 for RT-11 FB (or RTEM-11). .LE;11 for P/OS. .END LIST .LE;Under RSX, a string describing your operating system type is available in Special String Symbol . This is a new feature, and may or may not be in P/OS and RT. .LE;Under RSX, a string describing your operating system version is available in Special String Symbol . This is a new feature, and may or may not be in P/OS and RT. .LE;Your system name is available in Special String Symbol .LITERAL (for RSX and P/OS) (for RT) .END LITERAL By default, this is the name given at SYSGEN. However (at least under RSX) if you are running DECnet, it will contain your DECnet Node Name. .END LIST .HL2 The Device Configuration .LIST "o" .LE;Determining the status of a driver: .LIST "-" .LE;".IFLOA driver" is satisfied if the driver is loaded. .LE;".IFNLOA driver" is satisfied if the driver is not loaded. .END LIST .LE;Determining the status of a device: .LITERAL .TESTDEVICE name .END LITERAL (where "name" is a physical or logical device name) returns, in Special String Symbol , the string .LITERAL "phys,n1,n2,n3,n4,flags" .END LITERAL where: .LIST "-" .LE;Phys is the physical name of the device. .LE;n1 through n4 represent: .LIST "." .LE;Under RSX and P/OS, the contents in octal of the words U.CW1 through U.CW4. This is the same information that is returned by GETLUN in the third through sixth words of the buffer. .LE;Under RT, n1 is the device size as a decimal number, with trailing dot. n2 through n4 are always zero. .END LIST .LE;Flags are three letter device status indications, separated by commas. One from each group will be returned: .LIST "." .LE;Driver status: .LIST " " .LE;LOD, driver is loaded. .LE;UNL, driver is not loaded. .END LIST .LE;Device status: .LIST " " .LE;ONL, device is online. .LE;OFL, device is offline. .LE;UNK, status is unknown (only by RT). .END LIST .LE;Mount status: .LIST " " .LE;MTD, device is mounted. .LE;NMT, device is not mounted. .END LIST .LE;Mount type (RSX and P/OS only): .LIST " " .LE;FOR, device is mounted foreign. .LE;NFO, device is not mounted foreign. .END LIST .LE;"Publicity" (RSX and P/OS only): .LIST " " .LE;PUB, device is set public. .LE;NPU, device is not set public. .END LIST .LE;Allocation (RSX and P/OS only): .LIST " " .LE;NAL, not allocated. .LE;ALU, allocated to this terminal. .LE;ALO, allocated to another terminal. .END LIST Be warned that some versions of the ICP get confused whether to return ALO or ALU. .LE;Attachment (RSX and P/OS only): .LIST " " .LE;NAT, not attached. .LE;ATU, attached by this copy of the ICP. .LE;ATT, attached by another task. .END LIST .END LIST .END LIST If the device is not in the system, returns "NSD,". .END LIST .HL2 Other Things About the System .LIST "o" .LE;Under RT only, you can find out what volume is on a given device by issuing .LITERAL .VOL symbol device .END LITERAL which loads the volume label into the string symbol. .LE;The current date and time are returned in the Special String Symbols .LIST "-" .LE; (blank under RT if there is none); .LE;