XTKERM4 ;SF/RWF - Kermit utility parts ;11/8/93 11:46 ;
;;7.3;TOOLKIT;;Apr 25, 1995
INIT ;Init kermit paramiters
S (XTKS("PN"),XTKR("PN"))=0
S XTKRDAT="~+ @-#N1" D RPAR S XTKSDAT="~+ @-#N1" D SPAR
S XTKS("TO")=15,XTKS("QA")="#",(XTKS("SOH"),XTKR("SOH"))=1
S (XTKR("MAXTRY"),XTKS("MAXTRY"))=10,XTKERR=0
S (XTKR("TRY"),XTKR("CCNT"),XTKR("PN"))=0,XTKR("PT")="B",XTKR("SA")=""
S (XTKS("TRY"),XTKS("CCNT"),XTKS("PN"))=0,XTKS("PT")="S",XTKS("SA")=""
S:'$D(XTKDIC) XTKERR=1 S:'$D(XTKMODE) XTKMODE=2 S:'$D(DWLC) DWLC=0
S U="^",XTKR("TRMRD")=^%ZOSF("TRMRD")
Q
RPAR ;Setup receive paramiters from the S packet, Some go into send parameters
Q:XTKRDAT']""
S X=$A(XTKRDAT)-35 S:X>1 XTKS("SIZ")=X
S XTKR("TO")=$A(XTKRDAT,2)-32,XTKS("EOL")=$A(XTKRDAT,5)-32,XTKR("QA")=$E(XTKRDAT,6)
S:XTKS("EOL")<1 XTKS("EOL")=13 S:XTKR("QA")=" "!(XTKR("QA")="") XTKR("QA")="#"
S:XTKR("TO")<1 XTKR("TO")=5
Q
SPAR ;Setup send paramiters from the Y packet.
Q:XTKSDAT']""
S X=$A(XTKSDAT)-35 S:X>1 XTKS("SIZ")=X
S XTKR("TO")=$A(XTKSDAT,2)-32,XTKS("NPAD")=$A(XTKSDAT,3)-32,XTKS("PADC")=$E(XTKSDAT,4)#64,XTKS("EOL")=$A(XTKSDAT,5)-32,XTKR("QA")=$E(XTKSDAT,6)
S:XTKS("EOL")<1 XTKS("EOL")=13 S:XTKR("QA")=" "!(XTKR("QA")="") XTKR("QA")="#" S:XTKS("NPAD")<0 XTKS("NPAD")=0
S:XTKR("TO")<1 XTKR("TO")=5
Q
SFILE ;Get file to send.
K DIC S XTKERR=1,DIC="^DIZ(8980,",DIC(0)="AEMQ",DIC("A")="KERMIT FILE TO SEND:" D ^DIC Q:Y'>0
S XTKERR=0,XTKDA=+Y,XTKDIC="^DIZ(8980,"_XTKDA_",2,",XTKFILE=$P(Y,U,2),DIE=DIC,DA=+Y,DR="1///NOW;3" D ^DIE
S XTKMODE=$P(^DIZ(8980,XTKDA,0),U,4) K DIC,DIE,DR,DA
Q
RFILE ;Recive file
W !!,"If you enter 'XXX' for the file name it will be replaced by the name sent."
K DIC S XTKERR=1,DLAYGO=8980,DIC="^DIZ(8980,",DIC(0)="AEMQLZ",DIC("A")="RECIEVE TO KERMIT FILE:",DIC("DR")="2//YES;3//TEXT" D ^DIC Q:Y'>0
S XTKDA=+Y,XTKFILE=$P(Y,U,2) I '$P(Y,U,3) S DA=+Y,DIE=DIC,DR="1///NOW;2;3" D ^DIE S Y(0)=^DIZ(8980,XTKDA,0)
S XTKERR=0,XTKDIC="^DIZ(8980,"_XTKDA_",2,",XTKR("RFN")=$P(Y(0),U,3),XTKMODE=$P(Y(0),U,4)
S @(XTKDIC_"0)")="" K DIC,DIE,DA,DR
Q
READY S X=0 X ^%ZOSF("RM"),^%ZOSF("TYPE-AHEAD"),^%ZOSF("EOFF"),^%ZOSF("TRMON") Q
RESTORE S X=$S($D(IOM):IOM,1:80) X ^%ZOSF("RM"),^%ZOSF("EON"),^%ZOSF("TRMOFF") Q:$D(XTKDEBUG)
CLEAN ;Kill off variables
K A,C,F1,L,X1,X2,XTKR,XTKS,XTKRDAT,XTKSDAT,XTKRPK,XTKSPK,XTKDA,XTKFILE,XTKDIC,Y,Z,XTKET
Q
BSPAR ;Build S or Y init string
S XTKSDAT="~"_$C(XTKS("TO")+32)_" @-#N1"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXTKERM4 2464 printed Dec 13, 2024@02:41:16 Page 2
XTKERM4 ;SF/RWF - Kermit utility parts ;11/8/93 11:46 ;
+1 ;;7.3;TOOLKIT;;Apr 25, 1995
INIT ;Init kermit paramiters
+1 SET (XTKS("PN"),XTKR("PN"))=0
+2 SET XTKRDAT="~+ @-#N1"
DO RPAR
SET XTKSDAT="~+ @-#N1"
DO SPAR
+3 SET XTKS("TO")=15
SET XTKS("QA")="#"
SET (XTKS("SOH"),XTKR("SOH"))=1
+4 SET (XTKR("MAXTRY"),XTKS("MAXTRY"))=10
SET XTKERR=0
+5 SET (XTKR("TRY"),XTKR("CCNT"),XTKR("PN"))=0
SET XTKR("PT")="B"
SET XTKR("SA")=""
+6 SET (XTKS("TRY"),XTKS("CCNT"),XTKS("PN"))=0
SET XTKS("PT")="S"
SET XTKS("SA")=""
+7 if '$DATA(XTKDIC)
SET XTKERR=1
if '$DATA(XTKMODE)
SET XTKMODE=2
if '$DATA(DWLC)
SET DWLC=0
+8 SET U="^"
SET XTKR("TRMRD")=^%ZOSF("TRMRD")
+9 QUIT
RPAR ;Setup receive paramiters from the S packet, Some go into send parameters
+1 if XTKRDAT']""
QUIT
+2 SET X=$ASCII(XTKRDAT)-35
if X>1
SET XTKS("SIZ")=X
+3 SET XTKR("TO")=$ASCII(XTKRDAT,2)-32
SET XTKS("EOL")=$ASCII(XTKRDAT,5)-32
SET XTKR("QA")=$EXTRACT(XTKRDAT,6)
+4 if XTKS("EOL")<1
SET XTKS("EOL")=13
if XTKR("QA")=" "!(XTKR("QA")="")
SET XTKR("QA")="#"
+5 if XTKR("TO")<1
SET XTKR("TO")=5
+6 QUIT
SPAR ;Setup send paramiters from the Y packet.
+1 if XTKSDAT']""
QUIT
+2 SET X=$ASCII(XTKSDAT)-35
if X>1
SET XTKS("SIZ")=X
+3 SET XTKR("TO")=$ASCII(XTKSDAT,2)-32
SET XTKS("NPAD")=$ASCII(XTKSDAT,3)-32
SET XTKS("PADC")=$EXTRACT(XTKSDAT,4)#64
SET XTKS("EOL")=$ASCII(XTKSDAT,5)-32
SET XTKR("QA")=$EXTRACT(XTKSDAT,6)
+4 if XTKS("EOL")<1
SET XTKS("EOL")=13
if XTKR("QA")=" "!(XTKR("QA")="")
SET XTKR("QA")="#"
if XTKS("NPAD")<0
SET XTKS("NPAD")=0
+5 if XTKR("TO")<1
SET XTKR("TO")=5
+6 QUIT
SFILE ;Get file to send.
+1 KILL DIC
SET XTKERR=1
SET DIC="^DIZ(8980,"
SET DIC(0)="AEMQ"
SET DIC("A")="KERMIT FILE TO SEND:"
DO ^DIC
if Y'>0
QUIT
+2 SET XTKERR=0
SET XTKDA=+Y
SET XTKDIC="^DIZ(8980,"_XTKDA_",2,"
SET XTKFILE=$PIECE(Y,U,2)
SET DIE=DIC
SET DA=+Y
SET DR="1///NOW;3"
DO ^DIE
+3 SET XTKMODE=$PIECE(^DIZ(8980,XTKDA,0),U,4)
KILL DIC,DIE,DR,DA
+4 QUIT
RFILE ;Recive file
+1 WRITE !!,"If you enter 'XXX' for the file name it will be replaced by the name sent."
+2 KILL DIC
SET XTKERR=1
SET DLAYGO=8980
SET DIC="^DIZ(8980,"
SET DIC(0)="AEMQLZ"
SET DIC("A")="RECIEVE TO KERMIT FILE:"
SET DIC("DR")="2//YES;3//TEXT"
DO ^DIC
if Y'>0
QUIT
+3 SET XTKDA=+Y
SET XTKFILE=$PIECE(Y,U,2)
IF '$PIECE(Y,U,3)
SET DA=+Y
SET DIE=DIC
SET DR="1///NOW;2;3"
DO ^DIE
SET Y(0)=^DIZ(8980,XTKDA,0)
+4 SET XTKERR=0
SET XTKDIC="^DIZ(8980,"_XTKDA_",2,"
SET XTKR("RFN")=$PIECE(Y(0),U,3)
SET XTKMODE=$PIECE(Y(0),U,4)
+5 SET @(XTKDIC_"0)")=""
KILL DIC,DIE,DA,DR
+6 QUIT
READY SET X=0
XECUTE ^%ZOSF("RM")
XECUTE ^%ZOSF("TYPE-AHEAD")
XECUTE ^%ZOSF("EOFF")
XECUTE ^%ZOSF("TRMON")
QUIT
RESTORE SET X=$SELECT($DATA(IOM):IOM,1:80)
XECUTE ^%ZOSF("RM")
XECUTE ^%ZOSF("EON")
XECUTE ^%ZOSF("TRMOFF")
if $DATA(XTKDEBUG)
QUIT
CLEAN ;Kill off variables
+1 KILL A,C,F1,L,X1,X2,XTKR,XTKS,XTKRDAT,XTKSDAT,XTKRPK,XTKSPK,XTKDA,XTKFILE,XTKDIC,Y,Z,XTKET
+2 QUIT
BSPAR ;Build S or Y init string
+1 SET XTKSDAT="~"_$CHAR(XTKS("TO")+32)_" @-#N1"
+2 QUIT