IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to move from comp-3 to comp


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunswap

New User


Joined: 23 Mar 2006
Posts: 13

PostPosted: Wed Sep 20, 2006 5:51 pm
Reply with quote

how to move pic s9(5) comp-3 to host variable pic s9(4) comp.[/b]
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Sep 21, 2006 1:36 am
Reply with quote

arunswap

The COMP and COMP-3 indicate how the value is stored in memory. The compiler takes care of the conversion from one form to the other.

01 VAR1 PIC S9(5) COMP-3.
01 VAR2 PIC S9(4) COMP.

MOVE VAR1 To VAR2.

Your concern here should be the size of the fields. If the value in VAR1 is less than -32768 or greater than 32767 the result will be incorrect because of truncation and switching of the sign.

Dave
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Thu Sep 21, 2006 2:08 am
Reply with quote

i think it moves right four digits only.. no problem with sighn..

.. if you have 5 digit number then you miss the highest digit. i.e left side digit because right justified.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts How to move DB2 Installation HLQ DB2 4
Search our Forums:

Back to Top