T. Worlton-- DCL-336 DCL-336 T. Worlton-- MODIFY MODIFY qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq MODIFY Modifies a set of ASCII files by detabbing, changing to fixed record length, truncating records, or searching for a specified string and replacing it with another string. Both string substitution and length conversion can occur in the same command execution. qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq FORMAT MODIFY file-spec[,...] Search-string Replace- string qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq restrictions You must have read access to the input file and write access and available disk quota for the output file. You must also have delete access for files in the output direc- tory for a temporary file which will be deleted if no changes are made. Trailing blanks are removed from each record unless the output file is a fixed record length file. qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq PARAMETERS file-spec[,...] Specifies the names of one or more files to be searched. You must specify at least one file name. If you specify two or more file names, separate them with commas. Wildcard characters are allowed in the file specification. Search-string Specifies the string to search for in the specified files. If the search-string contains any lowercase letters or non- alphanumeric characters (including spaces), enclose it in quotation marks. The search-string is required unless the LENGTH or DETAB qualifier is specified. You can use the /CONTROL and /EXACT qualifiers to alter the way that MODIFY matches search strings. Replace-string Specifies the string to be used to replace the search string in the specified files. If the replace-string contains any lowercase letters or nonalphanumeric characters (including spaces), enclose it in quotation marks. qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq DESCRIPTION The MODIFY command enables you to search through files for a specific character string and replace it with another character string. All records containing occurrences of the string are displayed followed by the modified record in reverse video. MODIFY also allows you to convert files to fixed record length files, to truncate records in files, or to detab files. The MODIFY command opens the specified files with READONLY access. It creates output files which record all records of the input files with any modifications. If there are no modified records, the output files are deleted when closed. Aborting the operation with CTRL_Y will leave a file of type "JOU" and the file name of the output file which was being created. qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq QUALIFIERS /COMMENT When specified with the /F77 qualifier, comments are converted to standard Fortran 77 form. Comment lines starting with "!" are changed to "*" comment lines. Debug lines starting with "D" are changed to "C" comment lines. Trailing comments beginning with "!" are removed. /CONFIRM Controls whether a request is issued before each individual MODIFY operation to confirm that the displayed record should be modified as shown. When the system issues the prompt, you can issue any of the following responses: Yes--Modify the record as shown No--Do not modify this record Retype--Retype the line (allows line editing, works with records up to 158 bytes) Quit--Use the modifications made up to this point and copy the rest of the records from the input file. Abort--Stop searching and delete the output file. Only the first character of each response should be typed. /CONTROL Specifies that the caret symbol ("^") in the search-string and/or replace-string is to be interpreted as a flag which indicates that the following character is a control character. /DETAB=n Specifies that tabs in the input file are to be replaced by an appropriate number of spaces. If the tab length, n, is not specified, the DEC default tab length of 8 will be used. Tabs will be replaced whenever one of the qualifiers: RANGE, LENGTH, DETAB, TRUNCATE, or CLIP are specified. /EXACT /NOEXACT (default) Controls whether the MODIFY command matches the search string exactly, or treats uppercase and lowercase letters as equivalents. Unless the strings are enclosed in quotes, they will still be converted to upper case by the system. The default qualifier, /NOEXACT, causes MODIFY to ignore case differences in the search string. Specifying the /EXACT qualifier causes the system to use less CPU time. Therefore, if you are sure of the case of the letters in the string, it is more efficient to use /EXACT. /FIXED Specifies that the output file should have fixed record length. The /FIXED qualifier requires the specification of the /LENGTH qualifier also. /F77 Specifies that a Fortran file is to be converted to standard source form from tab-format. If the /COMMENT qualifier is also specified, "!" comments are converted to "*" comments, and "D" debug lines are converted to "C" comment lines. If the length qualifier is not specified, the text past column 72 is discarded. Use the /LENGTH qualifier to keep longer lines. /LENGTH=n Specifies the record length of the output file for a fixed record length output file when /FIXED is specified, or the maximum record length of the output file when /FIXED is not specified. /LOG (default) /NOLOG Controls whether the MODIFY command displays each record to be modified followed by the modified record in reverse video. /OUTPUT=file-spec Specifies the name of the output file. By default the output file has the same name as the input file with an incremented version number. Wild cards are allowed for the file name or type, but no partial wild cards are allowed in the output file specification. For example HE*.DAT is allowed as an input file specification, but not for an output file specification. /RANGE=n1:n2 Specifies the range of columns to search for the specified search-string. If no range is specified, all occurrences of the search string are located and replaced in each record. /TRUNCATE Specifies that text beyond the allowed record length is to be truncated. /UNCOMMENT when specified with the /F77 qualifier it causes all comments to be removed. /WRAP Specifies that text beyond the allowed record length is to be wrapped to a new record. qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq EXAMPLES 1 $ MODIFY/EXACT HE*.FOR/OUTPUT=*.FTN "Larry" "Moe" This command searches all files of type FOR and name beginning with the letters HE in the current directory for the string "Larry" and replaces it with the string "Moe". The new files created have the same name as the input files, but with a file type of FTN instead of FOR. The /EXACT qualifier means that only strings matching the search string exactly (including upper/lower case) will be found, so "LARRY" would be bypassed. 2 $ MODIFY/CONFIRM DRA1:[*]LOGIN.COM SUBS MODIFY This command searches the LOGIN.COM files in all main directories on disk DRA1: for the string "SUBS", displays the records containing this string, followed by the record as it will appear after the change and prompts the user to confirm the change. The output file in each directory will be LOGIN.COM with an incremented version number. Note that if you have SYSPRV, the output file will belong to the parent directory. You must have read access to each LOGIN.COM file and write access to each directory in order to perform this operation. In addition there must be adequate disk quota for each directory owner to create the file. 3 $ MODIFY/CONTROL *.TXT "^@" "" Delete all occurrences of the NUL character in files of type TXT in the current directory. The search_string is deleted whenever the replace_string is null. 4 $ MODIFY/FIXED/LENGTH=72/NOLOG/OUTPUT=IBM.FOR IBM.TXT Convert file IBM.TXT to a fixed record length file of length 72 and truncate each record that is greater than 72 bytes long. The new fixed record length file will be called IBM.FOR. Since there will be no apparent difference between the two records when displayed on the screen and many records will be affected, the display of changes was turned off with the /NOLOG qualifier. Note that when an output record length is specified, tabs are converted to the appropriate number of spaces. Since no DETAB qualifier and value was given, the DEC default value of 8 will be used. 5 $ MODIFY/RANGE=2:10 SAMPLE.TXT "Abc" defgh Search columns 2 through 10 of file SAMPLE.TXT for the string "Abc" and replace it with the string "DEFGH". Although the search string is in quotes, the case is not significant since the /EXACT qualifier was not specified. Since the replace string was not in quotes, it would be in upper case in the output document even if /EXACT had been specified. 6 $ MODIFY/DETAB=5 JUNK.TXT Examine each record of JUNK.TXT for tab characters and replace them with the appropriate number of spaces for a tab length of 5. 7 $ MODIFY/LENGTH=64/WRAP TEST.DAT Read each record of TEST.DAT and write the output records with a maximum of 64 characters/record, wrapping text beyond column 64 to a new record. 8 $ MODIFY/F77/LOG TEST.FOR Read each record of TEST.FOR and convert from DEC tab-format Fortran to standard fixed-format.