Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Rexx Variable Substitution with POS command

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Jul 07, 2011 7:21 pm    Post subject: Rexx Variable Substitution with POS command
Reply with quote

I can not get a substitution variable to work using the POS command
and have seen nothing in the manulas telling me that I can not do this.

Has anyone done this..????? It works fine with other commands.

genlvl = '&gen040'||'='

genver = pos('"genlvl"',text)
Back to top
View user's profile Send private message

daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 711
Location: Pennsylvania

PostPosted: Thu Jul 07, 2011 7:29 pm    Post subject:
Reply with quote

I would run the exec with a TRACE(I) just before the code in question.

A TRACE(0) just afterwards will stop the clutter.

There looks like lots of quotes (and double quotes) confusing things.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10478
Location: italy

PostPosted: Thu Jul 07, 2011 7:44 pm    Post subject: Reply to: Rexx Variable Substitution with POS command
Reply with quote

no reason not to work if coded correctly,
variable needles and haystacks are most common in non basic REXX parsing!

rather than debugging Your code ( clear as mud, I dare to say icon_biggrin.gif )

here is working snippet , which correctly return 6


Code:
 000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000002 /*                                                                   */
 000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 000004 Trace "O"                                                               
 000005                                                                         
 000006 Parse Source _sys _how _cmd .                                           
 000007                                                                         
 000008 text   = ".....&GEN040=..."                                             
 000009 genlvl = '&GEN040' || '='                                               
 000010 say pos(genlvl,text)                                                   
 000011                                                                         
 000012 Exit 0                                                                 
 000013                                                                         


tested and working

given the scarce info provided that' s the best I can do
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2110
Location: Silicon Valley

PostPosted: Thu Jul 07, 2011 8:10 pm    Post subject: Reply to: Rexx Variable Substitution with POS command
Reply with quote

Quote:
I can not get a substitution variable to work


Are you expecting the ampersand to resolve and substitute the variable?

It seems like you want this to work:
Code:
gen040 = 'testlvl'
genlvl = '&gen040'||'='

genver = pos('"genlvl"',text)


If you want it to be treated as a variable, do not use quotes:
Code:
gen040 = 'testlvl'
genlvl = gen040 ||'='

genver = pos('"genlvl"',text)
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Jul 07, 2011 8:14 pm    Post subject: Reply to: Rexx Variable Substitution with POS command
Reply with quote

GENVER = GENIDS||'='
"&GEN040="

517 *-* say 'text='text
>>> "text=//WSS820P1 PROC GEN040='+1',
"
text=//WSS820P1 PROC GEN040='+1',


518 *-* GENBEG = POS(GENVER,TEXT)
>>> "0"

As you can see this did not return the position 0, this is
the only time I have had problems using the POS command.
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10478
Location: italy

PostPosted: Thu Jul 07, 2011 8:21 pm    Post subject: Reply to: Rexx Variable Substitution with POS command
Reply with quote

a zero position is the proper result when searching for ( needle )
Code:
&GEN040=


and the strings being searched ( haystack) does not contain it
as per
Code:
text=//WSS820P1 PROC GEN040='+1',   
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Jul 07, 2011 8:27 pm    Post subject:
Reply with quote

enrico,

You are so right.... and I am blind as a BAT and just as tired, as I said
I have never had any trouble using the pos and substitution before, so
I was trying the different combo's with command. It was not until your
reply I see just what was wrong and what I was checking for......

Thanks once again from this tired old dog............. icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10478
Location: italy

PostPosted: Thu Jul 07, 2011 8:30 pm    Post subject: Reply to: Rexx Variable Substitution with POS command
Reply with quote

don' t worry, it happens!
and what' s wrong with old dogs anyway...
I bet I am older than You icon_biggrin.gif
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu Jul 07, 2011 8:32 pm    Post subject:
Reply with quote

I have been doing this for 42 years just to give you and Idea of my age
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help on TDQ load from file using... subratarec CICS 4 Wed Jun 13, 2018 11:32 pm
This topic is locked: you cannot edit posts or make replies. Rexx code to find greater then symobl... Bharath Vikraman CLIST & REXX 8 Tue May 29, 2018 9:40 am
No new posts Trap the jcl error message or maxcc i... ankita agarwal CLIST & REXX 5 Fri May 18, 2018 2:08 pm
No new posts Rexx command to open an another text ... Bharath Vikraman PC Guides & IT News 7 Sat May 12, 2018 4:34 pm
No new posts IBM Pcomm macro startmacro command do... JGregoire IBM Tools 0 Wed May 09, 2018 12:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us