How to store a lengthy value in a field



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

How to store a lengthy value in a field

Postby ritnihi » Mon Jan 25, 2016 6:13 pm

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.
ritnihi
 
Posts: 9
Joined: Wed Dec 28, 2011 5:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to store a lengthy value in a field

Postby NicC » Mon Jan 25, 2016 7:11 pm

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?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to store a lengthy value in a field

Postby steve-myers » Mon Jan 25, 2016 7:33 pm

  • 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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: How to store a lengthy value in a field

Postby ritnihi » Tue Jan 26, 2016 3:47 pm

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.
ritnihi
 
Posts: 9
Joined: Wed Dec 28, 2011 5:24 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to store a lengthy value in a field

Postby NicC » Tue Jan 26, 2016 4:12 pm

Search the manual for compiler limits. Robert's answer applies.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to store a lengthy value in a field

Postby prino » Tue Jan 26, 2016 4:20 pm

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.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: How to store a lengthy value in a field

Postby Akatsukami » Tue Jan 26, 2016 5:07 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to PL/I