View previous topic :: View next topic
|
Author |
Message |
ammuthan_ss
New User
Joined: 09 Dec 2003 Posts: 3 Location: chennai
|
|
|
|
I am trying to move data value 9(7)v99 to 9(7).99.
but when the move happens the value 000001992 moved as 0000000.19.
isn't that should come as 0000019.92. i want the value like this only.
please help. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
provide a cut&paste version of your - data element definitions
- your procedural statements used to populate the receiving field.
yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect. |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
It looks like there must be another numeric field before this field and it is defined incorrectly.
ie:
Code: |
05 NUM-FIELD1 PIC 9(5).
05 NUM-FIELD2 PIC 9(7)V99.
|
NUM-FIELD1 is defined as 5, but should be 7. and it is throwing off your placement by two bytes. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
valyk, there also could be a REDEFINES issue ... or an intermediate variable is being used .... or etc etc. Without actually seeing the data definitions, we cannot predict what the precise problem is.
Furthermore, it is not at all clear how your "solution" resolves the problem, since (1) nobody knows if a group move is being used, which would be required for your "solution" to work, and (2) your "solution" would shift the data 2 bytes to the LEFT, not RIGHT, so the output value would be 1992.00 instead of 0.19 -- not quite the same. |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
I was just thinking in a simplistic scenario, reading an input field and moving to output. But, you're right, I went the wrong way with my example. |
|
Back to top |
|
|
ammuthan_ss
New User
Joined: 09 Dec 2003 Posts: 3 Location: chennai
|
|
|
|
dbzTHEdinosauer wrote: |
provide a cut&paste version of your - data element definitions
- your procedural statements used to populate the receiving field.
yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect. |
03 PRICE PIC s9(007)V99 COMP-3. (this comes from file)
01 WS-TOTALDEBIT PIC 9(7)v99.
01 WS-TOTALDEBIT-1 PIC 9(7).99.
ADD PRICE TO WS-TOTALDEBIT
MOVE WS-TOTALDEBIT TO WS-TOTALDEBIT-1 |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Also check the explicit or implicit (default) DECIMAL POINT IS statement. It could affect the outcome of your move if it is set to COMMA, not to PERIOD as you may have presumed. |
|
Back to top |
|
|
valyk
Active User
Joined: 16 Apr 2008 Posts: 104 Location: South Carolina
|
|
|
|
ammuthan_ss wrote: |
dbzTHEdinosauer wrote: |
provide a cut&paste version of your - data element definitions
- your procedural statements used to populate the receiving field.
yes, it should work, but obviously you have defined something incorrectly.
or your data mapping of the input data is incorrect. |
03 PRICE PIC s9(007)V99 COMP-3. (this comes from file)
01 WS-TOTALDEBIT PIC 9(7)v99.
01 WS-TOTALDEBIT-1 PIC 9(7).99.
ADD PRICE TO WS-TOTALDEBIT
MOVE WS-TOTALDEBIT TO WS-TOTALDEBIT-1 |
Add a display for PRICE. Make sure your input data is really what you think it is. |
|
Back to top |
|
|
ammuthan_ss
New User
Joined: 09 Dec 2003 Posts: 3 Location: chennai
|
|
|
|
Kjeld wrote: |
Also check the explicit or implicit (default) DECIMAL POINT IS statement. It could affect the outcome of your move if it is set to COMMA, not to PERIOD as you may have presumed. |
Yes. I have this in my program.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
after commenting them out my proggram works fine.
Thanks so much for your help... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I would suggest changing your edit mask, instead of removing the special names clause.
but that depends on if the program is for a country that uses comma instead of decimal.
you can use Language Environment routines to edit monetary fields, allowing the local/regional settings to control, and then you don't have to play with the 'is this output supposed tobe a comma or decimal point'. |
|
Back to top |
|
|
|