View previous topic :: View next topic
|
Author |
Message |
i413678 Currently Banned Active User
Joined: 19 Feb 2005 Posts: 112 Location: chennai
|
|
|
|
Hi,
I want to display the amount like
($127.00)
how can I display like this.
thanks in advance
pavan |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
i413678 Currently Banned Active User
Joined: 19 Feb 2005 Posts: 112 Location: chennai
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
i413678 Currently Banned Active User
Joined: 19 Feb 2005 Posts: 112 Location: chennai
|
|
|
|
Hi,
Thank you one and all of ibmmainframes.com
Cheers..................
pavan |
|
Back to top |
|
|
|