calculating in MB

hi all,
have got a ksh script which tries to monitor memory usage of app servers. i do a

 ps -0 rss -p <PID> 

to get the memory size in KB but when i divide by 1024 to convert to MB i dont know how to round it up ??

thanks in advance.

add 512 to the KB size then divide by 1024....

i get a value of '1274496' from the

 ps -o rss -p <pid> 

command and when i add 512 to this and divide by 1024 it comes to '1245.125'

is there a function in ksh to round this up so the value returned is '1245' ??

ta.

use expr to add 512 and again to divide by 1024

X=`expr val_in_kilobytes + 512`
MB=`expr $X / 1024`