View previous topic :: View next topic
|
Author |
Message |
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
Hi
Please help on this.
My Input field declaration is
01 WS-AMT PIC -(16)9.9(2). ----->Length 20
Output field declaration is
01 WS-AMT1 PIC X(20).
-100 is moved to WS-AMT
then WS-AMT moved to WS-AMT1.
WS-AMT1 is displayed as "13spaces-100.00"
But I need WS-AMT1 to be displayed as "-100.0013spaces"
Regards
Binaya |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
and how would the following be displayed:
.01+
.10+
1.00+
10.00+
1000.00+
10000.00+
100000.00+
1000000.00+
10000000.00+
100000000.00+
1000000000.00+
10000000000.00+
100000000000.00+
1000000000000.00+
10000000000000.00+
100000000000000.00+
1000000000000000.00+
.01-
.10-
1.00-
10.00-
1000.00-
10000.00-
100000.00-
1000000.00-
10000000.00-
100000000.00-
1000000000.00-
10000000000.00-
100000000000.00-
1000000000000.00-
10000000000000.00-
100000000000000.00-
1000000000000000.00- |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
also,
you do not mean compress,
apparently you mean left justify. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Is -(16)9.9(2) correct?
Don't you want -9(16).9(2) ?
And why aren't you getting leading zeroes? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Phrzby Phil: -(16)9 and -9(16) are two different pictures -- the first uses the minus sign as a floating insertion symbol (which gives the results posted) while the second uses fixed sign position and left fill zeroes.
Binaya: the only way I know of to achieve what you want is to move the data into your field, then find the first non-blank character and move them to the left of your output variable. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
I see - never used the (n) after a sign before - learn something new every day! Thanks. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Phrzby Phil wrote: |
Is -(16)9.9(2) correct? |
Yes, it is similar to ----------------9.99
Binaya,
when you define a numeric edited variable in cobol (and it doesn't matter if it is -(16)9.9(2) or -9(16).99 or any other format), the decimal point will always be in the same position, whatever value you have in the variable.
Using -(16)9.9(2) and some of Dick's examples, you will have:
Code: |
-0.01
-0.10
-1.00
-10.00
1000.00
10000.00
100000.00
1000000.00 |
If you want to have the number left justified, you will have to do it manually, by using reference modification for example. |
|
Back to top |
|
|
|