MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems with Alphanumeric Comparison

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Aug 05, 2003 11:36 pm    Post subject: Problems with Alphanumeric Comparison Reply with quote

Hi,

I received a request to compare two files based on a 3 char Key field. (The field is an alphanumeric field). At one particular instance the key in the first file contained a value of '6E3' and the key in the Second file contained a value of '608'. As per the EBCDIC sequence 6E3 is less than 608. But the program control went inside the greater than condition. Later I found that it considered 6E3 to be the Exponential form 6E+003 ie 6000.

So the result of the comparison was incorrect. Can anyone of you please let me know is there any way in REXX to handle this kind of problems. I fixed a temporary solution by prefixing the key field by 'A'. But I would like a better solution.

Thanks,
Back to top
View user's profile Send private message
warp5
Intermediate


Joined: 02 Dec 2002
Posts: 429
Topics: 18
Location: Germany

PostPosted: Wed Aug 06, 2003 12:44 am    Post subject: Reply with quote

Please post your compare statement so it can be examined.
Back to top
View user's profile Send private message Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Aug 06, 2003 1:54 am    Post subject: Reply with quote

Sure, Here is it. Note: I'm only posting first half of my code

Code:

OUT_COUNT = 0                                 
OUT.      = ''                                 
OUT.0     = 0                                 
                                               
SAY 'PROGRAM STARTED !!!'                     
EXECIO * DISKR INFILE1 (STEM INONE. FINIS"     
SAY 'INONE OPENED: '||INONE.0||' RECORDS'     
EXECIO * DISKR INFILE2 (STEM INTWO. FINIS"     
SAY 'INTWO OPENED: '||INTWO.0||' RECORDS'     
                                               
OUT_COUNT = OUT_COUNT + 1                     
OUT.OUT_COUNT = "ACCOUNT NO, RR NO, RR NAME"   
                                               
J = 1                                         
I = 1                                         
DO WHILE I <= INONE.0 & J <= INTWO.0           
     ONEKEY = SUBSTR(INONE.I, 7, 3)       
     ONENAME = SUBSTR(INONE.I, 14, 32)         
     TWOKEY = SUBSTR(INTWO.J, 32, 3)         
     TWOACCT = SUBSTR(INTWO.J, 14, 9)             
                                                 
     DO WHILE ((I <= INONE.0) & (ONEKEY < TWOKEY))
          I = I + 1                               
          ONEKEY = SUBSTR(INONE.I, 7, 3)     
          ONENAME = SUBSTR(INONE.I, 14, 32)       
     END                                         
                                                 
...............


The Control comes out of the inner DO Statement
Code:
 DO WHILE ((I <= INONE.0) & (ONEKEY < TWOKEY))
when ONEKEY = '6E3' and TWOKEY = '608'.

Please give me your comments.
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Wed Aug 06, 2003 9:32 am    Post subject: Reply with quote

Phantom, If you need to enforce a character comparison, then I think you need to use the strict comparison operator '<<'.

Check out this link:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ3A330/2.2.2.3?SHELF=&DT=20000710164756
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group