Page 1 of 1

Mainframe Question_CEIL function in PL/1

PostPosted: Tue Dec 17, 2013 4:52 pm
by Aish
Hi Team,
This is regarding a query in Mainframe.
I have a requirement (PLI) where a value is being displayed as 0.9791 with the variable defined as FIXED(15,4). The value is derived on some calculation and stored in this variable. When the same calculation is done in excel, the result is 0.9792. The business requirement is to have the value displayed as 0.9792 without changing the variable declaration. Does the CEIL function in PLI help here ? Is it similar to CEILING function in excel ?
Please let me know the options if any asap.
Thanks,
Aish.

Re: Mainframe Question_CEIL function in PL/1

PostPosted: Tue Dec 17, 2013 5:30 pm
by enrico-sorichetti
... oops ... replied to the wrong topic

Re: Mainframe Question_CEIL function in PL/1

PostPosted: Tue Dec 17, 2013 7:16 pm
by NicC
Hello, and welcome to the forum. A couple of pointes to conesider... We do not do asap; we do as and when we want and if we want. You want asap? You pay for it.
Scondly... as this is a mainframe forum why waste time typing "mainframe question"?

If you wanted it asap you would have written a little program to test it out for yourself and you would have had your answer by now - even before posting!
Note that Excel does its calculations to 126 or so decimals. I don not know how many decimals mainframe does it to without looking up a manual. And I suspect you need rounding not ceilings.

Re: Mainframe Question_CEIL function in PL/1

PostPosted: Tue Dec 17, 2013 7:55 pm
by enrico-sorichetti
I don not know how many decimals mainframe does it to without looking up a manual.

PIC computations are done WITH the precision ( decimal places if You want ) specified in the picture ...

but IIRC PL/1 when evaluating an expression adjusts beforehand everything to the highest precision
of the variables involved in order to process properly the intermediate results

2decplaces = 3decplaces * 6decplaces

3decplaces gets converted/adjusted to 6 decimal places
the result is truncated to 2 decimal places

2decplaces = 2decplaces / 2decplaces
no precision adjustment takes place

for financial application there are rules to be followed
Your auditing department should be able to tell

in Italy for example all the computations for the IRS must be carried on with 4 decimal places
and the result must be rounded and displayed with 2 decimal places ( cents of Euros of course )