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

Problem in Repeated FIND in ISPF Edit MACRO


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Soumya Roy

New User


Joined: 19 Feb 2009
Posts: 10
Location: Bangalore

PostPosted: Wed Jul 13, 2011 3:30 pm
Reply with quote

Hi,

I am doing a "FIND ALL" to get the number of occurrence of the string
': PROC'.
After that I'm doing "FIND NEXT" to search the above string throughout the MEMBER.

Till this point, it was successful.

After the above, I need to search another string which should look like: "END PARANAME"

I have an array INP. which has the PARA names[like : INP.1 = PARA1, INP.2 = PARA2 etc]

Now I am trying to search the string as:

STR2FND = 'END 'INP.idx''

"ISREDIT FIND FIRST '(STR2FND)'"

However the search is not successfull this time and it's actually searching the last string found from the previos search[the last result of the prev search is ': PROC']. It's not at all searching the value in the variable STR2FND.

Could you please share some idea? I'm not sure if there is any syntax error.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 13, 2011 4:26 pm
Reply with quote

Your explanations are not clear at all, specifically this part:
Quote:
However the search is not successfull this time and it's actually searching the last string found from the previos search[the last result of the prev search is ': PROC'].

Code:
"ISREDIT FIND FIRST '(STR2FND)'"
Are you sure this is exactly how your command is coded ?
According to the quotes, you are looking for (STR2FND)
Back to top
View user's profile Send private message
Soumya Roy

New User


Joined: 19 Feb 2009
Posts: 10
Location: Bangalore

PostPosted: Wed Jul 13, 2011 5:04 pm
Reply with quote

Quote:
However the search is not successfull this time and it's actually searching the last string found from the previos search[the last result of the prev search is ': PROC'].


I have searched the string ': PROC' intially.

Now I am doing a new search with a different string. When I am trying to FIND the string 'END PARANAME', it's actually searching ': PROC'.

Hope this time it's more clear.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 13, 2011 5:26 pm
Reply with quote

Soumya Roy wrote:
Hope this time it's more clear.


no it is not.

Marso has suggested that your syntax sucks. (he did not say that, i am)

run the instruction with trace,
so that you can see what the resolution of
"ISREDIT FIND FIRST '(STR2FND)'"
is.

that will provide you with the info necessary to fix your own problem.
why are you using open '(' and closed ')' parenthesis?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 13, 2011 5:30 pm
Reply with quote

I am going to provide you with a hint:
"ISREDIT FIND FIRST '" STR2FND "'"
because I really don't want to see anymore of your responses,
other than 'I found the problem, it was ..., thank you Marso for your help'
Back to top
View user's profile Send private message
Soumya Roy

New User


Joined: 19 Feb 2009
Posts: 10
Location: Bangalore

PostPosted: Wed Jul 13, 2011 7:06 pm
Reply with quote

Yeah. Syntax was bad.

Running fine now.

Thanks both of you.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 13, 2011 7:13 pm
Reply with quote

thx for the feedback,
and we will be here in the event that you have a problem in the future,
or you see an opportunity where you can help someone that has a problem.

have a good week.

dbz
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 13, 2011 8:45 pm
Reply with quote

You're welcome.

Here are a couple of tips for macro writers:
  • If most of the external commands (and I mean external to REXX) are sent to the editor,
    code Address ISREDIT as the first line of the macro.
    then you can use edit commands without prefixing each of them.
  • It is very important to check the return code after each command.

Here is an example:
Code:
/* REXX */
Trace O

Address ISREDIT
'MACRO (fstring)'
QP=Pos("'",fstring)
Select
   When QP=1  Then Quote=''
   When QP<>0 Then Quote='"'
   Otherwise       Quote="'"
End

LblLst = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Lbl1 = 1
Lbl2 = 0

'FIND FIRST 'Quote||fstring||Quote
If RC <> 0 Then Do
   ZEDSMSG = 'Field not found'
   ZEDLMSG = 'The field you specified was not found'
   Address ISPEXEC 'SETMSG MSG(ISRZ000)'
   Exit 4
End
'LABEL .ZCSR = .T'MakeLabel()' 0'

Do Forever
   'RFIND'
   If RC <> 0 Then Leave
   'LABEL .ZCSR = .T'MakeLabel()' 0'
End

'LOCATE .TAA'
Exit


MakeLabel:
   Lbl2 = Lbl2 + 1
   If Lbl2 > 26 Then Do
      Lbl1 = Lbl1 + 1
      Lbl2 = 1
   End
   MyLbl = Substr(LblLst,Lbl1,1) || Substr(LblLst,Lbl2,1)
Return MyLbl
I can't remember where this macro come from (maybe I wrote it, but I have doubts about this)
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Looking for a little history of ISPF ... TSO/ISPF 5
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top