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
 

 

COMP DATA TYPE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
padmavenug

New User


Joined: 08 Aug 2005
Posts: 3
Location: Chennai, Tamil NAdu, INDIA

PostPosted: Thu Aug 25, 2005 10:49 am    Post subject: COMP DATA TYPE
Reply with quote

Hi,
Can anyone explain me how to choose which COMP (COMP1,COMP2.....)data types to choose for different requirements.
How to calculate the size of the var declared as any of the COMP data types? This is a interview question.

Regards
padma
Back to top
View user's profile Send private message

atik

New User


Joined: 29 Jul 2005
Posts: 20

PostPosted: Fri Aug 26, 2005 2:26 pm    Post subject:
Reply with quote

Depending on the requirement and where the var will used, the data types are used. For eg calculations are faster if u declare comp. Also memory utilization is more in boundaries in case of COMP compared to COMP-3.
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Fri Aug 26, 2005 3:19 pm    Post subject: Re: COMP DATA TYPE
Reply with quote

Hi

find some information regarding all COMP data

hai,


the following is the details of COMP items.


BINARY
Specified for binary data items. Such items have a decimal equivalent
consisting of the decimal digits 0 through 9, plus a sign. Negative
numbers are represented as the two's complement of the positive number
with the same absolute value.

The amount of storage occupied by a binary item depends on the number
of decimal digits defined in its PICTURE clause:

Digits in PICTURE Clause Storage Occupied
1 through 4 2 bytes (halfword)
5 through 9 4 bytes (fullword)
10 through 18 8 bytes (doubleword) │
The leftmost bit of the storage area is the operational sign.

PACKED-DECIMAL
Specified for internal decimal items. Such an item appears in storage
in packed decimal format. There are 2 digits for each character
position, except for the trailing character position, which is
occupied by the low-order digit and the sign. Such an item can
contain any of the digits 0 through 9, plus a sign, representing a
value not exceeding 18 decimal digits.

The sign representation uses the same bit configuration as the 4-bit
sign representation in zoned decimal fields (see Table 12 in
topic 2.7.12.2 and Table 13 in topic 2.7.12.2).

COMPUTATIONAL or COMP
Representation of the COMPUTATIONAL phrase is system-dependent and is
normally assigned to representations that yield the greatest
efficiency when arithmetic operations are performed on that system.
For the VS COBOL II compiler, the COMPUTATIONAL phrase is synonymous
with BINARY.

COMPUTATIONAL-1 or COMP-1
Specified for internal floating-point items (single precision).
COMP-1 items are 4 bytes long. The sign is contained in the first bit
of the leftmost byte and the exponent is contained in the remaining 7
bits. The last 3 bytes contain the mantissa.

COMPUTATIONAL-2 or COMP-2
Specified for internal floating-point items (double precision).
COMP-2 items are 8 bytes long. The sign is contained in the first bit
of the leftmost byte and the remaining 7 bits contain the exponent.
The remaining 7 bytes contain the mantissa.

COMPUTATIONAL-3 or COMP-3 (internal decimal)
For VS COBOL II, this is the equivalent of PACKED-DECIMAL.

COMPUTATIONAL-4 or COMP-4 (binary)
For VS COBOL II this is the equivalent of BINARY.

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

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am


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