®
IBM Software Group
Rational Developer for System z – v9.x
RDz Search Options
Jon Sayles – jsayles@us.ibm.com
IBM Trademarks and Copyrights
© Copyright IBM Corporation 2008 through 2015.
All rights reserved – including the right to use these materials for RDz instruction.
The information contained in these materials is provided for informational purposes only, and is
provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible
for any damages arising out of the use of, or otherwise related to, these materials. Nothing
contained in these materials is intended to, nor shall have the effect of, creating any warranties
or representations from IBM or its suppliers or licensors, or altering the terms and conditions of
the applicable license agreement governing the use of IBM software. References in these
materials to IBM products, programs, or services do not imply that they will be available in all
countries in which IBM operates.
This information is based on current IBM product plans and strategy, which are subject to change
by IBM without notice. Product release dates and/or capabilities referenced in these materials
may change at any time at IBM’s sole discretion based on market opportunities or other factors,
and are not intended to be a commitment to future product or feature availability in any way.
IBM, the IBM logo, the on-demand business logo, Rational, the Rational logo, and other IBM
Rational products and services are trademarks or registered trademarks of the International
Business Machines Corporation, in the United States, other countries or both. Other company,
product, or service names may be trademarks or service marks of others.
2
UNIT
The RDz Workbench
Topics:
 z/OS Remote Search
 Program Search
3
Remote z/OS Search
Using Search you can search
for wildcard strings
throughout an LPAR
(connection) across PDS
datasets with differing
high-level qualifiers, and
including offline and
migrated content
There are two different kinds
of search:
Search 
1.
 Default searching
 Flexible
 Many useful options for:


2.
Searching
Search results
Remote Indexed search

Effective for certain search
use cases

Covered later in this section
4
Customizing the Search Dialog
Out of the box, RDz’s Search Dialog displays every installed search option. You will not need
them all.
 Click Customize
 From the Search Page Selection
 Click Deselect All
 Check just those search options you want to see
 Click OK
 Left-click / Hold and drag the left-hand margin of the Search page to make it a thin Rectangle (see next slide)
5
Remote z/OS Search – Options in the Search View
 Compact U.I.
 Hyper-text linked Search Results
 Hover/Peek into Search Results
 Search specifically for:
Type of Dataset 
Member name pattern 
Search for text pattern 
 Text patterns within libraries
 Text patterns within sequential datasets
 EBCDIC (hex) values
 Specific library members
 Specific data sets:
 QSAM (sequential)
 PDS members with a wildcard name
pattern
What DSN or what selected
DSNs to search 
 Can Filter result set lines
 Optimize (buffer) search results
view build-out
 Search using Regular expressions
 Change "search for" criteria on-the-fly
 Cancel long-running searches
 Save Search results
 Save combine with update for
Search/Replace
 Leverage the name and Results view
for functionality
Searching Options
Note that, TSO/ISPF SuperC and SearchFor utilities do
not take into account Code Pages. RDz’s Remote z/OS
Search does (take Code Pages into account).
Searches for non-English characters (i.e. German
umlaut, Spanish inverted question and exclamation marks,
DBCS characters) are more accurate using RDz
6
Search Results
 Loads the source file, and positions
the current-line
 When the search
completes, a
new Remote
z/OS Search
view will appear
in Eclipse
 You can expand
the entries to see
individual source
lines that match
your search
criteria
 Double-Click a line
 Double-click a
line to download
and open the file
in the Content
Area
7
Search Result Set Filter – Logically "AND’ng“ Your Search Results
All search results for "PERFORM"
Client-Side Search result set filtering 
Show lines with PERFORM and EDIT
8
z/OS Remote Search Results view Preview
RDz provides an ability to peek at a few lines of code before downloading/opening the file that
contains statements/records that match your search pattern text
 This (preview ability) provides context around the found result line, and can save time and
machine resources
 You may not have to download file to find out if it contains what you need as per your
requirement – you can just peek at the surrounding lines/records
9
9
Note: Requires 8.5 Server
Sorting Search Results – on Last Modified
 Once your Search finishes, you can sort by any category
