View previous topic :: View next topic
|
Author |
Message |
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
10 abc-x pic x occurs 24 times.
10 xyz-x pic x occurs 24 times.
these two arrays can contain alphabets a,b,c,d...soo.. also 0,1,2,3,...
my requirement is to build another array which is having a bad history, means greater value has to be captured...
Plz advice! |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Are you referring this?
Code: |
IF abc-x(i) > xyz-x(i) THEN
...put in another array... |
Please add some more info on this. |
|
Back to top |
|
|
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
yes,
see the data;
80868939001165701D0432100000BBBBBBBBBBBBB20070627
80868939001165799LLLL321000EEEE0EE00EEEEE20020115
The underlined data is the string of array.. I shud compare both the data and put it in another array... |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Comparison on what basis???
Have to be sorted order??? |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
|
|
advith001 wrote: |
yes,
see the data;
80868939001165701D0432100000BBBBBBBBBBBBB20070627
80868939001165799LLLL321000EEEE0EE00EEEEE20020115
The underlined data is the string of array.. I shud compare both the data and put it in another array... |
can u provide us the actual requirement so that we can help u. |
|
Back to top |
|
|
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
abc-x pic x occurs 24 times -- value is D0432100000BBBBBBBBBBBBB
xyz-x pic x occurs 24 times -- value is LLLL321000EEEE0EE00EEEEE
pqr-x pic x occurs 24 times -- result of comparison
if abc-x(i) > xyz-x(i)
Move abc-x(i) to pqr-x(i)
else
move xyz-x(i) to pqr-x(i).
I can do this.. but the reulst is L0433210000EEE0EE00EEEEE
considering number is greater than alphabets.. but in my senario, 0 is the least and Z is the highest value I mean 0123456789abcd...z (a is greater than 0 to 9)
Hope this is more clreat abt my req..
Thanks guys in advance... |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
The results are coming like this b'coz: Hex valule of the Number is greater than that of the character.
eg: 0(X'F0') > A(X'C1')
-Ajay |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
well, here is another example of plan without planning.
a is not greater than 0. so simple comparisions are not going to work.
suggest that you have a conversion table.
01 in-val.
05 filler pic x( )
value '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
01 out-val.
05 filler pic x( )
value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.
then before your compare:
move abc-x(i) to abc-value
move xyz-x(i) to xzy-value
convert abc-value with in-val/out-val (0 would become an A, A>K)
convert xyz-value same
that way abc-x(i) = 0, abc-value would be A
xyz-x(i) = A, xzy-value would be K
thus
IF abc-value < xzy-value
move abc-x(i) to pqr-x(i)
else
move xzy-x(i) to pqr-x(i) |
|
Back to top |
|
|
advith001
New User
Joined: 16 Mar 2005 Posts: 23
|
|
|
|
Dick, this makes sence! Thank you.. I would try this tomorrow! |
|
Back to top |
|
|
|