Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
raju_rangam
Warnings : 1

New User

Joined: 31 Mar 2005
Posts: 25
Location: bangalore

 Posted: Tue Dec 27, 2005 11:33 am    Post subject: How can we store of -1234 as comp3 value how can we store of -1234comp3 value

umeshkmrsh

New User

Joined: 21 Sep 2005
Posts: 79
Location: India

 Posted: Tue Dec 27, 2005 2:35 pm    Post subject: Could you please explain the question.
raju_rangam
Warnings : 1

New User

Joined: 31 Mar 2005
Posts: 25
Location: bangalore

 Posted: Wed Dec 28, 2005 1:05 pm    Post subject: s suppose some explanation on comp3, that how it stores internally
anilbatta

New User

Joined: 13 Nov 2005
Posts: 22

 Posted: Wed Dec 28, 2005 4:32 pm    Post subject: 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.
kumar_ngl
Warnings : 1

New User

Joined: 05 Aug 2005
Posts: 50
Location: chennai

 Posted: Wed Dec 28, 2005 5:48 pm    Post subject: 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
DavidatK

Active Member

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

Posted: Wed Dec 28, 2005 9:09 pm    Post subject: Re: regarding comp3

 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.
rajesh_1183

Active User

Joined: 24 Nov 2005
Posts: 121

 Posted: Thu Dec 29, 2005 11:54 am    Post subject: comp-3 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
mijanurit
Currently Banned

New User

Joined: 26 Aug 2005
Posts: 33
Location: bangalore

 Posted: Sun Jan 08, 2006 10:13 am    Post subject: Re: regarding comp3 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
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

Posted: Mon Jan 09, 2006 4:13 am    Post subject:

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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm ADSO Store Procedure to receive mutip... yogi.47eie IDMS/ADSO 2 Fri Aug 21, 2015 7:14 pm store randomly selected row vinod.fugal CICS 1 Thu Jul 16, 2015 11:49 am Computational Fields and the Value it... Chetan Kumar COBOL Programming 8 Tue Jul 07, 2015 1:50 pm Load and Store amitc23 PL/I & Assembler 4 Tue Jan 20, 2015 1:37 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us