View previous topic :: View next topic
|
Author |
Message |
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
this is my requirement....
Code: |
WORKING STORAGE
WS-CHAR PIC X(70)
WS-COMP PIC S9(7)V9(2)
PROCEDURE DIV.
MOVE WS-CHAR(24:9) TO WS-COMP |
but if WS-CHAR(24:9) = 000014000 i am getting WS-COMP value as 001400000
can anyone let me know how to achieve this... thanks in advance... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
can anyone let me know how to achieve this |
Yes, there is a link to manuals at the top of the page. Click it, find the COBOL Language Reference manual, and read up on the MOVE statement. Read long enough and you find that your move is working exactly as COBOL rules dictate it should.
Explanation: the implied decimal point on the sending field is after the last character -- so 000014000 is 14,000. This value is aligned to the receiving field decimal point (which is the V) and 2 zeroes are appended for the places after the implied decimal point. And voila the value is 001400000. If this is not what you want, you will need to change your code to achieve your desired goal. Since you didn't say what that goal is, and it is not psychic day today, we cannot tell you what changes are needed. |
|
Back to top |
|
|
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
Thanks Bob |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
That would be Robert. . . |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Redefine WS-COMP as PIC S9(09), move the 9-Bytes to this redefined field and all will be forgiven....
Your subject indicates moving to COMP-3.
Is this a true statement?
If you ultimately need to populate a COMP-3 field, I would first move the 9-Bytes to an intermediate WS display-numeric 9-Byte field and then move the display-numeric field to the COMP-3 field.
You can't go wrong.... |
|
Back to top |
|
|
PrabakarV
New User
Joined: 21 Dec 2007 Posts: 88 Location: My Desk
|
|
|
|
I am sorry for the typo. Sorry Robert.
Thanks Bill. |
|
Back to top |
|
|
|