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
 

 

Problem with division in cobol

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

New User


Joined: 25 Jan 2006
Posts: 13
Location: mumbai

PostPosted: Fri Feb 24, 2006 12:45 pm    Post subject: Problem with division in cobol
Reply with quote

Hi all,

I am facing a problem with COBOL DIVIDE which i will explain you in detail.

i have a field A PIC 9(31). IT IS HAVING SOME VALUE SAY 94375.

(THE VALUE OF A IS HAVING 16 DIGITS IN MY PROGRAM)

I HAVE TO DIVIDE THAT FIELD BY SAY 97.

NOW WHAT I AM WRITING IN COBOL PROGRAM IS

DIVIDE A BY 97 GIVING B REMAINDER C.

BY USING THIS I AM NOT GETTING THE PROPER ANSWER AS IT IS TAKING SOME OF THE DIGITS FROM THE ACTUAL QUOTIENT WHICH IS MY REQUIRED ANSWER.
& DUE TO THAT ALSO NOT GETTING PROPER REMAINDER.

AND IF DECLARE A AS PIC 9(16) IT GIVES THE PROPER ANSWER.

SO COULD YOU PLEASE HELP ME ON THIS ISSUE.
Back to top
View user's profile Send private message

chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Fri Feb 24, 2006 7:34 pm    Post subject: Re: Problem with division in cobol
Reply with quote

Hi,
would you plz provide your code
regards,
chandan
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Feb 24, 2006 8:25 pm    Post subject: Re: Problem with division in cobol
Reply with quote

dtalele,

I find an almost similar question posted by another user. Quite strange you both got the same doubt.

Quote:
i have a field A PIC 9(31). IT IS HAVING SOME VALUE SAY 94375.

Can you define a Numeric Field with 31 digits position. It would not exceed 18...I think.... pls provide your code for a better understanding.

Please correct, I may be wrong as usual...

Regards,

Priyesh.
Back to top
View user's profile Send private message
hncs

New User


Joined: 01 Mar 2006
Posts: 11

PostPosted: Thu Mar 02, 2006 4:56 pm    Post subject: DIVIDE PROBLEM
Reply with quote

THIS IS POSTED ALREADY. PLEASE SEARCH PREVIOUS POSTS.
Back to top
View user's profile Send private message
VENKATA999
Warnings : 2

New User


Joined: 05 Jan 2006
Posts: 44

PostPosted: Sun Mar 05, 2006 7:12 pm    Post subject: Re: Problem with division in cobol
Reply with quote

Hi Friends ,

The problem is that , numeric dataname should not declare more than 9(18) . If any one do so , will get unpredictable results .The reason why 9(16) is giving the correct result , because 9(16) itself is able to store the value which u are giving .

Incase of alphabetic dataname it is 30 and alphanumeric it is 128 .


I hope this will help . Let me know if u have any concerns .

Thank you,
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. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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