XTKERMIT ;SF-ISC/RWF - Kermit protocol controler ;9/14/94 08:38 [ 11/22/95 1:17 PM ]
;;7.3;TOOLKIT;;Apr 25, 1995
;IHS/OHPRD/FJE 11/25/95 kermit utilities modified to remove some IO if
;IHS/OHPRD/FJE 11/25/95 variable XTKHL7 exists, queues task for data transfer to HL7
;To call from outside on KERMIT
;set XTKDIC = fileman type global root, DWLC = last current data node
;Return DWLC = last data node, XTKDIC is killed.
;For Send: XTKFILE = The file name for target.
;Optional
;set XTKMODE = 0 to send/receive in Image mode (no conversion)
; 1 to send/receive in DATA mode (just convert control char.).
; 2 to send/receive as TEXT (Mac) (FM word-processing).
; 3 to send/receive as TEXT (PC).
;Text mode sends a CR after each global node
; make a new global node for each CR received.
S ;MENU ENTRY POINT ONLY.
D SFILE^XTKERM4,SEND K DWLC,XTKDIC,XTKMODE Q
SEND ;Send data from host.
D INIT^XTKERM4 G ABORT:XTKERR D READY^XTKERM4,^XTKERM1,DONE
Q
R ;MENU ENTRY POINT ONLY.
D RFILE^XTKERM4,RECEIVE K DWLC,XTKDIC,XTKMODE Q
RECEIVE ;Load a file into the host.
D INIT^XTKERM4 G ABORT:XTKERR D READY^XTKERM4,^XTKERM2,DONE
Q
;Close up shop
ABORT W !!,$C(7),$S($L(XTKERR)>1:XTKERR,1:"Aborting File Transfer!")
DONE D RESTORE^XTKERM4 S Y=$S(XTKERR:-1,1:1) Q
;Modes 0 = Image or binary, 1 = Data, 2 = Text
MODE U IO(0) S DIR(0)="8980,3",DIR("B")=$S('$D(XTKMODE):"TEXT",1:$P("IMAGE^DATA^TEXT (Mac)^TEXT (PC)",U,XTKMODE+1)) D ^DIR K DIR Q:$D(DIRUT) S XTKMODE=+Y
U IO
Q
SR S DIR(0)="S^S:SEND;R:RECEIVE",DIR("A")="Send from the Host, Receive to the Host"
D ^DIR K DIR
Q
CLEAN K XTKERR,XTMODE,XTKDIC Q
TEST K ^TMP("XTKERM",$J),XTKDIC S XTKDEBUG=0 D SR Q:$D(DIRUT) D @Y
Q
KERM ;Entry from Mailman Talkman
U IO(0) K ^TMP("XTKERM",$J),XTKDIC D SR Q:$D(DIRUT) U IO D @Y
XTKERMIT ;SF-ISC/RWF - Kermit protocol controler ;9/14/94 08:38 [ 11/22/95 1:17 PM ]
+1 ;;7.3;TOOLKIT;;Apr 25, 1995
+2 ;IHS/OHPRD/FJE 11/25/95 kermit utilities modified to remove some IO if
+3 ;IHS/OHPRD/FJE 11/25/95 variable XTKHL7 exists, queues task for data transfer to HL7
+4 ;To call from outside on KERMIT
+5 ;set XTKDIC = fileman type global root, DWLC = last current data node
+6 ;Return DWLC = last data node, XTKDIC is killed.
+7 ;For Send: XTKFILE = The file name for target.
+8 ;Optional
+9 ;set XTKMODE = 0 to send/receive in Image mode (no conversion)
+10 ; 1 to send/receive in DATA mode (just convert control char.).
+11 ; 2 to send/receive as TEXT (Mac) (FM word-processing).
+12 ; 3 to send/receive as TEXT (PC).
+13 ;Text mode sends a CR after each global node
+14 ; make a new global node for each CR received.
S ;MENU ENTRY POINT ONLY.
+1 DO SFILE^XTKERM4
DO SEND
KILL DWLC,XTKDIC,XTKMODE
QUIT
SEND ;Send data from host.
+1 DO INIT^XTKERM4
IF XTKERR
GOTO ABORT
DO READY^XTKERM4
DO ^XTKERM1
DO DONE
+2 QUIT
R ;MENU ENTRY POINT ONLY.
+1 DO RFILE^XTKERM4
DO RECEIVE
KILL DWLC,XTKDIC,XTKMODE
QUIT
RECEIVE ;Load a file into the host.
+1 DO INIT^XTKERM4
IF XTKERR
GOTO ABORT
DO READY^XTKERM4
DO ^XTKERM2
DO DONE
+2 QUIT
+3 ;Close up shop
ABORT WRITE !!,$CHAR(7),$SELECT($LENGTH(XTKERR)>1:XTKERR,1:"Aborting File Transfer!")
DONE DO RESTORE^XTKERM4
SET Y=$SELECT(XTKERR:-1,1:1)
QUIT
+1 ;Modes 0 = Image or binary, 1 = Data, 2 = Text
MODE USE IO(0)
SET DIR(0)="8980,3"
SET DIR("B")=$SELECT('$DATA(XTKMODE):"TEXT",1:$PIECE("IMAGE^DATA^TEXT (Mac)^TEXT (PC)",U,XTKMODE+1))
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
QUIT
SET XTKMODE=+Y
+1 USE IO
+2 QUIT
SR SET DIR(0)="S^S:SEND;R:RECEIVE"
SET DIR("A")="Send from the Host, Receive to the Host"
+1 DO ^DIR
KILL DIR
+2 QUIT
CLEAN KILL XTKERR,XTMODE,XTKDIC
QUIT
TEST KILL ^TMP("XTKERM",$JOB),XTKDIC
SET XTKDEBUG=0
DO SR
IF $DATA(DIRUT)
QUIT
DO @Y
+1 QUIT
KERM ;Entry from Mailman Talkman
+1 USE IO(0)
KILL ^TMP("XTKERM",$JOB),XTKDIC
DO SR
IF $DATA(DIRUT)
QUIT
USE IO
DO @Y