Sample TPNS CPI-C networks -------------------------- Following are two TPNS CPI-C networks and associated STL program definitions that can be used to communicate with the CPI-C APING and APINGD programs. These samples require TPNS V3R5 or beyond. The first sample defines a TPNS CPI-C client application that attaches the APINGD server. A code level exchange is made and then two conversations are initiated serially. Each conversation performs three send/receive iterations of a short data stream. When the last receive completes, the conversation is deallocated. The second sample defines a TPNS CPI-C server application that can be attached by an APING client. A code level exchange is made and then incoming data is received and echoed back to the partner. If a receive error occurs or the client deallocates the conversation, the server terminates. Refer to the note in each network definition for initiation commands and system-dependent definitions. Change the system-dependent definitions as required to be compatible with your environment. ------------------------------------------------------------------------- TPNS CPI-C client that attaches the APINGD server: ------------------------------------------------------------------------- @NET TAPING NTWRK CONRATE=YES, OPTIONS=(MONCMND), HEAD='CPI-C NETWORK' * * CPI-C Network defining a TPNS client that attaches the APINGD server. * * Note: In the network definition below, change the APPLNAME to match * a VTAM application definition that has the APPC=YES parameter. * Also change NODE.LUNAME in the SIDEINFO statement to match * the node and LU that the APINGD server is running on. If the * client and server are running on the same node, you can * eliminate "NODE." from this specification. * LU1TPA PATH DKLU1TPA * APPLNAME APPCLU APPLID=APPLNAME, SIDEINFO=((DESTNAME=APINGD,MODENAME=#INTER, TPNAME=APINGD,LUNAME=NODE.LUNAME)) LU1TPA TP TPNAME=TPA, TPTYPE=CLIENT, INSTANCE=(1,1), PATH=(LU1TPA), CPITRACE=VERB @ENDNET @include cpicvar @include cpiccon DKLU1TPA: MSGTXT say 'Starting msgtxt 'msgtxtid() /* Set up CPI-C verb input parameters: */ code_level='01022B024D5653'x code_level_len=length(code_level) send_buffer='LU '||appcluid()||', TP instance '||tpinstno()||, ': Data sent from TPA to APINGD.' send_length=length(send_buffer) requested_length=200 sym_dest_name='APINGD' /* conversation loop... */ do I=1 to 2 say 'TPA issues CMINIT for conversation with APINGD' CMINIT(conversation_id,, sym_dest_name,, return_code) say 'return code ' char(return_code) say 'TPA issues CMSCT' CMSCT(conversation_id,, cm_mapped_conversation,, return_code) say 'return code ' char(return_code) say 'TPA issues CMSSL' CMSSL(conversation_id,, cm_none,, return_code) say 'return code ' char(return_code) say 'TPA issues CMSDT' CMSDT(conversation_id,, cm_deallocate_sync_level,, return_code) say 'return code ' char(return_code) say 'TPA issues CMALLC of conversation with APINGD' CMALLC(conversation_id,, return_code) say 'return code ' char(return_code) /* Exchange code level... */ say 'TPA sends code level to APINGD' CMSEND(conversation_id,, code_level,, code_level_len,, request_to_send_received,, return_code) say 'return code ' char(return_code) say 'TPA gets code level from APINGD' CMRCV(conversation_id,, receive_buffer,, requested_length,, data_received,, received_length,, status_received,, request_to_send_received,, return_code) say 'return code ' char(return_code) /* Send/receive iteration... */ do J=1 to 3 say 'TPA issues CMSEND to APINGD' CMSEND(conversation_id,, send_buffer,, send_length,, request_to_send_received,, return_code) say 'return code ' char(return_code) say 'TPA issues CMRCV from APINGD' CMRCV(conversation_id,, receive_buffer,, requested_length,, data_received,, received_length,, status_received,, request_to_send_received,, return_code) say 'return code ' char(return_code) end say 'TPA issues CMDEAL of conversation with APINGD' CMDEAL(conversation_id,, return_code) say 'return code ' char(return_code) end say 'TPA DONE.' ENDTXT ------------------------------------------------------------------------- TPNS CPI-C server that can be attached by an APING client: ------------------------------------------------------------------------- @NET TAPINGD NTWRK CONRATE=YES, OPTIONS=(MONCMND), HEAD='CPI-C NETWORK' * * CPI-C Network defining a TPNS server that is to be attached by * APING. * * Start this network as a batch job, then enter the following TSO * command: * "aping NODE.LUNAME -t TPA" at the TSO command prompt. * * Note: Change NODE to match the node that TPNS is running on and * LUNAME to match a VTAM application defined on this node. The * VTAM APPL must be defined using the documented criteria for * an APPCLU (i.e. APPC=YES specified). Also change APPLNAME in * the network definition below to match this VTAM APPL name. * If the client and server are running on the same node, you * can eliminate "NODE." from the command above. * LU1TPA PATH DKLU1TPA * APPLNAME APPCLU APPLID=APPLNAME LU1TPA TP TPNAME=TPA, TPTYPE=SERVER, INSTANCE=(0,1), PATH=(LU1TPA), CPITRACE=VERB @ENDNET @include cpicvar @include cpiccon DKLU1TPA: MSGTXT say 'Starting msgtxt 'msgtxtid() /* Set up CPI-C verb input parameters: */ requested_length=32763 say 'TPC issues CMACCP of conversation with TPB' CMACCP(conversation_id,, return_code) say 'return code ' char(return_code) /* Exchange code level... */ send_buffer='01022C024F532F'x send_length=length(send_buffer) say 'TPA gets the code level from APING' CMRCV(conversation_id,, receive_buffer,, requested_length,, data_received,, received_length,, status_received,, request_to_send_received,, return_code) say 'return code ' char(return_code) say 'TPA sends the code level to APING' CMSEND(conversation_id,, send_buffer,, send_length,, request_to_send_received,, return_code) say 'return code ' char(return_code) send_buffer='' send_length=0 do while(return_code=cm_ok & data_received<>cm_no_data_received) say 'TPA issues CMRCV from APING' CMRCV(conversation_id,, receive_buffer,, requested_length,, data_received,, received_length,, status_received,, request_to_send_received,, return_code) say 'return code ' char(return_code) send_buffer=send_buffer||receive_buffer send_length=send_length+received_length if status_received=cm_send_received & , data_received<>cm_no_data_received then do say 'TPA echos the data to APING' CMSEND(conversation_id,, send_buffer,, send_length,, request_to_send_received,, return_code) say 'return code ' char(return_code) send_buffer='' send_length=0 end end say 'TPA DONE.' ENDTXT