First off, The way I read your question tells me you want to Clear a File and after that check to see who is using it. Is that correct?
If so, could you explain why.
I would think you would do it in the reverse order. Make sure no one is using before the clear.
Anyway, here are some options.
Prior to calling the RPG program, you can check for locks and/or ALCOBJ.
Or, Once in the RPG program, you can call a CL program or procedure that would check for locks and return a parm. The CL program could create a file or Data Queue that could be used by the calling program to send message to users.