Terminal ids can only be used on the same JavaGateway that created the terminal. Again, this is a security feature to stop other programs that connect to the same CICS Transaction Gateway from manipulating that terminal.