Searches the source code for a specified string and displays source lines that contain an occurrence of the string. Format SEARCH [range] [string]
1 – Parameters
range Specifies a program region to be searched. Use any of the following formats: mod-name Searches the specified module from line 0 to the end of the module. mod-name\line-num Searches the specified module from the specified line number to the end of the module. mod-name\line- Searches the specified module from the line num:line-num number specified on the left of the colon to the line number specified on the right. line-num Uses the current scope to find a module and searches that module from the specified line number to the end of the module. The current scope is established by a previous SET SCOPE command, or the PC scope if you did not enter a SET SCOPE command. If you specify a scope search list with the SET SCOPE command, the debugger searches only the module associated with the first named scope. line-num:line-num Uses the current scope to find a module and searches that module from the line number specified on the left of the colon to the line number specified on the right. The current scope is established by a previous SET SCOPE command, or the PC scope if you did not enter a SET SCOPE command. If you specify a scope search list with the SET SCOPE command, the debugger searches only the module associated with the first named scope. null (no entry) Searches the same module as that from which a source line was most recently displayed (as a result of a TYPE, EXAMINE/SOURCE, or SEARCH command, for example), beginning at the first line following the line most recently displayed and continuing to the end of the module. string Specifies the source code characters for which to search. If you do not specify a string, the string specified in the last SEARCH command, if any, is used. You must enclose the string in quotation marks (") or apostrophes (') under the following conditions: o The string has any leading or ending space or tab characters o The string contains an embedded semicolon o The range parameter is null If the string is enclosed in quotation marks, use two consecutive quotation marks ("") to indicate an enclosed quotation mark. If the string is enclosed in apostrophes, use two consecutive apostrophes ('') to indicate an enclosed apostrophe.
2 – Qualifiers
2.1 /ALL
Specifies that the debugger search for all occurrences of the string in the specified range and display every line containing an occurrence of the string.
2.2 /IDENTIFIER
Specifies that the debugger search for an occurrence of the string in the specified range but display the string only if it is not bounded on either side by a character that can be part of an identifier in the current language.
2.3 /NEXT
(Default) Specifies that the debugger search for the next occurrence of the string in the specified range and display only the line containing this occurrence.
2.4 /STRING
(Default) Specifies that the debugger search for and display the string as specified, and not interpret the context surrounding an occurrence of the string, as it does in the case of /IDENTIFIER.
3 – Description
The SEARCH command displays the lines of source code that contain an occurrence of a specified string. If you specify a module name with the SEARCH command, that module must be set. To determine whether a particular module is set, use the SHOW MODULE command, then use the SET MODULE command, if necessary. Qualifiers for the SEARCH command determine whether the debugger: (1) searches for all occurrences (/ALL) of the string or only the next occurrence (/NEXT); and (2) displays any occurrence of the string (/STRING) or only those occurrences in which the string is not bounded on either side by a character that can be part of an identifier in the current language (/IDENTIFIER). If you plan to enter several SEARCH commands with the same qualifier, you can first use the SET SEARCH command to establish a new default qualifier (for example, SET SEARCH ALL makes the SEARCH command behave like SEARCH/ALL). Then you do not have to use that qualifier with the SEARCH command. You can override the current default qualifiers for the duration of a single SEARCH command by specifying other qualifiers. Related commands: (SET,SHOW) LANGUAGE (SET,SHOW) MODULE (SET,SHOW) SCOPE (SET,SHOW) SEARCH
4 – Examples
1.DBG> SEARCH/STRING/ALL 40:50 D module COBOLTEST 40: 02 D2N COMP-2 VALUE -234560000000. 41: 02 D COMP-2 VALUE 222222.33. 42: 02 DN COMP-2 VALUE -222222.333333. 47: 02 DR0 COMP-2 VALUE 0.1. 48: 02 DR5 COMP-2 VALUE 0.000001. 49: 02 DR10 COMP-2 VALUE 0.00000000001. 50: 02 DR15 COMP-2 VALUE 0.0000000000000001. DBG> This command searches for all occurrences of the letter D in lines 40 to 50 of the module COBOLTEST, the module that is in the current scope. 2.DBG> SEARCH/IDENTIFIER/ALL 40:50 D module COBOLTEST 41: 02 D COMP-2 VALUE 222222.33. DBG> This command searches for all occurrences of the letter D in lines 40 to 50 of the module COBOLTEST. The debugger displays the only line where the letter D (the search string) is not bounded on either side by a character that can be part of an identifier in the current language. 3.DBG> SEARCH/NEXT 40:50 D module COBOLTEST 40: 02 D2N COMP-2 VALUE -234560000000. DBG> This command searches for the next occurrence of the letter D in lines 40 to 50 of the module COBOLTEST. 4.DBG> SEARCH/NEXT module COBOLTEST 41: 02 D COMP-2 VALUE 222222.33. DBG> This command searches for the next occurrence of the letter D. The debugger assumes D to be the search string because D was the last one entered and no other search string was specified. 5.DBG> SEARCH 43 D module COBOLTEST 47: 02 DR0 COMP-2 VALUE 0.1. DBG> This command searches for the next occurrence (by default) of the letter D, starting with line 43.