View previous topic :: View next topic |
Author |
Message |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Tue Aug 05, 2003 11:36 pm Post subject: Problems with Alphanumeric Comparison |
|
|
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 |
|
 |
warp5 Intermediate

Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Wed Aug 06, 2003 12:44 am Post subject: |
|
|
Please post your compare statement so it can be examined. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Wed Aug 06, 2003 1:54 am Post subject: |
|
|
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 |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
|
Back to top |
|
 |
|
|