View previous topic :: View next topic
|
Author |
Message |
sungang77
New User
Joined: 03 Nov 2005 Posts: 46 Location: Shanghai, China
|
|
|
|
Code: |
01 PAY-RECORD.
05 PAY-ID PIC X(9).
05 PAY-CLASS PIC X(3).
05 PAY-HRS PIC S9(3)V9 PACKED-DECIMAL.
05 PAY-AMT PIC S9(7)V99 PACKED-DECIMAL. |
Question:Referring to the above example, what one advantage does PACKED-DECIMAL have over BINARY?
Choice 1
PAY-RECORD is smaller than if it used BINARY fields.
Choice 2
PACKED-DECIMAL fields use less storage.
Choice 3
PACKED-DECIMAL arithmetic has greater precision.
Choice 4
PACKED-DECIMAL instructions execute faster.
Choice 5
Digits and signs are verified for each PACKED-DECIMAL operation. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
Back to top |
|
|
sungang77
New User
Joined: 03 Nov 2005 Posts: 46 Location: Shanghai, China
|
|
|
|
Thanks khamarutheen.
I've read the article.
There is no obvious answer to the question.
In another URL
http://www.discinterchange.com/TechTalk_BCD_binary_.html
I get to know that choice 2 is wrong.
But I still not sure 1 or 3 is correct.
The choice 4 must be wrong, because the binary execute the fastest.
The choice 5 is also wrong.
The choice 1, if COMP-3, PAY-RECORD is 9+3+5+10=27;
if BINARY, PAY-RECORD is 9+3+3+6=21.
so choice 1 should be right.
the choice 3, I remember that I ever read that PACKED-DECIMAL has more precision.
So...I am not very confirm whether the answer should be 1 or 3. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
hi frnd,
Choice 3: PACKED-DECIMAL arithmetic has greater precision.
my doubt is arithmetic precision inclues (,),+,/,*,- also.. so may be the choice 3 right.. let us make clear the answer and again let us discuss.. |
|
Back to top |
|
|
sungang77
New User
Joined: 03 Nov 2005 Posts: 46 Location: Shanghai, China
|
|
|
|
OK khamarutheen.
Thank you~~~ |
|
Back to top |
|
|
|