Exchange/SNA Manual
Console Program Example
Example Programs
E–18 104700 Tandem Computers Incorporated
 Page 7 [1] $RJE.EXCHAPPL.CONSRC 1991-05-29 13:38:20
 EXCHANGE/SNA CONSOLE APPLICATION EXAMPLE
 339. 000000 0 0 !****************************************************************************!
 340. 000000 0 0 ! This procedure performs the main loop of the program. !
 341. 000000 0 0 !****************************************************************************!
 342. 000000 0 0
 343. 000000 0 0 PROC ROOT MAIN;
 344. 000000 1 0
 345. 000000 1 0 BEGIN
 346. 000000 1 1
 347. 000000 1 1 CALL initialize;
 348. 000001 1 1 DO !main loop
 349. 000001 1 1 BEGIN
 350. 000001 1 2 CALL console^read;
 351. 000002 1 2 CALL prompt;
 352. 000003 1 2 fnum := -1;
 353. 000005 1 2 CALL AWAITIO (fnum, !buffer^addr! ,await^count);
 356. 000015 1 2
 357. 000015 1 2 IF fnum = term^fnum
 358. 000015 1 2 THEN
 359. 000021 1 2 BEGIN ! Terminal I/O completed
 360. 000021 1 3 ! Make entered string all capitals
 361. 000021 1 3 CALL SHIFTSTRING (sbuf^term, await^count,0);
 362. 000026 1 3 IF await^count = 4 AND sbuf^term = "EXIT"
 363. 000026 1 3 THEN ! User wants to stop
 364. 000042 1 3 end^loop := true
 365. 000042 1 3 ELSE
 366. 000045 1 3 BEGIN ! User entered a console command
 367. 000045 1 4 ! Cancel the outstanding console read
 368. 000045 1 4 CALL CANCEL (cons^fnum);
 369. 000050 1 4 IF <> THEN CALL DEBUG;
 370. 000052 1 4 IF await^count <> 0
 371. 000052 1 4 THEN
 372. 000054 1 4 BEGIN
 373. 000054 1 5 ! Send the command to the host
 374. 000054 1 5 CALL WRITE (cons^fnum, ibuf^term, await^count);
 377. 000064 1 5 IF <> THEN CALL DEBUG;
 378. 000066 1 5 CALL AWAITIO (cons^fnum);
 379. 000074 1 5 IF <> THEN CALL DEBUG;
 380. 000076 1 5 END;
 381. 000076 1 4 END;
 382. 000076 1 3 END ! End of terminal I/O completed
 383. 000076 1 2 ELSE
 384. 000077 1 2 IF fnum = cons^fnum
 385. 000077 1 2 THEN
 386. 000103 1 2 BEGIN ! Console I/O has completed
 387. 000103 1 3 ! Cancel the outstanding terminal read
 388. 000103 1 3 CALL CANCEL (term^fnum);
 389. 000106 1 3 IF <> THEN CALL DEBUG;
 390. 000110 1 3 ! Modify terminal attributes to write over the prompt
 391. 000110 1 3 CALL SETMODE (term^fnum, auto^line^feed, lfterm);
 394. 000117 1 3 IF <> THEN CALL DEBUG;










