View previous topic :: View next topic
|
Author |
Message |
shr_amar Warnings : 2 Active User
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Hello ,
I want to pass value of maximum 5 bytes to alphanumric field and map it to Numeric field 9(5) . And the output of the Numeric field passed to Alphanumric field of x(5).
INitial value should not be changed .Given is the example.
02 WS-XYZ PIC X(5).
02 WS-ABC PIC 9(5).
MOVE ' 0CDE' TO WS-XYZ.
MOVE WS-XYZ TO WS-ABC.
MOVE WS-ABC TO WS-XYZ.
AND THE VALUE OF WS-XYZ COMING AS 0CD5. Is there any way we can get the same output without introducing new variable. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Why would you want to put non-numeric values in a numeric field?
If we understand what the requirement really is, we may be able to offer suggestions.
Even if you find a way to force incompatible values into a field, you will have many problems using that mis-match later. . . |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Because of the lack of the sign on the numeric field, COBOL is forcing the sign for the last digit to "F" - E is x'c5' and 5 is x'f5'.....
You might change the numeric field to s9(5) and see what happens..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you make the change to s9(5) and get what you want, please try
Code: |
MOVE ' 0CDX' TO WS-XYZ |
and post back the result. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi,
I don't know why you want to do this, but try substituting:
MOVE WS-XYZ TO WS-ABC(1:)
for your 2nd move. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Deleted |
|
Back to top |
|
|
|