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
 

 

How can we store of -1234 as comp3 value

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

New User


Joined: 31 Mar 2005
Posts: 25
Location: bangalore

PostPosted: Tue Dec 27, 2005 11:33 am    Post subject: How can we store of -1234 as comp3 value
Reply with quote

how can we store of -1234comp3 value
Back to top
View user's profile Send private message

umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Dec 27, 2005 2:35 pm    Post subject:
Reply with quote

Could you please explain the question.
Back to top
View user's profile Send private message
raju_rangam
Warnings : 1

New User


Joined: 31 Mar 2005
Posts: 25
Location: bangalore

PostPosted: Wed Dec 28, 2005 1:05 pm    Post subject: s
Reply with quote

suppose some explanation on comp3, that how it stores internally
Back to top
View user's profile Send private message
anilbatta

New User


Joined: 13 Nov 2005
Posts: 22

PostPosted: Wed Dec 28, 2005 4:32 pm    Post subject:
Reply with quote

Hi Raju,

Please elaborate the question and my sincere advice is to explain your problem clearly.

I will explain the concept of COMP-3 in detailed manner. COMP-3 will be in Hexadecimal format and stores the values according to that.
Formaula for calculating the COMP-3 value is:

Example: 01 A
02 B PIC S(9) COMP-3

EXPLANATION:
The no of digits that the value will be stored is 6, because the formaula for this is (n/2)+1 exclusively for COMP-3. The result will be 4.5+1, so in this case, the final result is 5 bcoz it will consider the nearest digit value. I hope this example will be helful for you.
Back to top
View user's profile Send private message
kumar_ngl
Warnings : 1

New User


Joined: 05 Aug 2005
Posts: 50
Location: chennai

PostPosted: Wed Dec 28, 2005 5:48 pm    Post subject:
Reply with quote

hi raju,

Usually in COMP-3 , 1 word is equal to 1/2 byte ..so in ur example its 2 bytes of 1234 and another 1/2 byte for (-)..so totally 3 bytes. this (-) will be stored in the right most area.

1 3 -
2 4

kumar.p.v
Back to top
View user's profile Send private message
DavidatK

Active Member


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

PostPosted: Wed Dec 28, 2005 9:09 pm    Post subject: Re: regarding comp3
Reply with quote

Quote:

how can we store of -1234comp3 value


Two examples of COMP-3.

Code:

    05  A            PIC S9(4)   COMP-3.
    05  B            PIC  9(4)   COMP-3.


    MOVE -1234                   TO A.
    MOVE -1234                   TO B.



The move to 'A' results a hex value in 'A' of:

024
13D

And the move to 'B' results in a hex value of :

024
13F

For both of these, the sign is in the right most half byte.

In 'A', because it's a signed field you can get a 'C' = '+' and a 'D' = '-' in the sign half byte. In 'B', because it's unsigned, you loss the sign when you move to the field and the sign will always be 'F' = unsigned.
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Thu Dec 29, 2005 11:54 am    Post subject: comp-3
Reply with quote

For Comp-3 variables sign will be stored in the last nibble(4 bytes)

last nible will contain..

C - if it is a signed positive
D - if it is a signed negative
F - if it is unsigned

Rajesh
Back to top
View user's profile Send private message
mijanurit
Currently Banned

New User


Joined: 26 Aug 2005
Posts: 33
Location: bangalore

PostPosted: Sun Jan 08, 2006 10:13 am    Post subject: Re: regarding comp3
Reply with quote

hi davidakt,

would u plz to explain ur example in details.


05 A PIC S9(4) COMP-3.
05 B PIC 9(4) COMP-3.


MOVE -1234 TO A.
MOVE -1234 TO B.




The move to 'A' results a hex value in 'A' of:

024
13D

And the move to 'B' results in a hex value of :

024
13F

i am not getting how value stored in A,
024
13d
actually problem with digit sequence.
i am thinking about
012
34D
plz explain.

thanks and regards
mijanurit
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jan 09, 2006 4:13 am    Post subject:
Reply with quote

Hi mijanurit,

Quote:
024
13D


This is a variation of the way hex values are displayed in ISPF. They're read top to bot, left to right. Each column represents 1 EBCDIC char.

An alternative is X'01234D', something similar to what you mentioned.
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 ADSO Store Procedure to receive mutip... yogi.47eie IDMS/ADSO 2 Fri Aug 21, 2015 7:14 pm
No new posts store randomly selected row vinod.fugal CICS 1 Thu Jul 16, 2015 11:49 am
No new posts Computational Fields and the Value it... Chetan Kumar COBOL Programming 8 Tue Jul 07, 2015 1:50 pm
No new posts Load and Store amitc23 PL/I & Assembler 4 Tue Jan 20, 2015 1:37 pm
No new posts How to dynamically assign different v... jackzhang75 CLIST & REXX 9 Wed Sep 10, 2014 6:32 pm


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