Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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 -> Mainframe COBOL
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
References
PostPosted: Wed Apr 23, 2008 4:15 pm    Post subject: Re: How to compare COMP field and COMP-3 field Reply with quote

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 893
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

Senior Member


Joined: 20 Oct 2006
Posts: 1176
Location: germany

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

Senior Member


Joined: 20 Oct 2006
Posts: 1176
Location: germany

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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1