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

Can we pass a variable to SEEK command


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

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jul 29, 2009 4:33 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jul 29, 2009 4:49 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jul 29, 2009 5:23 pm
Reply with quote

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
Code:
F ALL 'i'

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Jul 29, 2009 5:24 pm
Reply with quote

Check the single and double quotes:

Code:
"isredit seek all '"lines.i"'"


And don't write REXX in UPPERCASE!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 29, 2009 5:32 pm
Reply with quote

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
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Wed Jul 29, 2009 5:51 pm
Reply with quote

Thank You Marso & Prino.
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 RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
Search our Forums:

Back to Top