(De)Allocation problems RA2TLIB - File in use

http://www-1.ibm.com/support/docview.wss?uid=isg1OW26812


Problem conclusion:
Issuing a TBCLOSE (or TBEND) with the LIBRARY paramter for a
table is not related to closing the dataset allocated to
that ddname. A TBSTATS to a non-existent library will first
close any existing tables and then attempt to open the
non-existent DD, but RC=0 even when table does not exist.
This allows a following FREE to free the corresponding DD.
Refer to APAR II08227 for further details.

Before the Allocation and before the FREE of e.g. RA/2 XXXTLIB insert in YOUR CLIST/REXX proc a:
ISPEXEC TBSTATS DUMMY LIBRARY(RA2TLIB)