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

How to compare COMP field and COMP-3 field


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

New User


Joined: 10 Aug 2006
Posts: 4
Location: India

PostPosted: Wed Apr 23, 2008 4:15 pm
Reply with quote

Hi,

Please let me know How to compare COMP field and COMP-3 field

Thanks,
Charu
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 23, 2008 4:48 pm
Reply with quote

IF FIELDA = FIELDB

or

IF FIELDA NOT = FIELDB

Have you tried reading the COBOL manual?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Apr 23, 2008 4:49 pm
Reply with quote

either move the comp-3 to a comp and make the compare
or
the cobol compiler will set up the necessary intermediate fields and perform the conversion for you when you code comp : comp-3.
Back to top
View user's profile Send private message
Sarumathi

New User


Joined: 10 Aug 2006
Posts: 4
Location: India

PostPosted: Wed Apr 23, 2008 6:09 pm
Reply with quote

Thanks for the response.

The Requirement is in CICS
I'll receive the numeric field of length 13 from the map. I need to compare this field with the s9(7) COMP-3 field.
We tried receiving the numeric field splitting into two sub fields with 9(7) and x(6) and then tried compare with s9(7) COMP-3. But it is not working.
For example when 5 is entered, it is received as "5 " i.e 5 and 3 spaces.
So the comparison is failed.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Apr 23, 2008 6:23 pm
Reply with quote

does not matter if it is CICS or anything else. In cobol, if you try to compare alpha with numerics you will not always receive the response that you desire.

you need to take the 13 char input field, and use a NUMVAL function to convert it to numerics.

COMPUTE 9-7-comp-3-field = FUNCTION NUMVAL(13-char-input-field)

IF 9-7-comp-3-field.

you could probably do:

IF COMP-3-field = FUNCTION NUMVAL(13-char-input-field)
Back to top
View user's profile Send private message
Sarumathi

New User


Joined: 10 Aug 2006
Posts: 4
Location: India

PostPosted: Fri Apr 25, 2008 11:28 am
Reply with quote

Thanks for the response.
It worked.
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(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top