Visual Studio Find with Match Whole Word option fails when searching for COBOL data items

Visual Studio Find with Match Whole Word option fails when searching for COBOL data items

Problem:

Customer is using Visual COBOL for Visual Studio 2010 2.1 and is using the Find option to search for the string "CUST".

He has the following data items defined in his program:

01 CUST                     PIC X(30).
01 CUST-CONTACT  PIC X(30).
01 CUST-COMPANY PIC X(30).

He is using the match whole word option and was expecting it to return only the references to CUST and not to the other data items with CUST as part of the name.

Is there a way of returning only references to the actual CUST data item?

Resolution:

This is a problem because the word search in Visual Studio knows nothing about COBOL identifiers and that the hyphen is treated as a word separator and not as part of the identifier for the search.

You can get the desired result by checking the Use box at the bottom of the dialog and selecting Regular Expressions and then using the search:

CUST~(-)

This says to search for all matches of CUST that do not have a hyphen following.

After you change the option to Regular Expressions an Expression Builder option appears as an arrow to the right of the search field. If you click this you will get a list of regular expression characters and you can click the option to list all characters to bring you to the Help on this subject.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-05-30 11:15
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.