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 Usergroups Profile Log in to check your private messages Log in
 

 

SORT to search a PDS and exclude results

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT to search a PDS and exclude results
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri Jan 31, 2014 12:08 am    Post subject: Reply to: SORT to search a PDS and exclude results
Reply with quote

read and experiment with ISPF SRCHFOR
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jan 31, 2014 12:16 am    Post subject: Reply to: SORT to search a PDS and exclude results
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: 73
Location: Boston

PostPosted: Fri Jan 31, 2014 12:01 pm    Post subject:
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

Moderator


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

PostPosted: Fri Jan 31, 2014 12:25 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jan 31, 2014 1:10 pm    Post subject: Reply to: SORT to search a PDS and exclude results
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: 73
Location: Boston

PostPosted: Fri Jan 31, 2014 1:34 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri Jan 31, 2014 2:25 pm    Post subject: Reply to: SORT to search a PDS and exclude results
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

Moderator


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

PostPosted: Fri Jan 31, 2014 2:49 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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