View previous topic :: View next topic
|
Author |
Message |
MikePradeep
New User
Joined: 05 Jan 2007 Posts: 5 Location: Bangalore
|
|
|
|
Can anyone tell me how comp-1 and comp-3 variables are used and stored , with some examples? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
COMP-1 :- IS BINARY FORMAT IS USED WHEN YOUR FIELD IS IN NUMERIC BUT NOT ANY DECIMAL POINT
STORING METHODE:- 0 TO 4 REQUIRES 2 BYTE
I.E PIC(9999) - 2BYTES
5 TO 9 REQUIRES 4 BYTE
10 TO 18 REQUIRES 8 BYTE
COMP-3 : IS CALLED PACKED DECIMAL: IS USED WHEN YOUR FIELD IS NUMERICS WITH DECIMAL POINTS
STORING METODE ARE-
FOR ODD-->(N/2)+0.5=STORAGE FIELD(BYTE)
FOR EVEN-->(N/2)+1= STORAGE FIELD(BYTE)
FOR EXAMPLE PIC(999) USAGE COMP-3 CONTAINS ODD SO BY ABOVE CALSULATION IT REQUIRES FIELD (3/2)+0.5=2BYTE
BASICALLY COMP IS USED FOR NUMERIS FIELD FOR FASTER CALUCALATION AND USAGE DISPLAY(DEFAULT) IS USED FOR ALPHANUMERIC AND ALPHABETIC CHARACTER FOR FASTER ACCESS
I THINK THIS WILL HELP YOU
FROM-SACHIN BORASE
PUNE |
|
Back to top |
|
|
shashirbsk
New User
Joined: 18 Jan 2007 Posts: 7 Location: hyderabad
|
|
|
|
As per my knowledge the explanation given for COMP-1 is for Binary, COMP and COMP-4 data items.
COMP-1 is specified for internal floating-point items (single precision) and is of 4 bytes long. COMP-1 cannot have a PIC clause.
Please correct me if I am wrong. |
|
Back to top |
|
|
|