DMSQT1 ;SFISC/EZ-STATUS CHECK ;11/13/97 12:08
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
Q
WAIT() ; extrinsic function, checks if SQLI is running (you must wait)
; returns 1 if nodes in ^DMSQ are changing, null otherwise
D DT^DICRW N J,FLG,DM S FLG=""
D SET H 2 D CHK
I FLG Q 1
E Q ""
SET ; set the DM array with current record counts
S J=""
F S J=$O(^DMSQ(J)) Q:J="" S DM(J)=$P(^(J,0),U,3)
Q
CHK ; check whether the counts have changed
S J=""
F S J=$O(^DMSQ(J)) Q:J="" S:DM(J)'=$P(^(J,0),U,3) FLG=1
Q
IDX(TI) ; extrinsic function, checks for indexes on table TI
; returns 1 if there are more indexes to process
; see INDEX^DMSQF2 for similar index checking code
N F,FI,IN,I,IF,IX,CI,FLG D DT^DICRW S FLG=""
S F=$P(^DMSQ("T",TI,0),U,7)
S FI=0 F S FI=$O(^DD(F,FI)) Q:'FI D
. S IN=0 F S IN=$O(^DD(F,FI,1,IN)) Q:'IN D
.. S I=$G(^DD(F,FI,1,IN,0))
.. I $P(I,U,3)]"" Q ; not a regular index
.. I I="" Q ; no data at DD location
.. S IF=+I,IX=$P(I,U,2) I IX=""!'IF Q ; no file # or index name
.. I $G(^DD(F,FI,1,IN,1))'[",DA)" Q ; last subscript isn't DA
.. S CI=$O(^DMSQ("C","D",F,FI,"")) Q:'CI ; missing column
.. S FLG=2 ; this index is a candidate for projection
I FLG=2 Q 1
E Q ""
DMSQT1 ;SFISC/EZ-STATUS CHECK ;11/13/97 12:08
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 QUIT
WAIT() ; extrinsic function, checks if SQLI is running (you must wait)
+1 ; returns 1 if nodes in ^DMSQ are changing, null otherwise
+2 DO DT^DICRW
NEW J,FLG,DM
SET FLG=""
+3 DO SET
HANG 2
DO CHK
+4 IF FLG
QUIT 1
+5 IF '$TEST
QUIT ""
SET ; set the DM array with current record counts
+1 SET J=""
+2 FOR
SET J=$ORDER(^DMSQ(J))
IF J=""
QUIT
SET DM(J)=$PIECE(^(J,0),U,3)
+3 QUIT
CHK ; check whether the counts have changed
+1 SET J=""
+2 FOR
SET J=$ORDER(^DMSQ(J))
IF J=""
QUIT
IF DM(J)'=$PIECE(^(J,0),U,3)
SET FLG=1
+3 QUIT
IDX(TI) ; extrinsic function, checks for indexes on table TI
+1 ; returns 1 if there are more indexes to process
+2 ; see INDEX^DMSQF2 for similar index checking code
+3 NEW F,FI,IN,I,IF,IX,CI,FLG
DO DT^DICRW
SET FLG=""
+4 SET F=$PIECE(^DMSQ("T",TI,0),U,7)
+5 SET FI=0
FOR
SET FI=$ORDER(^DD(F,FI))
IF 'FI
QUIT
Begin DoDot:1
+6 SET IN=0
FOR
SET IN=$ORDER(^DD(F,FI,1,IN))
IF 'IN
QUIT
Begin DoDot:2
+7 SET I=$GET(^DD(F,FI,1,IN,0))
+8 ; not a regular index
IF $PIECE(I,U,3)]""
QUIT
+9 ; no data at DD location
IF I=""
QUIT
+10 ; no file # or index name
SET IF=+I
SET IX=$PIECE(I,U,2)
IF IX=""!'IF
QUIT
+11 ; last subscript isn't DA
IF $GET(^DD(F,FI,1,IN,1))'[",DA)"
QUIT
+12 ; missing column
SET CI=$ORDER(^DMSQ("C","D",F,FI,""))
IF 'CI
QUIT
+13 ; this index is a candidate for projection
SET FLG=2
End DoDot:2
End DoDot:1
+14 IF FLG=2
QUIT 1
+15 IF '$TEST
QUIT ""