I see there are plenty of excellent programs others have written that can
 
be used to address the problem.  Thought I'd throw in my two cents, since
 I 
was annoyed by the same problem many years ago.

I wrote an XEDIT macro, SELUTIL ("select" utility) that was intended sole
ly 
for manipulating the selection levels of lines directly, to be combined 

with other tools.  You could use it to examine lines with selection level
s 
from d1 through d2 and change their selection level to s1 if they contain
ed 
the target loctarg, also changing seltarg adjacent lines (perhaps to yet 

another selection level), optionally changing the lines between the two 

targets to yet another selection level.  A sequence of SELUTIL commands 

could do the sort of thing you want, or could be put into another macro. 
 
To see 3 lines before and 4 lines after the CATALOG line, you could use:

selutil 0 * 2 /CATALOG/ -4 1
selutil 0 * 2 /CATALOG/  5 3

The first command examines all lines in the file (selection levels 0 
through *), changes the level to 2 for all lines that "locate /CATALOG/" 

finds, and changes the level to 1 for the preceding 3 lines.  (It says -4
 
instead of -3 because the second target line, 4 lines up, is not changed,
 
just the intervening lines.  There is also syntax available for giving th
e 
second target line yet another selection level.)   Similarly, the second 

command changes the level to 3 for the following 4 lines.

So, if you then SET DISPLAY 1 3, you will see all the lines you want.  If
 
you SET DISPLAY 2 2, you will see only the CATALOG lines.  If you SET 
DISPLAY 1 2, you will see the CATALOG lines and the 3 lines preceding eac
h 
one, etc.

Someone once saw it on VMSHARE and asked for permission to include it in 
a 
book.  I never did get a copy of the book, but I have the code if anyone 

wants it.  It is also still available in NOTE SELUTIL in the VMSHARE 
ARCHIVES.

Reply via email to