(column) in the results view.
Last Modified is one of the more popular sorts
Or Created
10
Saving Remote Search Queries (all versions) – 1 of 3
 You can save a Remote z/OS® Search query and run it from the Remote Systems view.
 Before you can save a search query, you must first run a remote z/OS search and have the search results
displayed in the Remote z/OS Search view. This option is limited to a single z/OS system under the following
conditions:
 You search for files using a resource name pattern and the file content search string is not specified.
 The search scope is for a single z/OS system. The scope can be an entire z/OS system or multiple
partitioned data sets on the same system.
 The search scope does not include z/OS projects or MVS™ subprojects.
Step 1. Execute a Search
11
Saving Remote Search Queries – 2 of 3
 In the Remote z/OS Search view, display the results of the search query you want to save. If you have done
more than one search, use the drop-down search history list to select the search query you want to save.
 Click the
icon to save the search query. This icon is enabled only if the search scope is limited to a
single z/OS system under the following conditions:
 You search for files using a resource name pattern and the file content search string is not specified
 The search scope is for a single z/OS system. The scope can be an entire z/OS system or multiple partitioned
data sets on the same system
 The search scope does not include z/OS projects or MVS™ subprojects
 The Add Query to Remote Systems View window opens.
 Type a name for the query and click OK. The search query is added to the
My Search Queries list under the MVS Files subsystem 
12
Saving Remote Search Queries – 3 of 3
 After you have saved a search query, you can do the following actions:
To run a saved query, select it in the Remote Systems view and click Run Query
from the pop-up menu.
To edit and run a saved query, select it in the Remote Systems view and click
Edit and Run from the pop-up menu.
This action opens the Remote z/OS Search window, which you can use to
change the search criteria and submit the search request.
 Note that in v9 and later the My Search Queries is renamed to:
My Favorites
13
Search in Options
 Two options for searching:
1. Search inside the DSNs organized by Filters
 Convenient for "selection-based" searching
 Can select multiple DSNs
2. Search in "Other contexts:"

Can type in any DSN and search
14
Optional Topic - RDz Search …vs… SRCHFOR (TSO/ISPF)

During one of my classes I got asked "Why use RDz's Search... Why not just use SRCHFOR?". So I compiled this list. And
although it's probably not complete - it paints a pretty clear picture of what RDz's Search can do that SRCHFOR does not:
1. Search against multiple libraries – and/or GDG datasets
2. Specify multiple search conditions - ability to logically AND or OR conditions
3. Filter the search results - on the client
4. Expand each found member and use the Search Results list to navigate directly to the line
that matched the search via hyper-link
5. Search across multiple LPARs
6. Filter at the member level (in your search, specify only certain member names)
7. Wave and reuse the Search Query
8. Sort by Last Modified
9. Search for Hex values – using the COBOL Editor
10. Compare found PDS members – directly from the Results list
11. Search results are compressed (no not-found PDS member names in the list)
12. Issue additional searches against initial search result (for compound search requirements)
13. Preview found-line-context, by hovering over the lines in Search results
14. Search against RDz “MVS File Filters”
15. Save off the PDS member names (only)
16. Invoke SRCHFOR and search JES Jobs using Menu Manager & REXX

Granted you might not have used the above techniques before - principally because SRCHFOR doesn't permit. But once you've
used one of these techniques - and it saves you time it will be hard to go back.
15
Optional Topic - z/OS Search Dialog – EBCDIC Hex/Binary Search
Ability to search for EBCDIC (hex/binary)
values
Utilize the same "regular
expression" search techniques
you learned for the Ctrl+F find
functionality within the LPEX and
COBOL editors
To search for Hex characters start
the Content string off with:
16
\x
Note: This feature requires 8.5 Server
Optional Topic - Search Results view toolbar options
 ‘Expand All’ and ‘Collapse All’ toolbar button
 Capability to customize table columns – order, show/hide, width
Expand/Collapse
‘Customize Table’ and
‘Preferences’ shortcut
added to View Menu
17
17
Optional Topic – Global change based on output of Search
 Sometimes you need to make a global change – and it would be nice to use
the “found” modules from an RDz Search
 It would also be nice to confine the changes you make into something like a
“sandbox” environment – in order to not affect Production
(or even Test  trending towards Production)
 To do this:
