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
 

 

How to handle a numeric of size 20 in cobol

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

New User


Joined: 26 Dec 2007
Posts: 18
Location: Chennai, India

PostPosted: Wed Feb 04, 2009 6:57 pm    Post subject: How to handle a numeric of size 20 in cobol
Reply with quote

Hi I have a file in which I have a field like the following
Code:

----+----3----+----4----+----5----+----6----+----7----+----8----+---
-0000000000049926.00                    00090047            20090202
 0000000000000157.40                    00090047            20090202
 0000000000111862.80                    00090047            20090202
 0000000000174050.96                    00090047            20090203
-0000000000326189.75 0000000000000000.0000090047            20090203
-0000000000243879.65                    00090047            20090203
-0000000000000517.82                    00090045            20090203
 0000000000332567.91 0000000000000000.0000010010            20090203
 0000000000090452.91 0000000000000000.0000010010            20090203


The field starting from 21st position till 40th position has to be treated like a numeric field and I have to add all these rows value for this position to find out the sum total in cobol. But cobol does not support numeric of more than 18 size. Can any one please help me to find out how to do that?
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8054
Location: East Dubuque, Illinois, USA

PostPosted: Wed Feb 04, 2009 7:01 pm    Post subject:
Reply with quote

Quote:
But cobol does not support numeric of more than 18 size.
Find the COBOL Programming Guide manual in the manuals link at the top of the page and look at the ARITH(EXTEND) compiler option. You will find your statement is not true if ARITH(EXTEND) is used.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Feb 04, 2009 7:21 pm    Post subject:
Reply with quote

or if you are restricted to an old compiler where the ARITH(EXTEND) option was not yet available, you could split the 20-digit numbers into "left" and "right" halves, add the right halves together, carry (if necessary) to the left halves, add the left halves, then concatenate the halves back together into your 20-digit number and then since you are limited to 18 digits, you'd need to define that 20-digit number as alphanumeric.
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
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 To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am


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