Searching a remote z/OS system

You can search a z/OS® system for file names or for files that contain a search string.

Before you begin

Connect to a remote system.

The search function can return search results incrementally so that you can begin working with search results before all results are returned. This function is controlled by a setting in the Remote z/OS Search preference page. To open this page, click Preferences at the bottom of the Remote z/OS Search window. For more information about controlling how frequently search results are updated, see Setting preferences for Remote z/OS Search.

About this task

The Remote z/OS Search window provides various options for searching z/OS systems. The following procedure provides basic search instructions. For more information about the various search options, see Setting other search options.

To search for strings in a specific data set or data set member, you can also use the Remote z/OS File Search window. This window generates a batch ISPF search-for request (ISPF option 3.14) and can be a more efficient way to search in large data sets. For more information about the Remote z/OS File Search window, see Searching remote z/OS files.

Tip: The Remote z/OS Search window retains the following search options that are used for a previous search, if you do not select a different object for the search:
  • The options in the Search for area
  • The With name field
  • The Content strings field
If you select a new object for a search, the search function prepares a new search and clears these options.
The following search options are always retained:
  • The Regular expression check boxes in the Search for area
  • Settings in the Search result options area
  • Settings in the Content string options area
  • The setting of the Search Options push button (expanded or collapsed)

Procedure

To search for a file or for file content on a z/OS system:

  1. To open the Remote z/OS Search window:
    • Click Search Search icon on the toolbar.
    • Press Ctrl+H.
    • Select Search > Search from the menu bar.
    • In the Remote Systems view or z/OS Projects view, right-click the file or container to search, and then select Search from the menu.
    • In the COBOL Editor, PL/I Editor, or z Systems® LPEX Editor, highlight a string and press Ctrl+H.
  2. Click the Remote z/OS Search tab.
    Remote z/OS Search is the default search view when you initiate a search from these views or editors:
    • Remote Systems view
    • z/OS Projects view
    • Remote System Details view
    • COBOL Editor
    • PL/I Editor
    • JCL Editor
    • z Systems LPEX Editor
    Note: A system administrator can change the default search view for these views and editors.
  3. Choose the type of file you are searching for:
    • Data set member: Select this option to search for a data set member.
    • Sequential data set: Select this option to search for a sequential data set, VSAM data set, or generation data set.
    • Partitioned data set: Select this option to search for a partitioned data set or generation data group.
  4. Optional: In the With name field, type the file name to search for.
    This field is optional when you are searching for file contents rather than a file name. If the Regular expression check box is not selected, you can use wildcard characters in the With name field. Valid characters include * to match any string and ? to match a single character. Wildcard characters are not allowed in a high-level qualifier.
    Important: To use the ? wildcard character, both the client and server must be version 9.0.1 or later. For examples of using the ? wildcard character, see Including the ? character in a content string search
  5. Optional: In the Content strings field, type the text to search for.
    To search for a file name, leave this field blank (or type * in the field). To search within a file, you must specify a content string in this field. You can use wildcard and escape characters in the Content strings field. Valid characters include * to match any string, ? to match any character, and \ to specify an escape character for these literals: * ? or \. For an example of constructing an AND search query, see Constructing an AND search query.
    Note: The Content strings field is not available for Partitioned data set searches.
  6. Optional: Select the Regular expression check box to enter a regular expression for the With name or Content strings field.
    You can use the \xhh escape sequence in the Content strings field to search for hexadecimal content in a remote z/OS file. For more information about searching for hexadecimal content, see the related topics. For the meaning of * and ? in regular expressions, see Class Pattern. For examples of constructing a regular expression search, see Constructing a regular expression search.
  7. Click Search.

Results

The search window closes and the Remote z/OS Search view opens, listing the search results. A search can return two types of results:
  • If you type a string in the With name field and leave the Content strings field empty, then the search returns a list of data set or member names as the search result.
  • If you type a string in the Content strings field, then the search returns a list of content strings as the search result.
You can double-click files that are listed in this view to open them in the editor. If you request a search for content strings within files, you can expand the files that are listed in this view by clicking + next to their names. The lines that match the specified search string are listed beneath these files. You can double-click a line number to open the corresponding file and position the cursor at that line. For more information about working with search results, see Working with search results.

Constructing an AND search query

Example

You can use the Remote z/OS Search window to run an AND search query:
  1. Open the Remote z/OS Search window.
  2. In the Content strings field, type a search string with the following syntax:
     .*<literal1>.+<literal2>
    To find all lines in a program that contain the strings IF and WS-PHARM, for example, type the following search string:
    .*IF.+WS-PHARM

Including the ? character in a content string search

Example

You can include the ? wildcard character in the Content string field of the search window. This character returns different results with the Regular expression option on (selected) or off (cleared).

Table 1. Results of ? wildcard characters in content string searches
Field name Regular expression option Use to search for Sample search string Matching results
Content string On Search for a character that occurs once or not at all in the position preceding the ? wildcard character. VARA?B The search in a COBOL program that contains the following variable declarations:
  • VARAA
  • VARAAB
  • VARAB
  • VARBA
  • VARAC
  • ABCVARABA
Returns matches for the variables VARAB, VARBA, ABCVARABA, because each of these strings contains VAR + A[0 or 1 time] + B.
Content string Off Search for any single character in the position of the ? wildcard character. VARA?B The search in a COBOL program that contains the following variable declarations:
  • VARAA
  • VARAAB
  • VARAB
  • VARBA
  • VARAC
  • ABCVARABA
Returns a match only for the variable VARAAB, because the search string matches only VAR + A + [any single character] + B.

Constructing a regular expression search

Example

You can perform a regular expression search using either the With name field or the Content string field. Regular expression searches in these fields function differently.
With name
A regular expression search in the With name field calls the regular expression engine searching for exact matches. The search scope for this type of search is member names (that is, you cannot use it to search data set names). The following two examples illustrate how a regular expression search functions with this list of member names:
  • COBOLTST
  • CBLTST
  • ACOBTST
  1. The search pattern COB returns no results because no member name is exactly COB.
  2. The search pattern *COB* returns all member names except CBLTST.
Content string
A regular expression search in the Content string field calls the regular expression engine searching for any match of the search string in the content of members. Given the same list of member names, the following regular expression searches in the Content string field return these results:
  1. The search pattern COB returns all member names except CBLTST because the search engine is looking for any instance of COB.
  2. The search pattern *COB* also returns all member names except CBLTST.