home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / RXAPPC.ZIP / TP1.CMD < prev    next >
OS/2 REXX Batch file  |  1992-10-03  |  3KB  |  66 lines

  1. /*                                                                 */
  2. /* REXX/APPC transaction program sample  (requester)               */
  3. /*                                                                 */
  4. trace off
  5. /*                                                                 */
  6. /* Tell Rexx that there is a new function available                */
  7. /*                                                                 */
  8.  
  9. CALL RXFUNCADD APPC,SAAAPPC,APPCSRV
  10.  
  11. /*                                                                 */
  12. /* start a Transaction Pgm (i.e., tell APPC we're here and running)*/
  13. /*                                                                 */
  14.  
  15. rc=appc('Tp_started',,'TP1','Lu1s.')
  16.  
  17. if rc=0 then do
  18.  
  19.   tpid=lu1s.0                   /* save the transaction pgm id     */
  20.  
  21. /*                                                                 */
  22. /* Open (allocate) a conversation with Transaction pgm (TP) TP2    */
  23. /* which is located on Node prompted for                           */
  24. /* Note the Userid and Password data format.                       */
  25. /*                                                                 */
  26.  
  27.   say 'Enter Partner LU name'
  28.   pull plu .
  29.   rc=appc('Allocate',lu1s.0,plu,'#BATCH','TP2','MAPPED','A','N', 'N','Lu1P.')
  30.  
  31.   if rc=0 then do
  32.  
  33.     convid=lu1p.1                   /* save the conversation id        */
  34.  
  35. /*                                                                 */
  36. /* Lets send some data ('Hello from tp1') to our partner           */
  37. /*                                                                 */
  38. /* Note: as this is a 'Mapped' conversations, the length info      */
  39. /*       is NOT part of the actual data.                           */
  40. /*                                                                 */
  41.  
  42.     rc=appc('Send_data',tpid,convid,'Mapped','Hello from tp1')
  43.  
  44. /*                                                                 */
  45. /* Now Lets receive send some data from our partner                */
  46. /* Our partner will have to turn the conversation around           */
  47. /*                                                                 */
  48.  
  49.     rc=appc('Receive_wait',tpid,convid,'Mapped','data.',1000)
  50.     say data.2
  51.  
  52.  
  53.   end
  54.   else Say 'Allocate failed rc=' c2x(Lu1P.2) 'Secondary rc=' c2x(Lu1P.3) 'Sense=' c2x(Lu1p.4)
  55.  
  56. /*                                                                 */
  57. /* Well, we're done now. So tell APPC we're done. APPC             */
  58. /* will close the conversation.                                    */
  59. /*                                                                 */
  60.   rc=appc('Tp_ended',tpid)
  61. end
  62. else do
  63.   say 'Communications manager has not been started'
  64.   say 'or is not configured for APPC'
  65. end
  66.