View previous topic :: View next topic |
Author |
Message |
mainframemouli Beginner
Joined: 23 Feb 2005 Posts: 87 Topics: 33
|
Posted: Mon Sep 03, 2007 10:08 pm Post subject: Searching String1 'AND' String2 across members |
|
|
My requirement is to search the strings 'TAX ARTE' and 'BUDGET' across the members of some 20 PDS....
To be clear....
I have two PDS say A and B.
A --> Mem1,Mem2,Mem3
B --> Mem4,Mem5,Mem6
I need to select only the members from above PDS having both 'TAX RATE' and 'BUDGET' in it....
I tried submitting batch using SUPERCE option
//
SRCHFOR "TAX RATE"
SRCHFOR "BUDGET"
//
But the above search criteria works as ('TAX RATE' OR 'BUDGET') not as
('TAX RATE' AND 'BUDGET').
What I have done is , I have serached for 'TAX RATE' first separately (Output1) and
'BUDGET'(Output2) separately..
I taken only the member name from both Output1 and Output2.
Then I merged Output1 and Output2= Output3.
Used ICEMAN , FIRSTDUP option for OUTPUT3 for getting the final result....
Please let me aware of any easiest way of doing this using utilities or thorugh Jcl??? |
|
Back to top |
|
|
blitz2 Beginner
Joined: 23 Jan 2007 Posts: 84 Topics: 14
|
Posted: Tue Sep 04, 2007 4:24 am Post subject: |
|
|
mainframemouli,
If you have file-aid in your shop, you can use the following control card in your SYSIN for each of your datasets.
Code: |
$$DD01 LIST MEMBER=(MEM1,MEM2,MEM3),IF=(1,0,C'TAX RATE'),IF=(1,0,C'BUDGET') |
Please do not include the 'member' parameter if you wish to search all members of the pds. I do not have access to the mainframe. So please try it out and post your findings.
________
IPAD CASES
Last edited by blitz2 on Thu Mar 10, 2011 5:35 pm; edited 1 time in total |
|
Back to top |
|
|
anbesivam Beginner
Joined: 09 Aug 2006 Posts: 66 Topics: 14
|
Posted: Tue Sep 04, 2007 4:56 am Post subject: |
|
|
Hi mainframemouli
I think, you can use Rexx to solve this.
1. Get all the members using LISTDS
Code: | /* GET ALL THE MEMBERS */
CALL OUTTRAP "MEMLIST."
"LISTDS" DS_NAME "MEMBERS"
CALL OUTTRAP "OFF" |
2. Read each member
Code: | /* BROWSE THRU ALL THE MEMBERS AND SEARCH FOR THE STRING */
DO J = 7 TO MEMLIST.0
OUTPUT. = ""
LINES. = ""
PARSE VALUE MEMLIST.J WITH MEM
MEM = STRIP(MEM)
/* READ THE MEMBER LINES TO A STEM VARIABLE */
"ALLOC DA('"PDS_NAME"("MEM")') F("INDD") SHR REUSE"
"EXECIO * DISKR INDD (FINIS STEM LINES."
/* ALLOCATE AN OUTPUT DD TO WRITE THE UPDATED MEMBER */
"ALLOC DA('"PS_NAM"') F("OUTDD") SHR REUSE" |
3. Check both strings using POS function
Code: | IF (POS( VAR1 , LINES.K) > 0) ! (POS( VAR2 , LINES.K) > 0) |
4. If both strings are available in the member, write the member name in saperate file.
Code: | /* WRITE THE OUTPUT MEMBER */
"EXECIO * DISKW OUTDD (FINIS STEM OUTPUT."
"FREE F(INDD)"
"FREE F(OUTDD)" |
5. otherwise read next member.
Hope this helps. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Sep 04, 2007 5:10 am Post subject: |
|
|
mainframemouli,
SRCHFOR utility can search for string with AND condition.
1. Go to 3.15 option
2. Type E at the command prompt.
3. you will be provided with a new panel. At the bottom of the panel you will find examples for searching string with AND condition
4. Code the SRCHFOR conditions in the top using those examples.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mainframemouli Beginner
Joined: 23 Feb 2005 Posts: 87 Topics: 33
|
Posted: Wed Sep 05, 2007 12:17 am Post subject: |
|
|
blitz2,
I don't have file-aid in shop , so couldn't able to test that out....
Kolusu,
I have found the following examples in the 3.15 option , But I couldn't make it out from that the 'AND' operation.
SRCHFOR 'ABCD',W Search for the word "ABCD"
SRCHFORC 'DEFG' "DEFG" must be on same line as word "ABCD"
To my requirement 'TAX RATE' and 'BUDGET' can be available at any place in the member need not be in the same line.
For example : If line 1 has 'TAX RATE' and Line 20 has 'Budget' that also to be captured. |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Sep 17, 2007 9:15 am Post subject: this should help |
|
|
Hello,
I have tried this on a PDS as an experiment and it worked for me.
I have searched a PDS for "KRICHA" and "PATLA".
I went into the 3.15 (Extended Search-For Utility) and entered "E" at command prompt.
I typed the below commands and saved it:
Code: |
Enter or change Process Statements in the EDIT window below:
****** ***************************** Top of Data ******************************
000001 SRCHFOR 'KRICHA',W
000002 SRCHFOR 'PATLA'
****** **************************** Bottom of Data ****************************
|
After selecting all the members in a PDS (S*) I hit PF3 and it returned me the members that had these two words.
HTH.
Thanks. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
NASCAR9 Intermediate
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
|
Posted: Wed Aug 17, 2016 1:18 pm Post subject: |
|
|
Adding a post to bring this topic to the top. I was able to use mf_user's instructions to solve a problem I was having searching a string with ticks '
_________________ Thanks,
NASCAR9 |
|
Back to top |
|
|
|
|