Page 1 of 1

How to store a lengthy value in a field

PostPosted: Mon Jan 25, 2016 6:13 pm
by ritnihi
Hi,

What we should be the declaration for an field which stores the below value. The declaration can be in working storage or PL/1 copybook layout also.
Like if 3/101, it gives value a more than 30 decimal values i.e 0.029702970297029702970.....

Thanks.

Re: How to store a lengthy value in a field

PostPosted: Mon Jan 25, 2016 7:11 pm
by NicC
PL/1 doesn't have copybooks - they are include members. Same thing but copybook is a COBOL term.

How many decimals are you required to store? Have you asked the analyst responsible for the design?

Re: How to store a lengthy value in a field

PostPosted: Mon Jan 25, 2016 7:33 pm
by steve-myers
  • No data area can hold the "complete" value you are showing. It is not possible. I'm going to break the rules and point to this Wikpedia article. You can use Google or your preferred search function to find other articles about this topic.
  • Of course, you didn't bother to show us the declaration you did make. This IBM manual can offer some suggestions. Use it.

Re: How to store a lengthy value in a field

PostPosted: Tue Jan 26, 2016 3:47 pm
by ritnihi
Hi NicC,
Yes, I am sorry that Pl/1 has include members not copybooks. I am a cobol developer so used that term.
I want to store the maximal possible decimals values. I have read the IBM manuals and understood that I can use BINARY or FIXED DECIMAL, but it will be great if you can tell me the solution for this.

Regards,
ritnihi.

Re: How to store a lengthy value in a field

PostPosted: Tue Jan 26, 2016 4:12 pm
by NicC
Search the manual for compiler limits. Robert's answer applies.

Re: How to store a lengthy value in a field

PostPosted: Tue Jan 26, 2016 4:20 pm
by prino
No, you don't want to store the maximum number of digits, as that is completely useless, and would only be done by someone who is totally clueless about accuracy and significant figures.

Then again, if the description in the previous sentence matches you, and you want to really hold a few zillion digits, just convert the GNU Multiple Precision Arithmetic Library to PL/I.

Re: How to store a lengthy value in a field

PostPosted: Tue Jan 26, 2016 5:07 pm
by Akatsukami
ritnihi wrote:Hi NicC,
Yes, I am sorry that Pl/1 has include members not copybooks. I am a cobol developer so used that term.
I want to store the maximal possible decimals values. I have read the IBM manuals and understood that I can use BINARY or FIXED DECIMAL, but it will be great if you can tell me the solution for this.

Regards,
ritnihi.

You do not, repeat not, want to use a scale other than zero with a FIXED BINARY variable.

As the IBM Knowledge Center appears to be wedged at the moment, I will tell you that you simply have to declare a FIXED DECIMAL variable with the maximum number of digits (15 or 31, depending on compiler options), and the same as scale. I will also echo Mr. Prins' sentiment that this is a stupid and useless thing to do. If this is a requirement imposed by some clueless analyst, team lead, or manager, resist it with whatever power is yours whilst looking for another position. If this idea is yours, drop it; it's a bad one.