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
 

 

How can I remove trailing zeros from a Floating point data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anil.csk

New User


Joined: 22 Oct 2007
Posts: 16
Location: Noida

PostPosted: Fri Jun 06, 2008 4:32 pm    Post subject: How can I remove trailing zeros from a Floating point data
Reply with quote

How can I remove trailing zeros from floating point data. In COBOL I've done this with referential modification. I want to know any simpler method.

After the decimal point data can be up to six digits. Here I'm taking the example up to there digist after decimal point:

example..

data is: 234.120

I want to represent as 234.12

if data is 234.100

then I want to represent as 234.1

f 234.001
then I want to represent as 234.001

if 234.010
then I want to represent as 234.01
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 06, 2008 4:43 pm    Post subject: Re: How can i remove trailing zeros form a Floating point da
Reply with quote

Simple. Assuming the data has been moved to an edited-pattern (as you've illustrated), begin at the last byte and test each byte (while moving backwards) for NUMERIC and ZERO, until the given tested-byte is NUMERIC and non-ZERO. You can put this in an in-line "PERFORM" loop.

You'll also have to make accommodations for the "period".

Bill
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Fri Jun 06, 2008 5:24 pm    Post subject:
Reply with quote

What does this have to do with floating point?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jun 06, 2008 5:40 pm    Post subject: Re: How can i remove trailing zeros form a Floating point da
Reply with quote

Bill O'Boyle wrote:
Simple. Assuming the data has been moved to an edited-pattern (as you've illustrated), begin at the last byte and test each byte (while moving backwards) for NUMERIC and ZERO, until the given tested-byte is NUMERIC and non-ZERO. You can put this in an in-line "PERFORM" loop.

You'll also have to make accommodations for the "period".

Bill


until the given tested-byte is NOT NUMERIC OR (NUMERIC and non-ZERO).

It has nothing to do with floating point.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 06, 2008 7:03 pm    Post subject: Re: How can I remove trailing zeros from a Floating point da
Reply with quote

Craig,

In my post, I had made a SWAG that the floating-point number had been moved to an edit-pattern, because this is what was illustrated.

Yes, COMP-1 and/or COMP-2 Floating-Point values are a different animal from any other format.

Bill
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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