Issue Search
Copy the modules
Paste them into a
Local Workstation
Project Folder
Continued on next slide…
18
Optional Topic – Global change based on output of Search – 2 of 2
Right-click over the Folder you’ve copied the source files into and select:
Search > File Search
From File Search
 Enter your text
 Click Selected resources
 Click Replace…
From Replace Text Matches
Enter the replacement text
Click OK …or…
Click Preview > to verify each change
19
Preferences - z/OS Remote Search
Three input controls are configurable
Inputs are disabled if preview checkbox is unchecked
Note that the 8.5 Search
enhancements require
RDz 8.5 server
20
20
Search – Additional Use Cases
 From Remote Systems:
 Select and Search… for:
*AMOUNT* in:
 <HLQ>.TEST.ASM
 <HLQ>.TEST.BMS
 <HLQ>.TEST.COBOL
 Search and Save Search Query:
 Select and Search… for:




*PHARM* in:
<HLQ>.TEST.BMS
<HLQ>.TEST.COBOL
<HLQ>.TEST.COPYLIB
<HLQ>.TEST.ASM
 Save this search
 From Remote Systems Explorer,
Re-run (Double-click) your saved Search Query

21
Additional Use Cases – Remote Search with Regular Expressions
1. Using Search and Regular Expressions, find
out what COBOL programs in the libraries
could be affected by a change to the DB2
tables (use your programs or the RDzClass
code you copied up to your mainframe PDS)
Examples
WARD_DATA|HOSP_BED
2. Using Search and Regular Expressions, find
out what COBOL programs in a library would
be affected by a change to one or more
copybook members 
3. Using Search and Regular Expressions, find
out what batch JCL jobs in the JCL library
would be affected by a change to datasets
(you can search on the DD name of any part
of the qualified DSN) 
22
Additional Use Cases – More Complex Regular Expressions
1. Search for COMPUTE statements in any module inside of <HLQ>.TEST.COBOL
where the member name begins with: TR or BN.
Use the Regular Expression: (*TR.*|BN.*)
2. Right-click over any of your Datasets
and select Search
 Specify:
With name: C*
Content strings: DISP=OLD
 Other contexts: SYS1.PROCLIB
23
Additional Use Cases – Search for the latest generation in a GDG
1.
2.
3.
Select Sequential data set
Select Other contexts:
Type your file name in, and click Search
Sort the Datasets returned by
clicking on the Name column
24
Leveraging the File Lists Created by Remote Search
 The search results list contains dataset and member names - which be:
Copied/pasted (file transferred) to:
 Other LPARS – that you can set up as a connection in RSE, and to your workstation
Added to MVS SubProjects:
 MVS SubProjects are topics covered in another module of this course
Searched again:
 Issue a search within the results list - allowing you to AND multiple search patterns
Compared with – Visual source compare
25
Using Remote Search on Individual Members of a Library
 Remote Search is not limited to entire
libraries at-a-time
 Remote Search can be used to find
text patterns:
In individual programs
In selected programs
And both individual and selected programs
in the same or across multiple LPARs
26
Searching Through Sequential Datasets
 You can select one or more QSAM files, and search through them for
Content Strings
And filter results
27
z/OS Remote Search Results view – and SCM Libraries
If you use CA-Endevor or CA-Panvalet/CA-Librarian – or Serena Changeman
you can search through source files for content strings as follows:
CA Endevor:
•
Any 'Endevor target file' as written to by a Endevor processor
(normally a PDS/PDSe) can be searched via RDz Remote z/OS Search
• The internal Endevor file's such as the MCF, or BASE ELIBS can not
be searched due to the internal structure of these by Endevor.
CA Panvalet / CA Librarian:
• Search of these internal files is similar to CA Endevor.
• If the output or control files is a PDS/PDSe then RDz SEARCH is
available via Remote Search facility
• The internal Panvalet/Librarian files are VSAM, and can only be
searched using File Manager
Serena Changeman:
• Changeman keeps all source within PDS/PDSe's file so normal RDz
search available.
28
28
Searching Through MVS File Filters
 You can Filters to organize disparate DSNs – then Search through all of the
datasets in the Filters with one action (Filters are in the next course module)
29
Search vs. Remote Index Search
 Use Search as your default search for analysis and discovery
