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
 

 

Want to display the amount like ($127.00)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Mon Dec 12, 2005 9:19 pm    Post subject: Want to display the amount like ($127.00)
Reply with quote

Hi,

I want to display the amount like

($127.00)

how can I display like this.

thanks in advance

pavan
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon Dec 12, 2005 10:08 pm    Post subject: Re: display format in cobol
Reply with quote

Hi pavan,

If your variable is 9(5) numeric... to get it displayed with currency sign...

picture of the field should be $99999...

after moving 11111 in this variable it gives $11111.

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Dec 13, 2005 5:18 am    Post subject:
Reply with quote

Hi Pavan,

Priyesh's solution works well if the field is filled totally with no leading zeros. If the field contains "1" it DISPLAYs as "$00001. Kind of awkward.

If you have a field defined as 9(005)V99 and it contains 12700, you may want to define a display field as $$$$$9.99. If you move the original field to the display field and DISPLAY it, it will display as:

bb$127.00 where b is a leading space. Note that the display field contains 2 more positions than the original field. The additional positions are needed to accommodate a 7 digit number and the $ sign and the decimal point.
Back to top
View user's profile Send private message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Tue Dec 13, 2005 6:08 pm    Post subject: format confirmation
Reply with quote

hi all,

thanks for answers but I want the amount should display with in parenthesis ( and ).

I am able to display the amount like $125.00 but I want to display like ($125.00) and my picture clause is $9(6)9.9(2).

I am getting the result if the value is 5.00 is
( $5.00) but I have to get ($5.00)

I hope the problem is clear.

pavan
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 13, 2005 9:16 pm    Post subject: Re: Want to display the amount like ($127.00)
Reply with quote

Then you'll have to define a variable with three sub-level.

01 Final-Value
05 First-Bracket PIC X Value "(".
05 Data-Value PIC $$$$9.
05 Last-Bracket PIC X Value ")".

Regards,

Priyesh.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Dec 14, 2005 11:51 pm    Post subject: Re: Want to display the amount like ($127.00)
Reply with quote

This is the only way I'm aware of tat you can produce the output your looking for'

Code:

01  WS-DISPLAY-DOLLAR.                                         
    05 WS-DOLLAR-AMOUNT         PIC $$$,$$$.99.                 
    05 FILLER                   PIC X             VALUE ')'.   
01 SUB                          PIC S9(12)        COMP-3.       

MOVE  127.00                TO WS-DOLLAR-AMOUNT.         
DISPLAY WS-DOLLAR-AMOUNT.                               
                                                         
PERFORM                                                 
  VARYING SUB FROM 1 BY 1                               
  UNTIL WS-DISPLAY-DOLLAR(SUB:1) NOT = ' '               
END-PERFORM.                                             
                                                         
MOVE '('                TO WS-DISPLAY-DOLLAR(SUB - 1:1).
                                                         
DISPLAY WS-DISPLAY-DOLLAR.                               


Results:

$127.00
($127.00)
Back to top
View user's profile Send private message
i413678
Currently Banned

Active User


Joined: 19 Feb 2005
Posts: 112
Location: chennai

PostPosted: Mon Jan 02, 2006 8:36 pm    Post subject: Reg : Thanks
Reply with quote

Hi,

Thank you one and all of ibmmainframes.com

Cheers..................

pavan
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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