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

Want to display the amount like ($127.00)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 1448
Location: Chicago, IL

PostPosted: Mon Dec 12, 2005 10:08 pm
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
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
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: 1448
Location: Chicago, IL

PostPosted: Tue Dec 13, 2005 9:16 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Adding a trailer with record count an... JCL & VSAM 4
No new posts How to display the leading zeros of a... DB2 7
No new posts SDSF display Max-RC in different colors TSO/ISPF 4
No new posts Converting a file from PD to display ... SYNCSORT 4
Search our Forums:

Back to Top