tasks:
 For "One-off" (unique) searches:
 When the libraries or member selection you're searching are unique combinations
 When the files you're searching are dynamic:
 The content within the members changes – and you need to search against the changed content
 When you wish to:




Save and reuse your Search Results
Utilize Regular Expressions for complex search requirements
Search freely across your LPAR (Remote Index Search is only available against datasets in a Filter)
Filter your results set (happens on the client, not in z/OS)
 Use Remote Index Search (covered in the Optional section of this module) only:
 When the libraries you're searching are static:
 The content within the members changes infrequently
 Good candidates are entities like: CORP.PROD.COBOL, CORP.PROD.COPYLIB
 When you wish to save MIPS searching against only static libraries:
 Searching through the created remote index is relatively inexpensive – compared to Search
 However, building the Remote Index is expensive – consider this carefully
 When you wish to format the results
 And when you DO NOT need to:
 Use Regular Expressions
 Save and reuse Search Results
 Search QSAM files
30
See slide notes for additional information on
Remote Index USS requirements
Advanced Topic - Remote Index Search – 1 of 3
There is another search mechanism available for RSE against
PDS datasets called a "Remote Index Search"
This search has two stages:
1. Create an index, from the text inside the file
 This creates a "Lucene index" (see slide notes)
 Index creation is relatively expensive
2.
1.
Search against the index

Can search against all members in the indexed PDS

Or members with names of a given pattern
 Searching the remote index is both fast and inexpensive
2a.
2b.
31
Advanced Topic - Remote Index Search – 2 of 3
Lucene index searches are sometimes faster than Remote Search. And you can still
double-click an entry to load the source into RDz and position your cursor

32
Advanced Topic - Remote Index Search – 3 of 3
Considerations:
Remote Index Search allows you to search
against all of the files in an entire Filter,
including:



Retrieved Data Sets
My Data Sets
Custom Filters
Consider the cost of indexing and searching
against a very large codebase
Retrieve Data Sets Lucene Index search is
done in using Java – so it will be faster
(and cheaper) if your z/OS has a zaap
processor installed
33
Advanced Topic - Remote Index Search –
Export Results – 1 of 2
Options for the Remote Index results:
Next/Previous – opens the results,
downloads the file and navigates from
found-result to result
Expand all/Collapse all – opens/closes
all detail search results (one-click)
Remove all/individual matches – from
the Results view
Select columns – from the report
Print
Export 
34
Advanced Topic - Remote Index Search – Export Results – 2 of 2
The exported
results create a
plain-text file,
which you can
copy into other
more useful
analysis
formats
(Excel, etc.)
2. Copy/Paste into Excel
1. Export creates 
35
Advanced Topic - New Remote Index Search Options
 Create Index now allows you to specify:
Location of the index datasets in z/OS Unix
 Note that Indexed builds can be shared on U.S.S.
– simply by specifying an Index Location that
your team has read access to
Standard Index type
 Takes up more space
 Faster search
Compact Index
 Takes up less space
 Slightly slower search
 Does not allow for line-positioning
of found text within a file
36
UNIT
RDz for ISPF Developers
Topics:
 Code Search – The Find and Replace Dialog
37
Find/Replace Dialog – 1 of 4 – Alternative Searching Functionality
Besides the ISPF Find/Change
command, there are other
ways to search and replace
text within a file
From anywhere inside your
source, press:
Ctrl+F …or… Ctrl+f
Brings up the following dialog
with find options 
1. Enter Find and/or
Replace value
2. Check one or more
search refinement
options 
3. Press a Find button
Find option checkboxes:







Case sensitive – case sensitive search
Whole word – finds your text delimited by spaces or dashes
Regular expression – powerful search meta-language – for complex search
Wrap – if starting mid-way through source, continue find from the top
Select found text – shows and selects found element
Peek: Shows specified number of lines of source after the found element
Restrict search to columns – search between start and end columns only
(covered on the next slide)
38
See Notes
Find/Replace Dialog – 2 of 4 – Options
 Next
– Find forward in the source
– Does not find text inside copy or include files
– Ctrl+n – finds next
 Previous
– Find upwards (back) in the source from your current cursor position
 All
