%ZTMOVE ;SF/STAFF - Easier Multi-CPU routine transfers ;12/27/94 09:26
;;8.0;KERNEL;;Jul 10, 1995
S:'$D(DTIME) DTIME=120
OUT S U="^",MGR=$P(^%ZOSF("MGR"),",",1) X ^%ZOSF("UCI") S:Y'["," Y=Y_","_^%ZOSF("VOL") S HOME=Y,HOME("MGR")=MGR
W !!,"This will move the complete text of the routines selected to",!,"the MGR account of the system being moved to."
W !,"If you send a large number of routines you may run out of disk space",!,"on the target system.",!!
W !,"From ",HOME," send what routines!" K ^UTILITY($J) X ^%ZOSF("RSEL") G EXIT:$O(^UTILITY($J,0))=""
W !!,"You're in ",HOME
K ZTSYS F ZTI=1:1 D WHERE G EXIT:$D(DUOUT) Q:X="" W !!,"Then..."
W !!,"Starting to send!"
F ZTI=1:1 Q:'$D(ZTSYS(ZTI)) S X=ZTSYS(ZTI),ZTMODE=$P(X,U,1),SYS=$P(X,U,2),UCI=$P(X,U,3) D SEND
W !!,"Summary" F ZTI=1:1 Q:'$D(ZTSYS(ZTI,1)) S X=ZTSYS(ZTI),Y=ZTSYS(ZTI,1) D
. W !?3,"To ",$P(X,U,2)," ",$S('Y:Y,$E(X)="M":"as task # "_Y,1:"in UCI: "_$P(X,U,3))
. Q
EXIT K ZTSK,ZTSYS,ZTI,ZTMODE,SYS,UCI,HOME,ANS,DEF,MGR,Y,X,DUOUT,^UTILITY($J)
Q
;
WHERE W !,"To which Volume Set (2-7 letters or * for all) to send routines? " R SYS:DTIME G ALL:ZTI=1&(SYS="*"),ESC:'$T!(SYS["^"),WHEX:SYS'?2.7U
I $P(HOME,",",2)=SYS W !,*7,"THIS IS THE SAME SYSTEM!!"
R !,"Auto-load or Manual: Manual//",X:DTIME S ZTMODE=$E(X_"M") G ESC:'$T!(X["^"),WHERE:"AM"'[ZTMODE
S UCI=MGR I ZTMODE="A" R !,"Enter UCI to unload into: ",UCI:DTIME G ESC:'$T!(UCI["^"),WHERE:UCI'?2.7U
S ZTSYS(ZTI)=ZTMODE_U_SYS_U_UCI,X=1 Q
WHEX S X="" Q
ESC S X="",DUOUT=1 Q
ALL ;
R !,"Auto-load or Manual: Manual//",X:DTIME S ZTMODE=$E(X_"M") G ESC:'$T!(X["^"),ALL:"AM"'[ZTMODE
S HOME(1)=$P(HOME,","),HOME(2)=$P(HOME,",",2),SYS="",UCI=""
F ZTI=1:1 S SYS=$O(^%ZIS(14.6,"AT",HOME(1),HOME(2),SYS)) Q:SYS="" I SYS'=HOME(2) S UCI=$O(^(SYS,"")) I UCI]"" S ZTSYS(ZTI)=ZTMODE_U_SYS_U_UCI
S X="" Q
SEND S MGR=HOME("MGR"),SYSM=SYS,X=$$LINK^%ZTM5(SYS) S:X]"" MGR=$P(X,","),SYSM=$P(X,",",2),ZTSYS(ZTI,2)=X
G SENDLOC:$P(HOME,",",2)=SYS ;ELSE SENDREM
SENDREM S X="ERR",@^%ZOSF("TRAP"),X="^[MGR,SYSM]%ZTSK"
W !!,">>ROUTINES WILL NOW BE SENT TO "_SYS_" MACHINE" D NODE W " AS TASK # ",ZTSK," <<",!
W:$D(ZTSYS(ZTI,2)) " accessed by uci,volume: ",ZTSYS(ZTI,2),!
I ZTMODE="M" W !,"REMEMBER YOU MUST LOAD THE ROUTINES IN MANUALLY AT THE OTHER CPU",!,"WITH 'D IN^%ZTMOVE'"
W !! S R=0
X "F I=1:1 S R=$O(^UTILITY($J,R)) Q:R'?1AP.ANP ZL @R W $J(R,10) S ^[MGR,SYSM]%ZTSK(ZTSK,I,0)=R F J=1:1 S T=$T(+J) Q:T="""" S ^(J)=T"
S ^[MGR,SYSM]%ZTSK(ZTSK,0,"ZTMOVE")=" routine"_$S(I-1'=1:"s",1:"")_" transfered from "_HOME,^[MGR,SYSM]%ZTSK(ZTSK,1)=I-1,ZTSYS(ZTI,1)=ZTSK
I ZTMODE="A" L ^[MGR,SYSM]%ZTSCH S ^[MGR,SYSM]%ZTSCH($$H3^%ZTM($H),ZTSK)="" W " Scheduled"
L Q
SENDLOC S X="ERR",@^%ZOSF("TRAP"),X="^%ZTSK" D NODE
W !!,">>ROUTINES WILL NOW BE SENT TO THIS MACHINE AS TASK # ",ZTSK," <<",!
I ZTMODE="M" W !,"REMEMBER YOU MUST LOAD THE ROUTINES IN MANUALLY ",!,"WITH 'D IN^%ZTMOVE'"
W !! S R=0
X "F I=1:1 S R=$O(^UTILITY($J,R)) Q:R'?1AP.ANP ZL @R W $J(R,10) S ^%ZTSK(ZTSK,I,0)=R F J=1:1 S T=$T(+J) Q:T="""" S ^(J)=T"
S ^%ZTSK(ZTSK,0,"ZTMOVE")=" routine"_$S(I-1'=1:"s",1:"")_" transfered from "_HOME,^%ZTSK(ZTSK,1)=I-1,ZTSYS(ZTI,1)=ZTSK
I ZTMODE="A" L ^%ZTSCH S ^%ZTSCH($H,ZTSK)="" L W " Scheduled"
L Q
;
NODE N %
S ZNODE=$S(ZTMODE="M":"EXIT^%ZTMOVE",1:"AUTO^%ZTMOVE")_U_$G(DUZ)_U_UCI_U_$H_U_($H+2)_",1",$P(ZNODE,U,14)=SYS
L +@X@(-1) S ZTSK=@X@(-1)+1 F ZTSK=ZTSK:1 Q:$D(@X@(ZTSK))=0
S @X@(ZTSK,0)=ZNODE,@X@(ZTSK,.1)=$S(ZTMODE="M":"K",1:1)
L +@X@(ZTSK),-@X@(-1)
S @X@(ZTSK,.03)="ZTMOVE of routines to "_SYS
Q
;
ERR W !,"CANNOT SEND TO '"_SYS_"'!",! S ZTSYS(ZTI,1)="Error exit" Q
;
IN ;
S:$D(DTIME)[0 DTIME=30
R !,"Task Number: ",ZTSK:DTIME G EXIT:'$T!(ZTSK="")!(ZTSK="^")
I ZTSK'?1N.N W !,"Enter a number between ",$O(^%ZTSK(.1))," and ",^%ZTSK(-1),"!" G IN
S DEL=0 R !,"Delete Task After Loading? ",YN:DTIME Q:'$T!(YN="^")
S DEL=(YN["Y")
I '$D(^%ZTSK(ZTSK)) W !!?3,*7,"No such task number exists.",! G IN
I '$D(^%ZTSK(ZTSK,0,"ZTMOVE")) W !!?3,*7,"Not a 'ZTMOVE' task!" G IN
X ^%ZOSF("UCI") S:Y'["," Y=Y_","_^%ZOSF("VOL") S N=^%ZTSK(ZTSK,1) W !!,N,^(0,"ZTMOVE"),!,"READY TO BE LOADED INTO '",Y
R "' ...OK? YES// ",X:DTIME G EXIT:"Yy"'[$E(X_"Y")
W ! S ZTL="W "" "",R F I=1:1 Q:'$D(^(I)) ZI ^(I)"
X "F J=1:1:N ZR S R=^%ZTSK(ZTSK,J,0) X ZTL ZS @R" K:DEL ^%ZTSK(ZTSK)
G EXIT
;
AUTO ;AUTO-LOAD
I '$D(^%ZTSK(ZTSK,0,"ZTMOVE")) G EXIT
S ZTL="F I1=1:1 Q:'$D(^(I1)) ZI ^(I1)"
F I=.9:0 S I=$O(^%ZTSK(ZTSK,I)) Q:I'>0 S R=^%ZTSK(ZTSK,I,0) X "ZR X ZTL ZS @R"
S ZTREQ="@" G EXIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HZTMOVE 4604 printed Dec 13, 2024@02:16:24 Page 2
%ZTMOVE ;SF/STAFF - Easier Multi-CPU routine transfers ;12/27/94 09:26
+1 ;;8.0;KERNEL;;Jul 10, 1995
+2 if '$DATA(DTIME)
SET DTIME=120
OUT SET U="^"
SET MGR=$PIECE(^%ZOSF("MGR"),",",1)
XECUTE ^%ZOSF("UCI")
if Y'[","
SET Y=Y_","_^%ZOSF("VOL")
SET HOME=Y
SET HOME("MGR")=MGR
+1 WRITE !!,"This will move the complete text of the routines selected to",!,"the MGR account of the system being moved to."
+2 WRITE !,"If you send a large number of routines you may run out of disk space",!,"on the target system.",!!
+3 WRITE !,"From ",HOME," send what routines!"
KILL ^UTILITY($JOB)
XECUTE ^%ZOSF("RSEL")
if $ORDER(^UTILITY($JOB,0))=""
GOTO EXIT
+4 WRITE !!,"You're in ",HOME
+5 KILL ZTSYS
FOR ZTI=1:1
DO WHERE
if $DATA(DUOUT)
GOTO EXIT
if X=""
QUIT
WRITE !!,"Then..."
+6 WRITE !!,"Starting to send!"
+7 FOR ZTI=1:1
if '$DATA(ZTSYS(ZTI))
QUIT
SET X=ZTSYS(ZTI)
SET ZTMODE=$PIECE(X,U,1)
SET SYS=$PIECE(X,U,2)
SET UCI=$PIECE(X,U,3)
DO SEND
+8 WRITE !!,"Summary"
FOR ZTI=1:1
if '$DATA(ZTSYS(ZTI,1))
QUIT
SET X=ZTSYS(ZTI)
SET Y=ZTSYS(ZTI,1)
Begin DoDot:1
+9 WRITE !?3,"To ",$PIECE(X,U,2)," ",$SELECT('Y:Y,$EXTRACT(X)="M":"as task # "_Y,1:"in UCI: "_$PIECE(X,U,3))
+10 QUIT
End DoDot:1
EXIT KILL ZTSK,ZTSYS,ZTI,ZTMODE,SYS,UCI,HOME,ANS,DEF,MGR,Y,X,DUOUT,^UTILITY($JOB)
+1 QUIT
+2 ;
WHERE WRITE !,"To which Volume Set (2-7 letters or * for all) to send routines? "
READ SYS:DTIME
if ZTI=1&(SYS="*")
GOTO ALL
if '$TEST!(SYS["^")
GOTO ESC
if SYS'?2.7U
GOTO WHEX
+1 IF $PIECE(HOME,",",2)=SYS
WRITE !,*7,"THIS IS THE SAME SYSTEM!!"
+2 READ !,"Auto-load or Manual: Manual//",X:DTIME
SET ZTMODE=$EXTRACT(X_"M")
if '$TEST!(X["^")
GOTO ESC
if "AM"'[ZTMODE
GOTO WHERE
+3 SET UCI=MGR
IF ZTMODE="A"
READ !,"Enter UCI to unload into: ",UCI:DTIME
if '$TEST!(UCI["^")
GOTO ESC
if UCI'?2.7U
GOTO WHERE
+4 SET ZTSYS(ZTI)=ZTMODE_U_SYS_U_UCI
SET X=1
QUIT
WHEX SET X=""
QUIT
ESC SET X=""
SET DUOUT=1
QUIT
ALL ;
+1 READ !,"Auto-load or Manual: Manual//",X:DTIME
SET ZTMODE=$EXTRACT(X_"M")
if '$TEST!(X["^")
GOTO ESC
if "AM"'[ZTMODE
GOTO ALL
+2 SET HOME(1)=$PIECE(HOME,",")
SET HOME(2)=$PIECE(HOME,",",2)
SET SYS=""
SET UCI=""
+3 FOR ZTI=1:1
SET SYS=$ORDER(^%ZIS(14.6,"AT",HOME(1),HOME(2),SYS))
if SYS=""
QUIT
IF SYS'=HOME(2)
SET UCI=$ORDER(^(SYS,""))
IF UCI]""
SET ZTSYS(ZTI)=ZTMODE_U_SYS_U_UCI
+4 SET X=""
QUIT
SEND SET MGR=HOME("MGR")
SET SYSM=SYS
SET X=$$LINK^%ZTM5(SYS)
if X]""
SET MGR=$PIECE(X,",")
SET SYSM=$PIECE(X,",",2)
SET ZTSYS(ZTI,2)=X
+1 ;ELSE SENDREM
if $PIECE(HOME,",",2)=SYS
GOTO SENDLOC
SENDREM SET X="ERR"
SET @^%ZOSF("TRAP")
SET X="^[MGR,SYSM]%ZTSK"
+1 WRITE !!,">>ROUTINES WILL NOW BE SENT TO "_SYS_" MACHINE"
DO NODE
WRITE " AS TASK # ",ZTSK," <<",!
+2 if $DATA(ZTSYS(ZTI,2))
WRITE " accessed by uci,volume: ",ZTSYS(ZTI,2),!
+3 IF ZTMODE="M"
WRITE !,"REMEMBER YOU MUST LOAD THE ROUTINES IN MANUALLY AT THE OTHER CPU",!,"WITH 'D IN^%ZTMOVE'"
+4 WRITE !!
SET R=0
+5 XECUTE "F I=1:1 S R=$O(^UTILITY($J,R)) Q:R'?1AP.ANP ZL @R W $J(R,10) S ^[MGR,SYSM]%ZTSK(ZTSK,I,0)=R F J=1:1 S T=$T(+J) Q:T="""" S ^(J)=T"
+6 SET ^[MGR
SET SYSM]%ZTSK(ZTSK,0,"ZTMOVE")=" routine"_$SELECT(I-1'=1:"s",1:"")_" transfered from "_HOME
SET ^[MGR
SET SYSM]%ZTSK(ZTSK,1)=I-1
SET ZTSYS(ZTI,1)=ZTSK
+7 IF ZTMODE="A"
LOCK ^[MGR,SYSM]%ZTSCH
SET ^[MGR
SET SYSM]%ZTSCH($$H3^%ZTM($HOROLOG),ZTSK)=""
WRITE " Scheduled"
+8 LOCK
QUIT
SENDLOC SET X="ERR"
SET @^%ZOSF("TRAP")
SET X="^%ZTSK"
DO NODE
+1 WRITE !!,">>ROUTINES WILL NOW BE SENT TO THIS MACHINE AS TASK # ",ZTSK," <<",!
+2 IF ZTMODE="M"
WRITE !,"REMEMBER YOU MUST LOAD THE ROUTINES IN MANUALLY ",!,"WITH 'D IN^%ZTMOVE'"
+3 WRITE !!
SET R=0
+4 XECUTE "F I=1:1 S R=$O(^UTILITY($J,R)) Q:R'?1AP.ANP ZL @R W $J(R,10) S ^%ZTSK(ZTSK,I,0)=R F J=1:1 S T=$T(+J) Q:T="""" S ^(J)=T"
+5 SET ^%ZTSK(ZTSK,0,"ZTMOVE")=" routine"_$SELECT(I-1'=1:"s",1:"")_" transfered from "_HOME
SET ^%ZTSK(ZTSK,1)=I-1
SET ZTSYS(ZTI,1)=ZTSK
+6 IF ZTMODE="A"
LOCK ^%ZTSCH
SET ^%ZTSCH($HOROLOG,ZTSK)=""
LOCK
WRITE " Scheduled"
+7 LOCK
QUIT
+8 ;
NODE NEW %
+1 SET ZNODE=$SELECT(ZTMODE="M":"EXIT^%ZTMOVE",1:"AUTO^%ZTMOVE")_U_$GET(DUZ)_U_UCI_U_$HOROLOG_U_($HOROLOG+2)_",1"
SET $PIECE(ZNODE,U,14)=SYS
+2 LOCK +@X@(-1)
SET ZTSK=@X@(-1)+1
FOR ZTSK=ZTSK:1
if $DATA(@X@(ZTSK))=0
QUIT
+3 SET @X@(ZTSK,0)=ZNODE
SET @X@(ZTSK,.1)=$SELECT(ZTMODE="M":"K",1:1)
+4 LOCK +@X@(ZTSK),-@X@(-1)
+5 SET @X@(ZTSK,.03)="ZTMOVE of routines to "_SYS
+6 QUIT
+7 ;
ERR WRITE !,"CANNOT SEND TO '"_SYS_"'!",!
SET ZTSYS(ZTI,1)="Error exit"
QUIT
+1 ;
IN ;
+1 if $DATA(DTIME)[0
SET DTIME=30
+2 READ !,"Task Number: ",ZTSK:DTIME
if '$TEST!(ZTSK="")!(ZTSK="^")
GOTO EXIT
+3 IF ZTSK'?1N.N
WRITE !,"Enter a number between ",$ORDER(^%ZTSK(.1))," and ",^%ZTSK(-1),"!"
GOTO IN
+4 SET DEL=0
READ !,"Delete Task After Loading? ",YN:DTIME
if '$TEST!(YN="^")
QUIT
+5 SET DEL=(YN["Y")
+6 IF '$DATA(^%ZTSK(ZTSK))
WRITE !!?3,*7,"No such task number exists.",!
GOTO IN
+7 IF '$DATA(^%ZTSK(ZTSK,0,"ZTMOVE"))
WRITE !!?3,*7,"Not a 'ZTMOVE' task!"
GOTO IN
+8 XECUTE ^%ZOSF("UCI")
if Y'[","
SET Y=Y_","_^%ZOSF("VOL")
SET N=^%ZTSK(ZTSK,1)
WRITE !!,N,^(0,"ZTMOVE"),!,"READY TO BE LOADED INTO '",Y
+9 READ "' ...OK? YES// ",X:DTIME
if "Yy"'[$EXTRACT(X_"Y")
GOTO EXIT
+10 WRITE !
SET ZTL="W "" "",R F I=1:1 Q:'$D(^(I)) ZI ^(I)"
+11 XECUTE "F J=1:1:N ZR S R=^%ZTSK(ZTSK,J,0) X ZTL ZS @R"
if DEL
KILL ^%ZTSK(ZTSK)
+12 GOTO EXIT
+13 ;
AUTO ;AUTO-LOAD
+1 IF '$DATA(^%ZTSK(ZTSK,0,"ZTMOVE"))
GOTO EXIT
+2 SET ZTL="F I1=1:1 Q:'$D(^(I1)) ZI ^(I1)"
+3 FOR I=.9:0
SET I=$ORDER(^%ZTSK(ZTSK,I))
if I'>0
QUIT
SET R=^%ZTSK(ZTSK,I,0)
XECUTE "ZR X ZTL ZS @R"
+4 SET ZTREQ="@"
GOTO EXIT