View previous topic :: View next topic
|
Author |
Message |
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
Hi,
What can be the maximum value of a comp-3 variable and how that variable can be declared. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Vivek,
Did you refer any manaul? From the QW -
Quote: |
PACKED-DECIMAL
Specified for internal decimal items. Such an item appears in
storage in packed decimal format. There are two digits for each
character position, except for the trailing character position,
which is occupied by the low-order digit and the sign. Such an
item can contain any of the digits 0 through 9, plus a sign,
representing a value not exceeding 18 decimal digits.
The sign representation uses the same bit configuration as the
4-bit sign representation in zoned decimal fields. For details,
see the Enterprise COBOL Programming Guide. |
|
|
Back to top |
|
|
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
Thanks Murali,
So what you mean is we can declare a COMP-3 variable as s9(18)v9(any number less than 18) comp-3.
Do correct me if i am wrong.
QW? If you can expand on this... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
viveksingal wrote: |
What can be the maximum value of a comp-3 variable and how that variable can be declared. |
If the ARITH(COMPAT) compiler option is in effect: 18 digits or S9(18)...
If the ARITH(EXTEND) compiler option is in effect: 31 digits or S9(31)... |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Vivek,
Quote: |
QW? If you can expand on this... |
QUICK REFERENCE available in MF. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
viveksingal wrote: |
So what you mean is we can declare a COMP-3 variable as s9(18)v9(any number less than 18) comp-3. |
No, tha max number of total digits is 18 or 31.....
Quote: |
Do correct me if i am wrong. |
Consider yourself corrected.... |
|
Back to top |
|
|
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
Thanks guys,
Now comes my actual problem... I want to multipy two values with these declarations ...
Pic S9(11)V9(6) usage COMP-3 and S9(10)V9(2) usage COMP-3
so to capture the result of this multiplication i have to declare a variable in this manner (considering values is maximum in both the input variables)... S9(21)V9(8) usage COMP-3 ...
and my compiler options support declaration of variable with maximum as 18....
How can i handle such a case now ... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
viveksingal wrote: |
and my compiler options support declaration of variable with maximum as 18.... |
Simple, add ARITH(EXTEND) to your compile.... |
|
Back to top |
|
|
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
But i am in need of a solution without changing the Compile options ... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
viveksingal wrote: |
But i am in need of a solution without changing the Compile options ... |
Bull Pucky.....
Either your results are always going to be accurate or not, what is the requirement? Accuracy or close to accurate? |
|
Back to top |
|
|
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
It has to be accurate ... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
viveksingal wrote: |
It has to be accurate ... |
If it has to be accurate and the number of digits is greater than 18, you will have to use ARITH(EXTEND)......
One or the other, accurate or just close to accurate...... |
|
Back to top |
|
|
viveksingal
New User
Joined: 11 Sep 2005 Posts: 10
|
|
|
|
Ok, but when we try to compile it via Endevor ... we are not able to find the ARITH parameter any where ... even when the Compile JCl is JSCANED ... we are not able to find ARITH parameter ....
Any idea on where we have to provide this parameter .... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When your compile is submitted, there are most likely parameters supplied in the compile PARM. You would need to add ARITH to those parms.
If you need to change how the jcl is created, i'd suggest you talk with the people who support Endevor on your system. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
Doesn't COBOL support floating point like PL/1 does? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Yes, COMP-1 & 2, but that still will not guarantee al the digits - another case of almost accurate....grin..... |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
In that case split the digits and the decimals, calculate and join afterwards |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
I don't think that will work for multiplication and division..... |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
Yep........I did it in the last century using PL/1 calculating interest over big money. Just deal with p- and q-parts. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Bitneuker wrote: |
Yep........I did it in the last century using PL/1 calculating interest over big money. Just deal with p- and q-parts. |
I don't know, there was a similar thread a while back and I too thought that it could be gotten around....But after trying with extreme values, the number of digits exceeded the available number and precision was lost..... |
|
Back to top |
|
|
noorkh
New User
Joined: 06 Mar 2006 Posts: 76 Location: Chennai
|
|
|
|
thanks for information. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Bitneuker wrote: |
Yep........I did it in the last century using PL/1 calculating interest over big money. Just deal with p- and q-parts. |
I stand corrected, had a little think time and came up wit a solution along your lines........ |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
CICS Guy wrote: |
I stand corrected, had a little think time and came up wit a solution along your lines........ |
Appriciate that |
|
Back to top |
|
|
|