– Finds all lines within the source
– Additionally will exclude or filter all source not matching your Find string

Provides an intermediate set of lines to AND your search with
– Press Ctrl+W to "show all" excluded lines …and/or to close the find dialog box
– Clicking anywhere in the main body of your source file also closes the Find dialog
– Click the pluses in the left-hand border to show filtered source
 Replace
– Adheres to COBOL columns
– If replace would push text past column 73 you will receive a warning
 Replace all
– Changes "found" to replacement of values throughout file
 Note that whatever you enter the Find/Replace dialog persists
This can be useful to do repeated searches within multiple files
39
Find/Replace Dialog – 3 of 4 – "ANDing" Search Results Sets
When you've completed a "Find ALL" search, the resulting set of statements can be searched
through, providing a means of "AND" filtering – useful for complex search requirements
Process:
• Perform an initial Find … ALL
• Find any other string:
• Press Next or Previous
(not All)
40
Find/Replace Dialog – 4 of 4 – Find Dialog Preferences
From: Window >
Preferences >
LPEX Editor >
Find Text
… you can set workspace preferences
for the Find Replace dialog.
 Consider: (for COBOL)
 Incremental find dialog
 Column restricted search
8  73
41
Regular Expressions in Ctrl+F (Find)
 Open WARDRPT.cbl
 Press Ctrl+F
 To open the Find/Replace dialog
 Check  Regular expression
 Enter the following find expression:
row-sub|records-written
 Click: All
Note that the single pipe separator | is a logical "OR" operator
To logically “AND” multiple search criteria separate them with: .*
See slide notes for
additional Regular
Expression ideas
42
Data Flow Analysis – For Maintenance and Production Support Tasks


Data Flow research is a complex analysis process that involves iterative
searching and building of mental "dependency maps" for variables that are
modified or referenced through statements within one or more programs
On the mainframe, you either:
 Utilize listing files/XREF entries – or –
 Using ISPF you access option 3.4, or =3.14 and issue a series of manual text FIND
operations – saving or writing down interim results.

This is:
 Typing-intensive
 Error-prone
 With lots of time spent loading programs into the editor in split-screen, etc.

Using RDz you:



This is:



Find your starting Search variable
Pin the Search View and double-click each found-reference
Not typing-intensive
Less error-prone
With RDz, all Search results are:


Fixed
Hyperlinked – available from a mouse click
43
RDz's Data Flow Analysis Techniques
Many categories of project requirements necessitate that you track the order in which
data values propagate within a program and across an application. This is
commonly referred to as "Data Flow Analysis"
While there is no single declarative function in RDz to address Data Flow Analysis,
there are techniques that exploit the advanced Eclipse functionality in the tooling.
RDz also provides a "Data Elements" view – that presents the complete list of
variables in a "Compilation Unit" – which can be used as an organizing interface
for your data analysis tasks.
Finally, it should be noted that RAA (Rational Asset Analyzer) does offer a single
"Impact Analysis" function that provides Data Flow Analysis
Occurrences in
Compilation
Ctrl+F
Search
ISPF Command
Line Find
RAA
Hyperlinked references –
synchronized with editor
Y
Y
N
Y
Color-coded "Modified" vs.
"Referenced" results
Y
N
N
Y
Use of Regular Expressions
in Search
Y
Y
N
Y
Automated Impact Analysis
N
N
N
Y
Multi-window views
(Analysis "Dashboard")
Y
Y
N
N
Search using Filtering
Excludes with lines/columns
N
Y
Y
N
44
Data Flow Analysis Using RDz
Technique steps:
From the starting point (a variable):
1. Select the field and search (using Occurrences in
Compilation Unit) for all instances of the field throughout
the source code
2. "Pin" the search results
3. Double-click each result line – which co-locates the line
in the editor
4. Analyze the statements operation
5. If another variable is indicated as being part of the
Data Flow task scope, return to Step 1 and search for
the next variable
45
Occurrences in Compilation Unit – Analysis Tools
If you are analyzing,
researching a data
problem – like
verifying Data Flow
or doing Impact
Analysis, or if you
just need to quickly
lookup the
occurrences of a
variable within your
program you can:
1. Select the variable
2. Right-click and select:
Occurrences in
Compilation Unit
This opens a Search
view with all
occurrences of that
variable:
1. Hyperlinked back to
the source line of the
reference
2. Color-coded –
showing the variable
reference in statements
that
- Declare or Modify a
variable in gold
- And all other variable
references in
statements in gray
46
Occurrences in Compilation Unit – continued
You can use Occurrences in Compilation Unit effectively to investigate data movement, analyze the impact of a
change, research the cause of a data-specific ABEND (like an 0C7 or 0C4), etc.
Here's an example showing Search on a variable, with the Search Results view moved, and "pinned" with
additional searches for Occurrences in Compilation Unit exposed through RDz
47
Concept – Pin the Occurrences in Compilation Unit - Search Results
Open a program in the editor

