IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can we compare one char with another char alphabet


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Thu Mar 13, 2008 3:50 pm
Reply with quote

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
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Mar 13, 2008 3:56 pm
Reply with quote

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
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Thu Mar 13, 2008 4:45 pm
Reply with quote

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
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Mar 13, 2008 4:50 pm
Reply with quote

Comparison on what basis???
Have to be sorted order???
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Mar 13, 2008 4:53 pm
Reply with quote

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
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Thu Mar 13, 2008 5:47 pm
Reply with quote

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
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Thu Mar 13, 2008 6:02 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Mar 13, 2008 6:10 pm
Reply with quote

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
View user's profile Send private message
advith001

New User


Joined: 16 Mar 2005
Posts: 23

PostPosted: Thu Mar 13, 2008 7:48 pm
Reply with quote

Dick, this makes sence! Thank you.. I would try this tomorrow! icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top