Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Harold Barnes

New User

Joined: 27 Oct 2015
Posts: 30
Location: United States

 Posted: Fri Aug 28, 2020 12:38 am    Post subject: Compare two character variables Head Scratcher Can someone explain why the 9 characters compare not equal (correct) but the 10 characters compare is neither equal or not equal? /* REXX */ trace o /* en = "1000000464" xs = "1000000468" */ en = "100000464" xs = "100000468" if en ¬= xs then do say "Not Equal" exit -1 end if en == xs then do say "equal" exit 0 end say "exit 99" exit 99 vs /* REXX */ trace o en = "1000000464" xs = "1000000468" /* en = "100000464" xs = "100000468" */ if en ¬= xs then do say "Not Equal" exit -1 end if en == xs then do say "equal" exit 0 end say "exit 99" exit 99

Joerg.Findeisen

Active User

Joined: 15 Aug 2015
Posts: 311
Location: Bamberg, Germany

Posted: Fri Aug 28, 2020 3:16 am    Post subject:

 Code: NUMERIC DIGITS 10

to see the difference.

PS: Change == to =
Joerg.Findeisen

Active User

Joined: 15 Aug 2015
Posts: 311
Location: Bamberg, Germany

Posted: Fri Aug 28, 2020 3:30 am    Post subject:

To compare strings, use the compare() function.

 Code: if compare(en,xs)¬=0 then say "Not Equal"; else say "Equal"
Harold Barnes

New User

Joined: 27 Oct 2015
Posts: 30
Location: United States

 Posted: Fri Aug 28, 2020 4:46 am    Post subject: Reply to: Compare two character variables Head Scratcher It has to do with non-strict compares. I switched to strict compares and now it works as expected. Time to get enlightened about strict compares.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Compare multiple files using JCL/Rexx... tanvi110788 JCL & VSAM 4 Tue May 19, 2020 5:47 pm Foreign character look different in m... hsinaz50 COBOL Programming 3 Tue May 12, 2020 6:40 am Compare Two datasets and Override Mat... ArunkumarGanesan DFSORT/ICETOOL 7 Mon Apr 27, 2020 7:45 pm To compare an input file with a maste... lekshmi133 COBOL Programming 5 Tue Apr 14, 2020 3:01 pm Is it possible to compare two files i... kushkush DFSORT/ICETOOL 3 Mon Apr 13, 2020 8:33 am

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us