1.
From the command line, type: F <variable-name> and press <Enter>
In the Editor source, Double-click (to select) <variable-name>
2.
From the Context Menu, select Occurrences
in Compilation Unit
This will launch a search for the variable throughout your program, and saves the search
results in a Search Results view
3.
From the Search View, click: Pin the Search View – This persists your results view, even when
you launch additional searches
48
Concept – Create a Data Analysis "Dashboard“ From Multiple Search Results
You can move (Drag & Drop)
the Search results views to
different Workbench areas
Or you can Detach the views
for optimized use of "screen
real estate" in your analysis
Here's an example of this
with an Assembler program
49
Review - Data Flow Analysis – Using Ctrl+F Regular Expressions
You can do Data Flow Analysis using:
• Ctrl+F
• Regular
Expressions – to OR multiple
variable searches
• Peek (set at 1 or 2) to see rows surrounding
the found lines
Find String with text separated by |
Clicking
50
All excludes rows
Show Expanded Source – RDz v9.1.1 and higher analysis feature
Expands all COBOL Copybooks and PL/I Include statements inline (within) the program source. And it opens the
expanded source file in Browse mode. This can simplify full-program-text analysis.

Note that EXEC SQL INCLUDE xxxx statements are not expanded (although Open Copy member works with these statements)
Expanded source
Program in edit
51
Data Flow Analysis – Review

Data Flow analysis is an iterative complex process, that involves
expanding the scope of your search as new variables in the data flow are
discovered

On the mainframe, you either:
 Utilize listing files/SX-REF entries – or
 Using ISPF you access option 3.4, or =3.14 and issue a series of manual text
FIND operations – saving or writing down interim results. This is:



Typing-intensive and error-prone
With lots of time spent loading programs into the editor in split-screen, etc.
Using RDz you:
1. Find your starting Search variable
2. Pin the Search View and double-click each reference
 There are static analysis tools from IBM that are dedicated to providing
this information, through ultra-quick and simple techniques
(ask your instructor about Rational Asset Analyzer)
52
Optional Topics and Workshops For This Section
 If you have time, and are comfortable with the material just
covered, feel free to read through the Optional Topic slides –
and/or try out the techniques shown using RDz and the sample
programs.
 The development techniques covered in these slides can make
your standard z/OS Maintenance, Production Support and
Development tasks much easier, and make you more
productive.
 So at some point – perhaps after class consider returning to
these optional topics to build out your RDz skills.
 Also – if you have access to RDz installed on your mainframe
and time permits, please try out the techniques shown using
your own application source.
53
Optional Topic – Using Regular Expressions to Search for Hex Values
You can use regular expressions to search for EBCDIC Hexadecimal Values,
embedded in a program or in copybook source:
Regular Expressions are an ASCII search mechanism
Use ASCII/EBCDIC comparison charts to map to the EBCDIC value you're
looking for
 ASCII - 1a
 EBCDIC - 3f
Regular Expression: [\x1a]
See Slide Notes for URLs to useful
Regular Expression tutorials online
Hex Edit of line 
ASCII 
EBCDIC 
A typical conversion table URL: http://www.flounder.com/ebcdictoascii1.htm
54
Optional Topic – Using Regular Expressions to change all within columns
You can use regular expressions to substitute for ISPF picture string editing.
Example – change all characters in columns 73  80 to blanks (spaces)
 Regular Expression
 Find: Type a period .
