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

Search two or more word with FILEAID


IBM Mainframe Forums -> Compuware & Other Tools
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 12:28 am
Reply with quote

Hi,
I need to find all the members of a partitioned library that have two or more words inside them, even if not in the same line.
With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row.
I was wondering if there is a way with batch FILEAID(FMNMAIN?).
The alternative would be to do more extractions and make the appropriate pairings with SORT, but I have very large libraries and the execution time is too much.

Thank you
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Feb 13, 2024 12:42 am
Reply with quote

SORT has no options to handle PDS datasets.

If your library is RECFM=FB,LRECL=80, then you can do this:

1) "unload" the library to a DSORG=PS dataset, using IEBPTPCH or other available utility
2) use SORT/ICETOOL/SYNCTOOL to process this flat temporary dataset, and to detect required original members. It is not very trivial task, but not rocket science as well.
3) SORT works extremely fast compared to other 99% of available tools.

Another option may be (with any RECFM/LRECL!):
1) use SUPERC to find the members with either of two required words, and
2) use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.

The complexity of SORT control statements would be about the same for both options.

You can try it yourself, before asking to provide you with a ready-to-use solution.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1313
Location: Vilnius, Lithuania

PostPosted: Tue Feb 13, 2024 1:16 am
Reply with quote

RedWolf wrote:
Hi,
With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row.


That's bullsh*t. You can specify multiple search terms and SRCHFOR finds all members, no matter how many words are on separate lines!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Feb 13, 2024 2:19 am
Reply with quote

RedWolf wrote:
Hi,
I need to find all the members of a partitioned library that have two or more words inside them, even if not in the same line.
With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row.
I was wondering if there is a way with batch FILEAID(FMNMAIN?).
The alternative would be to do more extractions and make the appropriate pairings with SORT, but I have very large libraries and the execution time is too much.

Thank you


ENOUGH THEORETICAL BLAH-BLAH-BLAH.

Bring here your examples: where your "With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row"?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Feb 13, 2024 2:19 pm
Reply with quote

It seems that FINDALL option that @prino has secretly referred to, only works for PS datasets. Maybe I am missing another keyword so far which enables this for PO as well.
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 7:20 pm
Reply with quote

prino wrote:
RedWolf wrote:
Hi,
With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row.


That's bullsh*t. You can specify multiple search terms and SRCHFOR finds all members, no matter how many words are on separate lines!


--


ok, maybe I got some parameters wrong. I'll show you what I do and what I get as output

the contents of the members are:

MEMBER A
MEMBRO A 1 PIPPO

MEMBER B
MEMBRO B 1 PLUTO

MEMBRO C
MEMBRO C 1

MEMBRO D
MEMBRO D 1 PIPPO
MEMBRO D 1 PLUTO

I want only MEMBER D (contains the two words, in different lines),
with this search:
//SEARCH EXEC PGM=ISRSUPC,
// PARM=(SRCHCMP)
//* 'FMSTOP')
//NEWDD DD DISP=SHR,DSN=XXXXXXX.XXX.XXX
//OUTDD DD SYSOUT=*
//SYSIN DD *
SRCHFOR 'PIPPO' AND 'PLUTO'

but I get this:

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

1 MEMBRO A 1 PIPPO

D --------- STRING(S) FOUND -------------------

1 MEMBRO D 1 PIPPO

ISRSUPC - MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
SEARCH-FOR SUMMARY SECTION SRCH DSN: U375469.LIB.INP

LINES-FOUND LINES-PROC MEMBERS-W/LNS MEMBERS-WO/LNS COMPARE-COLS LONGEST-LI
2 11 2 3 1:80 80


THE FOLLOWING PROCESS STATEMENTS (USING COLUMNS 1:72) WERE PROCESSED:
SRCHFOR 'PIPPO' 'PLUTO'
ISRS024W EXTRA DATA DETECTED AFTER NORMAL STATEMENT END. STATEMENT ACCEPTED WITH WARNING NOTIFICATION.

i tried also
SRCHFOR 'PIPPO' 'PLUTO'
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Feb 13, 2024 7:24 pm
Reply with quote

See my comment above yours, and also have a look at the allowed SRCHFOR term(s).

What RECFM;LRECL does your DSN have?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Feb 13, 2024 7:42 pm
Reply with quote

