Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Search string in PDS members

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Wed Dec 09, 2009 10:36 am    Post subject: Search string in PDS members
Reply with quote

I have following REXX code for searching particular string in all members within a PDS. The code has been taken from a post on this forum. However, after minor changes, the code is still not able to search in all members. Under MEMVIEW label, the statement

ADDRESS TSO 'EXECIO 1 DISKR INDD'

is returning 2 for all members except first one. Hence, not able to search string in those elements.
Since I am not well versed in REXX, can anyone please help me debug the code?


Code:

/*******************************REXX***********************************/
/*TRACE R*/                                                             
DROP ID                                                                 
DSN = A.B.JCL                                                   
STRING = 'ABCDEFGH'                                                     
/**********************************************************************/
/*            GET DATAID FOR DATASET AND ISSUE LMOPEN                 */
/**********************************************************************/
MEMBER = ' '                                                           
ADDRESS ISPEXEC 'LMINIT DATAID('ID'),                                   
        DATASET('"'"DSN"'"') ENQ(SHR)'                                 
ADDRESS ISPEXEC 'LMOPEN DATAID('ID') OPTION(INPUT)'                     
LMRC = 0                                                               
CNT = 0                                                                 
/**********************************************************************/
/*             LOOP THROUGH ALL THE MEMBERS IN THE PDS                */
/**********************************************************************/
DO WHILE LMRC = 0                                                       
   ADDRESS ISPEXEC 'LMMLIST DATAID('ID') OPTION(LIST),                 
                    MEMBER(MEMBER) STATS(NO)'                           
   LMRC = RC                                                           
   IF LMRC = 0 THEN                                                     
    DO                                                                 
      CNT = CNT + 1                                                     
      SAY 'MEMBER'CNT 'IS:' MEMBER                                     
      CALL MEMVIEW                                                     
    END                                                                 
   ELSE                                                                 
      SAY 'MLIST NOT SUCCESSFUL'                                       
END                                                                     
/**********************************************************************/
/*  FREE THE MEMBER LIST AND CLOSE THE DATAID FOR THE PDS             */
/**********************************************************************/
ADDRESS ISPEXEC 'LMMLIST DATAID('ID') OPTION(FREE)'                     
ADDRESS ISPEXEC 'LMCLOSE DATAID('ID')'                                 
EXIT                                                                   
/**********************************************************************/
/*     VIEW THE MEMBER AND SEARCH FOR THE STRING                      */
/**********************************************************************/
MEMVIEW:                                                               
DROP INDD                                                               
DROP INREC                                                             
MEMBER = STRIP(MEMBER)                                                 
DSNTOT = DSN||'('MEMBER||')'                                           
DSNTOT = "'"DSNTOT"'"                                                   
EOF_FLAG = 2                                                           
RET_CODE = 0                                                           
RC= 0                                                                   
/*ADDRESS TSO 'ALLOC FI('INDD') DA('DSNTOT') SHR'*/                     
ADDRESS TSO 'EXECIO 0 DISKR INDD(OPEN'                                 
DO WHILE RET_CODE \= EOF_FLAG                                           
   ADDRESS TSO 'EXECIO 1 DISKR INDD'                                   
   RET_CODE = RC                                                       
/* SAY 'MY RC IS' RC*/                                                 
   IF RET_CODE = 0 THEN                                                 
    DO                                                                 
      PARSE PULL INREC.1                                               
/*    SAY 'MY STRING' INREC.1 */                                       
      IF POS(STRING,INREC.1) > 0 THEN                                   
      DO                                                               
         SAY 'STRING' INREC.1                                           
         SAY 'STRING PRESENT IN MEMBER:' MEMBER                         
      END                                                               
      ELSE NOP                                                         
    END                                                                 
   ELSE                                                                 
   DO                                                                   
    SAY 'LEAVING RC IS' RC                                             
    LEAVE                                                               
   END                                                                 
END                                                                     
/*ADDRESS TSO 'FREE FI('INDD')'*/                                       
RETURN                                                                 



Thanks in advance.

Andy.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Wed Dec 09, 2009 1:03 pm    Post subject: Reply to: Search string in PDS members
Reply with quote

is there any reason for everybody ( Yourself included ) to waste time in reinventing the wheel..

the fact that You found the snippet on the forums does not mean that it is the best approach

I guess you' ll be on Your own for this issue
Back to top
View user's profile Send private message
Andy85

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Wed Dec 09, 2009 1:14 pm    Post subject:
Reply with quote

Quote:

the fact that You found the snippet on the forums does not mead that it is the best approach


I was not asking for best approach. I was asking help since I was facing an error in one step. And if in case of issues, I have to be on my own, then whats the purpose for this forum's existence. I searched the forum for my query, got the post, used the same, but got stuck in one statement, which forced me to write the post.

Anyways, I have found the issue and its fixed.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10374
Location: italy

PostPosted: Wed Dec 09, 2009 1:29 pm    Post subject: Reply to: Search string in PDS members
Reply with quote

Quote:
I was not asking for best approach. ... And if in case of issues, I have to be on my own, then whats the purpose for this forum's existence.


the forum is there to give help on reasonable technical issues and to provide
info about better ways of doing things..

On a serious forum You should expect to get the best answers based on the responder' s experience

but looks like You are one of those people who do not accept good answers, they just want the answer they expect

Youl' ll never get tha from me sonny icon_wink.gif

if You are not satified with the forum' s answers, well...

just fire us, sue us to be reimbursed for the expenses
and ask another no charge consulting firm
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2088
Location: Silicon Valley

PostPosted: Wed Dec 09, 2009 7:58 pm    Post subject: Reply to: Search string in PDS members
Reply with quote

Quote:
Anyways, I have found the issue and its fixed.


Can you post the fix?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TBSARG - Deleting the search criteria... ISPFHerc TSO/ISPF 1 Thu Dec 14, 2017 8:18 am
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Historical/statistical details for me... elixir1986 TSO/ISPF 13 Wed Aug 30, 2017 9:02 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us