View previous topic :: View next topic
|
Author |
Message |
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi,
Can we pass a variable to SEEK like,
Code: |
DO I = 1 TO LINES.0
LINES.I=STRIP(LINES.I)
"ISREDIT SEEK ALL '&LINES.I'"
"ISREDIT (COUNT) = SEEK_COUNTS"
SAY LINES.I "=" COUNT
END |
LINES variable has following data,
Code: |
LINE
REX
ISREDIT
SAY |
This is not working.. I am getting the following output
LINE = 00000030
REX = 00000030
ISREDIT = 00000030
SAY = 00000030
Sushanth |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I take it that your code is in a macro rather than just open code.
Tried SEEK but it came up with command not found, but FIND works. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Expat,
Yes it is a macro. Following is the code with FIND
Code: |
/**** REXX ************************************/
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
"ISREDIT MACRO (HEADER)"
"ALLOC DA('HXSULL.TEST(ISTTI)') F(INPUT) SHR REUSE"
"EXECIO * DISKR INPUT (STEM LINES. FINIS"
DO I = 1 TO LINES.0
LINES.I=STRIP(LINES.I)
"ISREDIT FIND ALL '&LINES.I'"
"ISREDIT (COUNT) = FIND_COUNTS"
SAY LINES.I "=" COUNT
END
"FREE F(INPUT)"
EXIT |
I ran it on the same and got the following results
Code: |
LINE = 00000032
REX = 00000032
ISREDIT = 00000032
SAY = 00000032 |
Instead of SEEK, if i run it with SEEK & SEEK_COUNTS. I get the following results.
Code: |
LINE = 00000030
REX = 00000030
ISREDIT = 00000030
SAY = 00000030 |
After running it with FIND, seeing the result and when i came back to my screen. All the 'i' letters were highlighted. So, i did a
The result was 32.
So, i just tried with a variable like L='ISREDIT'
Code: |
"ISREDIT FIND ALL '&L'" |
It gave me 3. yes thats true.
So, i am wondering can a stem variable be passed as a parameter to FIND or SEEK.
Sushanth |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Check the single and double quotes:
Code: |
"isredit seek all '"lines.i"'" |
And don't write REXX in UPPERCASE! |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Make two small changes to your code:
Code: |
DO I = 1 TO LINES.0
LINES.I=STRIP(LINES.I)
"ISREDIT SEEK ALL '"LINES.I"'"
"ISREDIT (COUNT) = SEEK_COUNTS"
SAY LINES.I "=" COUNT
END |
(the second change is: use indentation to improve readability) |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Thank You Marso & Prino. |
|
Back to top |
|
|
|