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
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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