IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

supression of zeroes


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
satish kanamarlapudi

New User


Joined: 23 Jul 2008
Posts: 29
Location: Little Rock - Arkansas

PostPosted: Wed Dec 31, 2008 1:10 pm
Reply with quote

Hi,


I had a requirement where in the output field instead of getting 0.00 which is declared as s9(13)v(02) comp-3, i should get the output as 0 only.

I tried giving it as z(08)vz(02) but it is coming as 0.00.

Please help me out in this.

Thx,
satish
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Dec 31, 2008 4:00 pm
Reply with quote

I tried a few options (like MOVE'0' TO WS-AMOUNT-EDIT) but it didn't help.
I would do with plain cobol:
Code:
01  WS-AMOUNT.
    03 WS-AMOUNT-EDIT    PIC z(8).9(2).

IF my-amount = 0 THEN
    MOVE '           0' TO WS-AMOUNT
ELSE
   MOVE my-amount TO WS-AMOUNT-EDIT
END-IF

(I think the 0 should be on the right)
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Wed Dec 31, 2008 4:56 pm
Reply with quote

Satish,
Is it specific to zero or any numbers which have no decimal part like 13.00 as 13 and so on?

If yes,then you have to compare the decimal part of your number and if it is 00,you have to move the number to a numeric variable which has no declaration of decimals.

Hope this helps.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 31, 2008 10:40 pm
Reply with quote

Hello,

This:
Code:
       01  Y                 PIC ZZ,ZZZ,ZZZ.BB-.     
                                                     
      *                                               
       PROCEDURE DIVISION.                           
       0000-MAINLINE.                                 
           MOVE 0123.00 TO Y.                         
           DISPLAY Y.                                 
           GOBACK.     

gives:
Code:
     123. 


Will this do what you want?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Dec 31, 2008 11:34 pm
Reply with quote

I think satish needs to answer muthuval's question before we can offer any more suggestions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to fill with zeroes pd intended s... DFSORT/ICETOOL 6
No new posts Converting spaces to zeroes DFSORT/ICETOOL 7
No new posts Squeeze record left so that zeroes ar... SYNCSORT 5
No new posts Format record to remove Leading zeroes DFSORT/ICETOOL 14
Search our Forums:

Back to Top