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

Moving comp-3 to signed numeric


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

New User


Joined: 02 Apr 2005
Posts: 3

PostPosted: Thu Sep 22, 2005 11:01 am
Reply with quote

Hello everyone,

When I try to move s9(2)v(3) comp-3 to s9(2)v(3) variable,
Iam not able to get the sign.

i,e If I move -5.000 stored in comp-3 variable to s9(2)v(3) variable , the result that is getting displayed is 05000.

Can anyone explain me why this is happening


Thanks in advance.
Kanishk
Back to top
View user's profile Send private message
nitin4.a

New User


Joined: 16 Aug 2005
Posts: 26

PostPosted: Thu Sep 22, 2005 11:11 am
Reply with quote

HI


These are the specifications about comp-3 and comp variables,might be it will help you

Sign is stored in comp-3 as:-It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C if
your number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is -102
etc...
also it is a packed decimal format

S9(7) COMP-3 field occupy 4 bytes and . Sign is stored as hex value in the last nibble



S9(7) SIGN TRAILING SEPARATE will take 8 bytes (one extra for sign)


regards
sonu
Back to top
View user's profile Send private message
Sridevi_C

Active User


Joined: 22 Sep 2005
Posts: 104
Location: Concord, New Hampshire, USA.

PostPosted: Tue Oct 04, 2005 11:43 pm
Reply with quote

Hi,
Sign doesn't contribute to the size of the data name: s9(2)v9(3) usage display.For display purpose,edit characters can be used, -9(2)v9(3) usage display.Now your result must be -05000.
Regards,
Sridevi.
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 Moving Or setting POINTER to another ... COBOL Programming 2
No new posts Convert HEX to Numeric DB2 3
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Find a record count/numeric is multip... COBOL Programming 1
Search our Forums:

Back to Top