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 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: 2504
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: 965
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: 2504
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 Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Extract Data till prev hour balaji81_k DB2 16 Fri Aug 25, 2017 9:25 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm

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