Start column: 73 End column: 80
 Replace: Type a space
Note that you could also use
the ISPF Picture string
command line command to do
this:
55
Optional Topic – Regular Expressions to search for "any hex chars in a file"
You can use Regular Expressions to find any EBCDIC (hex) data in source files:
 Regular Expression
Type this in the Find area: [\x00-\x1F]
Note – the COBOL Editor
(see Appendix B) can be
use to effectively search
for specific Hex (binary)
values in EBCDIC.
The LPEX editor's regular
expression search – by
default – uses ASCII.
56
Regular Expressions Can Be Used in All Search Contexts
 You can use Regular Expressions to search for text:
In a program
Throughout all programs in a project
On the mainframe:
 Across all members n a PDS
 Across multiple PDSs of different types: .COBOL, .BMS, .JCL, etc.
57
Finding Related Text on Adjacent Lines
 Sometimes what you're looking for is broken across adjacent
lines. Example: Find MOVE and a specific variable when the variable is not
on the same line as the MOVE verb
 The pattern for search across lines is
ABC[\s\S]*?DEF
 In order to search across lines you
will need to use the Search menu
(similar to the previous example)
 Try this:
Open TRTMNT.cbl
From the Search menu
Select: Search…
Enter: move[\s\S]*?actual-val
Enter: TRTMNT.cbl in the
File name patterns edit box
Press Search
58
Regular Expressions – Used to Support ISPF Find "Picture Strings"
ISPF Editor
LPEX Editor
Simple String
Y
Previous String
Find Previous / F5
Delimited String
Y
Text string
Y
Picture Strings – special characters
Y – with regular expressions
^
Ctlr+F,  Regular Expression,
P'-' – any non-blank character
Ctlr+F,  Regular Expression,
P'.' – any non-displayable character
Ctlr+F,  Regular Expression,
P'#' – any numeric character
Ctlr+F,  Regular Expression,
P'-' – any non-numeric character
Ctlr+F,  Regular Expression,
P'@' – any alphabetic character
Ctlr+F,  Regular Expression,
P'<' – any lower-case character
Ctlr+F,  Regular Expression,
P'>' any upper-case alphabetic character
Ctlr+F,  Regular Expression,
P'$' – any special character (not alphanumeric)
Ctlr+F,  Regular Expression,
59
Dot, any single
character
\
logical NOT
P'=' – any character
Ctrl+F
.
.
special Expression
\x
Hexadecimal
[^\x20]
[^\x20-\x7E]
[0-9]
[^0-9\x20]
[A-Za-z]
[a-z]
[A-Z]
[^A-Za-z0-9]
(Optional Topic) Find/Replace Dialog – Regular Expressions
The Regular Expression meta-language is based on a few simple constructs
60
Find/Replace With Regular Expressions
 Expression
 Load test1.cbl into the editor
 Check Regular expression
