Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Rexx , string comparison through variables

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

New User


Joined: 12 Sep 2013
Posts: 4
Location: ABCD

PostPosted: Wed Jan 08, 2014 11:22 am    Post subject: Rexx , string comparison through variables
Reply with quote

Working on a Rexx program , I am trying to compare two variables containg value as a single alphabet , its not working , when I display values of the two variables they are same. like : Variable1 = A , Variable2 = A
If Variable1 = A (its working )
but if i give Variable1 = Variable2 ( It does not work )

I have initailised both variables at the start of my Rexx program.
variable1 I take as input from user (PULL Variable1) and Variable2 I read from file.
Please advise , thank you.
Back to top
View user's profile Send private message

sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 08, 2014 11:28 am    Post subject:
Reply with quote

Hi Ruchita,

Could you provide the code you've tried?
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 08, 2014 11:38 am    Post subject:
Reply with quote

You may try using this built-in function,

Code:

COMPARE(string1, string2[, pad])

    returns "0" if "string1" and "string2" are identical
    otherwise, returns the position of the first character that does not match
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Wed Jan 08, 2014 1:16 pm    Post subject:
Reply with quote

If Variable1 & Variable2 has the same string, IF VARIABLE1 = VARIABLE2 condition should work independent of whether you are getting the values from console or file.
We will be able to help if you provide your REXX code with TRACE ON.
Back to top
View user's profile Send private message
Ruchita Jain

New User


Joined: 12 Sep 2013
Posts: 4
Location: ABCD

PostPosted: Wed Jan 08, 2014 6:02 pm    Post subject: Reply to: Rexx , string comparison through variables
Reply with quote

Thank you , I performed some hit and trial , variable2 is coming from file so was picking spaces too, solved the issue icon_surprised.gif
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Thu Jan 09, 2014 9:29 am    Post subject:
Reply with quote

Great!. Trace functionality in REXX always help in such cases.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Jan 09, 2014 11:05 pm    Post subject:
Reply with quote

Here's a good example of why we require that querents produce the actual code, enclosed in Code tags.
Code:
/* Rexx */                               
  v1 = "A"                               
  v2 = "A "                             
                                         
  if (v1=v2) then                       
    say "V1 is equal to V2"             
  else                                   
    say "V1 is not equal to V2"         
                                         
  if (v1==v2) then                       
    say "V1 is strictly equal to V2"     
  else                                   
    say "V1 is not strictly equal to V2"
                                         

Note that v1 is equal,, but not strictly equal, to v2.
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us