collecting memory usage by a process

Hi Guys,

I work on a AIX environment and I'm trying to write a script where I can collect all the memory used by a process. Basically I'm executing the command 'ps -fu userid' to get all the process ids and then executing the 'ps v PID' to get all the memory allocated by PPID. My question is when I issue the 'ps v PID' command I get the following columns: PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND. So now should I be using the SIZE column to sum the total amount of memory used by a process. In my case these userids are DB2 instances as I work with DB2. DB2 also has it own commands that I can used by I would to get the number from the OS first then compare it with the one provided by DB2. Please any comments are higlhly appreciated. Thanks.

man lsof

I'd use the RSS (program running size) figure.