Enter the following Regular expressions, and click All
after each:
Expression
What it does
[0-9]
All numeric characters
[a-z]
All alphabetic characters
[a-z]
Check:  Case sensitive in the dialog, and reissue this regular expression.
Then un-check Case sensitive before continuing
DL.C
Find all variables with "DL" – any character – then the letter C
[^\s]
Find all characters except for white space (blanks: \s )
[^a-z]
Non-alphabetic characters
[^A-Z\x20]
Non-alphabetic characters and no white spaces
[^A-Z0-9\x20]
Non-alphanumeric characters and no white spaces
[^A-Z0-9\x20-]
Non-alphanumeric characters, no white spaces, no dashes
[^A-Z0-9\x20\(\)..-]
Non-alphanumeric characters, no parenthesis and no white spaces
[^*A-Z0-9\x20\(\)..-]
Non-alphanumeric characters, no parenthesis, no asterisks, no white spaces
.*(data)
Find all variables that end in "data"
PIC .9|PIC 9\(
Find all numeric variable declarations
61
See Notes
Optional Topic – Another Useful Search
Mechanism – Persist Find Results
 Using the Search menu, you can
search on a variable (or any partial
selected text) in a program with:
Search
Text > File
 The results persist and are hyperlinked – for
easy navigation, and can be:
Copied/pasted to a requirements document
Changed
Replace Selected…
Replace All…
Searched Again
to provide the
capability of
AND-ing
multiple search
patterns
62
Optional Topic – Highlight Found Text
 Some ISPF developers prefer to
highlight all found text occurrences.
 This can be accomplished from:
Preferences > LPEX Editor >
System z LPEX Editor > Find Text
 Use Ctrl+F (Find) to search and
highlight text in your source
To remove highlighted entries,
type: clearMatches
on the editor command line
63
ISPF - Find All (Exclude) Search Within File
Common ISPF editing technique:
- Exclude various source lines
- find (within) excluded lines
- Used extensively on giant
production source files
Command ====> F (or C) 'xxx' X
To perform this using RDz
use the same command
line syntax format:
1. Exclude lines
2. Then type: F <xxxx> ALL
X
This will limit the scope of the
search to only the excluded
source lines
Note that ALL operand is not required
64
ISPF - Find All (Not Exclude) Search
Another common ISPF technique
- Exclude various source lines
- Find within (not) excluded lines
Command ====> F (or C) 'xxx' NX
To perform this using RDz use the same
command line syntax format:
1. Exclude lines
2. Then type: F <xxxx> ALL
NX
This will limit the scope of the search to only
the NOT excluded source lines
Note that the ALL operand is not required
65
Optional Topic – Supporting the
ISPF "ONLY" Command
ISPF provides a "one-command"
exclude/find all – "ONLY"
ISPF "ONLY" does the following:
Top ; x all ; F 'xxx' all
The RDz ONLY emulation is:
1. Select the variable (or text pattern)
2. Right-click > Selected > Filter selection
Note that you can create a custom "User Key Action" – for filterSelection – so that ONLY is
more closely emulated.
 Preferences > LPEX Editor > User Key Actions
 Define a custom Key for filterSelection
 In this example, Alt+F9 (a-f9) is set to: filterSelection
66
Another Example of Text Filtering – Selected > Filter selection
 Double-click to select a:
 COBOL Keyword
 Literal
 Variable
 Label (Paragraph or Section name)
 Right-Click
Selected
 Filter selection


Note the plus signs
Expand/Collapse filtered code
Press Ctrl/W to un-filter and return to
normal program view
67
Show In > Data Elements
Along with Occurrences in Compilation
Unit, you can get a global (Data
Division) – wide list of your
variables and paragraphs with:
Show In > Data Elements
This creates a sort-able list of all the
data elements with several actions
against them:
•
•
•
•
•
Hyper-link to any variable
declaration
Re-sort the list by various
columns
Filter the list:
•
By data element name
•
Remote paragraph/section
labels
Remove columns
Open and mark occurrences
throughout the source
(prior topic)
68
Sorting the Data Elements view
Can sort/re-sort by any column in the view
Useful for:
•
Categorizing variables  sort by Declared In
•
Organizing by COBOL Group  sort by Top-Level Item
•
Sorting by numeric …vs… character data  sort by Declaration
•
Business Rules candidates  sort by References
69
Finding unused variables
To find unused variables in a program
1.
2.
3.
4.
5.
6.
Filter the View (small downward pointing triangle)
 Hide program labels
Sort by References (lowest to highest) – zero references are your candidate unused list
Look at the Declared In column – candidates for removal are declared in your .cbl program
Look at the Item type – for Data items (not indexes)
Look at the Level – Level 1 are Group fields, that will need further examination
When in doubt, right-click the variable and select: Occurrences in Compilation Unit for a detailed view of field usage
70
Filtering the Data Elements view
Filter view results horizontally
search by data element name
or text pattern
Filter out or add back into the view results paragraphs and sections, and FILLER ("unnamed items")
by clicking the small downward-pointing triangle
on the far-right corner of the view
Filter out Columns
Acts as an on/off toggle
to add/remove columns
from view
71
Topic Summary
After having completed this topic, you should now be able to:
Search through your source files on z/OS
Use Regular Expressions for complex search requirements
Filter search results – for AND'd search requirements
Understand the difference between Index and regular (TSO) search
Export Index search results to an external format
72
Backup Slides
73
RSE Component Overview
Source: "Developer for System z & WLM", Onno Van Den Troost
See slide notes…
74
See Notes