home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rexx
/
rxappc
/
tp2.cmd
< prev
Wrap
OS/2 REXX Batch file
|
1992-10-03
|
3KB
|
62 lines
/* */
/* REXX/APPC transaction program sample (server) */
/* */
trace off
/* */
/* Tell Rexx that there is a new function available */
/* */
CALL RXFUNCADD APPC,SAAAPPC,APPCSRV
/* */
/* Tell APPC that we are TP2 and we're ready to talk to any other */
/* TP that calls us. */
/* */
rc=appc('Receive_allocate','TP2','Lu2s.')
tpid=lu2s.0 /* save the TP ID */
convid=lu2s.1 /* and conversation ID */
ConvType=Lu2s.3 /* get Conversation type (Basic/Mapped) */
/* */
/* Lets receive some data from our partner. */
/* */
/* Note: This is a 'Mapped' Conversation. */
/* */
rc=appc('Receive_wait',tpid,convid,ConvType,'data.',1000)
say data.2
/* */
/* We have the data. In this sample, we know there is no more */
/* data coming, so a receive_immediate will turn the line around. */
/* In reality one should check the state after the receive_wait */
/* to see if all the data was received, and check again after */
/* the receive_immediate. */
/* */
/* But were skimping here, cause its only a sample */
/* */
rc=appc('Receive_immediate',tpid,convid,ConvType,'data1.',1000)
/* */
/* We should be in 'SEND' state now, that means WE can SEND */
/* data1.0 should contain 'SEND' as what_received */
/* */
rc=appc('Send_data',tpid,convid,ConvType,'Hello from tp2')
/* */
/* OK, data sent. Now we are done. */
/* Tell APPC that this transaction is complete. */
/* */
/* This could be a 'do forever' loop processing single */
/* transmissions from multiple requestors one at a time. */
/* */
/* */
rc=appc('Tp_ended',tpid)
'exit'