home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / RXAPPC.ZIP / RXAPPC.INF (.txt) < prev    next >
OS/2 Help File  |  1992-10-12  |  32KB  |  1,222 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. (C) Copyright IBM Corp. 1992 ΓòÉΓòÉΓòÉ
  3.  
  4.  
  5. ΓòÉΓòÉΓòÉ 2. Installation ΓòÉΓòÉΓòÉ
  6.  
  7.  
  8. ΓòÉΓòÉΓòÉ 2.1. REXXAPPC Installation ΓòÉΓòÉΓòÉ
  9.  
  10. Copy SAAAPPC.DLL to a LIBPATH directory 
  11.  
  12. Start Communications Manager 
  13.  
  14. Add a modified version of the following TP definition for TP2 to your 
  15. Communications Manager NDF file in \CMLIB\APPN 
  16.  
  17.   DEFINE_TP  TP_NAME(TP2)
  18.              FILESPEC(idrive\os2\cmd.exe)
  19.              PARM_STRING(/c [fdrive\fpath\]tp2.cmd)
  20.              CONVERSATION_TYPE(EITHER)
  21.              CONV_SECURITY_RQD(NO)
  22.              SYNC_LEVEL(EITHER)
  23.              TP_OPERATION(NONQUEUED_AM_STARTED)
  24.              PROGRAM_TYPE(VIO_WINDOWABLE)
  25.              RECEIVE_ALLOCATE_TIMEOUT(INFINITE);
  26.  
  27. where idrive is the drive OS/2 is installed on and 
  28.  
  29. fdrive\fpath are the drive and path where TP2.CMD exists if it is NOT in a 
  30. directory in the PATH= environment variable 
  31.  
  32. type APPNV configname /E to update the active Communications Manager 
  33. configuration 
  34.  
  35.  where configname is the name of the NDF file modified above 
  36.  
  37. Add the following line to all REXXAPPC execs to insure the function is 
  38. registered 
  39.  
  40. If rxfuncquery('Appc') then call rxfuncadd 'APPC','SAAAPPC','APPCSRV'
  41.  
  42.  
  43. ΓòÉΓòÉΓòÉ 3. REXXAPPC Programming Interface ΓòÉΓòÉΓòÉ
  44.  
  45. The REXXAPPC function package provides two sets of functions: 
  46.  
  47.  1. Control Verbs 
  48.  
  49.    o Receive_allocate 
  50.    o Tp_started 
  51.    o Tp_ended 
  52.  
  53.  2. Conversation Verbs 
  54.  
  55.    o Allocate 
  56.    o Confirm 
  57.    o Confirmed 
  58.    o Convert 
  59.    o Deallocate 
  60.    o Flush 
  61.    o Get_attributes 
  62.    o Prepare_to_receive 
  63.    o Receive_wait 
  64.    o Request_to_send 
  65.    o Send_Conversation 
  66.    o Send_data 
  67.    o Send_error 
  68.    o Test_rts 
  69.  
  70.     Note:  These verbs are supported in both Basic and Mapped formats thru a 
  71.     function parameter rather than separate functions. 
  72.  
  73. The basic format of the APPC service function is as follows: 
  74.  
  75. APPC( function [ , function specific data ] )
  76.  
  77. REXXAPPC Function syntax
  78.  
  79.  
  80. ΓòÉΓòÉΓòÉ 3.1. Basic Return codes ΓòÉΓòÉΓòÉ
  81.  
  82. In addition to specific return codes for each function, there is a set of 
  83. values that can be returned for any of the functions. These are called Basic 
  84. return codes and are documented here to simplify the document. 
  85.  
  86. Syntax related Basic return codes 
  87.  
  88. o BAD_CONV_ID               0x02000000 
  89. o BAD_CONV_TYPE              0x11000000 
  90. o BAD_LL                 0xF1000000 
  91. o BAD_LU_ALIAS              0x03000000 
  92. o BAD_RETURN_CONTROL           0x14000000 
  93. o BAD_SECURITY              0x13000000 
  94. o BAD_SYNC_LEVEL             0x12000000 
  95. o BAD_TP_ID                0x01000000 
  96.  
  97. Operation Related Basic return codes 
  98.  
  99. o TP_BUSY                 0x02F0 
  100. o COMM_SUBSYSTEM_ABENDED         0x03F0 
  101. o COMM_SUBSYSTEM_NOT_LOADED        0x04F0 
  102. o INVALID_VERB_SEGMENT          0x08F0 
  103. o UNEXPECTED_DOS_ERROR          0x11F0 
  104. o CONVERSATION_TYPE_MIXED         0x1900 
  105. o CANCELLED                0x2100 
  106. o DEALLOC_ABEND              0x0500 
  107. o DEALLOC_ABEND_PROG           0x0600 
  108. o DEALLOC_ABEND_SVC            0x0700 
  109. o DEALLOC_ABEND_TIMER           0x0800 
  110. o DEALLOC_NORMAL             0x0900 
  111. o PROG_ERROR_NO_TRUNC           0x0C00 
  112. o PROG_ERROR_PURGING           0x0E00 
  113. o PROG_ERROR_TRUNC            0x0D00 
  114. o UNSUCCESSFUL              0x1400 
  115. o STACK_TOO_SMALL             0x15F0 
  116. o ALLOCATION_FAILURE_NO_RETRY       0x04000000 
  117. o ALLOCATION_FAILURE_RETRY        0x05000000 
  118. o CONVERSATION_TYPE_MISMATCH       0x34600810 
  119. o ALLOCATE_NOT_PENDING          0x09050000 
  120. o ATTACH_MANAGER_INACTIVE         0x08050000 
  121. o CONFIRM_BAD_STATE            0x32000000 
  122. o CONFIRM_NOT_LL_BDY           0x33000000 
  123. o CONFIRM_ON_SYNC_LEVEL_NONE       0x31000000 
  124. o CONFIRMED_BAD_STATE           0x41000000 
  125. o DEALLOC_BAD_TYPE            0x51000000 
  126. o DEALLOC_CONFIRM_BAD_STATE        0x53000000 
  127. o DEALLOC_FLUSH_BAD_STATE         0x52000000 
  128. o DEALLOC_LOG_LL_WRONG          0x57000000 
  129. o DEALLOC_NOT_LL_BDY           0x55000000 
  130. o FLUSH_NOT_SEND_STATE          0x61000000 
  131. o INVALID_DATA_SEGMENT          0x06000000 
  132. o INVALID_PROCESS             0x25050000 
  133. o INVALID_SEMAPHORE_HANDLE        0xD6000000 
  134. o NO_USE_OF_SNASVCMG           0x17000000 
  135. o P_TO_R_INVALID_TYPE           0xA1000000 
  136. o P_TO_R_NOT_LL_BDY            0xA2000000 
  137. o P_TO_R_NOT_SEND_STATE          0xA3000000 
  138. o PIP_LEN_INCORRECT            0x16000000 
  139. o PIP_NOT_ALLOWED             0x31600810 
  140. o PIP_NOT_SPECIFIED_CORRECTLY       0x32600810 
  141. o RCV_AND_POST_NOT_LL_BDY         0xD2000000 
  142. o R_T_S_BAD_STATE             0xE1000000 
  143. o RCV_AND_POST_BAD_FILL          0xD5000000 
  144. o RCV_AND_POST_BAD_STATE         0xD1000000 
  145. o RCV_AND_WAIT_BAD_FILL          0xB5000000 
  146. o RCV_AND_WAIT_BAD_STATE         0xB1000000 
  147. o RCV_AND_WAIT_NOT_LL_BDY         0xB2000000 
  148. o RCV_IMMD_BAD_FILL            0xC4000000 
  149. o RCV_IMMD_BAD_STATE           0xC1000000 
  150. o SEND_ERROR_BAD_TYPE           0x03010000 
  151. o SECURITY_NOT_VALID           0x51600F08 
  152. o SEND_DATA_BAD_MAP_NAME         0xF3000000 
  153. o SEND_DATA_NOT_SEND_STATE        0xF2000000 
  154. o SEND_ERROR_LOG_LL_WRONG         0x02010000 
  155. o SYNC_LEVEL_NOT_SUPPORTED        0x41600810 
  156. o TOO_MANY_TPS              0x43020000 
  157. o TP_NAME_NOT_RECOGNIZED         0x21600810 
  158. o TRANS_PGM_NOT_AVAIL_NO_RETRY      0x00004C08 
  159. o TRANS_PGM_NOT_AVAIL_RETRY        0x31604B08 
  160. o UNKNOWN_PARTNER_MODE          0x18000000 
  161. o UNDEFINED_TP_NAME            0x06050000 
  162.  
  163.  
  164. ΓòÉΓòÉΓòÉ 3.1.1. APPC Conversations and general information ΓòÉΓòÉΓòÉ
  165.  
  166. APPC provides two general types of conversations, (i.e., peer-to-peer 
  167. communication sessions): 
  168.  
  169. o Basic 
  170.  
  171.   A basic conversation provides low level control of the data being 
  172.   transmitted. A sending program (Transaction Program or TP) can build a buffer 
  173.   of logical records, with a length for each logical record, and transmit the 
  174.   entire buffer. The receiving TP can choose to process the buffer as a single 
  175.   buffer, or to receive ONLY one logical records worth of data. 
  176.  
  177.   This provides a great deal of flexibility and power. The receiving program 
  178.   need not KNOW or CARE how the sending program packaged a particular 
  179.   transmission. It can choose to process only individual logical records. The 
  180.   receiving TP would not know how many records were to be processed or their 
  181.   layout in the buffer, or in fact whether the entire record was sent in a 
  182.   single or multiple transmissions. The APPC subsystem will do the unblocking 
  183.   as part of the transmission service. 
  184.  
  185.   This is known as 'LL' type reception, and can be specified on any of the 
  186.   Receive data functions described later. 
  187.  
  188.   The other Basic conversation receive option is called 'Buffer'. Using this 
  189.   option, the receiving TP must provide code to extract a logical record from 
  190.   the buffer received. 
  191.  
  192.   To use either basic conversation reception type requires BOTH the sender AND 
  193.   receiver TPs to perform special processing. For each logical record in a 
  194.   transmission buffer, a 2 byte length field must precede the actual data of 
  195.   the logical record. The length field MUST include the length of the length 
  196.   field itself. Therefore the minimum logical record size (including length 
  197.   field) is 2 bytes. In addition, (including this REXX adapter) the layout of 
  198.   the length field is required to be in 370 data format (i.e., the high-order 
  199.   byte of the length (in binary) must be at the lowest memory address, this is 
  200.   backwards from the way it normally is stored on the INTEL architecture 
  201.   machines.)  A length value of 258 decimal would be x'0102' in hex, and should 
  202.   be stored that way immediately in front of the data. The INTEL layout that we 
  203.   are all used to would have the data in memory like this x'0201' 
  204.  
  205.     Example:
  206.  
  207.     x'0102'data    correct layout
  208.  
  209.     x'0201'data    incorrect layout
  210.  
  211.   You can use the D2X built-in function to convert a REXX whole number into a 
  212.   hexadecimal string with the correct layout. 
  213.  
  214.   As you will see later, the receive functions return a value called 
  215.   'what_received'. This value indicates the state of the current logical record 
  216.   or buffer. 
  217.  
  218.    Data_complete A complete logical record has been received. Please note that 
  219.              this does NOT mean that ALL data sent has been received, only that 
  220.              the CURRENT logical record has been moved into the TPs application 
  221.              buffer space by the communications subsystem. 
  222.  
  223.    Data_incomplete There was insufficient room in the TPs application buffer 
  224.              space for the entire logical record. More data for this record 
  225.              will be received on subsequent receive call(s). There is no way to 
  226.              determine how many receive calls are required to receive ALL the 
  227.              data in this logical record, unless the TPs involved have some 
  228.              prearranged protocol. 
  229.  
  230.    Data      If you use the 'Buffer' option, this means that data has been 
  231.              received. How much of the actual transmission is unknown. When no 
  232.              more data is available, Data_complete will be returned. 
  233.  
  234. o Mapped 
  235.  
  236.   A mapped conversation supports transmission and reception of blocks of data. 
  237.   The receive function used specifies how much data can be received at one 
  238.   time. There is no logical record format, and the APPC subsystem will not 
  239.   perform any processing of the data itself. This makes transmission of 
  240.   complete blocks of data (file copies etc) easy. 
  241.  
  242.   For mapped conversations you can not receive 'Data'. 
  243.  
  244. There are additional 'what_received' values when no data has been received, 
  245. that indicate the state of the conversation. These are described here for 
  246. clarity. 
  247.  
  248. SEND      This TP is now in SEND state 
  249.  
  250. CONFIRM   The other TP has requested that you confirm its last transmission. 
  251.           You may use either the 'Confirmed' verb to confirm reception, or 
  252.           'Send_error' to deny confirmation. 
  253.  
  254. CONFIRM_SEND The remote TP has issued a 'Prepare_to_receive' verb with in 
  255.           'Confirm' level conversation. You can confirm it (by using the 
  256.           'Confirmed' verb), and this TP will be placed in SEND state. 
  257.           Otherwise, this TP will remain in receive state. 
  258.  
  259. CONFIRM_DEALLOCATE The remote TP has requested that the conversation be 
  260.           terminated. If this TP used 'Confirmed', the session will be ended. 
  261.           Otherwise the session will continue. The send/receive state of this 
  262.           TP depends on  many things, but can be determined by using the 
  263.           'Get_attributes' verb. 
  264.  
  265. The Values returned for 'what_received' are: 
  266.  
  267. DATA      '256' 
  268.  
  269. DATA_COMPLETE '512' 
  270.  
  271. DATA_INCOMPLETE '1024' 
  272.  
  273. SEND      '1' 
  274.  
  275. CONFIRM   '2' 
  276.  
  277. CONFIRM_SEND '3' 
  278.  
  279. CONFIRM_DEALLOCATE '4' 
  280.  
  281. These values are the decimal representation of the binary values returned by 
  282. the APPC subsystem. 
  283.  
  284.  
  285. ΓòÉΓòÉΓòÉ 3.2. REXXAPPC Control Verb Functions ΓòÉΓòÉΓòÉ
  286.  
  287.  
  288. ΓòÉΓòÉΓòÉ 3.2.1. Receive_allocate ΓòÉΓòÉΓòÉ
  289.  
  290. APPC( 'Receive_allocate', tpname, stemname )
  291.  
  292. Allows a 'server' LU to wait for a session request from a 'requester' system. 
  293.  
  294. tpname is the name this server program will be known by. A requester must use 
  295. tpname when an Allocate request is made to connect to this server. 
  296.  
  297. to supply a service tp name, enter the EBCDIC value in hex. 
  298.  
  299. '06F3F0F1'x
  300.  
  301. stemname is the name of a REXX stem variable where info returned from the 
  302. Receive_allocate call will be placed. 
  303.  
  304. This function will return one of the following values: 
  305.  
  306. 0         Function completed ok 
  307.  
  308.           Additional info will be in the variable stemname in the following 
  309.           order: 
  310.  
  311.    stemname.0 tp_ID to be used in subsequent functions on this conversation 
  312.  
  313.    stemname.1 conv_ID to be used on subsequent functions on this conversation 
  314.  
  315.    stemname.2 sync_level, synchronization level 
  316.  
  317.              'N' = None 
  318.  
  319.              'C' = Confirm 
  320.  
  321.    stemname.3 Conversation Type 
  322.  
  323.              'B' = Basic 
  324.  
  325.              'M' = Mapped 
  326.  
  327.    stemname.4 user_ID, Conversation level user ID of the conversation 
  328.              initiating program. 
  329.  
  330.    stemname.5 LU_alias, Local LU alias name or '' if none. 
  331.  
  332.    stemname.6 Partner_LU name, Local name of LU from which the Allocate request 
  333.              was received. 
  334.  
  335.    stemname.7 mode_name, the mode name used on the allocate request. 
  336.  
  337. not 0     error return code from Receive_allocate request. 
  338.  
  339.           Note:  stemname will be dropped 
  340.  
  341.  
  342. ΓòÉΓòÉΓòÉ 3.2.2. Tp_started ΓòÉΓòÉΓòÉ
  343.  
  344. APPC( 'Tp_started' , [ LU_alias ] , tpname, stemname )
  345.  
  346. Establishes a server program on this system with name tpname. If LU_alias is 
  347. supplied it must be one of the LU_alias names established during system 
  348. configuration. If LU_alias is not supplied, the configured default LU will be 
  349. used. 
  350.  
  351. to supply a service tp name, enter the EBCDIC value in hex. 
  352.  
  353. '06F3F0F1'x
  354.  
  355. This function returns one of two values: 
  356.  
  357. 0         Function Completed ok 
  358.  
  359.           Additional info will be in the variable stemname in the following 
  360.           order: 
  361.  
  362.    stemname.0 tp_ID to be used in subsequent functions on this conversation 
  363.  
  364. not 0     error return code from Tp_started request. 
  365.  
  366.           Note:  stemname will be dropped 
  367.  
  368.  
  369. ΓòÉΓòÉΓòÉ 3.2.3. Tp_ended ΓòÉΓòÉΓòÉ
  370.  
  371. APPC( 'Tp_ended' , tp_ID [ , type ] )
  372.  
  373. Terminates the server program on this system with name tp_ID. the tp_ID value 
  374. is returned on the 'Received_allocate' or 'Tp_started' functions. 
  375.  
  376. type can be either of the following, of which only the first character is 
  377. significant 
  378.  
  379. 'Soft'    Ends the TP, but does NOT terminate any active sessions between the 
  380.           partners 
  381.  
  382. 'Hard'    Ends the TP, AND terminates any active sessions between the partners. 
  383.  
  384. This function returns one of two values: 
  385.  
  386. 0         Function Completed ok 
  387.  
  388. not 0     error return code from Tp_ended request. 
  389.  
  390.  
  391. ΓòÉΓòÉΓòÉ 3.3. REXXAPPC Conversation Verb Functions ΓòÉΓòÉΓòÉ
  392.  
  393.  
  394. ΓòÉΓòÉΓòÉ 3.3.1. Allocate Conversation ΓòÉΓòÉΓòÉ
  395.  
  396. APPC( 'Allocate' , tp_ID , Partner_LU , Modename , tpname ,
  397.     type , Return_control , sync_level , security , stemname )
  398.  
  399. Create a conversation with server tpname on system Partner_LU using tp_ID as 
  400. this applications name in mode Modename. 
  401.  
  402. Partner_LU may be a Local LU Alias, an implicit LU, or a Fully Qualified 
  403. Partner LU name (i.e., contains Network_name.LU_name). 
  404.  
  405. to supply a service tp name, enter the EBCDIC value in hex. 
  406.  
  407. '06F3F0F1'x
  408.  
  409. type must be one of the following (of which only the first character is 
  410. significant) 
  411.  
  412. 'Basic'   Basic conversation 
  413.  
  414. 'Mapped'  Mapped Conversation 
  415.  
  416. Return_control can contain any of the following values (of which only the first 
  417. character is significant) 
  418.  
  419. 'Allocated' Return from the function when the conversation is established. 
  420.  
  421. 'Immediate' Returns control immediately whether or not the conversation was 
  422.           established. 
  423.  
  424. 'Free'    Returns control when a conversation is available, whether or not the 
  425.           conversation was established. 
  426.  
  427. Sync_level can contain one of the following values (of which only the first 
  428. character is significant): 
  429.  
  430. 'None'    No synchronization verbs are allowed during this conversation 
  431.  
  432. 'Confirm' Synchronization verbs ARE allowed during this conversation. 
  433.  
  434. Security may contain one of the following values, which must be complete: 
  435.  
  436. 'None'    No conversation level Security 
  437.  
  438. 'Same'    The user ID was verified when the local transaction program was 
  439.           initiated. 
  440.  
  441. 'Pgm U P' The remote LU validates access by examining the Userid string (up to 
  442.           10 characters with no imbedded spaces) and the Password (up to 10 
  443.           characters with no imbedded spaces) 
  444.  
  445.                     Example
  446.  
  447.                     'Pgm SOMEUSER SOMEPWD'
  448.  
  449.           Note:  The Userid and Password strings should be in upper case. This 
  450.           can be done with the Translate built-in function. 
  451.  
  452. stemname is the name of a REXX stem variable that will contain additional 
  453. information if the allocate request succeeds. 
  454.  
  455. This function returns one of two values: 
  456.  
  457. Note:  stemname will be dropped before the call is executed 
  458.  
  459. 0         Function Completed ok 
  460.  
  461.    stemname.1 conv_ID to be used on subsequent functions on this conversation 
  462.  
  463. not 0     error return code from Allocate request. 
  464.  
  465.           additional info is provided as follows: 
  466.  
  467.    stemname.2 primary return code 
  468.  
  469.    stemname.3 secondary return code 
  470.  
  471.    stemname.4 sense data 
  472.  
  473.  
  474. ΓòÉΓòÉΓòÉ 3.3.2. Confirm ΓòÉΓòÉΓòÉ
  475.  
  476. APPC( 'Confirm' , tp_ID , conv_ID , type )
  477.  
  478. Requests the remote application program to confirm (synchronize) the last 
  479. transmission. This function will force any buffered data to be sent, and then 
  480. wait for a reply from the remote application. To use this function request, 
  481. then conversation must have been allocated with a Sync_level of 'Confirm'. 
  482.  
  483. type must be one of the following (of which only the first character is 
  484. significant) 
  485.  
  486. 'Basic'   Basic conversation 
  487.  
  488. 'Mapped'  Mapped Conversation 
  489.  
  490. This function returns one of two values: 
  491.  
  492. 0         Function Completed ok 
  493.  
  494. not 0     error return code from Confirm request. 
  495.  
  496.  
  497. ΓòÉΓòÉΓòÉ 3.3.3. Confirmed ΓòÉΓòÉΓòÉ
  498.  
  499. APPC( 'Confirmed' , tp_ID , conv_ID , type )
  500.  
  501. Sends a positive response to a 'Confirm' request issued by the remote 
  502. transaction program. This function request can be used only when a 'Confirm' 
  503. request has been received. (see the Receive_ function request) 
  504.  
  505. type must be one of the following (of which only the first character is 
  506. significant) 
  507.  
  508. 'Basic'   Basic conversation 
  509.  
  510. 'Mapped'  Mapped Conversation 
  511.  
  512. This function returns one of two values: 
  513.  
  514. 0         Function Completed ok 
  515.  
  516. not 0     error return code from Confirmed request. 
  517.  
  518.  
  519. ΓòÉΓòÉΓòÉ 3.3.4. Convert ΓòÉΓòÉΓòÉ
  520.  
  521. APPC( 'Convert' , direction , table , expression )
  522.  
  523. Converts data from one type to another 
  524.  
  525. direction must be one of the following (of which only the first character is 
  526. significant) 
  527.  
  528. 'Ascii'   Convert data from EBCDIC to ASCII 
  529.  
  530. 'Ebcdic'  Convert data from ASCII to EBCDIC 
  531.  
  532. table must be one of the following 
  533.  
  534. 'A'       Use the Communications Manager 'A' translate table 
  535.  
  536. 'E'       Use the Communications Manager 'AE' translate table 
  537.  
  538. 'G'       Use the Communications Manager 'G' translate table. This table is 
  539.           user supplied, and MUST be specified as part of the Workstation 
  540.           Parameters in the Communications Manager Profile. 
  541.  
  542. expression is the data to convert, for example 
  543.  
  544. left(data_receive_from_host,10)
  545. or
  546. data_received_from_host
  547.  
  548. This function returns either the converted data, or '' in case of error 
  549.  
  550.  
  551. ΓòÉΓòÉΓòÉ 3.3.5. Deallocate ΓòÉΓòÉΓòÉ
  552.  
  553. APPC( 'Deallocate' , tp_ID , conv_ID , type, dtype )
  554.  
  555. Ends the conversation conv_ID. 
  556.  
  557. type must be one of the following (of which only the first character is 
  558. significant) 
  559.  
  560. 'Basic'   Basic conversation 
  561.  
  562. 'Mapped'  Mapped Conversation 
  563.  
  564. dtype must be one of the following (of which only the first character is 
  565. significant) 
  566.  
  567. Sync_level the conversation will be deallocated based on the Sync_level 
  568.           setting. 
  569.  
  570.           If Sync_level is 'None' a 'Flush' function will be executed and the 
  571.           conversation will be ended. 
  572.  
  573.           If Sync_level is 'Confirm', a 'Confirm' function will be executed and 
  574.           the conversation will be terminated only if 'Confirmed'. Otherwise an 
  575.           error results and the conversation is NOT ended. 
  576.  
  577. 'Flush'   A 'Flush' function will be executed and the conversation will be 
  578.           ended. 
  579.  
  580. 'Abend'   The conversation will be ended abnormally. If the conversation was in 
  581.           send state, a 'Flush' function will be executed. If in receive state, 
  582.           data may be purged and/or logical records may be terminated. 
  583.  
  584.           If this is a Basic conversation type, 'Abend' is equivalent to 
  585.           'Abend-Pgm' in the APPC Programmers Reference. 
  586.  
  587.           Note:  The 'Abend-SVC' and 'Abend-Timer' Basic conversation options 
  588.           are not supported. 
  589.  
  590. This function returns one of two values: 
  591.  
  592. 0         Function Completed ok 
  593.  
  594. not 0     error return code from Deallocate request. 
  595.  
  596.  
  597. ΓòÉΓòÉΓòÉ 3.3.6. Flush ΓòÉΓòÉΓòÉ
  598.  
  599. APPC( 'Flush' , tp_ID , conv_ID , type )
  600.  
  601. Forces any data buffered by the local LU to be sent to the remote LU. 
  602.  
  603. type must be one of the following (of which only the first character is 
  604. significant) 
  605.  
  606. 'Basic'   Basic conversation 
  607.  
  608. 'Mapped'  Mapped Conversation 
  609.  
  610. This function returns one of two values: 
  611.  
  612. 0         Function Completed ok 
  613.  
  614. not 0     error return code from Flush request. 
  615.  
  616.  
  617. ΓòÉΓòÉΓòÉ 3.3.7. Get_attributes ΓòÉΓòÉΓòÉ
  618.  
  619. APPC( 'Get_attributes' , tp_ID , conv_ID , type , stemname )
  620.  
  621. Provides attribute of the specified conversation. 
  622.  
  623. type must be one of the following (of which only the first character is 
  624. significant) 
  625.  
  626. 'Basic'   Basic conversation 
  627.  
  628. 'Mapped'  Mapped Conversation 
  629.  
  630. stemname is the name of a REXX stem variable that will contain additional 
  631. information if the allocate request succeeds. 
  632.  
  633. This function returns one of two values: 
  634.  
  635. 0         Function Completed ok 
  636.  
  637.    stemname.0 net_name 
  638.  
  639.              The name of the network containing the local LU 
  640.  
  641.    stemname.1 LU_name 
  642.  
  643.              The name of the local LU 
  644.  
  645.    stemname.2 LU_alias name 
  646.  
  647.              The alias name of the local LU 
  648.  
  649.    stemname.3 partner_LU_localname 
  650.  
  651.              The name the partner LU is known by on this system 
  652.  
  653.    stemname.4 partner_LU_netname 
  654.  
  655.              The name the partner LU is known by on this network 
  656.  
  657.    stemname.5 partner_full_name 
  658.  
  659.              The fully qualified name of the partner LU 
  660.  
  661.    stemname.6 mode_name 
  662.  
  663.              The mode_name in use by this conversation 
  664.  
  665.    stemname.7 sync_level in use during this conversation 
  666.  
  667.              'N' = None 
  668.  
  669.              'C' = Confirm 
  670.  
  671.    stemname.8 user_ID 
  672.  
  673.              The conversation level userid name (if any) or '' if none 
  674.  
  675. not 0     error return code from Get_attributes request. 
  676.  
  677.           Note:  stemname will be dropped 
  678.  
  679.  
  680. ΓòÉΓòÉΓòÉ 3.3.8. Prepare_to_receive ΓòÉΓòÉΓòÉ
  681.  
  682. APPC( 'Prepare_to_receive' , tp_ID , conv_ID , type , rtype , locks )
  683.  
  684. Used to change from send state to receive state, in anticipation of data. 
  685.  
  686. type must be one of the following (of which only the first character is 
  687. significant) 
  688.  
  689. 'Basic'   Basic conversation 
  690.  
  691. 'Mapped'  Mapped Conversation 
  692.  
  693. rtype must be one of the following (of which only the first character is 
  694. significant) 
  695.  
  696. 'Sync_level' the function will be performed based on the synchronization level 
  697.           set for this conversation. 
  698.  
  699.    None      A 'Flush' function will be executed prior to entering receive 
  700.              mode. 
  701.  
  702.    Confirm   A 'Confirm' function (which includes a Flush function, will be 
  703.              executed. 
  704.  
  705.              If the partner confirms receipt, the function will return in 
  706.              receive mode. 
  707.  
  708.              If the confirm fails, the return code determines the state of the 
  709.              conversation. 
  710.  
  711. 'Flush'   A 'flush' function will be performed prior to entering receive mode. 
  712.  
  713. locks specifies when to return control after executing the Confirm function of 
  714. this verb. If Sync_level for this conversation is None, then this parameter is 
  715. ignored. 
  716.  
  717. locks must be one of the following (of which only the first character is 
  718. significant) 
  719.  
  720. 'Short'   Control is returned immediately after the 'Confirm' function of this 
  721.           verb is executed. 
  722.  
  723. 'Long'    Control is returned upon receipt of information or data from the 
  724.           partner. 
  725.  
  726. This function will return one of two values: 
  727.  
  728. 0         Function completed ok 
  729.  
  730. not 0     error return code from Prepare_to_receive request. 
  731.  
  732.  
  733. ΓòÉΓòÉΓòÉ 3.3.9. Receive_wait ΓòÉΓòÉΓòÉ
  734.  
  735. APPC( 'Receive_wait' , tp_ID , conv_ID , type , stemname , maxlen )
  736.  
  737. Used to receive data from the other partner in this conversation. 
  738.  
  739. stemname is the name of a REXX stem variable where info returned from the 
  740. Receive_wait call will be placed. 
  741.  
  742. type must be one of the following (of which only the first character is 
  743. significant) 
  744.  
  745. 'Mapped'  Mapped Conversation 
  746.  
  747. 'Buffer'  Basic conversation with 'Buffer' receive option. 
  748.  
  749. 'LL'      Basic conversation with 'Logical' record receive option. 
  750.  
  751. This function will return one of two values: 
  752.  
  753. 0         Function completed ok 
  754.  
  755.           Additional info will be in the variable stemname in the following 
  756.           order: 
  757.  
  758.    stemname.0 a value to indicate what was received. 
  759.  
  760.    stemname.1 a value to indicate whether the remote partner sent a 'Request to 
  761.              Receive' direction change request as well as data. 
  762.  
  763.    stemname.2 the data received if stemname.0 indicates either 
  764.  
  765.              Data (for basic conversations only) 
  766.  
  767.              Data_complete 
  768.  
  769.              Data_incomplete 
  770.  
  771. not 0     error return code from Receive_wait request. 
  772.  
  773.  
  774. ΓòÉΓòÉΓòÉ 3.3.10. Receive_immediate ΓòÉΓòÉΓòÉ
  775.  
  776. APPC( 'Receive_immediate' , tp_ID , conv_ID , type , stemname , maxlen )
  777.  
  778. Used to receive data from the other partner in this conversation. 
  779.  
  780. stemname is the name of a REXX stem variable where info returned from the 
  781. Receive_immediate call will be placed. 
  782.  
  783. type must be one of the following (of which only the first character is 
  784. significant) 
  785.  
  786. 'Mapped'  Mapped Conversation 
  787.  
  788. 'Buffer'  Basic conversation with 'Buffer' receive option. 
  789.  
  790. 'LL'      Basic conversation with 'Logical' record receive option. 
  791.  
  792. This function will return one of two values: 
  793.  
  794. 0         Function completed ok 
  795.  
  796.           Additional info will be in the variable stemname in the following 
  797.           order: 
  798.  
  799.    stemname.0 a value to indicate what was received. 
  800.  
  801.    stemname.1 a value to indicate whether the remote partner sent a 'Request to 
  802.              Receive' direction change request as well as data. 
  803.  
  804.    stemname.2 the data received if stemname.0 indicates either 
  805.  
  806.              Data (for basic conversations only) 
  807.  
  808.              Data_complete 
  809.  
  810.              Data_incomplete 
  811.  
  812. not 0     error return code from Receive_immediate request. 
  813.  
  814. type must be one of the following (of which only the first character is 
  815. significant) 
  816.  
  817. 'Mapped'  Mapped Conversation 
  818.  
  819. 'Buffer'  Basic conversation with 'Buffer' receive option. 
  820.  
  821. 'LL'      Basic conversation with 'Logical' record receive option. 
  822.  
  823. queue_name is the name of an external data queue where info returned from the 
  824. Receive_post call will be placed. 
  825.  
  826. This function will return one of two values: 
  827.  
  828. 0         Function processing started 
  829.  
  830.           when this function completes, the following info will be placed on 
  831.           the external data queue queue_name: 
  832.  
  833.           a line consisting of the following data 
  834.  
  835.           conv_ID what_received request_to_receive_requested 
  836.  
  837.           where 
  838.  
  839.    conv_ID is the conversation ID that returned this information 
  840.  
  841.    what_received indicates what information was received 
  842.  
  843.    either '0' or '1' to indicate if the partner has requested to receive 
  844.    information. 
  845.  
  846. If what_received indicates Data (for basic conversations only), Data_complete 
  847. or Data_incomplete, then an additional record will be placed on the queue 
  848. following (fifo) the information recorded above. 
  849.  
  850. not 0     error return code from Receive_post request. 
  851.  
  852.  
  853. ΓòÉΓòÉΓòÉ 3.3.11. Request_to_send ΓòÉΓòÉΓòÉ
  854.  
  855. APPC( 'Request_to_send' , tp_ID , conv_ID , type )
  856.  
  857. Requests permission to send data to the remote LU. 
  858.  
  859. type must be one of the following (of which only the first character is 
  860. significant) 
  861.  
  862. 'Basic'   Basic conversation 
  863.  
  864. 'Mapped'  Mapped Conversation 
  865.  
  866. This function returns one of two values: 
  867.  
  868. 0         Function Completed ok 
  869.  
  870. not 0     error return code from Request_to_send request. 
  871.  
  872.  
  873. ΓòÉΓòÉΓòÉ 3.3.12. Send_Conversation ΓòÉΓòÉΓòÉ
  874.  
  875. APPC( 'Send_Conversation' , tp_ID , Partner_LU , Modename , tpname , type, Return_control ,
  876. security , data, [ Conv_Group_Id ] , stemname)
  877.  
  878. Create a conversation with server tpname on system Partner_LU using tp_ID in 
  879. Mode Modename, sends data and then deallocates the conversation without 
  880. confirmation. 
  881.  
  882. Partner_LU may be a Local LU Alias, an implicit LU, or a Fully Qualified 
  883. Partner LU name (i.e., contains Network_name.LU_name). 
  884.  
  885. to supply a service tp name, enter the EBCDIC value in hex. 
  886.  
  887. '06F3F0F1'x
  888.  
  889. type must be one of the following (of which only the first character is 
  890. significant) 
  891.  
  892. 'Basic'   Basic conversation 
  893.  
  894. 'Mapped'  Mapped Conversation 
  895.  
  896. Return_control can contain any of the following values (of which only the first 
  897. character is significant) 
  898.  
  899. 'Allocated' Return from the function when the conversation is established. 
  900.  
  901. 'Immediate' Returns control immediately whether or not the conversation was 
  902.           established. 
  903.  
  904. 'Free'    Returns control when a conversation is available, whether or not the 
  905.           conversation was established. 
  906.  
  907. 'ConWinner' Returns control when the first contention-winner session becomes 
  908.           available 
  909.  
  910. 'Group'   Allocates a specific session specified by the Conv_Group_Id parameter 
  911.  
  912.           Note:  If 'Group' is specified then Conv_Group_Id MUST be supplied 
  913.  
  914. Security may contain one of the following values, which must be complete: 
  915.  
  916. 'None'    No conversation level Security 
  917.  
  918. 'Same'    The user ID was verified when the local transaction program was 
  919.           initiated. 
  920.  
  921. 'Pgm U P' The remote LU validates access by examining the Userid string (up to 
  922.           10 characters with no imbedded spaces) and the Password (up to 10 
  923.           characters with no imbedded spaces) 
  924.  
  925.                     Example
  926.  
  927.                     'Pgm SOMEUSER SOMEPWD'
  928.  
  929.           Note:  The Userid and Password strings should be in upper case. This 
  930.           can be done with the Translate built-in function. 
  931.  
  932. stemname is the name of a REXX stem variable that will contain additional 
  933. information if the allocate request succeeds. 
  934.  
  935. This function returns one of two values: 
  936.  
  937. Note:  stemname will be dropped before the call is executed 
  938.  
  939. 0         Function Completed ok 
  940.  
  941.    stemname.1 Conv_Group_ID if Return_type is NOT 'Group' 
  942.  
  943. not 0     error return code from Allocate request. 
  944.  
  945.           additional info is provided as follows: 
  946.  
  947.    stemname.2 primary return code 
  948.  
  949.    stemname.3 secondary return code 
  950.  
  951.    stemname.4 sense data 
  952.  
  953.  
  954. ΓòÉΓòÉΓòÉ 3.3.13. Send_data ΓòÉΓòÉΓòÉ
  955.  
  956. APPC( 'Send_data' , tp_ID , conv_ID , type , data)
  957.  
  958. Sends data to the remote application program. 
  959.  
  960. type must be one of the following (of which only the first character is 
  961. significant) 
  962.  
  963. 'Basic'   Basic conversation 
  964.  
  965. 'Mapped'  Mapped Conversation 
  966.  
  967. This function returns one of two values: 
  968.  
  969. 0         Function Completed ok 
  970.  
  971. not 0     error return code from Send_data request. 
  972.  
  973.  
  974. ΓòÉΓòÉΓòÉ 3.3.14. Send_error ΓòÉΓòÉΓòÉ
  975.  
  976. APPC( 'Send_error' , tp_ID , conv_ID , type , layer )
  977.  
  978. Sends an error indication to the remote LU. 
  979.  
  980. type must be one of the following (of which only the first character is 
  981. significant) 
  982.  
  983. 'Basic'   Basic conversation 
  984.  
  985. 'Mapped'  Mapped Conversation 
  986.  
  987. layer must be one of the following (of which only the first characteis 
  988. significant) 
  989.  
  990. 'Program' This error was detected by the application programming level 
  991.  
  992. 'Service' This error was detected by the LU service program layer 
  993.  
  994. An LU Service Program is a transaction program that is written to provide 
  995. services to other programs at your LU.  Example LU service programs include the 
  996. SNA distribution system (SNA/DS), the APPC Mapped Conversation Support, and 
  997. Distributed Data Management (DDM). 
  998.  
  999. The basic conversation interface is intended for LU service programs.  It has 
  1000. extended features that are very valuable in this environment. 
  1001.  
  1002. o You can build architected records called general data stream (GDS) variables. 
  1003. o You can send or receive more than one data record in a single buffer with a 
  1004.   single verb. 
  1005. o You can provide a unique or optimized mapped conversation interface (good for 
  1006.   protocol converters). 
  1007. o You can provide a log data GDS variable when reporting an error (aids in 
  1008.   problem determination). 
  1009. o You can distinguish between errors detected by your program and errors 
  1010.   detected by your program's user. 
  1011.  
  1012.  The LAYER parameter of SEND_ERROR is intended to provide this last feature. 
  1013. It indicates where the error was detected.  If the error was detected by the 
  1014. program that uses your LU service program, specify Program.  If the error was 
  1015. detected by your LU service program, specify Service. 
  1016.  
  1017. The intent is to control the error recovery procedures at the partner LU. 
  1018.  
  1019. If the error was detected by the program that uses your LU service program, the 
  1020. error was in something outside the scope of your program. Therefore, the error 
  1021. recovery is also outside the scope of your program. At the partner LU, the 
  1022. error indication is passed up to the program which is using the partner LU 
  1023. service program. 
  1024.  
  1025. If the error was detected by your LU service program, the error and its 
  1026. recovery are within the scope of the service.  The error can be reported and 
  1027. recovery procedures completed without bothering the users at either LU. 
  1028.  
  1029. When you want to inform the partner program about the type of error detected 
  1030. (internal programming error, invalid request, unrecognized parameter, e.t.c), 
  1031. build a special data record which contains this information and use SEND_DATA 
  1032. to send it as the first data record after a SEND_ERROR request. 
  1033.  
  1034. This function returns one of two values: 
  1035.  
  1036. 0         Function Completed ok 
  1037.  
  1038. not 0     error return code from Send_error request. 
  1039.  
  1040.  
  1041. ΓòÉΓòÉΓòÉ 3.3.15. Test_rts ΓòÉΓòÉΓòÉ
  1042.  
  1043. APPC( 'Test_rts' , tp_ID , conv_ID , type )
  1044.  
  1045. Used to determine if the remote LU has requested to send data. 
  1046.  
  1047. type must be one of the following (of which only the first character is 
  1048. significant) 
  1049.  
  1050. 'Basic'   Basic conversation 
  1051.  
  1052. 'Mapped'  Mapped Conversation 
  1053.  
  1054. This function returns one of two values: 
  1055.  
  1056. 0         Function Completed ok 
  1057.  
  1058. not 0     error return code from Test_rts request. 
  1059.  
  1060.  
  1061. ΓòÉΓòÉΓòÉ 3.3.16. Trans_table ΓòÉΓòÉΓòÉ
  1062.  
  1063. APPC( 'Trans_table', table_type )
  1064.  
  1065. Used to set different translate tables to be used for any data translations 
  1066. required internally. The default Table is 'E' (AE). 
  1067.  
  1068. table_type must be one of the following 
  1069.  
  1070. 'A'       Use the Communications Manager 'A' translate table 
  1071.  
  1072. 'E'       Use the Communications Manager 'AE' translate table (DEFAULT) 
  1073.  
  1074. 'G'       Use the Communications Manager 'G' translate table. This table is 
  1075.           user supplied, and MUST be specified as part of the Workstation 
  1076.           Parameters in the Communications Manager Profile. 
  1077.  
  1078. This function returns one value: 
  1079.  
  1080. 0         Function Completed ok 
  1081.  
  1082.  
  1083. ΓòÉΓòÉΓòÉ 3.4. Sample Programs ΓòÉΓòÉΓòÉ
  1084.  
  1085.  
  1086. ΓòÉΓòÉΓòÉ 3.4.1. Client ΓòÉΓòÉΓòÉ
  1087.  
  1088. This is a sample 'requester' TP program in REXX. 
  1089.  
  1090. /*                                                                 */
  1091. /* REXX/APPC transaction program sample  (requester)               */
  1092. /*                                                                 */
  1093. trace off
  1094. /*                                                                 */
  1095. /* Tell Rexx that there is a new function available                */
  1096. /*                                                                 */
  1097.  
  1098. CALL RXFUNCADD APPC,SAAAPPC,APPCSRV
  1099.  
  1100. /*                                                                 */
  1101. /* start a Transaction Pgm (i.e., tell APPC we're here and running)*/
  1102. /*                                                                 */
  1103.  
  1104. rc=appc('Tp_started',,'TP1','Lu1s.')
  1105.  
  1106. if rc=0 then do
  1107.  
  1108.   tpid=lu1s.0                   /* save the transaction pgm id     */
  1109.  
  1110. /*                                                                 */
  1111. /* Open (allocate) a conversation with Transaction pgm (TP) TP2    */
  1112. /* which is located on Node prompted for                           */
  1113. /* Note the Userid and Password data format.                       */
  1114. /*                                                                 */
  1115.  
  1116.   say 'Enter Partner LU name'
  1117.   pull plu .
  1118.   rc=appc('Allocate',lu1s.0,plu,'#BATCH','TP2','MAPPED','A','N', 'N','Lu1P.')
  1119.  
  1120.   if rc=0 then do
  1121.  
  1122.     convid=lu1p.1                   /* save the conversation id        */
  1123.  
  1124. /*                                                                 */
  1125. /* Lets send some data ('Hello from tp1') to our partner           */
  1126. /*                                                                 */
  1127. /* Note: as this is a 'Mapped' conversations, the length info      */
  1128. /*       is NOT part of the actual data.                           */
  1129. /*                                                                 */
  1130.  
  1131.     rc=appc('Send_data',tpid,convid,'Mapped','Hello from tp1')
  1132.  
  1133. /*                                                                 */
  1134. /* Now Lets receive send some data from our partner                */
  1135. /* Our partner will have to turn the conversation around           */
  1136. /*                                                                 */
  1137.  
  1138.     rc=appc('Receive_wait',tpid,convid,'Mapped','data.',1000)
  1139.     say data.2
  1140.  
  1141.  
  1142.   end
  1143.   else Say 'Allocate failed rc=' c2x(Lu1P.2) 'Secondary rc=' c2x(Lu1P.3) 'Sense=' c2x(Lu1p.4)
  1144.  
  1145. /*                                                                 */
  1146. /* Well, we're done now. So tell APPC we're done. APPC             */
  1147. /* will close the conversation.                                    */
  1148. /*                                                                 */
  1149.   rc=appc('Tp_ended',tpid)
  1150. end
  1151. else do
  1152.   say 'Communications manager has not been started'
  1153.   say 'or is not configured for APPC'
  1154. end
  1155.  
  1156.  
  1157. ΓòÉΓòÉΓòÉ 3.4.2. Server ΓòÉΓòÉΓòÉ
  1158.  
  1159. This is a sample 'server'TP program in REXX. 
  1160.  
  1161. /*                                                                 */
  1162. /* REXX/APPC transaction program sample  (server)                  */
  1163. /*                                                                 */
  1164. trace off
  1165. /*                                                                 */
  1166. /* Tell Rexx that there is a new function available                */
  1167. /*                                                                 */
  1168.  
  1169. CALL RXFUNCADD APPC,SAAAPPC,APPCSRV
  1170.  
  1171. /*                                                                 */
  1172. /* Tell APPC that we are TP2 and we're ready to talk to any other  */
  1173. /* TP that calls us.                                               */
  1174. /*                                                                 */
  1175.  
  1176. rc=appc('Receive_allocate','TP2','Lu2s.')
  1177.  
  1178. tpid=lu2s.0                     /* save the TP ID                  */
  1179. convid=lu2s.1                   /* and conversation ID             */
  1180. ConvType=Lu2s.3            /* get Conversation type (Basic/Mapped) */
  1181.  
  1182. /*                                                                 */
  1183. /* Lets receive some data from our partner.                        */
  1184. /*                                                                 */
  1185. /* Note: This is a 'Mapped' Conversation.                          */
  1186. /*                                                                 */
  1187.  
  1188. rc=appc('Receive_wait',tpid,convid,ConvType,'data.',1000)
  1189. say data.2
  1190.  
  1191. /*                                                                 */
  1192. /* We have the data. In this sample, we know there is no more      */
  1193. /* data coming, so a receive_immediate will turn the line around.  */
  1194. /* In reality one should check the state after the receive_wait    */
  1195. /* to see if all the data was received, and check again after      */
  1196. /* the receive_immediate.                                          */
  1197. /*                                                                 */
  1198. /* But were skimping here, cause its only a sample                 */
  1199. /*                                                                 */
  1200.  
  1201. rc=appc('Receive_immediate',tpid,convid,ConvType,'data1.',1000)
  1202.  
  1203. /*                                                                 */
  1204. /*  We should be in 'SEND' state now, that means WE can SEND       */
  1205. /*  data1.0 should contain 'SEND' as what_received                 */
  1206. /*                                                                 */
  1207.  
  1208. rc=appc('Send_data',tpid,convid,ConvType,'Hello from tp2')
  1209.  
  1210. /*                                                                 */
  1211. /*  OK, data sent. Now we are done.                                */
  1212. /*  Tell APPC that this transaction is complete.                   */
  1213. /*                                                                 */
  1214. /*  This could be a 'do forever' loop processing single            */
  1215. /*  transmissions from multiple requestors one at a time.          */
  1216. /*                                                                 */
  1217. /*                                                                 */
  1218.  
  1219. rc=appc('Tp_ended',tpid)
  1220.  
  1221. 'exit'
  1222.