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
 

 

Moving comp-3 to signed numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Moving comp-3 to signed numeric
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    Post subject: Re: Moving comp-3 to signed numeric
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    Post subject: Re: Moving comp-3 to signed numeric
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    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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm


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