SDQVAL ;ALB/MJK - Query Object Validation Methods ;8/12/96
;;5.3;Scheduling;**131**;Aug 13, 1993
;
QRY(SDQ,SDERR) ; -- validate query input
;
; -- do checks
IF SDQ,$D(@SDQUERY@(SDQ)) Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("QUERY")=SDQ
S SDOUT("QUERY")=SDQ
D BLD(4096800.101,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
QRYINACT(SDQ,SDMSG,SDERR) ; -- is query inactive?
;
; -- do checks
IF '$G(@SDQUERY@(SDQ,"ACTIVE")) Q 1
;
; -- build error msg indicating that query is active
N SDIN,SDOUT
S SDIN("QUERY")=SDQ
S SDOUT("QUERY")=SDQ
D BLD(4096800.106,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
QRYACT(SDQ,SDMSG,SDERR) ; -- is query active?
;
; -- do checks
IF $G(@SDQUERY@(SDQ,"ACTIVE")) Q 1
;
; -- build error msg indicating that query is inactive
N SDIN,SDOUT
S SDIN("QUERY")=SDQ
S SDOUT("QUERY")=SDQ
D BLD(4096800.102,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
ACTION(SDACT,SDERR) ; -- validate action input
;
; -- do checks
IF SDACT="SET"!(SDACT="GET") Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("ACTION")=SDACT
S SDOUT("ACTION")=SDACT
D BLD(4096800.108,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
FILTER(SDFIL,SDERR) ; -- validate filter input
N X
;
; -- do checks
; S X=SDFIL D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("FILTER")=SDFIL
S SDOUT("FILTER")=SDFIL
D BLD(4096800.104,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
INDEX(SDQ,SDIDX,SDERR) ; -- validate index input
;
; -- do checks
IF $O(^TMP("SDQUERY CLASS",$J,SDQ,"INDEX","B",SDIDX,0)) Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("INDEX")=SDIDX
S SDOUT("INDEX")=SDIDX
D BLD(4096800.105,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
STATUS(SDSTA,SDERR) ; -- validate active status
;
; -- do checks
IF SDSTA="TRUE"!(SDSTA="FALSE") Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("STATUS")=SDSTA
S SDOUT("STATUS")=SDSTA
D BLD(4096800.103,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
PAT(DFN,SDERR) ; -- validate DFN input
;
; -- do checks
IF DFN,$D(^DPT(DFN,0)) Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("ID")=DFN
S SDOUT("ID")=DFN
D BLD(4096800.002,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
RANGE(SDBEG,SDEND,SDERR) ; -- validate date range
;
; -- do checks
; **** ADD MORE CHECKS HERE! ****
IF SDBEG,SDEND,SDBEG'>SDEND Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("BEGIN")=SDBEG
S SDIN("END")=SDEND
S SDOUT("BEGIN")=SDBEG
S SDOUT("END")=SDEND
D BLD(4096800.022,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
PROP(SDQ,SDERR) ; -- are properties set for execution
N SDTYPE,SDOK,SDPROP
S SDOK=1,SDPROP=""
S SDTYPE=+$G(@SDQUERY@(SDQ,"INDEX TYPE"))
;
; -- do checks
; -- check if type is invalid
IF SDTYPE=0!(SDTYPE>4) D
. S SDOK=0
. S SDPROP=SDPROP_"INDEX / "
;
; -- if type is regular or composite date range
IF SDTYPE=1!(SDTYPE=4),$G(@SDQUERY@(SDQ,"MASTER VALUE"))="" D
. S SDOK=0
. S SDPROP=SDPROP_$G(@SDQUERY@(SDQ,"INDEX EXTERNAL"))_" / "
;
;
; -- if type is regular date range or composite date range
IF SDTYPE=2!(SDTYPE=4) D
. IF $G(@SDQUERY@(SDQ,"BEGIN DATE"))="" D Q
. . S SDOK=0
. . S SDPROP=SDPROP_"BEGIN DATE / "
. ;
. IF $G(@SDQUERY@(SDQ,"END DATE"))="" D Q
. . S SDOK=0
. . S SDPROP=SDPROP_"END DATE / "
;
;
; -- if type is composite (currently not supported [10/97])
IF SDTYPE=3 D
. S SDOK=0
. S SDPROP=SDPROP_"NO SUPPORTED / "
;
;
; -- build error msg
IF 'SDOK D
. N SDIN,SDOUT
. S SDIN("PROPERTIES")=SDPROP
. S SDOUT("PROPERTIES")=SDPROP
. D BLD(4096800.109,.SDIN,.SDOUT,$G(SDERR))
;
PROPQ Q SDOK
;
;
SCAN(SDQ,SDERR) ; -- is everything set up for SCAN to proceed?
;
; -- do checks
; -- is callback defined
IF $G(@SDQUERY@(SDQ,"SCAN APP CALLBACK"))]"" Q 1
;
; -- build error msg
D BLD(4096800.112,"","",$G(SDERR))
Q 0
;
;
SCANCB(SDCB,SDERR) ; -- is scan callback valid M code?
N X
;
; -- do checks
;S X=SDCB D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
Q 1
;
; -- build error msg
N SDIN,SDOUT
S SDIN("CALLBACK")=SDCB
S SDOUT("CALLBACK")=SDCB
D BLD(4096800.113,.SDIN,.SDOUT,$G(SDERR))
Q 0
;
;
BLD(SDMSG,SDIN,SDOUT,SDERR) ; -- build message
D BLD^DIALOG(SDMSG,.SDIN,.SDOUT,$G(SDERR),"F")
IF $G(SDEBUG) D
. D MSG^DIALOG("WES","","",5,$G(SDERR))
. N DIR
. S DIR(0)="E",DIR("A")="Press RETURN to continue"
. W ! D ^DIR
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDQVAL 4449 printed Dec 13, 2024@03:00:05 Page 2
SDQVAL ;ALB/MJK - Query Object Validation Methods ;8/12/96
+1 ;;5.3;Scheduling;**131**;Aug 13, 1993
+2 ;
QRY(SDQ,SDERR) ; -- validate query input
+1 ;
+2 ; -- do checks
+3 IF SDQ
IF $DATA(@SDQUERY@(SDQ))
QUIT 1
+4 ;
+5 ; -- build error msg
+6 NEW SDIN,SDOUT
+7 SET SDIN("QUERY")=SDQ
+8 SET SDOUT("QUERY")=SDQ
+9 DO BLD(4096800.101,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
QRYINACT(SDQ,SDMSG,SDERR) ; -- is query inactive?
+1 ;
+2 ; -- do checks
+3 IF '$GET(@SDQUERY@(SDQ,"ACTIVE"))
QUIT 1
+4 ;
+5 ; -- build error msg indicating that query is active
+6 NEW SDIN,SDOUT
+7 SET SDIN("QUERY")=SDQ
+8 SET SDOUT("QUERY")=SDQ
+9 DO BLD(4096800.106,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
QRYACT(SDQ,SDMSG,SDERR) ; -- is query active?
+1 ;
+2 ; -- do checks
+3 IF $GET(@SDQUERY@(SDQ,"ACTIVE"))
QUIT 1
+4 ;
+5 ; -- build error msg indicating that query is inactive
+6 NEW SDIN,SDOUT
+7 SET SDIN("QUERY")=SDQ
+8 SET SDOUT("QUERY")=SDQ
+9 DO BLD(4096800.102,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
ACTION(SDACT,SDERR) ; -- validate action input
+1 ;
+2 ; -- do checks
+3 IF SDACT="SET"!(SDACT="GET")
QUIT 1
+4 ;
+5 ; -- build error msg
+6 NEW SDIN,SDOUT
+7 SET SDIN("ACTION")=SDACT
+8 SET SDOUT("ACTION")=SDACT
+9 DO BLD(4096800.108,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
FILTER(SDFIL,SDERR) ; -- validate filter input
+1 NEW X
+2 ;
+3 ; -- do checks
+4 ; S X=SDFIL D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
+5 QUIT 1
+6 ;
+7 ; -- build error msg
+8 NEW SDIN,SDOUT
+9 SET SDIN("FILTER")=SDFIL
+10 SET SDOUT("FILTER")=SDFIL
+11 DO BLD(4096800.104,.SDIN,.SDOUT,$GET(SDERR))
+12 QUIT 0
+13 ;
+14 ;
INDEX(SDQ,SDIDX,SDERR) ; -- validate index input
+1 ;
+2 ; -- do checks
+3 IF $ORDER(^TMP("SDQUERY CLASS",$JOB,SDQ,"INDEX","B",SDIDX,0))
QUIT 1
+4 ;
+5 ; -- build error msg
+6 NEW SDIN,SDOUT
+7 SET SDIN("INDEX")=SDIDX
+8 SET SDOUT("INDEX")=SDIDX
+9 DO BLD(4096800.105,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
STATUS(SDSTA,SDERR) ; -- validate active status
+1 ;
+2 ; -- do checks
+3 IF SDSTA="TRUE"!(SDSTA="FALSE")
QUIT 1
+4 ;
+5 ; -- build error msg
+6 NEW SDIN,SDOUT
+7 SET SDIN("STATUS")=SDSTA
+8 SET SDOUT("STATUS")=SDSTA
+9 DO BLD(4096800.103,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
PAT(DFN,SDERR) ; -- validate DFN input
+1 ;
+2 ; -- do checks
+3 IF DFN
IF $DATA(^DPT(DFN,0))
QUIT 1
+4 ;
+5 ; -- build error msg
+6 NEW SDIN,SDOUT
+7 SET SDIN("ID")=DFN
+8 SET SDOUT("ID")=DFN
+9 DO BLD(4096800.002,.SDIN,.SDOUT,$GET(SDERR))
+10 QUIT 0
+11 ;
+12 ;
RANGE(SDBEG,SDEND,SDERR) ; -- validate date range
+1 ;
+2 ; -- do checks
+3 ; **** ADD MORE CHECKS HERE! ****
+4 IF SDBEG
IF SDEND
IF SDBEG'>SDEND
QUIT 1
+5 ;
+6 ; -- build error msg
+7 NEW SDIN,SDOUT
+8 SET SDIN("BEGIN")=SDBEG
+9 SET SDIN("END")=SDEND
+10 SET SDOUT("BEGIN")=SDBEG
+11 SET SDOUT("END")=SDEND
+12 DO BLD(4096800.022,.SDIN,.SDOUT,$GET(SDERR))
+13 QUIT 0
+14 ;
+15 ;
PROP(SDQ,SDERR) ; -- are properties set for execution
+1 NEW SDTYPE,SDOK,SDPROP
+2 SET SDOK=1
SET SDPROP=""
+3 SET SDTYPE=+$GET(@SDQUERY@(SDQ,"INDEX TYPE"))
+4 ;
+5 ; -- do checks
+6 ; -- check if type is invalid
+7 IF SDTYPE=0!(SDTYPE>4)
Begin DoDot:1
+8 SET SDOK=0
+9 SET SDPROP=SDPROP_"INDEX / "
End DoDot:1
+10 ;
+11 ; -- if type is regular or composite date range
+12 IF SDTYPE=1!(SDTYPE=4)
IF $GET(@SDQUERY@(SDQ,"MASTER VALUE"))=""
Begin DoDot:1
+13 SET SDOK=0
+14 SET SDPROP=SDPROP_$GET(@SDQUERY@(SDQ,"INDEX EXTERNAL"))_" / "
End DoDot:1
+15 ;
+16 ;
+17 ; -- if type is regular date range or composite date range
+18 IF SDTYPE=2!(SDTYPE=4)
Begin DoDot:1
+19 IF $GET(@SDQUERY@(SDQ,"BEGIN DATE"))=""
Begin DoDot:2
+20 SET SDOK=0
+21 SET SDPROP=SDPROP_"BEGIN DATE / "
End DoDot:2
QUIT
+22 ;
+23 IF $GET(@SDQUERY@(SDQ,"END DATE"))=""
Begin DoDot:2
+24 SET SDOK=0
+25 SET SDPROP=SDPROP_"END DATE / "
End DoDot:2
QUIT
End DoDot:1
+26 ;
+27 ;
+28 ; -- if type is composite (currently not supported [10/97])
+29 IF SDTYPE=3
Begin DoDot:1
+30 SET SDOK=0
+31 SET SDPROP=SDPROP_"NO SUPPORTED / "
End DoDot:1
+32 ;
+33 ;
+34 ; -- build error msg
+35 IF 'SDOK
Begin DoDot:1
+36 NEW SDIN,SDOUT
+37 SET SDIN("PROPERTIES")=SDPROP
+38 SET SDOUT("PROPERTIES")=SDPROP
+39 DO BLD(4096800.109,.SDIN,.SDOUT,$GET(SDERR))
End DoDot:1
+40 ;
PROPQ QUIT SDOK
+1 ;
+2 ;
SCAN(SDQ,SDERR) ; -- is everything set up for SCAN to proceed?
+1 ;
+2 ; -- do checks
+3 ; -- is callback defined
+4 IF $GET(@SDQUERY@(SDQ,"SCAN APP CALLBACK"))]""
QUIT 1
+5 ;
+6 ; -- build error msg
+7 DO BLD(4096800.112,"","",$GET(SDERR))
+8 QUIT 0
+9 ;
+10 ;
SCANCB(SDCB,SDERR) ; -- is scan callback valid M code?
+1 NEW X
+2 ;
+3 ; -- do checks
+4 ;S X=SDCB D ^DIM IF $D(X) Q 1 ; -- bug in DIR/DIM combo
+5 QUIT 1
+6 ;
+7 ; -- build error msg
+8 NEW SDIN,SDOUT
+9 SET SDIN("CALLBACK")=SDCB
+10 SET SDOUT("CALLBACK")=SDCB
+11 DO BLD(4096800.113,.SDIN,.SDOUT,$GET(SDERR))
+12 QUIT 0
+13 ;
+14 ;
BLD(SDMSG,SDIN,SDOUT,SDERR) ; -- build message
+1 DO BLD^DIALOG(SDMSG,.SDIN,.SDOUT,$GET(SDERR),"F")
+2 IF $GET(SDEBUG)
Begin DoDot:1
+3 DO MSG^DIALOG("WES","","",5,$GET(SDERR))
+4 NEW DIR
+5 SET DIR(0)="E"
SET DIR("A")="Press RETURN to continue"
+6 WRITE !
DO ^DIR
End DoDot:1
+7 QUIT
+8 ;