Home > Uncategorized > ISPF Edit ‘Count’ macro

ISPF Edit ‘Count’ macro

Just a little macro I put together to count the number of occurrences of a string in a file when editing it.

/* rexx */ 
ADDRESS ISREDIT "MACRO (text)" 
 
if text = '' then do 
 say 'Nothing to search for. Enter text to search for ith cmd' 
 return 0 
 end 
 
address isredit "find all "text 
address isredit "(num,lines) = FIND_COUNTS" 
num=num+0 
lines=lines+0 
s='' 
if num > 1 then s='s' 
ls='' 
if lines > 1 then ls='s' 
on='' 
if lines > 0 then on = ' on 'lines' line'ls 
say 'Found 'num' occurance's' of 'text||on

To run it, just type count followed by the string to search for, and any other parameters such as the column number on the command line when in edit and press enter. E.G.

COUNT ‘some string’

or

COUNT NAME 1

 

 

 

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: