Search for a string in a set of PS files

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
sharmi
Member
Posts: 13
Joined: Wed Jul 17, 2013 3:23 pm

Search for a string in a set of PS files

Post by sharmi » Mon Jul 06, 2015 5:05 pm

Greetings All,

I have planned to create a tool which would help me to find out the 'value' in a set of files. I will explain my thought below followed by my query,

For ex,

I have designed a panel using which user would input ID and Name. In my logic if ID is 100, then i have given

data51 = Filename1
data52 = Filename2
data53 = Filename3
data54 = Filename4
"ISREDIT SRCHFOR 'Name.1'"

I have inputted 'Sharmi' as name and this value should be searched in those 4 files. If that value is found in any of those files, then that file name should be captured in a variable. And my logic continues, if it is not found in those 4 files, it will search in

BUSfl = Filename5
"ISREDIT SRCHFOR 'Name.1'"

And, if found here this filename will be captured.

When i displayed RC after the ISREDIT SRCHFOR command, it showed 20 even if the name exists in those files or not.

Please Guide me how to know if the name exists or not and also to capture the found file name.

Note: It will be found only in one of those first 4 files. If not found in those, it will be in filename5.

Thank you all in advance.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Jul 06, 2015 7:37 pm

Why don't you find out what an RC of 20 means? Have you used Trace?

sharmi
Member
Posts: 13
Joined: Wed Jul 17, 2013 3:23 pm

Post by sharmi » Wed Jul 08, 2015 12:29 pm

Hi Collins,

Thanks for your reply.

Yeah i have used TRACE ON. I am a beginner in REXX so i am trying to find out what RC=20 means in ISREDIT. But couldn't get the exact answer.

Please help me to figure it out.

Thanks in advance.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed Jul 08, 2015 2:42 pm

RC 20 means absolutely no fat chance on earth the thing which caused the 20 could possibly work.

Can you post the output of the trace (copy/paste from your emulator), say 10 liines before the error, the error, and 10 lines after.

sharmi
Member
Posts: 13
Joined: Wed Jul 17, 2013 3:23 pm

Post by sharmi » Fri Jul 10, 2015 10:48 am

Hi Collins,

There are no errror messages, i instructed it to display RC, so it showed 20.

I have posted my rough code below,

TRACE ON
"ISREDIT MACRO"
x=msg("off")
ADDRESS "ISPEXEC"
"LIBDEF ISPPLIB DATASET ID('USERID.REXX.LIB')"
"DISPLAY PANEL(GETPNL)"

/* Get input values from the user*/
"VGET (REGN,ORG1,ORG2,ORG3,ORG4,ORG5,ORG6,ORG7,ORG8,ORG9,CARD1,CARD2,
CARD3,CARD4,CARD5,CARD6,CARD7,CARD8,CARD9) SHARED"
if rc=0 then
org.1 = org1
org.2 = org2
org.3 = org3
org.4 = org4
org.5 = org5
org.6 = org6
org.7 = org7
org.8 = org8
org.9 = org9
card.1 = card1
card.2 = card2
card.3 = card3
card.4 = card4
card.5 = card5
card.6 = card6
card.7 = card7
card.8 = card8
card.9 = card9
i=1
j=1
card = 'N'
do until card = 'Y'
if org.i = '100' then
data51 = filename1
data52 = filename2
data53 = filename3
data54 = filename4
"ISREDIT SRCHFOR 'card.i'"
say rc
exit
if rc=0 then
card = 'Y'
else
BUSfl = filename5
"ISREDIT SRCHFOR 'card.i'"
if rc=0 then
card = 'Y'

And it goes on checking the other files. Here after displaying RC i have given exit comman, since the code goes in loop.

Hope this gives some clarity.

Thanks in advance.

Post Reply