- INHR ;JSH; 22 Dec 93 16:42;Interface - Misc. Reports
- ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
- ;COPYRIGHT 1991-2000 SAIC
- ;
- STATUS ;Message Statistics by status
- N:'$D(ZTSK) %DT,INSD,INED,ZTSK
- D DATES Q:(INSD<0)!(INED<0)
- S ZTRTN="STATZTSK^INHR" D QUEUE Q:$D(ZTSK) D WAIT^DICD
- STATZTSK ;TaskMan entry point to print message stats by status
- N:'$D(ZTSK) INCNT,S,I,INHD,INI,DUOUT,PAGE
- S I=INSD-.0000001,TYPE="STATUS"
- F S I=$O(^INTHU("B",I)) Q:'I Q:I>INED S X=0 F S X=$O(^INTHU("B",I,X)) Q:'X S S=$P(^INTHU(X,0),U,3) S:S]"" INCNT(S)=$G(INCNT(S))+1
- S INHD(1)=" Status Count"
- W:'$D(ZTSK) @IOF D HEAD
- S C=$P(^DD(4001,.03,0),U,2)
- S INI="" F S INI=$O(INCNT(INI)) Q:INI="" S Y=INI D Y^DIQ W !?3,Y,?35,INCNT(INI)
- K:$D(ZTSK) ^%ZTSK(ZTSK)
- Q
- ;
- DEST ;Message statistics by destination
- N %DT,INSD,INED,ZTSK
- D DATES Q:(INSD<0)!(INED<0)
- S ZTRTN="DESTZTSK^INHR" D QUEUE Q:$D(ZTSK) D WAIT^DICD
- DESTZTSK ;TaskMan entry point to print message stats by destination
- N:'$D(ZTSK) INCNT,S,I,INHD,INI,DUOUT,PAGE
- S I=INSD-.0000001,TYPE="DESTINATION"
- F S I=$O(^INTHU("B",I)) Q:'I Q:I>INED S X=0 F S X=$O(^INTHU("B",I,X)) Q:'X S S=$P(^INTHU(X,0),U,2) S:S]"" INCNT(S)=$G(INCNT(S))+1
- S INHD(1)=" Destination Count"
- W:'$D(ZTSK) @IOF D HEAD
- S INI="" F S INI=$O(INCNT(INI)) Q:'INI D Q:$G(DUOUT)
- . I $Y+3>IOSL D HEAD Q:$G(DUOUT)
- . W !?3,$E($P($G(^INRHD(INI,0)),U),1,40),?48,INCNT(INI)
- K:$D(ZTSK) ^%ZTSK(ZTSK)
- Q
- ;
- DSTAT ;Message statistics by destination/status
- N:'$D(ZTSK) %DT,INSD,INED,ZTSK
- D DATES Q:(INSD<0)!(INED<0)
- S ZTRTN="DSZTSK^INHR" D QUEUE Q:$D(ZTSK) D WAIT^DICD
- DSZTSK ;TaskMan entry point to print message stats by destination/status
- N:'$D(ZTSK) INCNT,S1,S2,I,INHD,IND,INS,TOTAL,DEST,DUOUT,PAGE
- S I=INSD-.0000001,TYPE="DESTINATION/STATUS"
- F S I=$O(^INTHU("B",I)) Q:'I Q:I>INED S X=0 F S X=$O(^INTHU("B",I,X)) Q:'X S S=$P(^INTHU(X,0),U,2,3) S:S?1.N1"^"1.E INCNT(+S,$P(S,U,2))=$G(INCNT(+S,$P(S,U,2)))+1
- S INHD(1)=" Destination Status Count"
- W:'$D(ZTSK) @IOF D HEAD
- S IND="" F S IND=$O(INCNT(IND)) Q:'IND D Q:$G(DUOUT)
- . I $Y+3>IOSL D HEAD Q:$G(DUOUT)
- . S (D,TOTAL)=0,DEST=$E($P($G(^INRHD(IND,0)),U),1,30) W !?3,DEST
- . S INS="" F S INS=$O(INCNT(IND,INS)) Q:INS="" D Q:$G(DUOUT)
- .. I $Y+3>IOSL D HEAD Q:$G(DUOUT) W !?3,DEST S D=0
- .. S C=$P(^DD(4001,.03,0),U,2),Y=INS D Y^DIQ W:D ! W ?35,$E(Y,1,30),?71,INCNT(IND,INS) S TOTAL=TOTAL+INCNT(IND,INS),D=1
- . I $Y+4>IOSL D HEAD Q:$G(DUOUT) W !?3,DEST
- . W !?70,"-----",!?63,"Total:",?71,TOTAL
- K:$D(ZTSK) ^%ZTSK(ZTSK)
- Q
- ;
- HEAD ;Header
- N L,I,X,Y
- K DUOUT S PAGE=+$G(PAGE)
- I IO=IO(0),'$D(ZTSK),$E(IOST,1,2)="C-",PAGE W !,*7 R X:DTIME S:$E(X)=U DUOUT=1
- Q:$G(DUOUT)
- W:PAGE @IOF S PAGE=PAGE+1
- S L="Interface Message Statics by "_TYPE S Y=INSD D DD^%DT S INSD(1)=Y,Y=INED D DD^%DT S INED(1)=Y
- W !?(40-($L(L)\2)),L
- S L="Period: "_INSD(1)_" - "_INED(1) W !?(40-($L(L)\2)),L,?(IOM-10),"Page: ",PAGE
- I $D(INHD)>9 W ! F I=1:1 Q:'$D(INHD(I)) W !,INHD(I)
- W ! K Z S $P(Z,"-",IOM+1)="" W Z
- Q
- ;
- QUEUE ;Select device for output and queue if necessary
- K IOP D ^%ZIS Q:POP S IOP=ION_";"_IOST_";"_IOM_";"_IOSL
- Q:IO=IO(0)
- S ZTIO=IOP
- F I="INSD","INED" S ZTSAVE(I)=""
- D ^%ZTLOAD W !?5,"Request "_$S($D(ZTSK):"",1:"NOT ")_"QUEUED!" Q
- ;
- DATES ;Get start/end dates (with time)
- S %DT("A")="START of Period: ",%DT="ATE" D ^%DT S INSD=+Y I INSD<0 S INED=-1 Q
- S %DT("A")="END of Period: ",%DT="ATE",%DT("B")="NOW" D ^%DT S INED=+Y
- S:INED\1=INED INED=INED+.999999
- Q
- INHR ;JSH; 22 Dec 93 16:42;Interface - Misc. Reports
- +1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
- +2 ;COPYRIGHT 1991-2000 SAIC
- +3 ;
- STATUS ;Message Statistics by status
- +1 IF '$DATA(ZTSK)
- NEW %DT,INSD,INED,ZTSK
- +2 DO DATES
- IF (INSD<0)!(INED<0)
- QUIT
- +3 SET ZTRTN="STATZTSK^INHR"
- DO QUEUE
- IF $DATA(ZTSK)
- QUIT
- DO WAIT^DICD
- STATZTSK ;TaskMan entry point to print message stats by status
- +1 IF '$DATA(ZTSK)
- NEW INCNT,S,I,INHD,INI,DUOUT,PAGE
- +2 SET I=INSD-.0000001
- SET TYPE="STATUS"
- +3 FOR
- SET I=$ORDER(^INTHU("B",I))
- IF 'I
- QUIT
- IF I>INED
- QUIT
- SET X=0
- FOR
- SET X=$ORDER(^INTHU("B",I,X))
- IF 'X
- QUIT
- SET S=$PIECE(^INTHU(X,0),U,3)
- IF S]""
- SET INCNT(S)=$GET(INCNT(S))+1
- +4 SET INHD(1)=" Status Count"
- +5 IF '$DATA(ZTSK)
- WRITE @IOF
- DO HEAD
- +6 SET C=$PIECE(^DD(4001,.03,0),U,2)
- +7 SET INI=""
- FOR
- SET INI=$ORDER(INCNT(INI))
- IF INI=""
- QUIT
- SET Y=INI
- DO Y^DIQ
- WRITE !?3,Y,?35,INCNT(INI)
- +8 IF $DATA(ZTSK)
- KILL ^%ZTSK(ZTSK)
- +9 QUIT
- +10 ;
- DEST ;Message statistics by destination
- +1 NEW %DT,INSD,INED,ZTSK
- +2 DO DATES
- IF (INSD<0)!(INED<0)
- QUIT
- +3 SET ZTRTN="DESTZTSK^INHR"
- DO QUEUE
- IF $DATA(ZTSK)
- QUIT
- DO WAIT^DICD
- DESTZTSK ;TaskMan entry point to print message stats by destination
- +1 IF '$DATA(ZTSK)
- NEW INCNT,S,I,INHD,INI,DUOUT,PAGE
- +2 SET I=INSD-.0000001
- SET TYPE="DESTINATION"
- +3 FOR
- SET I=$ORDER(^INTHU("B",I))
- IF 'I
- QUIT
- IF I>INED
- QUIT
- SET X=0
- FOR
- SET X=$ORDER(^INTHU("B",I,X))
- IF 'X
- QUIT
- SET S=$PIECE(^INTHU(X,0),U,2)
- IF S]""
- SET INCNT(S)=$GET(INCNT(S))+1
- +4 SET INHD(1)=" Destination Count"
- +5 IF '$DATA(ZTSK)
- WRITE @IOF
- DO HEAD
- +6 SET INI=""
- FOR
- SET INI=$ORDER(INCNT(INI))
- IF 'INI
- QUIT
- Begin DoDot:1
- +7 IF $Y+3>IOSL
- DO HEAD
- IF $GET(DUOUT)
- QUIT
- +8 WRITE !?3,$EXTRACT($PIECE($GET(^INRHD(INI,0)),U),1,40),?48,INCNT(INI)
- End DoDot:1
- IF $GET(DUOUT)
- QUIT
- +9 IF $DATA(ZTSK)
- KILL ^%ZTSK(ZTSK)
- +10 QUIT
- +11 ;
- DSTAT ;Message statistics by destination/status
- +1 IF '$DATA(ZTSK)
- NEW %DT,INSD,INED,ZTSK
- +2 DO DATES
- IF (INSD<0)!(INED<0)
- QUIT
- +3 SET ZTRTN="DSZTSK^INHR"
- DO QUEUE
- IF $DATA(ZTSK)
- QUIT
- DO WAIT^DICD
- DSZTSK ;TaskMan entry point to print message stats by destination/status
- +1 IF '$DATA(ZTSK)
- NEW INCNT,S1,S2,I,INHD,IND,INS,TOTAL,DEST,DUOUT,PAGE
- +2 SET I=INSD-.0000001
- SET TYPE="DESTINATION/STATUS"
- +3 FOR
- SET I=$ORDER(^INTHU("B",I))
- IF 'I
- QUIT
- IF I>INED
- QUIT
- SET X=0
- FOR
- SET X=$ORDER(^INTHU("B",I,X))
- IF 'X
- QUIT
- SET S=$PIECE(^INTHU(X,0),U,2,3)
- IF S?1.N1"^"1.E
- SET INCNT(+S,$PIECE(S,U,2))=$GET(INCNT(+S,$PIECE(S,U,2)))+1
- +4 SET INHD(1)=" Destination Status Count"
- +5 IF '$DATA(ZTSK)
- WRITE @IOF
- DO HEAD
- +6 SET IND=""
- FOR
- SET IND=$ORDER(INCNT(IND))
- IF 'IND
- QUIT
- Begin DoDot:1
- +7 IF $Y+3>IOSL
- DO HEAD
- IF $GET(DUOUT)
- QUIT
- +8 SET (D,TOTAL)=0
- SET DEST=$EXTRACT($PIECE($GET(^INRHD(IND,0)),U),1,30)
- WRITE !?3,DEST
- +9 SET INS=""
- FOR
- SET INS=$ORDER(INCNT(IND,INS))
- IF INS=""
- QUIT
- Begin DoDot:2
- +10 IF $Y+3>IOSL
- DO HEAD
- IF $GET(DUOUT)
- QUIT
- WRITE !?3,DEST
- SET D=0
- +11 SET C=$PIECE(^DD(4001,.03,0),U,2)
- SET Y=INS
- DO Y^DIQ
- IF D
- WRITE !
- WRITE ?35,$EXTRACT(Y,1,30),?71,INCNT(IND,INS)
- SET TOTAL=TOTAL+INCNT(IND,INS)
- SET D=1
- End DoDot:2
- IF $GET(DUOUT)
- QUIT
- +12 IF $Y+4>IOSL
- DO HEAD
- IF $GET(DUOUT)
- QUIT
- WRITE !?3,DEST
- +13 WRITE !?70,"-----",!?63,"Total:",?71,TOTAL
- End DoDot:1
- IF $GET(DUOUT)
- QUIT
- +14 IF $DATA(ZTSK)
- KILL ^%ZTSK(ZTSK)
- +15 QUIT
- +16 ;
- HEAD ;Header
- +1 NEW L,I,X,Y
- +2 KILL DUOUT
- SET PAGE=+$GET(PAGE)
- +3 IF IO=IO(0)
- IF '$DATA(ZTSK)
- IF $EXTRACT(IOST,1,2)="C-"
- IF PAGE
- WRITE !,*7
- READ X:DTIME
- IF $EXTRACT(X)=U
- SET DUOUT=1
- +4 IF $GET(DUOUT)
- QUIT
- +5 IF PAGE
- WRITE @IOF
- SET PAGE=PAGE+1
- +6 SET L="Interface Message Statics by "_TYPE
- SET Y=INSD
- DO DD^%DT
- SET INSD(1)=Y
- SET Y=INED
- DO DD^%DT
- SET INED(1)=Y
- +7 WRITE !?(40-($LENGTH(L)\2)),L
- +8 SET L="Period: "_INSD(1)_" - "_INED(1)
- WRITE !?(40-($LENGTH(L)\2)),L,?(IOM-10),"Page: ",PAGE
- +9 IF $DATA(INHD)>9
- WRITE !
- FOR I=1:1
- IF '$DATA(INHD(I))
- QUIT
- WRITE !,INHD(I)
- +10 WRITE !
- KILL Z
- SET $PIECE(Z,"-",IOM+1)=""
- WRITE Z
- +11 QUIT
- +12 ;
- QUEUE ;Select device for output and queue if necessary
- +1 KILL IOP
- DO ^%ZIS
- IF POP
- QUIT
- SET IOP=ION_";"_IOST_";"_IOM_";"_IOSL
- +2 IF IO=IO(0)
- QUIT
- +3 SET ZTIO=IOP
- +4 FOR I="INSD","INED"
- SET ZTSAVE(I)=""
- +5 DO ^%ZTLOAD
- WRITE !?5,"Request "_$SELECT($DATA(ZTSK):"",1:"NOT ")_"QUEUED!"
- QUIT
- +6 ;
- DATES ;Get start/end dates (with time)
- +1 SET %DT("A")="START of Period: "
- SET %DT="ATE"
- DO ^%DT
- SET INSD=+Y
- IF INSD<0
- SET INED=-1
- QUIT
- +2 SET %DT("A")="END of Period: "
- SET %DT="ATE"
- SET %DT("B")="NOW"
- DO ^%DT
- SET INED=+Y
- +3 IF INED\1=INED
- SET INED=INED+.999999
- +4 QUIT