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 , 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: 1790
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 Will this code extract 1 byte from fi... pkmurali CLIST & REXX 8 Sat Nov 10, 2018 11:13 pm
No new posts Error reading file in REXX module ashek15 CLIST & REXX 3 Wed Oct 24, 2018 4:50 am
No new posts Calling and updating SAS Macro variab... Yogesh Jaiswal All Other Mainframe Topics 7 Thu Oct 11, 2018 12:37 pm
No new posts UNSTRING a big string Apurva Ghogale COBOL Programming 16 Thu Sep 20, 2018 12:12 pm
No new posts Encoding using rexx pkmurali CLIST & REXX 2 Sat Sep 08, 2018 1:05 am

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