View previous topic :: View next topic
|
Author |
Message |
mal_pra007
New User
Joined: 14 Oct 2012 Posts: 5 Location: India
|
|
|
|
Hello,
I have a variable V1 with PIC S9(9)C9(4) COMP-3.
Another variable is -- V2 PIC x(14)
V2-X redefines V2 as PIC 9(9).9(4).
Now, i have to compare V1 with V2 and if they are not equal, then i have to report the difference. Please help me on how to do this in COBOL. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Assuming your V1 is PIC S9(09)V9(4) COMP-3 instead of what you posted (which is not valid COBOL), why not compare V2-X to V1? What happened when you tried it? Since V1 has an implied decimal point, you cannot directly compare V1 to V2 since they would compare equal if and only if the fractional part of V1 was 0000 (the implied decimal point for a PIC X variable is always to the right of the last character).
Quote: |
Please help me on how to do this in COBOL. |
Why not use the obvious
and see what happens? |
|
Back to top |
|
|
|