Hi,
What is the maximum decimal position a numeric data item can have in COBOL. When I search for it I got the details about ARTH(EXTEND) but that's about using 31 digits in a numeric number. So does that mean if I want to use a decimal number, it can have 31-digits after decimal with that option active?
COBOL decimal number limit.
-
- Registered Member
- Posts: 24
- Joined: Mon Aug 12, 2013 10:50 am
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: COBOL decimal number limit.
For decimal (zoned or packed) 31 digits is the maximum, achieved, as you have pointed out correctly, by using compiler option ARITH(EXTEND). With ARITH(COMPAT) the maximum is 18 digits.
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: COBOL decimal number limit.
The answer partly depends upon what you want to know. As far as fixed-decimal arithmetic, 31 digits is the absolute limit for a single variable in Enterprise COBOL. However, COBOL supports floating point variables that can use larger / smaller values (but the precision won't go over 8 or 16 digits, depending upon which COMP floating point format you use).
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: COBOL decimal number limit.
ARITH(EXTEND) also increases the number of significant digits for COMP-1/COMP-2 floating-point data. Note that floating-point values are an "approximation" of a true decimal value. Sometimes a little off down a number of decimal places.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute