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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts JCL to get submitted once dataset has... vinu78 JCL & VSAM 17 Thu Feb 16, 2017 7:32 am


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