In a CL program, you can use the RCVMSG command to read the messages in QSYSOPR.
A simple program to monitor for messages would be something like this:
DCL &MSG *CHAR 128
RCVMSG QSYSOPR WAIT(*MAX) MSG(&MSG)
your logic here – Either within this CL or call a program with &MSG as a parm.