Wildcard Support (Indirectly) You have spent all day implementing project change order MC-0145 and it is time to compile the results. Unfortunately you have edited 22 different files in six directories and must patiently type 22 sets of command lines to compile each module and store the objects in the master library. If only the Fortran-77 compiler and librarian understood wildcard command lines. Of all the RSX utilities, PIP and SRD (from DECUS) are the only tasks which take wildcard file specifications. This is fine for getting directories or deleting files but does not solve the problem of compiling all files edited since last 8:00 this morning. @OPS.CMD -------- The solution is an general purpose indirect command file that uses PIP or SRD to select files and then generate individual command lines for each file. Such a file is shown in Figure 1. Figure 2 shows the subsection that needs to be changes to use SRD (V6.3) instead of PIP to select files. The command file, OPS.CMD, is simple to use. The procedure expects a file selection string and prototype command line, each enclosed in parentheses. For example, the following command would compile all Fortran programs in the current directory: >@OPS (*.FTN) (F77 $F,$F=$F) The prototype commands uses '$x' as filename symbols. The symbol '$N' is the fully qualified file-specification. There is also a symbol for each part of the RSX file-specification: $D Device name $U UIC $G Group number $O Owner number $F File name $T File type $V Version To see how each symbol may be used, the following output would occur if OPS.CMD was selected itself and each symbol output. >@OPS (LB:[1,2]OPS.CMD) (; $N $D $U $G $O $F $T $V) >; DL0:[1,2]OPS.CMD;1 DL0: [1,2] 1 2 OPS .CMD ;1 >@ Any legal PIP or SRD file selection specification may be used. This means files may be selected across directories, using wild-characters, or by date. For example, the following commands select just the Fortran programs with the prefix "ABC" that were edited today. >@OPS (ABC*.FTN/TD) (F77 $F,$F=$F) [PIP version] >@OPS (ABC*.FTN/DA) (F77 $F,$F=$F) [SRD version] OPS.CMD can also be used to execute a series of prototype commands. If no command is specified, the procedure will prompt for a series of command lines. Each line will be executed for every selected file. The commands may include references indirect command files. This can make it very easy to update a whole series of directories. Assume a project is organized so [*,10] contains the source files and [*,20] contains a command file name BUILD.CMD that can assemble or compile the sources found in the particular account and leave the object file in [*,20] and listing in [*,30]. The resulting objects are to be placed in the master library [10,10]PROJECT.OLB. The following @OPS command sequence will update all modules edited today. >@OPS ([*,10]*.*/TD) >* Command #1 [S]: SET /UIC=$U >* Command #2 [S]: @[$G,20]BUILD $F >* Command #3 [S]: SET /UIC=[10,10] >* Command #4 [S]: LBR PROJECT.OLB/RP=[$G,20]$F.OBJ >* Command #5 [S]: SET /UIC=$U >* Command #6 [S]: PIP [$G,20]$F.OBJ;*/DE/NM >* Command #7 [S]: How @OPS Works -------------- Internally, the OPS.CMD procedure uses the file selection string to output a directory to a temporary file. It then reads the temporary file. For each filename found, the procedure fills in the symbols in the prototype command and issues the resulting command. OPS.CMD is a good example of a Indirect MCR program. The RSX indirect command file processor is effectively a language interpreter, capable of arithematic and string operations, control flow (GOTO) and I/O. OPS.CMD uses the .PARSE directive extensively. The command line .PARSE COMMAN "()()" TMP FILE TMP CMD1 TMP is used to get the initial file selection and command line from the input command. The .PARSE directive uses the specified delimiters, "()()" in this case, to parse the supplied string, COMMAN, into substrings. COMMAN is a special indirect symbol that is set to the initial command line. The input string is scanned for the first delimiter and all text to the left stored in the first symbol (TMP). The next delimiter is used and an next found is then stored in the next symbol (FILE). The delimiters are never stored. The next section shows how indirect symbols can be created. The loop uses the numeric symbol CMD to produces the string symbols CMD1, CMD2, etc. Indirect MCR's I/O capabilities are shown at label .3000:. The preceeding line opens the temporary file OPS.TMP for input. The .READ directive reads one record into symbol LINE. The special symbol is tested to see when the end of the file is reached. The input lines are tested for two forms, the directory header and the actual filename. Here the PIP and SRD versions differ because of the difference in listing output. Besides using slightly different .PARSE directives, the SRD version also uses a .PARSE to remove the trailing spaces from the filename ($F), type ($T) and version ($V). The final section of OPS.CMD generates the actual command lines. Again the .PARSE directive is used to scan for dollar signs. If one is found, the sequence of statements .SETS CHR NXT[1:1] .SETS NXT NXT[2:*] .SETS OUT OUT+TXT+$'CHR' gets the type file symbol (CHR), sets NXT to the remainder of the command, and appends and preceeding text plus the file symbol to OUT. One modification that would make OPS.CMD more bullet-proof would be to test CHR to make sure a legal file symbol is specified.