What is an "AS 400 on z/OS"? AS/400 (aka iSeries) is a different hardware architecture and runs OS/400, which has DB2 integrated into the operating system kernel. z/OS is the operating system for mainframes (aka zSeries). DB2 for z/OS, DB2 for AS/400, and DB2 LUW are separate products.
So what I don't understand is (a) on which platform you are working, and (b) where you want to write your messages to. Do you mean the (db2) shell? Or the operating system console as z/OS has one?