Tuesday, June 18, 2013

Case Sensitive search

Find command that we have in mainframes is not a case sensitive search.

F ’FindMe’ will do a case insensitive search

But we have many scenarios wherein we need to search based on case, we can use the below command for the same -

F C’FindMe’ will do a case sensitive search

Search string which is not suffix or prefix of another word

Many a times we need to find the count of a particular word in a file, but this word can also be a prefix or suffix to another word. In order to find the word as a whole,

F 'STRING' WORD;

Here we will get only the occurences of the word 'STRING' in the file or code and no other words like 'UNSTRING' or 'STRINGS'

Only the lines which contain a particular string

If we need to see only the lines which have a particular string, then we can use the command

X ALL; F 'STRING' ALL

This command is especially useful when we need to review standards in a cobol program.

For example, if we need to check that "TO" clause is at a particular position -

X ALL; F 'TO' ALL