Take a look at
http://publib.boulder.ibm.com/infocenter/zoslnctr/v1r7/index.jsp?topic=/com.ibm.znetwork.doc/znetwork_268.html. It's the Z/OS docs on the TN3270E protocol. IBM's docs were always good back in the day; this may help more than source code staring.