Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Search for a string in a PS from another PS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Search for a string in a PS from another PS
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    Post subject: Re: Search for a string in a PS from another PS
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us