View previous topic :: View next topic
|
Author |
Message |
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
Hi Guys :
Why I can't diplay the following tiems.
Code: |
WORKING-STORAGE SECTION.
01 W-TEST.
05 W-TEST1 PIC S99V9 USAGE COMP-3.
05 FILLER PIC X(01).
..
Procedure division.
MOVE ZERO TO W-TEST
MOVE 34.1 TO W-TEST1
DIPLAY 'W-TEST1 IS '
W-TEST1
DISPLAY 'W-TEST IS '
W-TEST. |
Then the W-TEST1 can display correctly,but the W-TEST can't display,its blank. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Why I can't diplay the following tiems. |
Because you have incorrect code. Just because the code can compile does not mean that it can work.
The move zero to w-test is immediately undone by moving a value to w-test1.
When you display w-test1 you get the correct value because that is the field you most recently moved a value to. The value in w-test is not blank, but it is not displayable characters either. |
|
Back to top |
|
|
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
Thanks.I already solved this problem.After I moved this to a variable like
PIC -ZZ.9. Then display ,it works now. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Good to hear it is working
From your original post, there was no indication that something was not working. It appeared you wanted clarification on the results you got with the posted code.
If something does not work the way you need, it is a good idea to be most clear on what you need to happen that does not happen. This
Quote: |
Then the W-TEST1 can display correctly |
sounds like it worked. . . (at least to me).
I mention this so that when other questions are posted, care is taken to make the info as complete as possible.
Thanks for using the "Code" tag for your posted code. It is much easier to read |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Linc,
When I display W-TEST I get:
Code: |
W-TEST IS 0
4E6ECEE4CE431F4
060352309204C00
|
not "blanks"
What you're getting is the Packed Decimal representation of 34V1 plus the low order zero resulting from the "MOVE ZERO"
When you DISPLAY a group field (W-TEST) no data conversion takes place; when you DISPLAY an elementary field (W-TEST1) the data is converted to display format. |
|
Back to top |
|
|
linc
New User
Joined: 25 Aug 2008 Posts: 25 Location: china
|
|
|
|
mmwife wrote: |
Hi Linc,
When I display W-TEST I get:
Code: |
W-TEST IS 0
4E6ECEE4CE431F4
060352309204C00
|
not "blanks"
What you're getting is the Packed Decimal representation of 34V1 plus the low order zero resulting from the "MOVE ZERO"
When you DISPLAY a group field (W-TEST) no data conversion takes place; when you DISPLAY an elementary field (W-TEST1) the data is converted to display format. |
Thanks mmwife.That's an excellent explanation. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
'welcum. |
|
Back to top |
|
|
|