Hi,
I don't know what the root of your problem may be but if 'wpsctran' is the name of a table then the fact that "tagno('xrec','wpsctran')" returns a non-zero value is no quarantee that "select wpsctran" will succeed since the second parameter to tag() can be referring to either the cdx file name or the table alias. E.g:
USE wpsctran ALIAS fred
IF TAGNO('xrec','wpsctran') > 0
SELECT wpsctran
ENDIF
HTH,
Viv