IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem with division in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 275
Location: Mumbai

PostPosted: Fri Feb 24, 2006 7:34 pm
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: 1448
Location: Chicago, IL

PostPosted: Fri Feb 24, 2006 8:25 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top