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

Search particular string in a pds


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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon May 13, 2013 6:09 pm
Reply with quote

hi,
I want to search particular string in a pds. i,e I want to include only those line which is not equal to string'program'

If it is a single member using below sort fields I can extract.

SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,NE,C'PROGRAM')

But I have more than 100 members in my pds.

Could you please help me in this regard?

Regds,
useit
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon May 13, 2013 6:18 pm
Reply with quote

Well, you can execute the same step 100 times.

DFSORT can read individual members of a PDS/E, when the members are specified in the JCL and just treated as an ordinary sequential dataset.

If you do a search of the forum, here and JCL, you'll find some suggestions for alternatives depending on what you want to do.
Back to top
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 81
Location: Australia

PostPosted: Mon May 13, 2013 6:23 pm
Reply with quote

Your requirement is best achieved by SuperC utility in batch

Code:
    //         JOB
    //SEARCH   EXEC PGM=ISRSUPC,PARM=('SRCHCMP,ANYC')
    //NEWDD    DD   DSN=USERID.PDS,DISP=SHR
    //         DD   DSN=USERID.PDS2,DISP=SHR
    //OUTDD    DD   DSN=output dsn
    //SYSIN    DD     *
     SRCHFOR 'PROGRAM'
    /*
    //


use the output DSN in the next step (probably SORT based on your requirement) to remove unwanted data and process further
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon May 13, 2013 6:26 pm
Reply with quote

I feel this is could be achieved better using REXX
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Mon May 13, 2013 6:56 pm
Reply with quote

srch for 'program' would list all the members which has string 'program' . but i need those members which doesnt have string"Program"..

Regds,
useit
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon May 13, 2013 7:03 pm
Reply with quote

Quote:
srch for 'program' would list all the members which has string 'program' . but i need those members which doesnt have string"Program"..


This is very much a rexx problem now

Search REXX forum for samples
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon May 13, 2013 7:16 pm
Reply with quote

useit wrote:
srch for 'program' would list all the members which has string 'program' . but i need those members which doesnt have string"Program"..

One more reason to use SuperC, which can easily be run from within a rexx program.

Among others, check the process options: LNFMTO (List not-found member or data set totals only), NOPRTCC, NOSUMS (they make it easier for rexx to process output).
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon May 13, 2013 7:33 pm
Reply with quote

OK, so SUPERC gives you all of the members with the search word in, so you get the full library listing and ignore those with, and you are left with only those members without.

Just ran a test on Marsos suggestion ................... even easier icon_biggrin.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon May 13, 2013 7:36 pm
Reply with quote

something like
Code:
 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  2 Line(s) not Displayed
 000003 //ISR    EXEC PGM=ISRSUPC,                                           *
 000004 //            PARM=(SRCHCMP,'LNFMTO')
 000005 //NEWDD    DD DISP=SHR,DSN=<YOUR PDS>
 000006 //OUTDD    DD SYSOUT=(*)
 000007 //SYSIN    DD *
 000008 SRCHFOR  '<YOUR SEARCH STRING>'
 000009 /*
 ****** **************************** Bottom of Data ****************************


will list all the members where the string is not found
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon May 13, 2013 7:39 pm
Reply with quote

Nice Marso and tested icon_smile.gif
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Tue May 14, 2013 1:30 pm
Reply with quote

thanks a lot enrico..i have tested this and it is working for me.

is it possible to copy only those line/record which has that string?

say for example i have pds which has some 100 members. i want to search for perticular string and copy only those line which has that string.

thanks in advance

Regds,
useit
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue May 14, 2013 1:49 pm
Reply with quote

Do you just need the record with string in output or do you need the member names aswell?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 14, 2013 2:10 pm
Reply with quote

I wonder if you might tell us what you are trying to achieve, rather than just carry on asking for little bits at a time?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue May 14, 2013 2:13 pm
Reply with quote

a YES/NO question deserves a YES/NO answer ...
YES You can do it

go to ISPF option 3.15, hit ( without hurting it ) the PF1 key
and scroll thru the help panes to arrive at

Code:
 Tutorial ----------- Extended Search-For - Process Options ---------- Tutorial
 Command ===>

 This is a list of the Search-For process options. To see a description of any
 particular option, type in that option name on the command line and press
 enter. A detailed list can be obtained by pressing enter to continue to the
 next panel.

     ALLMEMS  ANYC     APNDLST  CKPACKL  COBOL    DPACMT   DPADCMT  DPBLKCL
     DPCBCMT  DPCPCMT  DPFTCMT  DPMACMT  DPPLCMT  DPPSCMT  FINDALL  FMSTOP
     IDPFX    LMTO     LNFMTO   LONGLN   LPSF     LTO
     MIXED    NOPRTCC  NOSEQ    NOSUMS   SDUPM    SEQ      XREF

                            (continued on next page)
 


where You can read about the options of srchfor.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue May 14, 2013 5:11 pm
Reply with quote

Hi Bill,

Have you ever see the cartoon with Charlie Brown and Lucy and the football?

Well, you are Charlie Brown and Useit is Lucy pulling the football away from you once again.

Look at the old posts by this TS and see how many times he has done this.

Good entertainment I must say.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 14, 2013 6:17 pm
Reply with quote

All I've done is told Lucy to put the ball down and kick it herself, 100 times, and since originally Lucy wanted the ball to go in one direction, and now in another, I've asked if we might know what is supposed to be achieved with the ball, so that we can tell whether kicking is needed. Perhaps even whether the ball is needed...
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue May 14, 2013 6:22 pm
Reply with quote

I understand totally. I follow this site daily, but only contribute occasionally.

Some TS just don't get it, and probably never will.

Charlie Brown has never kicked the ball. Lucy always wins.
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 Copy only TEXT or String from a record SYNCSORT 4
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Help with C character vs C string All Other Mainframe Topics 3
Search our Forums:

Back to Top