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

SORT to search a PDS and exclude results


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
spoorni

New User


Joined: 29 Nov 2007
Posts: 20
Location: india

PostPosted: Thu Jan 30, 2014 11:07 pm
Reply with quote

Hi,

I am trying to do the following:
1) Search the members of a PDS for a string.
2) Exclude the members of the PDS which have the above mentioned string and get the list.

Is this possible using a SORT or do I need to use any other utilities or tools?

Any help is appreciated.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 31, 2014 12:08 am
Reply with quote

read and experiment with ISPF SRCHFOR
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: Fri Jan 31, 2014 12:16 am
Reply with quote

DFSORT cannot do it directly.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Jan 31, 2014 12:01 pm
Reply with quote

One alternate way could be as below. But this would INCLUDE members having the string and not EXCLUDE.
For your case, you could get the full list of members with another step - say STEP3(like STEP2) and do a simple Join to get the unpaired records between the outputs of STEP2 and STEP3. This would list the members that does not have the string.

Code:

//STEP1 EXEC PGM=IEBPTPCH                       
//SYSPRINT DD SYSOUT=*                         
//SYSUT1 DD  DSN=YOUR INPUT PDS,DISP=SHR     
//SYSUT2 DD  DSN=INTRIM1,           
//            DISP=(NEW,CATLG,CATLG),           
//            MGMTCLAS=WORKW,                   
//            SPACE=(TRK,(10,10),RLSE),         
//            DCB=(RECFM=FB)                   
//SYSIN DD *                                   
          PUNCH TYPORG=PO                       
/*                                             
//*                                             
//STEP2 EXEC  PGM=SORT                         
//SYSOUT    DD  SYSOUT=*                       
//SORTIN   DD DSN=INTRIM1,DISP=SHR   
//*                                             
//SORTOUT  DD DSN=LISTS THE MEMBER NAMES,           
//            DISP=(,CATLG,DELETE),             
//            SPACE=(CYL,(1,1),RLSE)           
//*           DCB=(RECFM=FB,LRECL=80)                         
//SYSIN    DD    *                                           
  OPTION COPY                                                 
  INREC  IFTHEN=(WHEN=GROUP,BEGIN=(2,11,CH,EQ,C'MEMBER NAME'),
         PUSH=(81:15,8))                                     
  OUTFIL INCLUDE=(1,80,SS,EQ,C'YOUR SEARCH STRING'),BUILD=(80,9)         
//*                                                           


If you would like to remove multiple entries, you would have an additional step to remove them.

Thanks,
Ashwin.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Fri Jan 31, 2014 12:25 pm
Reply with quote

Rexx comes handy for such requirement...

Lots of examples in forum
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: Fri Jan 31, 2014 1:10 pm
Reply with quote

hailashwin,

That will get the names of the members containing the search value. It is those not containing the search value which are required.

You don't need another step to get rid of duplicates, you could use OUTFIL with NODETAIL, REMOVECC, SECTIONS and TRAILER3.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Fri Jan 31, 2014 1:34 pm
Reply with quote

Bill Woodger,
Quote:

That will get the names of the members containing the search value. It is those not containing the search value which are required.

Just gave him a hint on how he could proceed. That is why I had mentioned that he would have to work further to get the EXCLUDE, because the first 2 steps would only get him those that contain the search string.

Thanks,
Ashwin.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 31, 2014 2:25 pm
Reply with quote

again ...
what is wrong in using what is already there... ISPF ISRSUPC

again
what is wrong in searching the forum with for example 'SRCHFOR SORT'
to land to some topics where it has been shown that

rexx is useless
sort might be needed only to cleanup the result

to get the TS started
here is a snippet i had already posted a few times

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 FRIENDLY PDS>
 000006 //OUTDD    DD SYSOUT=(*)
 000007 //SYSIN    DD *
 000008 SRCHFOR  '<YOUR FRIENDLY STRING>'
 000009 /*
 ****** **************************** Bottom of Data ****************************


to obtain ( for my pds a my string )
Code:
********************************* TOP OF DATA **********************************
  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
   MEMBER TOTALS SECTION                   SRCH DSN: ENRICO.TEST.JCL

MEMBER-SEARCHED         LINES-FOUND   LINES-PROC

A                               0            4
ADRDSSU                         0           14
ALLOCAT                         0            9
ALLOCAT2                        0           24
ALLOCAT3                        0           38
AMATERSE                        0           11
ASMTIVP                         0           60
B                               0            5
...
...
...
Z                               0           13
ZDSNAMES                        0           16
ZPROCS                          0           13
ZZ                              0            7
ZZ1                             0           16

  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
     SEARCH-FOR SUMMARY SECTION            SRCH DSN: ENRICO.TEST.JCL

LINES-FOUND  LINES-PROC  MEMBERS-W/LNS  MEMBERS-WO/LNS  COMPARE-COLS  LONGEST-LI
        0         1455            0             62           1:80           80

PROCESS OPTIONS USED: LNFMTO

THE FOLLOWING PROCESS STATEMENTS (USING COLUMNS 1:72) WERE PROCESSED:
   SRCHFOR 'NOTTHERE'

******************************** BOTTOM OF DATA ********************************

and if the result is too crowded use a sort exclude/include to clean it up


the trick is in the
Code:
 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  2 Line(s) not Displayed
 000003 //ISR    EXEC PGM=ISRSUPC,                                           *
 000004 //            PARM=(SRCHCMP,'LNFMTO')

the LNFMTO

without that the TS will just get

Code:
********************************* TOP OF DATA **********************************
  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
 LINE-#  SOURCE SECTION                    SRCH DSN: ENRICO.TEST.JCL


 A                           --------- STRING(S) FOUND -------------------

      8  SRCHFOR 'NOTTHERE'

  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
     SEARCH-FOR SUMMARY SECTION            SRCH DSN: ENRICO.TEST.JCL

LINES-FOUND  LINES-PROC  MEMBERS-W/LNS  MEMBERS-WO/LNS  COMPARE-COLS  LONGEST-LI
        1         1460            1             61           1:80           80


THE FOLLOWING PROCESS STATEMENTS (USING COLUMNS 1:72) WERE PROCESSED:
   SRCHFOR 'NOTTHERE'

******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Fri Jan 31, 2014 2:49 pm
Reply with quote

Thanks Enrico for the insight icon_redface.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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
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 JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top