have you already checked that this is not a library list problem because it seems you don’t specify the library in your clear statement.
If the MSGQ is owned by the program that calls the CLP to clear it , you may use *PRV as first parameter.
Hope it may help.
The library list has no relationship to the problem. This is a ‘program message queue’, not an external message queue. The message queue only exists within the job. It’s not in a library.
The problem is that the message queue needs to be specified in the PGMQ() parameter instead of MSGQ(). The correct parameter value could be determined if the structure of the program or procedure calls was given, including program attributes, in particular ILE or OPM.
A reasonable guess to start is simply RMVMSG PGMQ(Program Queue Name) or RMVMSG MSGQ(*PRV).