ZIBRSEL ; IHS/ADC/GTH - NONINTERACTIVE ROUTINE SELECT ; [ 10/29/2002 7:42 AM ]
;;3.0;IHS/VA UTILITIES;**4,9**;FEB 07, 1997
; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err.
; XB*3*9 IHS/SET/GTH XB*3*9 10/29/2002 Cache' mods.
;
; Return the number of selected routines set into the
; indicated variable.
;
; E.g.:
; I '$$RSEL^ZIBRSEL("B-BZZZZZZZ","ARRAY(") W "NONE SELECTED" Q
;
; If routines exists in the list or range, their name will
; be returned as the last subscript of indicated variable in
; the 2nd parameter. The default is ^TMP("ZIBRSEL",$J,
;
; If routine B exists, then node ^TMP("ZIBRSEL",$J,"B") will
; be null.
;
; It is the programmer's responsibility to ensure the name
; of the array is correctly formed.
;
; Variables used:
; X = String indicating list or range of routines.
; Y = String indicating variable into which to set the
; selected routines. Default = ^TMP("ZIBRSEL",$J,
; F = First routine, if range.
; L = Last routine, if range.
; N = Number of routines returned.
; Q = Quote character.
;
Q
;
RSEL(X,Y) ;PEP - Select a list or range of routines, return in Y, # sel in N.
I '$L($G(X)) Q "NO ROUTINES SPECIFIED IN PARAMETER"
NEW F,L,N,O,Q
; S O=$P(^%ZOSF("OS"),"-",1) ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err.
;S O=$P(^%ZOSF("OS"),"^",1) ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
;I O["MSM" S O="MSM" ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
;E S O="unknown" ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
;I '$L($T(@O)) Q "OPERATING SYSTEM '"_O_"' NOT SUPPORTED." ;IHS/SET/GTH XB*3*9 10/29/2002
S O=$$VERSION^%ZOSV(1),O=$P(O," ") ;IHS/SET/GTH XB*3*9 10/29/2002
I '(O["Cache"),'(O["MSM") Q "OPERATING SYSTEM '"_O_"' NOT SUPPORTED." ;IHS/SET/GTH XB*3*9 10/29/2002
I '$L($G(Y)) KILL ^TMP("ZIBRSEL",$J) S Y="^TMP(""ZIBRSEL"","_$J_","
S F=$P(X,"-"),L=$P(X,"-",2),N=0,Q=""""
I '(F]"") Q 0
I F["*" S F=$P(F,"*"),L="*",X=$P(X,"*")
;D @O ;IHS/SET/GTH XB*3*9 10/29/2002
D DIR ;IHS/SET/GTH XB*3*9 10/29/2002
Q N
;
DIR ; Check the directory ;IHS/SET/GTH XB*3*9 10/29/2002
MSM ; Micronetics Standard MUMPS.
;I F]"",$D(^ (F)) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
I F]"",$D(^$R(F)) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
I L="*" D Q
. ; F S F=$O(^ (F)) Q:F=""!('(X=$E(F,1,$L(X)))) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
. F S F=$O(^$R(F)) Q:F=""!('(X=$E(F,1,$L(X)))) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
.Q
; F S F=$O(^ (F)) Q:F=""!(F]L) S N=N+1,@(Y_Q_F_Q_")")="" Q:L="" ;IHS/SET/GTH XB*3*9 10/29/2002
F S F=$O(^$R(F)) Q:F=""!(F]L) S N=N+1,@(Y_Q_F_Q_")")="" Q:L="" ;IHS/SET/GTH XB*3*9 10/29/2002
Q
;
ZIBRSEL ; IHS/ADC/GTH - NONINTERACTIVE ROUTINE SELECT ; [ 10/29/2002 7:42 AM ]
+1 ;;3.0;IHS/VA UTILITIES;**4,9**;FEB 07, 1997
+2 ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err.
+3 ; XB*3*9 IHS/SET/GTH XB*3*9 10/29/2002 Cache' mods.
+4 ;
+5 ; Return the number of selected routines set into the
+6 ; indicated variable.
+7 ;
+8 ; E.g.:
+9 ; I '$$RSEL^ZIBRSEL("B-BZZZZZZZ","ARRAY(") W "NONE SELECTED" Q
+10 ;
+11 ; If routines exists in the list or range, their name will
+12 ; be returned as the last subscript of indicated variable in
+13 ; the 2nd parameter. The default is ^TMP("ZIBRSEL",$J,
+14 ;
+15 ; If routine B exists, then node ^TMP("ZIBRSEL",$J,"B") will
+16 ; be null.
+17 ;
+18 ; It is the programmer's responsibility to ensure the name
+19 ; of the array is correctly formed.
+20 ;
+21 ; Variables used:
+22 ; X = String indicating list or range of routines.
+23 ; Y = String indicating variable into which to set the
+24 ; selected routines. Default = ^TMP("ZIBRSEL",$J,
+25 ; F = First routine, if range.
+26 ; L = Last routine, if range.
+27 ; N = Number of routines returned.
+28 ; Q = Quote character.
+29 ;
+30 QUIT
+31 ;
RSEL(X,Y) ;PEP - Select a list or range of routines, return in Y, # sel in N.
+1 IF '$LENGTH($GET(X))
QUIT "NO ROUTINES SPECIFIED IN PARAMETER"
+2 NEW F,L,N,O,Q
+3 ; S O=$P(^%ZOSF("OS"),"-",1) ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err.
+4 ;S O=$P(^%ZOSF("OS"),"^",1) ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
+5 ;I O["MSM" S O="MSM" ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
+6 ;E S O="unknown" ; XB*3*4 IHS/ADC/GTH 05-22-97 Prevent <INDER> err. ;IHS/SET/GTH XB*3*9 10/29/2002
+7 ;I '$L($T(@O)) Q "OPERATING SYSTEM '"_O_"' NOT SUPPORTED." ;IHS/SET/GTH XB*3*9 10/29/2002
+8 ;IHS/SET/GTH XB*3*9 10/29/2002
SET O=$$VERSION^%ZOSV(1)
SET O=$PIECE(O," ")
+9 ;IHS/SET/GTH XB*3*9 10/29/2002
IF '(O["Cache")
IF '(O["MSM")
QUIT "OPERATING SYSTEM '"_O_"' NOT SUPPORTED."
+10 IF '$LENGTH($GET(Y))
KILL ^TMP("ZIBRSEL",$JOB)
SET Y="^TMP(""ZIBRSEL"","_$JOB_","
+11 SET F=$PIECE(X,"-")
SET L=$PIECE(X,"-",2)
SET N=0
SET Q=""""
+12 IF '(F]"")
QUIT 0
+13 IF F["*"
SET F=$PIECE(F,"*")
SET L="*"
SET X=$PIECE(X,"*")
+14 ;D @O ;IHS/SET/GTH XB*3*9 10/29/2002
+15 ;IHS/SET/GTH XB*3*9 10/29/2002
DO DIR
+16 QUIT N
+17 ;
DIR ; Check the directory ;IHS/SET/GTH XB*3*9 10/29/2002
MSM ; Micronetics Standard MUMPS.
+1 ;I F]"",$D(^ (F)) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
+2 ;IHS/SET/GTH XB*3*9 10/29/2002
IF F]""
IF $DATA(^$RANDOM(F))
SET N=N+1
SET @(Y_Q_F_Q_")")=""
+3 IF L="*"
Begin DoDot:1
+4 ; F S F=$O(^ (F)) Q:F=""!('(X=$E(F,1,$L(X)))) S N=N+1,@(Y_Q_F_Q_")")="" ;IHS/SET/GTH XB*3*9 10/29/2002
+5 ;IHS/SET/GTH XB*3*9 10/29/2002
FOR
SET F=$ORDER(^$RANDOM(F))
IF F=""!('(X=$EXTRACT(F,1,$LENGTH(X))))
QUIT
SET N=N+1
SET @(Y_Q_F_Q_")")=""
+6 QUIT
End DoDot:1
QUIT
+7 ; F S F=$O(^ (F)) Q:F=""!(F]L) S N=N+1,@(Y_Q_F_Q_")")="" Q:L="" ;IHS/SET/GTH XB*3*9 10/29/2002
+8 ;IHS/SET/GTH XB*3*9 10/29/2002
FOR
SET F=$ORDER(^$RANDOM(F))
IF F=""!(F]L)
QUIT
SET N=N+1
SET @(Y_Q_F_Q_")")=""
IF L=""
QUIT
+9 QUIT
+10 ;