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
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am

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