View previous topic :: View next topic
|
Author |
Message |
jtwohig
New User
Joined: 24 Jul 2006 Posts: 18
|
|
|
|
Hi,
Ok, trying to clear the Cobol cobwebs. I have these 3 fields:
05 WW-SEG-01 PIC X(10).
05 WW-SEG-01-RE REDEFINES WW-SEG-01.
10 WW-SEG-01-N PIC 9(04).
10 WW-SEG-01-N2 PIC 9(06).
05 WW-PREV-SEG-01 PIC 9(04) VALUE 0.
05 WW-DIFF PIC 9(04) VALUE 0.
and this calc:
COMPUTE WW-DIFF = (WW-SEG-01-N - WW-PREV-SEG-01 )
Basically, I want to see if the difference between the two fields is > 1
and then...do something
IF WW-DIFF > 1
DISPLAY '********************************'
DISPLAY 'WW-SEG-01-N : ' WW-SEG-01-N
DISPLAY 'WW-PREV-SEG-01: ' WW-PREV-SEG-01
DISPLAY 'WW-DIFF : ' WW-DIFF
END-IF
This is what displays when I run my program:
WW-SEG-01-N : 10
WW-PREV-SEG-01: 9 0
WW-DIFF : 8000
Any idea why ?
Thanks,
J. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
J,
Without knowing exactly what your input values are it's difficult to tell you exactly why you're getting the results you are. The results appear to contradict each other in formatting.
However, I think your question is why you 10 ? 90 = 80? The problem is that the result field is defined as a non signed field. The result is the Absolute (positive) vale for the number. Define the result field as S9(4). Your results will be different.
Dave |
|
Back to top |
|
|
jtwohig
New User
Joined: 24 Jul 2006 Posts: 18
|
|
|
|
Thanks Dave. Had a temporary memoery lapse but I have figured this problem out...
J |
|
Back to top |
|
|
|