Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Want to see if the difference between the two fields is >

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Mon Aug 07, 2006 6:11 pm    Post subject: Want to see if the difference between the two fields is >
Reply with quote

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
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Aug 07, 2006 11:11 pm    Post subject: Re: compute
Reply with quote

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
View user's profile Send private message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Mon Aug 07, 2006 11:27 pm    Post subject: Re: compute
Reply with quote

Thanks Dave. Had a temporary memoery lapse but I have figured this problem out...
J
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
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us