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: 964
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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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