Mainframe Question_CEIL function in PL/1



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

Mainframe Question_CEIL function in PL/1

Postby Aish » Tue Dec 17, 2013 4:52 pm

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.
Aish
 
Posts: 1
Joined: Tue Dec 17, 2013 4:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Mainframe Question_CEIL function in PL/1

Postby enrico-sorichetti » Tue Dec 17, 2013 5:30 pm

... oops ... replied to the wrong topic
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Mainframe Question_CEIL function in PL/1

Postby NicC » Tue Dec 17, 2013 7:16 pm

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.
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: Mainframe Question_CEIL function in PL/1

Postby enrico-sorichetti » Tue Dec 17, 2013 7:55 pm

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 )
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post