View previous topic :: View next topic
|
Author |
Message |
dtalele Currently Banned New User
Joined: 25 Jan 2006 Posts: 13 Location: mumbai
|
|
|
|
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 |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
would you plz provide your code
regards,
chandan |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
hncs
New User
Joined: 01 Mar 2006 Posts: 11
|
|
|
|
THIS IS POSTED ALREADY. PLEASE SEARCH PREVIOUS POSTS. |
|
Back to top |
|
|
VENKATA999 Warnings : 2 New User
Joined: 05 Jan 2006 Posts: 44
|
|
|
|
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 |
|
|
|