MainframeSupports
tip week 35/2019:

Once I wrote a tip about regular expressions in the ISPF EDIT/VIEW FIND command. In this tip I explicitly assume that you know about using picture strings in FIND. But I have now realised that I should use a little more time on this subject. Especially because picture strings also works for BROWSE, which regular expressions do not.

The most well-known picture string is probably P'.' as ISPF EDIT/VIEW suggests you use this string to find non-displayable characters when you open a dataset or member containing such characters. In a picture string you can use a number of special characters to represent a whole class of characters. The most comprehensive class is = which covers all characters. I sometime use FIND P'=' ALL to count the number of characters in a VB dataset. It does not give any meaning to use it in a FB dataset as the number of characters always is LRECL * number of lines.

The next class of characters is ¬ which covers all non-blank characters. I often use the command CHANGE P'¬' ' ' ALL from-pos to-pos to space out parts of a dataset/member. I only use FIND P'.' when non-displayable characters pops up in a dataset/member where such characters should not occur.

More advanced usages are the special characters representing alfabetic characters, numeric characters and special characters respectively @, # and -, if you work on an installation using an english EBCDIC setup. If you are in doubt about these characters you can always do the following: 1. Type in FIND in the command field without parameters, 2. Press Enter, 3. Press HELP (F1) twice, 4. Choose item 3. and now you are presented with a list and description of the different special characters in picture strings.

Recently I needed to find all the lines in a dataset containing a dataset name using a D99 qualifier, for instance MYUSER.D17.SOMEDATA. I used FIND P'-D##-' for the task. - represents the dots, D represents D, as all alphanumeric characters represent themselves, and # represents the two digits. Another great thing about picture strings is that they can be used in CHANGE commands. Assume I would like to replace D with X in the above qualifier without changing the digits or the dots. I can do this using CHANGE P'-D##-' P'=X===' ALL and here the strength of = as a class is clearly demonstrated. Picture strings is a strong tool which I hope you will enjoy in the future.

Previous tip in english        Forrige danske tip        Tip list