View previous topic :: View next topic
|
Author |
Message |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 139 Location: brisbane
|
|
|
|
i've got the following code fragment:
Code: |
01 WS-NUMFMT PIC Z(12)9.99- BLANK WHEN ZERO.
01 MNTH_ONG_LIAB_AMT PIC X(11) JUSTIFIED.
...
MOVE 12345.67 TO WS-NUMFMT
MOVE WS-NUMFMT TO MNTH_ONG_LIAB_AMT |
this produces the correct result : "12345.67-"
however, with the definition :
01 WS-NUMFMT PIC -Z(12)9.99 BLANK WHEN ZERO.
... I lose the sign, and get only "12345.67"
any help appreciated ! |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
How can moving a positive value to WS-NUMFMT produce a "correct" (as you say) negative result?
I would expect the "-" in the edit mask to be replaced with a blank since your value is positive.
You need to show results as produced, not just say what they are. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
I think at a minimum you have a typo; at the maximum you are lying. Code:
Code: |
000800 WORKING-STORAGE SECTION.
000900 01 WS-VARS.
001000 05 WS-NUMVAR1 PIC Z(12)9.99- BLANK WHEN ZERO.
001100 05 WS-NUMVAR2 PIC -Z(12)9.99 BLANK WHEN ZERO.
001200 PROCEDURE DIVISION.
001300 MOVE 12345.67 TO WS-NUMVAR1
001400 WS-NUMVAR2.
001500 DISPLAY 'NUMVAR1 >' WS-NUMVAR1 '<'.
001600 DISPLAY 'NUMVAR2 >' WS-NUMVAR2 '<'.
001700 DISPLAY ' ' .
001800 MOVE -12345.67 TO WS-NUMVAR1
001900 WS-NUMVAR2.
002000 DISPLAY 'NUMVAR1 >' WS-NUMVAR1 '<'.
002100 DISPLAY 'NUMVAR2 >' WS-NUMVAR2 '<'. |
produces results of
Code: |
NUMVAR1 > 12345.67 <
NUMVAR2 > 12345.67<
NUMVAR1 > 12345.67-<
NUMVAR2 >- 12345.67< |
These results are precisely as expected -- and completely contradict what you posted. Hence my earlier statement that you have typo(s) or are lying. |
|
Back to top |
|
|
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 139 Location: brisbane
|
|
|
|
there was an obvious typo in the original post; but equally true you didn't read the post.
error on my part was not using a floating sign. The definition should have been:
01 WS-NUMFMT PIC -(12)9.99 BLANK WHEN ZERO.
The 'lying' suggestion both unprofessional and unbecoming of a 'moderator' |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2154 Location: USA
|
|
|
|
jzhardy wrote: |
there was an obvious typo in the original post; but equally true you didn't read the post.
error on my part was not using a floating sign. The definition should have been:
01 WS-NUMFMT PIC -(12)9.99 BLANK WHEN ZERO.
The 'lying' suggestion both unprofessional and unbecoming of a 'moderator' |
I recommend you either to RTFM, or move your questions to the Beginners Forum.
No way to discuss in your manner here. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
I stand by my reply.
You still moved an unsigned number to WS-NUMFMT, and you have not replied to that.
Your post: MOVE 12345.67 TO WS-NUMFMT |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
You CANNOT, under any circumstances, get the value 12345.67- when you move 12345.67 to your WS-NUMFMT variable. I showed this in my code post. So when you tell us you got certain results, and it has been proved beyond any doubt that you CANNOT get those results with what you posted, what conclusion should we draw? Furthermore, I did NOT accuse you of lying -- what I said was that you either have a typo or you were lying.
Start posting on Beginners and Students Forum as it is much more suited for your skill set. It doesn't matter how many "years" of experience you claim, you are a beginner.
Topic locked to prevent further waste of time. |
|
Back to top |
|
|
|