IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Give an example for TRUNC built in function


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
G.S.Sekhar

New User


Joined: 19 Aug 2005
Posts: 5

PostPosted: Fri Dec 02, 2005 11:28 am
Reply with quote

Hi
Please give an example for TRUNC built in function with postive and negative values.

Thanks in advance.

Somu...
Back to top
View user's profile Send private message
balaji81_k

Active User


Joined: 29 Jun 2005
Posts: 155

PostPosted: Fri Dec 02, 2005 12:28 pm
Reply with quote

hai,
trunc is the functions used to truncate all the values after it encounter the decimal point.

eg-1:

trunc(15.9)=ans(15)
trunc(-15.8)= ans(-15).
iam not sure for -ve number but for +ve is correct
Back to top
View user's profile Send private message
Nanda Krishna

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Fri Dec 23, 2005 4:41 pm
Reply with quote

Hi,

e.g. DCL (X,Y) DECIMAL FIXED(3,2);

X = 3.32;
Y = TRUNC(X); /* Y = 3.00 */

X = - 3.32;
Y = TRUNC(X); /* Y = -3.00 */

Note: TRUNC doesn't truncate all the values after it encounter the decimal
point. It only changes the fractional part of an argument to zero.
(It may be +ve or -ve number)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
No new posts INSYNC option with same function as I... JCL & VSAM 0
Search our Forums:

Back to Top