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: 7932
Location: Bellevue, IA

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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


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