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

Dollar sign for non zero values


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paramita.barman

New User


Joined: 12 Oct 2006
Posts: 18

PostPosted: Sun Jan 11, 2009 9:58 pm
Reply with quote

Hi,

I have got a 9(2).99 field. I need to add a $ sign for any value greater than 0, but no $ sign should come for any value equal to zero. For ex: 01.01 should become $01.01. But 00.00 shd remain 00.00.

How is it possible in Cobol?

Thanks in advance.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sun Jan 11, 2009 10:06 pm
Reply with quote

Code:
       01  WS-VARIABLES.
           05  WS-WITH                 PIC $99.99.
           05  WS-WITHOUT              REDEFINES WS-WITH
                                       PIC B99.99.

       LINKAGE SECTION.
      /
       PROCEDURE DIVISION.
       S1000-MAIN       SECTION.
           MOVE ZERO                   TO  WS-WITHOUT.
           DISPLAY WS-WITHOUT.
           MOVE 1.01                   TO  WS-WITH.
           DISPLAY WS-WITH.
produces as output
Code:
  00.00
 $01.01
Back to top
View user's profile Send private message
paramita.barman

New User


Joined: 12 Oct 2006
Posts: 18

PostPosted: Sun Jan 11, 2009 10:10 pm
Reply with quote

Thanks a lot [icon_smile.gif]
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
Search our Forums:

Back to Top