View previous topic :: View next topic
|
Author |
Message |
Sarumathi
New User
Joined: 10 Aug 2006 Posts: 4 Location: India
|
|
|
|
Hi,
Please let me know How to compare COMP field and COMP-3 field
Thanks,
Charu |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
IF FIELDA = FIELDB
or
IF FIELDA NOT = FIELDB
Have you tried reading the COBOL manual? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Sarumathi
New User
Joined: 10 Aug 2006 Posts: 4 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Sarumathi
New User
Joined: 10 Aug 2006 Posts: 4 Location: India
|
|
|
|
Thanks for the response.
It worked. |
|
Back to top |
|
|
|