DGMSCK ;ALB/PJR - CONSISTENCY API'S FROM DGRPC3 ; 4/19/04 10:24am
;;5.3;Registration;**451,1015**;Mar 12, 2004;Build 21
0 Q ;; Must be called at a tag (API)
;;
MSCK(MSECHK) ;; Check MSE API
N I1,I2,MSE
S (MSERR,MSDATERR)=0,ANYMSE="" F I1=1:1:3 S ANYMSE(I1)=0
F MSE="4;5;6;7","9;10;11;12","14;15;16;17" D ANY
;; ANYMSE Saved for use with checks 79 through 82
S ANYMSE="" F I1=1:1:3 I ANYMSE(I1) S ANYMSE=ANYMSE_I1
Q 1
ANY S ANYMSE=0 F I2=1:1:4 I $P(DGP(.32),"^",$P(MSE,";",I2))]"" S ANYMSE=1 Q
I 'ANYMSE Q
S ANYMSE(MSE+1\5)=1 ;; Set ANY Data found for Last, NTL, and NNTL
F I2=1:1:4 I $P(DGP(.32),"^",$P(MSE,";",I2))']"" S MSERR=1 S:I2>2 MSDATERR=1
I MSDATERR Q
F I2=3,4 I $E($P(DGP(.32),"^",$P(MSE,";",I2)),4,7)="0000" S (MSERR,MSDATERR)=1 Q
Q
CNCK(CONCHK) ;; Check Conflicts API
N I1,I2,DATA,DATE,FROMPC,LOC,NODE,TOPC,YESNO
S CONERR=0 F I1=1:1:7 S I2=$T(CNFLT+I1) D LOC
Q 1
LOC ;;
S LOC=$P(I2,";;",2),DATA=$P(I2,";;",3),CONSPEC(LOC)=DATA
S NODE=$P(DATA,",",1),YESNO=$P(DATA,",",2)
S FROMPC=$P(DATA,",",3),TOPC=$P(DATA,",",4)
S CONARR(LOC)=0 I $P(DGP(NODE),"^",YESNO)'="Y" Q
S CONARR(LOC)=1
F I2=FROMPC,TOPC S DATE=$P(DGP(NODE),"^",I2) I 'DATE!($E(DATE,4,7)="0000") S CONERR=1,CONARR(LOC)=2 Q
Q
RANGE(RANSET) ;; Set Conflict Date Ranges
N I1,I2,I3
S I1="WWI,WWIIE,WWIIP,KOR,VIET,LEB,GREN,PAN,GULF,SOM,YUG,OTHER"
F I2=1:1:12 S I3=$P(I1,",",I2),RANGE(I3)=$$GETCNFDT^DGRPDT(I3)
Q 1
MSFROMTO(MSESET) ;; Set first and last overall MSE from/to dates
N MSEFROM,MSETO,I1,I2
S MSEFROM=9999999,MSETO=0 ;; Initialize from/to dates
;;
;; Find first MSE FROM Date and last MSE TO date
I $G(ANYMSE) D
.F I1=6,11,16 S I2=$P(DGP(.32),"^",I1) I I2,I2<MSEFROM S MSEFROM=I2
.F I1=7,12,17 S I2=$P(DGP(.32),"^",I1) I I2,I2>MSETO S MSETO=I2
Q MSEFROM_"^"_MSETO
;;
CNFLT ;;
;;SOM;;.322,16,17,18
;;YUG;;.322,19,20,21
;;PAN;;.322,7,8,9
;;GREN;;.322,4,5,6
;;LEB;;.322,1,2,3
;;VIET;;.321,1,4,5
;;GULF;;.322,10,11,12
DGMSCK ;ALB/PJR - CONSISTENCY API'S FROM DGRPC3 ; 4/19/04 10:24am
+1 ;;5.3;Registration;**451,1015**;Mar 12, 2004;Build 21
0 ;; Must be called at a tag (API)
QUIT
+1 ;;
MSCK(MSECHK) ;; Check MSE API
+1 NEW I1,I2,MSE
+2 SET (MSERR,MSDATERR)=0
SET ANYMSE=""
FOR I1=1:1:3
SET ANYMSE(I1)=0
+3 FOR MSE="4;5;6;7","9;10;11;12","14;15;16;17"
DO ANY
+4 ;; ANYMSE Saved for use with checks 79 through 82
+5 SET ANYMSE=""
FOR I1=1:1:3
IF ANYMSE(I1)
SET ANYMSE=ANYMSE_I1
+6 QUIT 1
ANY SET ANYMSE=0
FOR I2=1:1:4
IF $PIECE(DGP(.32),"^",$PIECE(MSE,";",I2))]""
SET ANYMSE=1
QUIT
+1 IF 'ANYMSE
QUIT
+2 ;; Set ANY Data found for Last, NTL, and NNTL
SET ANYMSE(MSE+1\5)=1
+3 FOR I2=1:1:4
IF $PIECE(DGP(.32),"^",$PIECE(MSE,";",I2))']""
SET MSERR=1
IF I2>2
SET MSDATERR=1
+4 IF MSDATERR
QUIT
+5 FOR I2=3,4
IF $EXTRACT($PIECE(DGP(.32),"^",$PIECE(MSE,";",I2)),4,7)="0000"
SET (MSERR,MSDATERR)=1
QUIT
+6 QUIT
CNCK(CONCHK) ;; Check Conflicts API
+1 NEW I1,I2,DATA,DATE,FROMPC,LOC,NODE,TOPC,YESNO
+2 SET CONERR=0
FOR I1=1:1:7
SET I2=$TEXT(CNFLT+I1)
DO LOC
+3 QUIT 1
LOC ;;
+1 SET LOC=$PIECE(I2,";;",2)
SET DATA=$PIECE(I2,";;",3)
SET CONSPEC(LOC)=DATA
+2 SET NODE=$PIECE(DATA,",",1)
SET YESNO=$PIECE(DATA,",",2)
+3 SET FROMPC=$PIECE(DATA,",",3)
SET TOPC=$PIECE(DATA,",",4)
+4 SET CONARR(LOC)=0
IF $PIECE(DGP(NODE),"^",YESNO)'="Y"
QUIT
+5 SET CONARR(LOC)=1
+6 FOR I2=FROMPC,TOPC
SET DATE=$PIECE(DGP(NODE),"^",I2)
IF 'DATE!($EXTRACT(DATE,4,7)="0000")
SET CONERR=1
SET CONARR(LOC)=2
QUIT
+7 QUIT
RANGE(RANSET) ;; Set Conflict Date Ranges
+1 NEW I1,I2,I3
+2 SET I1="WWI,WWIIE,WWIIP,KOR,VIET,LEB,GREN,PAN,GULF,SOM,YUG,OTHER"
+3 FOR I2=1:1:12
SET I3=$PIECE(I1,",",I2)
SET RANGE(I3)=$$GETCNFDT^DGRPDT(I3)
+4 QUIT 1
MSFROMTO(MSESET) ;; Set first and last overall MSE from/to dates
+1 NEW MSEFROM,MSETO,I1,I2
+2 ;; Initialize from/to dates
SET MSEFROM=9999999
SET MSETO=0
+3 ;;
+4 ;; Find first MSE FROM Date and last MSE TO date
+5 IF $GET(ANYMSE)
Begin DoDot:1
+6 FOR I1=6,11,16
SET I2=$PIECE(DGP(.32),"^",I1)
IF I2
IF I2<MSEFROM
SET MSEFROM=I2
+7 FOR I1=7,12,17
SET I2=$PIECE(DGP(.32),"^",I1)
IF I2
IF I2>MSETO
SET MSETO=I2
End DoDot:1
+8 QUIT MSEFROM_"^"_MSETO
+9 ;;
CNFLT ;;
+1 ;;SOM;;.322,16,17,18
+2 ;;YUG;;.322,19,20,21
+3 ;;PAN;;.322,7,8,9
+4 ;;GREN;;.322,4,5,6
+5 ;;LEB;;.322,1,2,3
+6 ;;VIET;;.321,1,4,5
+7 ;;GULF;;.322,10,11,12