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

Compare Numeric and Character


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

New User


Joined: 26 Feb 2006
Posts: 38

PostPosted: Wed Dec 20, 2006 4:15 pm
Reply with quote

Hi,

I have two variables. One is from the file (Trailer count x(9)). another is a counter that i have in the program 9(7).

counter1 x(9) - value is '000000045'
counter2 9(7) - value is '0000045'

If u compare, both have to be equal logically (45 & 45) but the result says they are different. I hope it does a character comparison since one is character.

Kindly, let me know is there any other alternative.

Regards
SSR
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Dec 20, 2006 4:32 pm
Reply with quote

Hi SSR,

One alternative is to move counter1 to numeric variable if it is numeric & then compare.
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Wed Dec 20, 2006 6:16 pm
Reply with quote

Hi SSR,

The comparision can be done only for compatible data types.
You can redefine the counter1 as
counter1-num redfeines counter1

Then compare counter1-num and counter2. I hope this will work fine.

Sandeep
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Compare two files with a key and writ... SYNCSORT 3
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts How to compare two rows of same table DB2 11
Search our Forums:

Back to Top