XQ91 ; SEA/MJM - Restrict availability of options (cont.) ;9/29/92 15:06 ;5/13/93 11:46 AM [ 04/02/2003 8:29 AM ]
;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
;;8.0;KERNEL;;Jul 10, 1995
S (XQI,XQJ)=1,XQDF="",(XQTDV,XQTOD)=0 W !
GETDV W !," Enter ",$S($O(XQDV(0))>0!($O(XQOD(0))>0):"another",1:"a")," DEVICE name (or -DEVICE to delete): " R X:DTIME S:'$T X=U G:X[U OUT
I '$L(X) S XQTDV=XQI-1,XQTOD=XQJ-1 G GOTDV
I X["?" S XQH="XQRESTRICT-DEVICE",XQDF=1,XQISV=XQI,XQTDV=XQI-1,XQJSV=XQJ,XQTOD=XQJ-1 D:X="?" EN^XQH D:X="??" LSTDV D:X="???" LSTFIL S XQI=XQISV,XQJ=XQJSV,XQDF="" G GETDV
I X["?" S XQDF=1 D LSTFIL S XQDF="" G GETDV
S XQFL=0 S:"-'"[$E(X,1) X=$E(X,2,99),XQFL=1
S DIC=3.5,DIC(0)="MEZ" D ^DIC I Y<0 W " ??",*7 G GETDV
I XQFL S XQOD(XQJ)=Y,XQJ=XQJ+1,XQFL=0 G GETDV
S XQDV(XQI)=Y,XQI=XQI+1 G GETDV
;
GOTDV ;Remove devices to delete (XQOD) from list of devices to add (XQDV)
I 'XQTOD!('XQTDV) G OK
S XQNDV=XQTDV,XQNOD=XQTOD,XQFL=0 F XQI=1:1 K:XQFL XQDV(XQI-1) S:XQFL XQTDV=XQTDV-1 Q:(XQI>XQNDV) S XQFL=0 F XQJ=1:1 Q:(XQJ>XQNOD) I $D(XQOD(XQJ))#2,XQDV(XQI)=XQOD(XQJ) K XQOD(XQJ) S XQFL=1,XQTOD=XQTOD-1
OK ;
S XQFL2=1
LSTOP ;
I $O(XQOP(0))="" W !!,"You have not yet selected any options." Q
W !!,"You've selected the following options: ",! S XQJ=0,XQI=IOM\15 F XQK=0:1 S XQJ=$O(XQOP(XQJ)) Q:XQJ="" W:'(XQK#XQI) ! W ?(XQK#XQI*15),$P(^DIC(19,XQJ,0),U,1)
Q:'XQFL2 S XQFL2=0
;
LSTRES ;List restrictions to be placed on all options
I $L(XQDR) W !!,"These restrictions will be updated for all options selected:",!
F XQI=1:1:5 I $D(XQFLD(XQI,"V")) W !,$P(XQFLD(XQI,0),U,1),": ",XQFLD(XQI,"V")
;
LSTDV ;List PERMITTED DEVICES to be added and deleted
S XQT=IOM\10
I (XQTDV>0) W !!,"You will add these PERMITTED DEVICES to all options chosen:",! S XQI=0,XQD=-1 F Q:(XQI+1>XQTDV) S XQD=$O(XQDV(XQD)) Q:XQD="" W:'(XQI#XQT) ! W ?(XQI#XQT*10),$P(XQDV(XQD),U,2) S XQI=XQI+1
I (XQTOD>0) W !!,$S(XQTDV:"And you ",1:"You "),"will delete these PERMITTED DEVICES from all options chosen:",! S XQI=0,XQD=-1 F Q:(XQI+1>XQTOD) S XQD=$O(XQOD(XQD)) Q:XQD="" W:'(XQI#XQT) ! W ?(XQI#XQT*10),$P(XQOD(XQD),U,2) S XQI=XQI+1
I XQDF S XQDF="" Q
;
OK1 R !!,"Do you wish to proceed? YES// ",X:DTIME S:'$T X=U G:X[U OUT G:(X["N"!(X["n")) OP^XQ9 I '(X["Y"!(X["y")!'$L(X)) W *7," ??",!,"Enter 'Y' or 'N'" G OK1
;
ACT ;Stuff the restrictions and devices into the OPTION file
S DIE=19,DA=0 F XQI=1:1 S DA=$O(XQOP(DA)),DR=XQDR Q:DA="" W !,$P(^DIC(19,DA,0),U,1) D ^DIE W "*" D:(XQTOD>0) KILDV I (XQTDV>0) S XQN=-1 F S XQN=$O(XQDV(XQN)) Q:XQN="" S DR="3.96///"_$P(XQDV(XQN),U,2) D ^DIE W "+"
G INIT^XQ9
;
KILDV ;Remove PERMITTED DEVICE from option
S DIC="^DIC(19,"_DA_",3.96,",DIK=DIC,DIC(0)="MEZ",XQN=-1,DA(1)=DA
F S XQN=$O(XQOD(XQN)) Q:XQN="" S X=$P(XQOD(XQN),U,2) D ^DIC S DA=+Y D ^DIK S DA=DA(1) W "-"
Q
LSTFIL ;Show OPTION or DEVICE file
W !,"Do you want to see the ",$S(XQDF:"DEVICE",1:"OPTION")," file? NO// " R X:DTIME S:'$T X="N" Q:X'["Y"&(X'["y") S X="?",DIC=$S(XQDF:3.5,1:"^DIC(19,"),DIC(0)="Q" D ^DIC K DIC S XQDF=""
Q
;
OUT ;
K XQOP,XQFLD,XQI,XQISV,XQJ,XQJSV,XQDV,XQOD,XQTDV,XQNDV,XQTOD,XQNOD,XQDF,XQFL,XQFL2,XQD,XQDR,XQK,XQM,XQN,XQR,XQT
K DIC,DIK,DIE,DR,DA,DI,DISYS,DLAYGO,DQ,D0,D1,I,J,K,L,X,Y,XY,%,%Y,C,POP
Q
XQ91 ; SEA/MJM - Restrict availability of options (cont.) ;9/29/92 15:06 ;5/13/93 11:46 AM [ 04/02/2003 8:29 AM ]
+1 ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
+2 ;;8.0;KERNEL;;Jul 10, 1995
+3 SET (XQI,XQJ)=1
SET XQDF=""
SET (XQTDV,XQTOD)=0
WRITE !
GETDV WRITE !," Enter ",$SELECT($ORDER(XQDV(0))>0!($ORDER(XQOD(0))>0):"another",1:"a")," DEVICE name (or -DEVICE to delete): "
READ X:DTIME
IF '$TEST
SET X=U
IF X[U
GOTO OUT
+1 IF '$LENGTH(X)
SET XQTDV=XQI-1
SET XQTOD=XQJ-1
GOTO GOTDV
+2 IF X["?"
SET XQH="XQRESTRICT-DEVICE"
SET XQDF=1
SET XQISV=XQI
SET XQTDV=XQI-1
SET XQJSV=XQJ
SET XQTOD=XQJ-1
IF X="?"
DO EN^XQH
IF X="??"
DO LSTDV
IF X="???"
DO LSTFIL
SET XQI=XQISV
SET XQJ=XQJSV
SET XQDF=""
GOTO GETDV
+3 IF X["?"
SET XQDF=1
DO LSTFIL
SET XQDF=""
GOTO GETDV
+4 SET XQFL=0
IF "-'"[$EXTRACT(X,1)
SET X=$EXTRACT(X,2,99)
SET XQFL=1
+5 SET DIC=3.5
SET DIC(0)="MEZ"
DO ^DIC
IF Y<0
WRITE " ??",*7
GOTO GETDV
+6 IF XQFL
SET XQOD(XQJ)=Y
SET XQJ=XQJ+1
SET XQFL=0
GOTO GETDV
+7 SET XQDV(XQI)=Y
SET XQI=XQI+1
GOTO GETDV
+8 ;
GOTDV ;Remove devices to delete (XQOD) from list of devices to add (XQDV)
+1 IF 'XQTOD!('XQTDV)
GOTO OK
+2 SET XQNDV=XQTDV
SET XQNOD=XQTOD
SET XQFL=0
FOR XQI=1:1
IF XQFL
KILL XQDV(XQI-1)
IF XQFL
SET XQTDV=XQTDV-1
IF (XQI>XQNDV)
QUIT
SET XQFL=0
FOR XQJ=1:1
IF (XQJ>XQNOD)
QUIT
IF $DATA(XQOD(XQJ))#2
IF XQDV(XQI)=XQOD(XQJ)
KILL XQOD(XQJ)
SET XQFL=1
SET XQTOD=XQTOD-1
OK ;
+1 SET XQFL2=1
LSTOP ;
+1 IF $ORDER(XQOP(0))=""
WRITE !!,"You have not yet selected any options."
QUIT
+2 WRITE !!,"You've selected the following options: ",!
SET XQJ=0
SET XQI=IOM\15
FOR XQK=0:1
SET XQJ=$ORDER(XQOP(XQJ))
IF XQJ=""
QUIT
IF '(XQK#XQI)
WRITE !
WRITE ?(XQK#XQI*15),$PIECE(^DIC(19,XQJ,0),U,1)
+3 IF 'XQFL2
QUIT
SET XQFL2=0
+4 ;
LSTRES ;List restrictions to be placed on all options
+1 IF $LENGTH(XQDR)
WRITE !!,"These restrictions will be updated for all options selected:",!
+2 FOR XQI=1:1:5
IF $DATA(XQFLD(XQI,"V"))
WRITE !,$PIECE(XQFLD(XQI,0),U,1),": ",XQFLD(XQI,"V")
+3 ;
LSTDV ;List PERMITTED DEVICES to be added and deleted
+1 SET XQT=IOM\10
+2 IF (XQTDV>0)
WRITE !!,"You will add these PERMITTED DEVICES to all options chosen:",!
SET XQI=0
SET XQD=-1
FOR
IF (XQI+1>XQTDV)
QUIT
SET XQD=$ORDER(XQDV(XQD))
IF XQD=""
QUIT
IF '(XQI#XQT)
WRITE !
WRITE ?(XQI#XQT*10),$PIECE(XQDV(XQD),U,2)
SET XQI=XQI+1
+3 IF (XQTOD>0)
WRITE !!,$SELECT(XQTDV:"And you ",1:"You "),"will delete these PERMITTED DEVICES from all options chosen:",!
SET XQI=0
SET XQD=-1
FOR
IF (XQI+1>XQTOD)
QUIT
SET XQD=$ORDER(XQOD(XQD))
IF XQD=""
QUIT
IF '(XQI#XQT)
WRITE !
WRITE ?(XQI#XQT*10),$PIECE(XQOD(XQD),U,2)
SET XQI=XQI+1
+4 IF XQDF
SET XQDF=""
QUIT
+5 ;
OK1 READ !!,"Do you wish to proceed? YES// ",X:DTIME
IF '$TEST
SET X=U
IF X[U
GOTO OUT
IF (X["N"!(X["n"))
GOTO OP^XQ9
IF '(X["Y"!(X["y")!'$LENGTH(X))
WRITE *7," ??",!,"Enter 'Y' or 'N'"
GOTO OK1
+1 ;
ACT ;Stuff the restrictions and devices into the OPTION file
+1 SET DIE=19
SET DA=0
FOR XQI=1:1
SET DA=$ORDER(XQOP(DA))
SET DR=XQDR
IF DA=""
QUIT
WRITE !,$PIECE(^DIC(19,DA,0),U,1)
DO ^DIE
WRITE "*"
IF (XQTOD>0)
DO KILDV
IF (XQTDV>0)
SET XQN=-1
FOR
SET XQN=$ORDER(XQDV(XQN))
IF XQN=""
QUIT
SET DR="3.96///"_$PIECE(XQDV(XQN),U,2)
DO ^DIE
WRITE "+"
+2 GOTO INIT^XQ9
+3 ;
KILDV ;Remove PERMITTED DEVICE from option
+1 SET DIC="^DIC(19,"_DA_",3.96,"
SET DIK=DIC
SET DIC(0)="MEZ"
SET XQN=-1
SET DA(1)=DA
+2 FOR
SET XQN=$ORDER(XQOD(XQN))
IF XQN=""
QUIT
SET X=$PIECE(XQOD(XQN),U,2)
DO ^DIC
SET DA=+Y
DO ^DIK
SET DA=DA(1)
WRITE "-"
+3 QUIT
LSTFIL ;Show OPTION or DEVICE file
+1 WRITE !,"Do you want to see the ",$SELECT(XQDF:"DEVICE",1:"OPTION")," file? NO// "
READ X:DTIME
IF '$TEST
SET X="N"
IF X'["Y"&(X'["y")
QUIT
SET X="?"
SET DIC=$SELECT(XQDF:3.5,1:"^DIC(19,")
SET DIC(0)="Q"
DO ^DIC
KILL DIC
SET XQDF=""
+2 QUIT
+3 ;
OUT ;
+1 KILL XQOP,XQFLD,XQI,XQISV,XQJ,XQJSV,XQDV,XQOD,XQTDV,XQNDV,XQTOD,XQNOD,XQDF,XQFL,XQFL2,XQD,XQDR,XQK,XQM,XQN,XQR,XQT
+2 KILL DIC,DIK,DIE,DR,DA,DI,DISYS,DLAYGO,DQ,D0,D1,I,J,K,L,X,Y,XY,%,%Y,C,POP
+3 QUIT