Clicky
Skip to Content
Custom Search

Reply to comment

atma1981
Offline
Joined: 06/09/2011
Addressing diffrence between COMP and COMP-3 question.

Point 1) Comp-3 is used to avoid rounding issues that occur when binary numbers are used to represent decimal fractions. This is especially important in systems that process large volumes of financial transactions/amounts (e.g. banking, credit cards, etc.).

Point 2) Use COMP-3 for any field where there is substantial arithmetic combined with substantial movement of the field to/from a DISPLAY item. If the field is not used with DISPLAY items, it may best be COMP. For example, to move it to a COMP field requires a PACK and a CVB instruction. To move a COMP field to a DISPLAY field requires a CVD and UNPACK. In each case, the intermediate result is a COMP-3 field. By using COMP-3 fields when DISPLAY NUMERIC fields provide/receive results, you avoid the extra conversions all the way to COMP.

Point 3) COMP-3 over COMP. Why? COMP-3 abends rather nicely with an 0C7 if you put rubbish in there, COMP does not. Also, when debugging a COMP-3 field, it is very easy to see what the value is when looking at it in hex. With COMP fields, you have to drag out a calculator and convert the hex value to find out the true value that is being used in a program.

Point 4) COMP is used for Binary Representation it allows only S and 9. Comp-3 is used for Packed Decimal values it allows S 9 V mostly it is useful for Decimal Calculation Values. 5)COMP stores the data in the binary format and COMP-3 stores the date in the BCD(Binary Coded Decimal)format. .

Reply

  • Allowed HTML tags:
      1. Lines and paragraphs break automatically.

    More information about formatting options

    CAPTCHA
    This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Navigation

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Number of Registered users 713
Theme by Dr. Radut.