TRANSFER Programming Manual

Sample Agent Program Code
Designing and Writing an Agent
069138, Update 1 to 040970 Tandem Computers Incorporated 10–23
156
157 **********************************************************************
158 * FIRST, CREATE A NEW ITEM (new item-id will be in rsp-cri-item-id) *
159 **********************************************************************
160
161 MOVE 111 TO uow-cri-item-type.
162 * See Appendix A for Item Types.
163 MOVE "Y" TO uow-cri-is-pkg-hdr.
164
165 MOVE 1 TO ih-uows-to-process.
166 MOVE -3 TO ih-request-code.
167
168 SEND ih-ipc-hdr, uow-cri-create-item-uow
169 TO "TISERV"
170 REPLY CODE 0, 1, 2 YIELDS
171 ih-ipc-hdr, rsp-cri-create-item-rsp,
172 CODE 3 YIELDS ih-ipc-hdr.
173
174 **********************************************************************
175 * The following 2 UOW's will be sent in the same SEND (Inter- *
176 * Process Communication). The reason this can be done is *
177 * threefold: *
178 * *
179 * 1) They all go to the same server class (TISERV). *
180 * 2) Neither of the UOW's needs information from the other (This *
181 * is why the above UOW-CRI could not be included). *
182 * 3) Each UOW sent has a separate working-storage area (If you *
183 * sent 2 UOW-CRI's in the same SEND, they would need *
184 * separate working-storage areas). *
185 * *
186 * The advantage of doing this is: fewer messages sent. *
187 * The disadvantage of doing this is: longer messages. *
188 * *
189 **********************************************************************
190
191 **********************************************************************
192 * BUILD THE UOW TO ADD THE FORWARDEE AS A RECIPIENT *
193 * *
194 * uow-ar-add-recip-uow *
195 * *
196 **********************************************************************
197
198 MOVE rsp-cri-item-id TO uow-ar-item-id.
199 MOVE ag-lnk-agent-data TO uow-ar-recip-name.
200 MOVE 340 TO uow-ar-recip-type.
201 * See Appendix A for Recip Types.
202 MOVE ALL "N" TO uow-ar-options.
203 MOVE "Y" TO uow-ar-use-depot-resol-flags.
204
205 **********************************************************************
206 * BUILD THE UOW TO ADD A SUBJECT RECORD TO THE NEW ITEM *
207 * *
208 * uow-air-add-item-rec-uow *
209 * *
210 **********************************************************************
211
212 MOVE rsp-cri-item-id TO uow-air-item-id.
213 MOVE 140 TO uow-air-data-byte-count.
214 MOVE "Package forwarded by sample agent" TO uow-air-client-data.
215 MOVE 115 TO uow-air-rec-type.
216 * See Appendix A for Rec Types.
217 MOVE -1 TO uow-air-rec-seq-num.
218
219 **********************************************************************
220 * ISSUE THE SEND *
221 **********************************************************************
222
223 MOVE 2 TO ih-uows-to-process.
224 MOVE -2 TO ih-request-code.