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
 

 

Dollar sign for non zero values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Dollar sign for non zero values
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: 8056
Location: East Dubuque, Illinois, USA

PostPosted: Sun Jan 11, 2009 10:06 pm    Post subject:
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    Post subject: @ Robert
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    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 Sorting of hex values Saurabh_mi DFSORT/ICETOOL 4 Thu May 25, 2017 3:49 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


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