View previous topic :: View next topic
|
Author |
Message |
Soumya Roy
New User
Joined: 19 Feb 2009 Posts: 10 Location: Bangalore
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
Soumya Roy
New User
Joined: 19 Feb 2009 Posts: 10 Location: Bangalore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Soumya Roy
New User
Joined: 19 Feb 2009 Posts: 10 Location: Bangalore
|
|
|
|
Yeah. Syntax was bad.
Running fine now.
Thanks both of you. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
|