Terminate code revised for DB2

- final