Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Move char to s9(7)v(2) comp-3

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
PrabakarV

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Tue Aug 04, 2009 5:27 pm    Post subject: Move char to s9(7)v(2) comp-3
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Tue Aug 04, 2009 5:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
PrabakarV

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Tue Aug 04, 2009 5:46 pm    Post subject:
Reply with quote

Thanks Bob
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 04, 2009 8:21 pm    Post subject:
Reply with quote

Hello,

Quote:
Thanks Bob
That would be Robert. . .
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Aug 04, 2009 8:29 pm    Post subject: Reply to: Move char to s9(7)v(2) comp-3
Reply with quote

Redefine WS-COMP as PIC S9(09), move the 9-Bytes to this redefined field and all will be forgiven.... icon_rolleyes.gif

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
View user's profile Send private message
PrabakarV

New User


Joined: 21 Dec 2007
Posts: 88
Location: My Desk

PostPosted: Wed Aug 05, 2009 8:18 pm    Post subject:
Reply with quote

I am sorry for the typo. Sorry Robert.

Thanks Bill.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us