1. Learn how to use the Code button when presenting your data and code to others.
RedWolf wrote:

the contents of the members are:
Code:
MEMBER A
MEMBRO   A    1 PIPPO

MEMBER B
MEMBRO   B    1   PLUTO     

MEMBRO C
 MEMBRO   C    1

MEMBRO D
MEMBRO   D    1 PIPPO
MEMBRO   D    1 PLUTO

I want only MEMBER D (contains the two words, in different lines),
with this search:
Code:
//SEARCH  EXEC PGM=ISRSUPC,                       
//            PARM=(SRCHCMP)                       
//*           'FMSTOP')                           
//NEWDD  DD DISP=SHR,DSN=XXXXXXX.XXX.XXX           
//OUTDD  DD SYSOUT=*                               
//SYSIN  DD *                                     
 SRCHFOR 'PIPPO' AND 'PLUTO'                       

but I get this:

Code:
 A                           --------- STRING(S) FOUND -------------------     
                                                                               
      1   MEMBRO   A    1 PIPPO                                                 
                                                                               
 D                           --------- STRING(S) FOUND -------------------     
                                                                               
      1   MEMBRO   D    1 PIPPO                                                 
                                                                               
  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
     SEARCH-FOR SUMMARY SECTION            SRCH DSN: U375469.LIB.INP           
                                                                               
LINES-FOUND  LINES-PROC  MEMBERS-W/LNS  MEMBERS-WO/LNS  COMPARE-COLS  LONGEST-LI
        2           11            2              3           1:80           80 
                                                                               
                                                                               
THE FOLLOWING PROCESS STATEMENTS (USING COLUMNS 1:72) WERE PROCESSED:           
    SRCHFOR 'PIPPO' 'PLUTO'                                                     
ISRS024W EXTRA DATA DETECTED AFTER NORMAL STATEMENT END.  STATEMENT ACCEPTED WITH WARNING NOTIFICATION.

i tried also
Code:
 SRCHFOR 'PIPPO' 'PLUTO'


2. Use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 8:36 pm
Reply with quote

sergeyken wrote:
SORT has no options to handle PDS datasets.

If your library is RECFM=FB,LRECL=80, then you can do this:

1) "unload" the library to a DSORG=PS dataset, using IEBPTPCH or other available utility
2) use SORT/ICETOOL/SYNCTOOL to process this flat temporary dataset, and to detect required original members. It is not very trivial task, but not rocket science as well.
3) SORT works extremely fast compared to other 99% of available tools.

Another option may be (with any RECFM/LRECL!):
1) use SUPERC to find the members with either of two required words, and
2) use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.

The complexity of SORT control statements would be about the same for both options.

You can try it yourself, before asking to provide you with a ready-to-use solution.


--

I've already done what you say, but I have a library with hundreds of thousands of members... the processing time is long and the sequential file I get is very large. I was looking for a faster solution.
Thanks
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 8:44 pm
Reply with quote

Joerg.Findeisen wrote:
See my comment above yours, and also have a look at the allowed SRCHFOR term(s).

What RECFM;LRECL does your DSN have?



My DSN is a Partitioned Dataset, with FB 80... a classical partitioned with jcl inside. A lot of JCL!
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 8:47 pm
Reply with quote

sergeyken wrote:
1. Learn how to use the Code button when presenting your data and code to others.
RedWolf wrote:

the contents of the members are:
Code:
MEMBER A
MEMBRO   A    1 PIPPO

MEMBER B
MEMBRO   B    1   PLUTO     

MEMBRO C
 MEMBRO   C    1

MEMBRO D
MEMBRO   D    1 PIPPO
MEMBRO   D    1 PLUTO

I want only MEMBER D (contains the two words, in different lines),
with this search:
Code:
//SEARCH  EXEC PGM=ISRSUPC,                       
//            PARM=(SRCHCMP)                       
//*           'FMSTOP')                           
//NEWDD  DD DISP=SHR,DSN=XXXXXXX.XXX.XXX           
//OUTDD  DD SYSOUT=*                               
//SYSIN  DD *                                     
 SRCHFOR 'PIPPO' AND 'PLUTO'                       

but I get this:

