Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 2 Wed Jul 26, 2017 5:19 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us