IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Search for a string in a PS from another PS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Fri Apr 08, 2005 7:26 pm
Reply with quote

Hi ,

I have a PS which contains the various another PS files DSN as its data.
Now i have a string , i want to know that how can i search this string in the PS files which are defined in the first PS file.

The jcl should first open the first ps then it will get the another PS name and then it should open that PS and then search in that.

Looking forward for your response.

Regards,

Vinit
Back to top
View user's profile Send private message
ranjit_bh

New User


Joined: 06 Apr 2005
Posts: 7

PostPosted: Fri Apr 08, 2005 10:48 pm
Reply with quote

Hi,
If you are willing to rexx then the following rexx routine and macro combination might be helpful.
ROUTINE
/*rexx*/
IPFILE = 'your input file'
address TSO "ALLOC FI(Din) DA('"IPFILE"') SHR"
address tso "execio * diskr din (stem file. "
address TSO "EXECIO 0 DISKR Din (FINIS"
address TSO "FREE FI(din)"
i = 0
do until i > file.0
i = i + 1
ADDRESS ISPEXEC "EDIT DATASET('"file.i"') MACRO(macro1)"
end
exit

MACRO
/*rexx*/
address isredit
"macro"
"f 'string to find'"
"(fnd,cnt) = find_counts"
if fnd > 0 then
say 'string found'
exit

Regards,
Ranjit
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Sat Apr 09, 2005 12:48 am
Reply with quote

Vinit
Here is something you can start with. You can use SUPREC in batch for searching in these files. Only catch here is you need to create the search file names dynamically from the file which has the complete list of the file names to be searched.
So craete two files with an LRECL 80. First file is MY.TEST.SUPERC.PART1

Code:

//SEARCH  EXEC PGM=ISRSUPC,                                           *
//            PARM=(SRCHCMP,                                           
//            '')                                                       
//NEWDD  DD DSN=SOME.EMPTY.DATASET,                                   
//          DISP=SHR                                                   

Then create another file MY.TEST.SUPERC.PART3
as follows.
Code:

//OUTDD  DD SYSOUT=*   
//SYSIN  DD *           
SRCHFOR  'your search string' 
//                     

Then using ICETOOL/SYNCTOOL
Code:

//STEP1 EXEC  PGM=SYNCTOOL                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG DD SYSOUT=*                         
//IN DD *                                   
MY.FILE.TOBE.SEARCHED.FILE1                 
MY.FILE.TOBE.SEARCHED.FILE2                 
MY.FILE.TOBE.SEARCHED.FILE3                 
MY.FILE.TOBE.SEARCHED.FILE4                 
MY.FILE.TOBE.SEARCHED.FILE5                 
/*                                           
//T1 DD DSN=&&T1,DISP=(,PASS)               
//T2 DD DSN=&&T2,DISP=(,PASS)               
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=SHR     
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=SHR     
//OUT DD DSN=&&OUT,DISP=(,PASS)             
//CON1 DD DSN=MY.TEST.SUPERC.PART1,DISP=SHR 
//     DD DSN=*.OUT,VOL=REF=*.OUT,DISP=SHR   
//     DD DSN=MY.TEST.SUPERC.PART3,DISP=SHR 
//*                                                         
//FINAL DD DSN=MY.TEST.SUPERC.FINAL,                       
//       DISP=(NEW,CATLG,DELETE),                           
//       UNIT=SYSDA,SPACE=(CYL,(5,5),RLSE),                 
//       DCB=(P.GDGDUMY,RECFM=FB,LRECL=80)                 
//TOOLIN DD *                                               
  COPY FROM(IN) USING(CTL1)                                 
  SORT FROM(CON) USING(CTL2)                               
  COPY FROM(CON1) TO(FINAL)                                 
/*                                                         
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,                                         
    OUTREC=(C'//       DD DISP=SHR',C',',59X,SEQNUM,8,ZD)   
  OUTFIL FNAMES=T2,                                         
    OUTREC=(C'//          DSN=',1,63,1X,SEQNUM,8,ZD)       
/*                                                         
//CTL2CNTL DD *                                             
  SORT FIELDS=(81,8,ZD,A)                                   
  OUTFIL FNAMES=OUT,OUTREC=(1,80)                           
/*
//STEP3 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSN=MY.TEST.SUPERC.FINAL,DISP=SHR
//SYSUT2 DD SYSOUT=(X,INTRDR)
//SYSIN  DD DUMMY
//*


This will create a job in MY.TEST.SUPERC.FINAL as below
Code:

//SEARCH  EXEC PGM=ISRSUPC,                                           *
//            PARM=(SRCHCMP,                                           
//            '')                                                       
//NEWDD  DD DSN=SOME.EMPTY.DATASET,                                     
//          DISP=SHR                                                   
//       DD DISP=SHR,                                                   
//          DSN=MY.FILE.TOBE.SEARCHED.FILE1                             
//       DD DISP=SHR,                                                   
//          DSN=MY.FILE.TOBE.SEARCHED.FILE2                             
//       DD DISP=SHR,                                                   
//          DSN=MY.FILE.TOBE.SEARCHED.FILE3                             
//       DD DISP=SHR,                                                   
//          DSN=MY.FILE.TOBE.SEARCHED.FILE4                             
//       DD DISP=SHR,                                                   
//          DSN=MY.FILE.TOBE.SEARCHED.FILE5 
//OUTDD  DD SYSOUT=*                         
//SYSIN  DD *                               
SRCHFOR  'your search string' 
//                                           

Using IEBGENER and Inernal Reader submit the job. Using OUTREC you can create MY.TEST.SUPERC.PART1 and MY.TEST.SUPERC.PART3 as well.



hth
-Som
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Tue Apr 12, 2005 8:26 pm
Reply with quote

Vinit
Did the above solution help you? Otherwise let us know what exactly you are looking for.

Regds
-Som
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue Apr 12, 2005 9:32 pm
Reply with quote

In alternative you can use Rexx for a binary search from one file to another... if you are looking for something like this I've just the code for you and it's fast and easy icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top