Code:
 A                           --------- STRING(S) FOUND -------------------     
                                                                               
      1   MEMBRO   A    1 PIPPO                                                 
                                                                               
 D                           --------- STRING(S) FOUND -------------------     
                                                                               
      1   MEMBRO   D    1 PIPPO                                                 
                                                                               
  ISRSUPC   -   MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
     SEARCH-FOR SUMMARY SECTION            SRCH DSN: U375469.LIB.INP           
                                                                               
LINES-FOUND  LINES-PROC  MEMBERS-W/LNS  MEMBERS-WO/LNS  COMPARE-COLS  LONGEST-LI
        2           11            2              3           1:80           80 
                                                                               
                                                                               
THE FOLLOWING PROCESS STATEMENTS (USING COLUMNS 1:72) WERE PROCESSED:           
    SRCHFOR 'PIPPO' 'PLUTO'                                                     
ISRS024W EXTRA DATA DETECTED AFTER NORMAL STATEMENT END.  STATEMENT ACCEPTED WITH WARNING NOTIFICATION.

i tried also
Code:
 SRCHFOR 'PIPPO' 'PLUTO'


2. Use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.


Thanks for your help in providing the correct answer. I have already applied the solution you proposed, but I was looking for something faster in processing
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Feb 13, 2024 8:49 pm
Reply with quote

RedWolf wrote:
sergeyken wrote:
SORT has no options to handle PDS datasets.

If your library is RECFM=FB,LRECL=80, then you can do this:

1) "unload" the library to a DSORG=PS dataset, using IEBPTPCH or other available utility
2) use SORT/ICETOOL/SYNCTOOL to process this flat temporary dataset, and to detect required original members. It is not very trivial task, but not rocket science as well.
3) SORT works extremely fast compared to other 99% of available tools.

Another option may be (with any RECFM/LRECL!):
1) use SUPERC to find the members with either of two required words, and
2) use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.

The complexity of SORT control statements would be about the same for both options.

You can try it yourself, before asking to provide you with a ready-to-use solution.


--

I've already done what you say, but I have a library with hundreds of thousands of members... the processing time is long and the sequential file I get is very large. I was looking for a faster solution.
Thanks


I doubt you have ever tried to process SUPERC output with SORT utility. I did it many times, and it works extremely fast (compared to any other approach).

Please, present here the code you have tried. Otherwise I have to consider you as a liar.
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 8:52 pm
Reply with quote

prino wrote:
RedWolf wrote:
Hi,
With batch SRCHFOR this is not possible, it finds the members that have the two words in the same row.


That's bullsh*t. You can specify multiple search terms and SRCHFOR finds all members, no matter how many words are on separate lines!


SRCHFOR finds all members that contain at least one word, I look for members that contain ALL the words of the search, even on different lines within the member. I have a very large patitioned as input. Do you know any parameters that allow you to do what I would like to do?

Grazie
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Feb 13, 2024 9:00 pm
Reply with quote

When you have more than 32k members in that DSN, I would opt for @sergeyken's approach using SUPERC and Sort. If it's less, use the IEBPTPCH method, followed by a Sort. When you STFW you will find some samples how to do.
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 9:59 pm
Reply with quote

sergeyken wrote:
RedWolf wrote:
sergeyken wrote:
SORT has no options to handle PDS datasets.

If your library is RECFM=FB,LRECL=80, then you can do this:

1) "unload" the library to a DSORG=PS dataset, using IEBPTPCH or other available utility
2) use SORT/ICETOOL/SYNCTOOL to process this flat temporary dataset, and to detect required original members. It is not very trivial task, but not rocket science as well.
3) SORT works extremely fast compared to other 99% of available tools.

Another option may be (with any RECFM/LRECL!):
1) use SUPERC to find the members with either of two required words, and
2) use SORT/ICETOOL/SYNCTOOL to re-process the output from SUPERC, and to detect the members with both required words.

The complexity of SORT control statements would be about the same for both options.

You can try it yourself, before asking to provide you with a ready-to-use solution.


--

I've already done what you say, but I have a library with hundreds of thousands of members... the processing time is long and the sequential file I get is very large. I was looking for a faster solution.
Thanks


I doubt you have ever tried to process SUPERC output with SORT utility. I did it many times, and it works extremely fast (compared to any other approach).

Please, present here the code you have tried. Otherwise I have to consider you as a liar.




