Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us