home about us   contact us
 
   







 


Chicago-Soft
ATTN: TSO Times
One Maple Street
Hanover, NH 03755
(603) 643-4002
information
@tsotimes.com

 

Quick Tip - SRCHFOR Exec

by Philip Allison

While working on a certain project, I had a serious need for a PDS scan facility while in ISPF edit or in an ISPF 3.4 dataset list. Sometimes I find it easier to scan libraries from a dataset list rather than invoke ISPF 3.14 for each library I have in mind. The SRCHFOR exec is an edit macro that you can use if you're editing a member and still wish to scan the entire library for a character string or wish to scan multiple libraries. This exec requires an ISPF skeleton to pass parameter data to the search program (ISRSUPC). The name of the skeleton I've used is also called SRCHFOR.

The SRCHFOR exec can be invoked in four ways.

Two from ISPF Edit of a Member:
1. Go to the command line and type in SRCHFOR. You will be prompted for the character string you wish to scan the entire library for. Do NOT use quotes since the exec will insert them into the character string for you.
2. Go to the command line and type in SRCHFOR XXXX, where XXXX is the character string you wish to scan for.
Two are from ISPF 3.4:
1. From the dataset type in SRCHFOR to the left of the dataset name. You will be prompted for the character string you wish to scan the library for.
2. From the dataset list type in SRCHFOR to the left of the dataset name followed by a slash (/), followed by the character string you are looking for. With the ISPF 3.4 option you can stack multiple searches within the dataset list by using the equal (=) sign to the left of each subsequent dataset name.

All output from the search is written to the terminal. This exec can be modified to route the output to a dataset name if you like.

Download this exec in text format (SP96QT2-SRCH.TXT)
/* Invoke superc searchall for a character string wile in EDIT or 
in ISPF 3.4. This exec will scan an entire PDS while in ISPF EDIT 
for a single character string. It can also be invoked in ISPF 3.4. 
For example, in ISPF EDIT W NO ARGUMENT: SRCHFOR (This will prompt 
you for the character to be searched). In ISPF EDIT WITH ARGUMENT: 
SRCHFOR JOB (This will search the PDS for the char string "job"). 
In ISPF 3.4 W NO ARGUMENT: SRCHFOR (This will prompt you for the 
character to be searched). In ISPF 3.4 WITH ARGUMENT: SRCHFOR / 
JOB (This will search the PDS for the char string "job"). The 
string must be input after the slash. This EXEC uses a skeleton 
called SRCHFOR which must be concat'd in the ISPSLIB DD of your 
TSO session./*

Address ISPEXEc "control errors return"
X=MSG("OFF")
SRCHSTR = " "
"ISREDIT MACRO (SRCHSTR)"
IF RC = 0 THEN ADDRESS ISPEXEC "ISREDIT (DSN) = DATASET"
ELSE
  DO
	ARG DSN SRCHSTR
	L1 = LENGTH(DSN)
	DSN = SUBSTR(DSN,2,L1-2)
  END

IF SRCHSTR = " " THEN
 DO
	SAY "ENTER STRING AND I WILL INSERT THE QUOTES FOR YOU"
	PULL SRCHSTR
 END
L2 = LENGTH(SRCHSTR) + 1
SRCHSTR = INSERT("'",SRCHSTR)
SRCHSTR = INSERT("'",SRCHSTR,L2)
SAY "SEARCH STRING "SRCHSTR "WILL BE USED"

ADDRESS TSO "FREE F(NEWDD,SYSIN,OUTDD)"
ADDRESS ISPEXEC "FTOPEN TEMP"
ADDRESS ISPEXEC "FTINCL SRCHFOR"
ADDRESS ISPEXEC "FTCLOSE"
ADDRESS ISPEXEC "VGET (ZTEMPF)"
ADDRESS TSO "ALLOC F(SYSIN) DA('"ZTEMPF"') SHR"
ADDRESS TSO "ALLOC F(NEWDD) DSNAME('"DSN"') SHR"
ADDRESS TSO "ALLOC F(OUTDD) DSNAME(*)"
ADDRESS ISPEXEC "SELECT PGM(ISRSUPC) PARM('L SRCHCMP CKPACKL ANYC')"
SELECT
  WHEN RC = 0 THEN
	DO
	SAY "THERE WERE NO HITS FOR ANY OF THE SEARCH STRINGS YOU SELECTED"
	END
  WHEN RC = 1 THEN RETURN    /* RC 1 INDICATES RECORD FOUND */
  OTHERWISE
	SAY " ERROR INVOKING SUPERC SRCHFOR...RETURN CODE " RC
END
EXIT

SRCHFOR &SRCHSTR

Philip Allison, Alltel Information Services, Inc., Little Rock, Arkansas




The TSO Times is back by popular demand!
Register now for your FREE subscription









 

Chicago-Soft, LTD
ISPF Tools & Toys
MVS Help Board
Lionel Dyck's Tools
IBM ISPF Page
Tom Brennan's Vista tn3270 Page
Mark Zelden's MVS Utilities


 


 

home · current articles · archives · forums ·
· subscribe · about us · contact us · links