Joined: 09 Nov 2009 Posts: 3 Location: Chennai, India
Hi,
I am trying to find the average of the quantity field from the input records. The SORT CARD that I coded is not displaying the decimal values correctly.
Joined: 09 Nov 2009 Posts: 3 Location: Chennai, India
Arun Raj,
Thank you. The SORT card that you gave is working and it is giving me the expected result.
But I am not sure why we are mutiplying the input data by 100 before averaging. Am I missing something about the AVG function?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
AVG only displays an integer value, not a decimal value.
So if you have 21/8, it will be displayed as 2, not as 2.625. If you want to display the decimal part, you have to multiply by the appropriate value (e.g. +100 for two decimal places or +1000 for three decimal places).