View previous topic :: View next topic
|
Author |
Message |
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Andy85
New User
Joined: 25 Dec 2008 Posts: 35 Location: India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
Anyways, I have found the issue and its fixed.
|
Can you post the fix? |
|
Back to top |
|
|
|