View previous topic :: View next topic
|
Author |
Message |
bipinpeter
Active User
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Hi All,
In a cobol program i declared 3 variables as follows,
05 WS-A PIC X(02) VALUE '12'.
05 WS-B PIC X(06) VALUE SPACES.
05 WS-C PIC 9(06) VALUE ZEROES.
AFTER THE BELOW OPERATION WHAT SHOULD BE THE VALUE IN EACH VARIABLES?
MOVE WS-A TO WS-B.
MOVE WS-B TO WS-C.
I got values as,
WS-A : 12
WS-B: '12 '(12 and 4 spaces)
WS-C:'12 0'(12,3 SPACES and one zero)
Any one explain to me Why i got this value in WS-C??
Regards,
Bipin Peter |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Why i got this value in WS-C?? |
Not to sound trite, but because that is the way it works. . . And it is not intuitive.
When you moved the x(6) to the 9(6), the "12" and the spaces were moved. When the value was "received" the system forced an "F" sign over the low order digit of the 9(6), creating an x'F0" (instead of the x'40' of the low-order space). |
|
Back to top |
|
|
|