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

Search string in PDS members


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Dec 09, 2009 1:03 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Dec 09, 2009 1:29 pm
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

Global Moderator


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

PostPosted: Wed Dec 09, 2009 7:58 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
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 file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top