Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Give an example for TRUNC built in function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Give an example for TRUNC built in function
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

New User


Joined: 29 Jun 2005
Posts: 86

PostPosted: Fri Dec 02, 2005 12:28 pm    Post subject: Re: Give an example for TRUNC built in function
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us