DIOZ ;SFISC/TKW - COMPILED SORT TEMPLATE ;11/29/94 09:53
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
ENCU ;MARK A SORT TEMPLATE FOR ROUTINE COMPILATION
I $G(DUZ(0))'="@" W !,$C(7),$$EZBLD^DIALOG(101) Q
EN1 N DDH,DIC,DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y,DIOZ
D OS^DII:'$D(DISYS) I $G(^DD("OS",DISYS,"ZS"))="" W $C(7),!,$$EZBLD^DIALOG(820) Q
D DIC Q:Y<0 S DIOZ=+Y
S DIR(0)="Y"
I $G(^DIBT(+Y,"ROU"))="" D Q
.D BLD^DIALOG(8029,$$EZBLD^DIALOG(8035),"","DIR(""A"")")
.S DIR("B")="YES" D BLD^DIALOG(9014,"","","DIR(""?"")"),^DIR Q:'Y
.S ^DIBT(DIOZ,"ROU")="^DISZ",^("ROUOLD")="DISZ"
.W !!,$C(7),DIR("?",2),!,DIR("?")
.Q
S X(1)=$$EZBLD^DIALOG(8035),X(2)="DISZ" D BLD^DIALOG(8028,.X,"","DIR(""A"")")
S DIR("B")="NO" D BLD^DIALOG(9019,"","","DIR(""?"")"),^DIR Q:'Y
K ^DIBT(DIOZ,"ROU")
W !!,$C(7),DIR("?",2),!,DIR("?")
Q
;
DIC S DIC="^DIBT(",DIC(0)="AEIQ",DIC("W")="W ?40,""FILE #"",$P(^(0),U,4) W:$D(^(""ROU"")) ?60,""Compiled"""
S DIC("S")="I '$P(^(0),U,8),Y'<1,$O(^DIBT(+Y,2,0))"
D ^DIC Q
;
ENC ;CREATE COMPILED SORT ROUTINE
D OS^DII:'$D(DISYS) I $G(^DD("OS",DISYS,"ZS"))="" D BLD^DIALOG(820) G QSV
I $O(^TMP("DIBTC",$J,""))="" D BLD^DIALOG(1501) G QSV
N %,%H,%I,DIROUT,DIRUT,DTOUT,DUOUT,DRN,I,J,K,X,Y,DIR
D NEW G:$D(DIERR) QSV
S K=2,I="" F S I=$O(^TMP("DIBTC",$J,I)) Q:I="" F J=0:0 S J=$O(^TMP("DIBTC",$J,I,J)) Q:'J S X=^(J) I X]"" S K=K+1,^UTILITY($J,0,K)=X
F I=1:1 S X=$P($T(TXT+I),";",3) Q:X="" S K=K+1,^UTILITY($J,0,K)=X
S X=$P(DIBTPGM,U,2) X ^DD("OS",DISYS,"ZS")
K ^TMP("DIBTC",$J)
Q
;
NEW I DIBTPGM'?1"^"1.7U1.4N D NXTNO(.DRN) Q:$D(DIERR) S DIBTPGM=DIBTPGM_$E("000",1,(4-$L(DRN)))_DRN
D NOW^%DTC,YX^%DTC
K ^UTILITY($J,0)
S ^UTILITY($J,0,1)=$P(DIBTPGM,U,2)_" ; GENERATED FROM '"_$P(^DIBT(DIBT1,0),U,1)_"' SORT TEMPLATE (#"_DIBT1_"), FILE:"_DP_", USER:"_$S($G(^VA(200,+DUZ,0))]"":$P(^(0),U),1:$P($G(^DIC(3,+DUZ,0)),U))_" ; "_Y
S ^UTILITY($J,0,2)=$T(DIOZ+1)
Q
;
NXTNO(DRN) ; GET NEXT AVAILABLE ROUTINE NUMBER
N DILOCK S DRN=0 D Q:DRN
N1 . S DILOCK=0,DRN=$O(^DI(.83,"C","n",DRN)) Q:'DRN D N3 G:DILOCK N1
N2 S DILOCK=0,DRN=$$NXTNO^DICLIB("^DI(.83,","","U") I DRN>9999 D BLD^DIALOG(1502) Q
D N3 G:DILOCK N2
Q
N3 L +^DI(.83,DRN,0):10 I '$T S DILOCK=1 Q
S ^DI(.83,DRN,0)=DRN_"^y",^DI(.83,"B",DRN,DRN)="",^DI(.83,"C","y",DRN)="" K ^DI(.83,"C","n",DRN) L -^DI(.83,DRN,0) Q
Q
;
ENRLS(DRN) ; MAKE ROUTINE NUMBER AVAILABLE FOR REUSE & DELETE ROUTINE
N DICLEAN,X S DRN=+$G(DRN),DICLEAN='DRN G:DRN R1
R S DRN=$O(^DI(.83,DRN)) Q:'DRN
R1 I $G(^DI(.83,DRN,0))]"" S $P(^(0),U,2)="n",^DI(.83,"C","n",DRN)="" K ^DI(.83,"C","y",DRN)
I $G(^%ZOSF("DEL"))]"" S X="DISZ"_$E("000",1,(4-$L(DRN)))_DRN X ^%ZOSF("DEL")
G:DICLEAN R
Q
;
QSV D:$G(DRN) ENRLS(DRN) K DIBTPGM
QER Q:$G(DIQUIET)
D MSG^DIALOG("W") S DIERR=1 Q
;
;DIALOG #101 'only those with programmer's access'
; #820 'no way to save routines on the system'
; #1501 'There is no code to save for this compiled...'
; #1502 'All available routine numbers...are in use...'
; #8028 '...currently compiled under namespace...'
; #8029 '...not currently compiled.'
; #8035 'Sort template'
; #9014 (help) 'if YES...Sort logic will be compiled...'
; #9019 (help) 'if YES...Sort logic...will NOT be compiled...'
;
TXT ;;
;;M X $S($D(DPQ):DX(DIXX),1:^UTILITY($J,99,DIXX))
DIOZ ;SFISC/TKW - COMPILED SORT TEMPLATE ;11/29/94 09:53
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
ENCU ;MARK A SORT TEMPLATE FOR ROUTINE COMPILATION
+1 IF $GET(DUZ(0))'="@"
WRITE !,$CHAR(7),$$EZBLD^DIALOG(101)
QUIT
EN1 NEW DDH,DIC,DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y,DIOZ
+1 IF '$DATA(DISYS)
DO OS^DII
IF $GET(^DD("OS",DISYS,"ZS"))=""
WRITE $CHAR(7),!,$$EZBLD^DIALOG(820)
QUIT
+2 DO DIC
IF Y<0
QUIT
SET DIOZ=+Y
+3 SET DIR(0)="Y"
+4 IF $GET(^DIBT(+Y,"ROU"))=""
Begin DoDot:1
+5 DO BLD^DIALOG(8029,$$EZBLD^DIALOG(8035),"","DIR(""A"")")
+6 SET DIR("B")="YES"
DO BLD^DIALOG(9014,"","","DIR(""?"")")
DO ^DIR
IF 'Y
QUIT
+7 SET ^DIBT(DIOZ,"ROU")="^DISZ"
SET ^("ROUOLD")="DISZ"
+8 WRITE !!,$CHAR(7),DIR("?",2),!,DIR("?")
+9 QUIT
End DoDot:1
QUIT
+10 SET X(1)=$$EZBLD^DIALOG(8035)
SET X(2)="DISZ"
DO BLD^DIALOG(8028,.X,"","DIR(""A"")")
+11 SET DIR("B")="NO"
DO BLD^DIALOG(9019,"","","DIR(""?"")")
DO ^DIR
IF 'Y
QUIT
+12 KILL ^DIBT(DIOZ,"ROU")
+13 WRITE !!,$CHAR(7),DIR("?",2),!,DIR("?")
+14 QUIT
+15 ;
DIC SET DIC="^DIBT("
SET DIC(0)="AEIQ"
SET DIC("W")="W ?40,""FILE #"",$P(^(0),U,4) W:$D(^(""ROU"")) ?60,""Compiled"""
+1 SET DIC("S")="I '$P(^(0),U,8),Y'<1,$O(^DIBT(+Y,2,0))"
+2 DO ^DIC
QUIT
+3 ;
ENC ;CREATE COMPILED SORT ROUTINE
+1 IF '$DATA(DISYS)
DO OS^DII
IF $GET(^DD("OS",DISYS,"ZS"))=""
DO BLD^DIALOG(820)
GOTO QSV
+2 IF $ORDER(^TMP("DIBTC",$JOB,""))=""
DO BLD^DIALOG(1501)
GOTO QSV
+3 NEW %,%H,%I,DIROUT,DIRUT,DTOUT,DUOUT,DRN,I,J,K,X,Y,DIR
+4 DO NEW
IF $DATA(DIERR)
GOTO QSV
+5 SET K=2
SET I=""
FOR
SET I=$ORDER(^TMP("DIBTC",$JOB,I))
IF I=""
QUIT
FOR J=0:0
SET J=$ORDER(^TMP("DIBTC",$JOB,I,J))
IF 'J
QUIT
SET X=^(J)
IF X]""
SET K=K+1
SET ^UTILITY($JOB,0,K)=X
+6 FOR I=1:1
SET X=$PIECE($TEXT(TXT+I),";",3)
IF X=""
QUIT
SET K=K+1
SET ^UTILITY($JOB,0,K)=X
+7 SET X=$PIECE(DIBTPGM,U,2)
XECUTE ^DD("OS",DISYS,"ZS")
+8 KILL ^TMP("DIBTC",$JOB)
+9 QUIT
+10 ;
NEW IF DIBTPGM'?1"^"1.7U1.4N
DO NXTNO(.DRN)
IF $DATA(DIERR)
QUIT
SET DIBTPGM=DIBTPGM_$EXTRACT("000",1,(4-$LENGTH(DRN)))_DRN
+1 DO NOW^%DTC
DO YX^%DTC
+2 KILL ^UTILITY($JOB,0)
+3 SET ^UTILITY($JOB,0,1)=$PIECE(DIBTPGM,U,2)_" ; GENERATED FROM '"_$PIECE(^DIBT(DIBT1,0),U,1)_"' SORT TEMPLATE (#"_DIBT1_"), FILE:"_DP_", USER:"_$SELECT($GET(^VA(200,+DUZ,0))]"":$PIECE(^(0),U),1:$PIECE($GET(^DIC(3,+DUZ,0)),U))_" ; "_Y
+4 SET ^UTILITY($JOB,0,2)=$TEXT(DIOZ+1)
+5 QUIT
+6 ;
NXTNO(DRN) ; GET NEXT AVAILABLE ROUTINE NUMBER
+1 NEW DILOCK
SET DRN=0
Begin DoDot:1
N1 SET DILOCK=0
SET DRN=$ORDER(^DI(.83,"C","n",DRN))
IF 'DRN
QUIT
DO N3
IF DILOCK
GOTO N1
End DoDot:1
IF DRN
QUIT
N2 SET DILOCK=0
SET DRN=$$NXTNO^DICLIB("^DI(.83,","","U")
IF DRN>9999
DO BLD^DIALOG(1502)
QUIT
+1 DO N3
IF DILOCK
GOTO N2
+2 QUIT
N3 LOCK +^DI(.83,DRN,0):10
IF '$TEST
SET DILOCK=1
QUIT
+1 SET ^DI(.83,DRN,0)=DRN_"^y"
SET ^DI(.83,"B",DRN,DRN)=""
SET ^DI(.83,"C","y",DRN)=""
KILL ^DI(.83,"C","n",DRN)
LOCK -^DI(.83,DRN,0)
QUIT
+2 QUIT
+3 ;
ENRLS(DRN) ; MAKE ROUTINE NUMBER AVAILABLE FOR REUSE & DELETE ROUTINE
+1 NEW DICLEAN,X
SET DRN=+$GET(DRN)
SET DICLEAN='DRN
IF DRN
GOTO R1
R SET DRN=$ORDER(^DI(.83,DRN))
IF 'DRN
QUIT
R1 IF $GET(^DI(.83,DRN,0))]""
SET $PIECE(^(0),U,2)="n"
SET ^DI(.83,"C","n",DRN)=""
KILL ^DI(.83,"C","y",DRN)
+1 IF $GET(^%ZOSF("DEL"))]""
SET X="DISZ"_$EXTRACT("000",1,(4-$LENGTH(DRN)))_DRN
XECUTE ^%ZOSF("DEL")
+2 IF DICLEAN
GOTO R
+3 QUIT
+4 ;
QSV IF $GET(DRN)
DO ENRLS(DRN)
KILL DIBTPGM
QER IF $GET(DIQUIET)
QUIT
+1 DO MSG^DIALOG("W")
SET DIERR=1
QUIT
+2 ;
+3 ;DIALOG #101 'only those with programmer's access'
+4 ; #820 'no way to save routines on the system'
+5 ; #1501 'There is no code to save for this compiled...'
+6 ; #1502 'All available routine numbers...are in use...'
+7 ; #8028 '...currently compiled under namespace...'
+8 ; #8029 '...not currently compiled.'
+9 ; #8035 'Sort template'
+10 ; #9014 (help) 'if YES...Sort logic will be compiled...'
+11 ; #9019 (help) 'if YES...Sort logic...will NOT be compiled...'
+12 ;
TXT ;;
+1 ;;M X $S($D(DPQ):DX(DIXX),1:^UTILITY($J,99,DIXX))