Help with scripting APT / dpkg in Debian 4

Hello,

I am attempting to write a (bash) shell script that will do some basic reporting based on the APT utilities and dpkg.

I need the following in the report:
Packages installed
(COLUMNS=200 dpkg -l | grep '/^ii/' > packages_installed)

Packages not installed
I suppose that I can do
COLUMNS=200 dpkg -l > packages_available
and then use cmp or diff to print a list of the differences which should just be the packages not installed

Packages with security updates
I'm drawing a blank on this one, maybe restricting sources to
deb Debian -- Security Information stable/updates main
and printing the output

Packages with updates
I think it's just
apt-get -u upgrade > packages_updates

Packages with new versions (including the distro)
apt-cache show?

The script should then print out in a legible form the different categories from the files created. I realize that there are some GUI's out there that do basically the same thing but this will run on servers. Ideally it should be dependent on the "standard" apt utilities.

Thanks for any input!