GDSX Manual

Using Pseudo Procedures in a NonStop TS/MP
Environment
Extended General Device Support (GDSX) Manual134303
D-26
USAMPLE2 Listing
251. Pm^Name^Len,
252. Ssc^Name^D,
253. Sc^Name^Len^D,
254. S^RCV^Buf,
255. 62,
256. 62,
257. Replied^Len);
258. End;
259. End;
261. End;
265. !===========================================================================
266. ! DEVICE^HANDLER Procedure begins here
267. !===========================================================================
268. ! Find out our own DCB- and TCB-address
269. @My^Dcb := Dcbtbl[Internal^Term^No];
270. @My^Tcb := My^Dcb.Tcbaddr;
271
272 -- Do the initialization
273. Call Initialize^Device^Handler;
274.
275. -- Do the Main-Loop
276. While 1 Do Begin
277.
278. -- wait for an event to complete (message from device or stop)
279. Evt := Wait^Event ((Disp^Ioc + Disp^Stop), -1D);
280.
281. -- an event occured
282. Case Evt of Begin
283. E^Ioc -> -- from our device
284. Begin
285. -- let's get the address of the IOCB for the message just
completed
286. Filenum := -1;
287. @Term^Iocb := ^Listen (0, Filenum, 0);
288. -- get the new address for the new buffer
289. @Work^Buf := Term^Iocb.BufaddrX;
290. -- clear the buffer that we send to the Server
291. RCV^Buf ':=' " " & RCV^Buf for 30;
292. -- move the buffer that we received from our device
293. RCV^Buf ':=' 0 & Work^Buf For Term^Iocb.Iocnt Bytes;
294. If Check^Buffer Then Begin
295. -- buffer passed our checks
296. -- start a TMF transaction
297. Ferr := ^Begintransaction;
298. If Ferr Then
299. -- we have an error with ^BEGINTRANSACTION - let's die
300. Call Debug;
301. -- send the buffer that we just received to the server
303. Call Call^PathSend;
305. If Ferr Then Begin
306. -- ^SERVERCLASS_SEND_ reported an error
307. -- let's cancel this transaction
308. Ferr := ^Aborttransaction;
309. If Ferr Then
310. -- we have an error with ^ABORTTRANSACTION - let's die
311. Call Debug;
312. -- get more info about the error reported by
313. -- ^SERVERCLASS_SEND_
314. Ferr := ^Serverclass_Send_Info_ (Pathsend^Error,
315. Pathsend^Error[1]);
316. If Ferr Then
317. -- we have an error with ^SERVERCLASS_SEND_INFO_
318. Call Debug;
319. -- move the error from ^SERVERCLASS_SEND_INFO_ into the
buffer
320. S^Term^Buf ':=' "Serverclass_Send_ error ";
322. S^Term^Buf ':=' "Serverclass_Send_ error " &
323. "PE:xxx, FS:xxx " &
324. S^Term^Buf[38] for 11 Bytes;
325. Call Numout(Ascii^Result, Pathsend^Error, 10, 3);
326. S^Term^Buf[27] ':=' Ascii^Result for 3 Bytes;
327. Call Numout(Ascii^Result, Pathsend^Error[1], 10, 3);