Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to compare COMP field and COMP-3 field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to compare COMP field and COMP-3 field
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    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Wed Apr 23, 2008 4:49 pm    Post subject:
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    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Wed Apr 23, 2008 6:23 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts fuzzy compare Martylin JCL & VSAM 9 Thu Mar 30, 2017 2:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us