A CL program can run SNDPGMMSG to send any message ID from any message file to an external message queue.
SNDPGMMSG MSGID( CPF0907 ) MSGF( QSYS/QCPFMSG ) TOMSGQ( QSYS/QSYSMSG ) ...
Beyond the basic parameters, you might need to specify MSGDTA( &somedata ) and populate the &somedata variable to match the substitution fields the are defined for the message ID. You can often leave MSGDTA() alone and live with the strange messages that result.
Tom