Skip to content

*QPSD - Program File String Search and Replace

Purpose

This utility searches programs for specified strings and, optionally, replaces the strings with user-specified strings. This utility can be used to convert programs line numbers from 4- to 5-digits or vise versa.

Procedure

To run this utility from Thoroughbred Basic Console Mode, type:

RUN “*QPSD” and press Enter.

To select this utility from the Thoroughbred Basic Utilities Menu, type one of the following:

Q and press Enter.

*Q and press Enter.

*QPSD and press Enter.

Menu option # and press Enter.

The following message is displayed:

DISC NAME OR NUMBER:

Type the name or number of the disk on which the program(s) resides and press Enter. The system prompts:

ENTER FILENAME OR MASK; (@) FOR ALL, (CR) TO END

Type up to 48 file names or masks and press Enter or type @ and press Enter. The “at” sign (@) includes all of the programs in the specified directory. If a specified program does not exist on the disk the name is rejected. After entering each name or mask, press Enter once. After you have entered all of the names or masks, press Enter again to continue with the procedure. To exit the utility, press F4.

CTL-1 TO SEARCH ONLY, CTL-2 TO REPLACE

Press F1 to display occurrences of the string, without replacing it. Press F2 to replace the string. If the string is to be replaced, the system responds with the following prompt:

VERIFY (Y/N)

Type Y and press Enter to have the utility ask before replacing strings, or type N and press Enter to have the utility automatically replace the strings. The system responds with the following prompt:

HARD COPY (Y/N)

Type Y and press Enter to have all statements containing a search string output to a printer or type N and press Enter to output to terminal only. If Y is entered, the system responds with the following prompt:

SELECT PRINTER: xx xx: (where: xx is a configured printer)

Make your printer selection from the list of available printers displayed in the prompt. Printers displayed in background mode are currently being used by another task and, therefore, are unavailable. If the printer requested cannot be opened, the user is prompted to make another selection. If only one printer is configured, this question is not asked. The system prompts:

START LINE

Type the number of the statement where the program is to begin the search and press Enter or press Enter to start the search at the first statement in the program. The system responds with the following prompt:

END LINE

Type the number of the statement where the utility should stop searching and press Enter or press Enter to search through to the last line in the program. The system prompts:

SEARCH FOR

Type the search string and press Enter. Any number of strings will be accepted. Press Enter to begin the search. If the REPLACE option was selected, the system responds with the following prompt:

REPLACE WITH

Type the string to be substituted for the previously entered search string and press Enter. If the VERIFY option was chosen, the system responds with the following:

REPLACE WITH xxxxxxxx (Y/N)? (where: xxxxxxxx is the replacement string)

Type Y and press Enter to replace the search string with the replacement string. Type N and press Enter to bypass the replacement and continue with the search. The following message is displayed as each string is found:

CR TO CONTINUE, CTL-IV TO END

Press Enter to continue to search for the next occurrence of the string or press F4 to end the search and replace function. The system redisplays the DISC ID prompt. Press F4 to return to the Thoroughbred Basic Utilities Menu.

If the program size increases after the search and replace procedure, the system prompts:

xxxxxxxx EXPANDED TO #### BYTES AT SECTOR #### (HIT CR)

Error Messages

ERROR xx EXPANDING PROGRAM, NOT MODIFIED

The utility was unable to create a larger file to accommodate the expanded program. The utility continues its search with the next program.

INSUFFICIENT SPACE FOR WORK FILE ON DISK xx.

There is not enough space available on the disk to create a scratch file to copy the program into. The run is aborted. Erase any old or unnecessary files to make more room and try the procedure again.

SKIPPED DUE TO COMPILATION ERROR

When a replacement was made, the resulting statement contained a syntax error. The utility continues searching starting at the next statement.

From the Thoroughbred Basic Utilities, version 8.9.1. Open this page in the PDF