Scusami se ti scrivo in italiano, ma voglio essere chiaro. Ho 61 anni, lavoro nel mondo Host IBM da 40. Ho fatto una domanda perché non trovo risposta nemmeno su chatgpt. Non devo e non voglio dimostrare a nessuno di essere in grado di saper usare IEBPTPCH ed un paio di sort. Se si ha una risposta alla mia domanda, posta con gentilezza, la si da... altrimenti non si mette in dubbio la mia professionalità. Grazie
Back to top
View user's profile Send private message
RedWolf

New User


Joined: 07 Feb 2024
Posts: 8
Location: Italy

PostPosted: Tue Feb 13, 2024 10:00 pm
Reply with quote

Joerg.Findeisen wrote:
When you have more than 32k members in that DSN, I would opt for @sergeyken's approach using SUPERC and Sort. If it's less, use the IEBPTPCH method, followed by a Sort. When you STFW you will find some samples how to do.


I will continue to use IEBPTPCH and SORT. Thanks a lot for the answer.
Back to top
View user's profile Send private message
Jim Evans

New User


Joined: 19 Sep 2024
Posts: 2
Location: UK

PostPosted: Fri Sep 20, 2024 6:47 pm
Reply with quote

If you're licensed for SELCOPY then here's a decent solution.
SELCOPY is able to directly process the whole library using BPAM, so it's very fast ...

Code:

//SC   EXEC PGM=SELCOPY                                             
//MYLIB     DD DISP=SHR,DSN=MY.LIBRARY.WITH.MANY.MEMBERS             
//SYSPRINT  DD SYSOUT=*                                             
//SYSIN     DD *                                                     
   option worklen = 33333    * Allows records up to LRECL=32K.       
   read MYLIB  dirdata       * DirData means use BPAM access.       
                                                                     
   if dir                    * Is it a directory rec?               
     then pos 33001 = 8 at 1 * Save new member name.                 
     then @w1=1              * Reset switch.                         
     then @w2=1              * Reset switch.                         
     then goto get           * Bypass.                               
                                                                     
   if pos any = 'PIPPO' !then @w1=2 * Indicate found.               
   if pos any = 'PLUTO' !then @w2=2 * Indicate found.               
                                                                     
   if @w1 = 2 !and @w2 = 2        * Both strings found?             
     then print from 33001 len=8  * Print the member name.           
     then flag eomemb             * Bypass rest of this member.     
                                                                     
   * SELCOPY automatically loops back to the 1st statement.         
/*                                                                   
[/code]
Back to top
View user's profile Send private message
Jim Evans

New User


Joined: 19 Sep 2024
Posts: 2
Location: UK

PostPosted: Fri Sep 20, 2024 6:51 pm
Reply with quote

Another BPAM solution using FileKit (formerly SELCOPYi - also from Compute (Bridgend) Ltd) ...
Code:

//FK   EXEC PGM=FILEKITB                                                     
//MYLIB     DD DISP=SHR,DSN=MY.LIBRARY.WITH.MANY.MEMBERS                     
//SDEPRINT  DD SYSOUT=*                                                     
//SYSPRINT  DD SYSOUT=*                                                     
//SDEIN     DD *                                                             
  macro LIBSCAN                                                             
/*                                                                           
//LIBSCAN   DD *                                                             
         /* REXX */                                                         
   'FileIO MYLIB openread  library'  /* LIBRARY means use BPAM */           
   'FileIO MYLIB option MEMBER'      /* Sets MYLIB.1.MEMBER */               
                                                                             
     /* Select only records containing EITHER string */                     
   'FileIO MYLIB where (record << "PIPPO" or record << "PLUTO")'             
                                                                             
   do forever                                                               
     W1=0; W2=0                                                             
     'FileIO MYLIB sread MyRec'                                             
     if rc >= 4 then leave    /* End of Library? */                         
                                                                             
     do i = 1 to MyRec.0                                                     
       if W1 = 0 & pos('PIPPO',MyRec.i) > 0 then W1 = 1                     
       if W2 = 0 & pos('PLUTO',MyRec.i) > 0 then W2 = 1                     
       if W1 = 1 & W2 = 1   then    /* Got both words? */                   
         do; say MYLIB.1.Member     /* Print the member name */             
             leave                                                           
         end                                                                 
     end                                                                     
   end                                                                       
/*                                                                           
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 -> Compuware & Other Tools

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
Search our Forums:

Back to Top