Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8165
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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us