View previous topic :: View next topic
|
Author |
Message |
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
Hi,
I have a variable defined as -
05 A PIC -9(09).99.
it is taking the values from databse as -
000000100.00
-000000015.25
000060000.00
Now I want the output in the field as -
100.00
-15.25
600.00
Please assist. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Define a variable with a floating sign, and MOVE A to that variable. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And if you want it left-justified, use UNSTRING ... DELIMITED BY ALL SPACE INTO a-rubbish-field the-field-you-want. |
|
Back to top |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
Please give an example |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
Back to top |
|
|
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
I defined the variable as PIC +++++++9999.99.
and the output i got is -
+0100.00
-0015.25
+60000.00
But i need the output as -
100.00
-15.25
60000.00
Please assist. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Use - instead of plus.
Decide what you want for zero, for numbers less than one, Define an apporpriate number of -s, like PIC -(9)9.99 - who knows? You do.
Read my previous post. |
|
Back to top |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
Try the below code
Code: |
05 A PIC -9(09).99.
05 B PIC -(09)9.99.
05 B-X REDEFINES B PIC X(13).
05 C PIC X(13).
05 D PIC X(13).
MOVE A TO B
UNSTRING B-X
DELIMITED BY ALL ' '
INTO C D
END-UNSTRING
DISPLAY D
|
Variable D has what you want |
|
Back to top |
|
|
|