XUSTAT2 ;SF/RWF - User/CPU/device stats part3 ;2/27/91 16:19 ;
;;8.0;KERNEL;;Jul 10, 1995
A S (XUEQ,XULI,XUTTIME)="",$P(XUEQ,"=",80)=XUEQ,$P(XULI,"-",80)=XULI,XUPA=1,Y=XUST D DD^%DT S XUST=Y,Y=XUEN D DD^%DT S XUEN=Y,XUTUSER=0
S XUHDR=$S(XUSORT="V":"VOLUME SET",XUSORT="U":"USER",XUSORT="S":"SERVICE",1:"DEVICE")_"-REPORT"
D HDR2
I XUSORT="V" S XUCPU=0 F I=1:1 S XUCPU=$O(^TMP($J,"DUZ",XUCPU)) Q:XUCPU']"" D PROC Q:$D(DUOUT)
I XUSORT="U" S XUSER="" F I=0:0 S XUSER=$O(^TMP($J,0,XUSER)) Q:XUSER']"" S XUREC=^(XUSER) D USER Q:$D(DUOUT)
I XUSORT="S" S XUSER="" F XUI=0:0 S XUSER=$O(^TMP($J,"SER",XUSER)) Q:XUSER']"" D SERV Q:$D(DUOUT)
I XUSORT="D" S XU1="" F XUI=0:0 S XU1=$O(^TMP($J,"DEV",XU1)) Q:XU1']"" D DEVICE Q:$D(DUOUT)
STATS W !!,"Total sign-on's processed: ",XUTREC
W !,"Total Taskman records: ",XUNOTM
W:XUSORT="U" !,"Total number of users: ",XUTUSER
W !,"Total number of sign-on's without a sign-off time: ",XUNODT,!
EXIT G END^XUSTAT
Q
PROC ;
I $Y+2>IOSL D HDR Q:$D(DUOUT)
S (XUON,XUSER)=0 F XUDUZ=0:0 S XUDUZ=$O(^TMP($J,"DUZ",XUCPU,XUDUZ)) Q:XUDUZ'>0 S X=^TMP($J,"DUZ",XUCPU,XUDUZ) S XUON=XUON+X,XUSER=XUSER+1
S X=$S($D(^TMP($J,"TIME",XUCPU,1)):^(1),1:0)
D SETTIME
W !,XUCPU,?15,XUON,?30,XUSER,?45,XUTIME,!,XULI
Q
USER ;
I $Y+4>IOSL D HDR Q:$D(DUOUT)
S XU1=+XUREC,XU1T=0,XUTUSER=XUTUSER+1 W !,XUSER
S XU2="" F I=1:1 S XU2=$O(XUNAME(XU2)) Q:XU2']"" D TIME
S X=XU1T D SETTIME W !,?20,$E(XULI,1,11),!,?20,XUTIME
Q
TIME S XUTIME="",X=$S($D(^TMP($J,"TIME",XU1,XU2))#2:^(XU2),1:0)
S XU1T=XU1T+X D:X SETTIME
W !,?5,XU2,?20,XUTIME,?35,$S($D(^TMP($J,"NODAT",XU1,XU2))#2:^(XU2),1:"")
Q
DEVICE ;
I $Y+4>IOSL D HDR Q:$D(DUOUT)
S X=$S(XU1?1A.E:XU1,$D(^%ZIS(1,XU1,0)):$P(^(0),"^"),1:XU1) W !,X
S XU2="",XU1T=0 F I=1:1 S XU2=$O(XUNAME(XU2)) Q:XU2']"" D TIME
S X=XU1T D SETTIME W !,?20,$E(XULI,1,11),!,?20,XUTIME
Q
SERV ;
I $Y+2>IOSL D HDR Q:$D(DUOUT)
S X=$S($D(^TMP($J,"TIME",XUSER,1)):^(1),1:0) D SETTIME
W !,XUSER,?37,XUTIME,?64,^TMP($J,"SER",XUSER),!,$E(XULI,1,$L(XUSER))
Q
SETTIME ;
S XUTTIME=XUTTIME+X,%=X,XUTIME=$S(%\86400:%\86400_" ",1:" "),%=%#86400,XUTIME=XUTIME_$E(%\3600+100,2,3)_":"_$E(%\60#60+100,2,3)_":"_$E(%#60+100,2,3)
Q
HDR I "C"[$E(IOST) S DIR(0)="E" D ^DIR Q:$D(DUOUT)
HDR2 W @IOF,! S Y=DT X ^DD("DD") W Y,?25,XUHDR,?65,"Page # ",XUPA,!?20
W !?14,"This report was generated for the period",!?12,"beginning ",XUST," and ending ",XUEN
W:XUSORT="V" !!,"VOL",?15,"Number of",?30,"Number of",?45,"Connect Time",!?15,"Sign-on's",?30,"Users",?45,"Hrs:Min.Sec"
W:XUSORT="U" !!,"USER NAME",?20,"Connect time",?35,"No",!,?5,"VOL",?20,"Hrs:Min:Sec",?35,"sign-off"
W:XUSORT="S" !!,"Service",?40,"Total",?60,"Total",!?37,"Hrs:Min.Sec",?59,"Sign On's"
W:XUSORT="D" !!,"DEVICE NAME",?20,"Connect time",?35,"No",!,?5,"VOL",?20,"Hrs:Min:Sec",?35,"sign-off"
W !,XUEQ S XUPA=XUPA+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUSTAT2 2886 printed Nov 22, 2024@17:23:10 Page 2
XUSTAT2 ;SF/RWF - User/CPU/device stats part3 ;2/27/91 16:19 ;
+1 ;;8.0;KERNEL;;Jul 10, 1995
A SET (XUEQ,XULI,XUTTIME)=""
SET $PIECE(XUEQ,"=",80)=XUEQ
SET $PIECE(XULI,"-",80)=XULI
SET XUPA=1
SET Y=XUST
DO DD^%DT
SET XUST=Y
SET Y=XUEN
DO DD^%DT
SET XUEN=Y
SET XUTUSER=0
+1 SET XUHDR=$SELECT(XUSORT="V":"VOLUME SET",XUSORT="U":"USER",XUSORT="S":"SERVICE",1:"DEVICE")_"-REPORT"
+2 DO HDR2
+3 IF XUSORT="V"
SET XUCPU=0
FOR I=1:1
SET XUCPU=$ORDER(^TMP($JOB,"DUZ",XUCPU))
if XUCPU']""
QUIT
DO PROC
if $DATA(DUOUT)
QUIT
+4 IF XUSORT="U"
SET XUSER=""
FOR I=0:0
SET XUSER=$ORDER(^TMP($JOB,0,XUSER))
if XUSER']""
QUIT
SET XUREC=^(XUSER)
DO USER
if $DATA(DUOUT)
QUIT
+5 IF XUSORT="S"
SET XUSER=""
FOR XUI=0:0
SET XUSER=$ORDER(^TMP($JOB,"SER",XUSER))
if XUSER']""
QUIT
DO SERV
if $DATA(DUOUT)
QUIT
+6 IF XUSORT="D"
SET XU1=""
FOR XUI=0:0
SET XU1=$ORDER(^TMP($JOB,"DEV",XU1))
if XU1']""
QUIT
DO DEVICE
if $DATA(DUOUT)
QUIT
STATS WRITE !!,"Total sign-on's processed: ",XUTREC
+1 WRITE !,"Total Taskman records: ",XUNOTM
+2 if XUSORT="U"
WRITE !,"Total number of users: ",XUTUSER
+3 WRITE !,"Total number of sign-on's without a sign-off time: ",XUNODT,!
EXIT GOTO END^XUSTAT
+1 QUIT
PROC ;
+1 IF $Y+2>IOSL
DO HDR
if $DATA(DUOUT)
QUIT
+2 SET (XUON,XUSER)=0
FOR XUDUZ=0:0
SET XUDUZ=$ORDER(^TMP($JOB,"DUZ",XUCPU,XUDUZ))
if XUDUZ'>0
QUIT
SET X=^TMP($JOB,"DUZ",XUCPU,XUDUZ)
SET XUON=XUON+X
SET XUSER=XUSER+1
+3 SET X=$SELECT($DATA(^TMP($JOB,"TIME",XUCPU,1)):^(1),1:0)
+4 DO SETTIME
+5 WRITE !,XUCPU,?15,XUON,?30,XUSER,?45,XUTIME,!,XULI
+6 QUIT
USER ;
+1 IF $Y+4>IOSL
DO HDR
if $DATA(DUOUT)
QUIT
+2 SET XU1=+XUREC
SET XU1T=0
SET XUTUSER=XUTUSER+1
WRITE !,XUSER
+3 SET XU2=""
FOR I=1:1
SET XU2=$ORDER(XUNAME(XU2))
if XU2']""
QUIT
DO TIME
+4 SET X=XU1T
DO SETTIME
WRITE !,?20,$EXTRACT(XULI,1,11),!,?20,XUTIME
+5 QUIT
TIME SET XUTIME=""
SET X=$SELECT($DATA(^TMP($JOB,"TIME",XU1,XU2))#2:^(XU2),1:0)
+1 SET XU1T=XU1T+X
if X
DO SETTIME
+2 WRITE !,?5,XU2,?20,XUTIME,?35,$SELECT($DATA(^TMP($JOB,"NODAT",XU1,XU2))#2:^(XU2),1:"")
+3 QUIT
DEVICE ;
+1 IF $Y+4>IOSL
DO HDR
if $DATA(DUOUT)
QUIT
+2 SET X=$SELECT(XU1?1A.E:XU1,$DATA(^%ZIS(1,XU1,0)):$PIECE(^(0),"^"),1:XU1)
WRITE !,X
+3 SET XU2=""
SET XU1T=0
FOR I=1:1
SET XU2=$ORDER(XUNAME(XU2))
if XU2']""
QUIT
DO TIME
+4 SET X=XU1T
DO SETTIME
WRITE !,?20,$EXTRACT(XULI,1,11),!,?20,XUTIME
+5 QUIT
SERV ;
+1 IF $Y+2>IOSL
DO HDR
if $DATA(DUOUT)
QUIT
+2 SET X=$SELECT($DATA(^TMP($JOB,"TIME",XUSER,1)):^(1),1:0)
DO SETTIME
+3 WRITE !,XUSER,?37,XUTIME,?64,^TMP($JOB,"SER",XUSER),!,$EXTRACT(XULI,1,$LENGTH(XUSER))
+4 QUIT
SETTIME ;
+1 SET XUTTIME=XUTTIME+X
SET %=X
SET XUTIME=$SELECT(%\86400:%\86400_" ",1:" ")
SET %=%#86400
SET XUTIME=XUTIME_$EXTRACT(%\3600+100,2,3)_":"_$EXTRACT(%\60#60+100,2,3)_":"_$EXTRACT(%#60+100,2,3)
+2 QUIT
HDR IF "C"[$EXTRACT(IOST)
SET DIR(0)="E"
DO ^DIR
if $DATA(DUOUT)
QUIT
HDR2 WRITE @IOF,!
SET Y=DT
XECUTE ^DD("DD")
WRITE Y,?25,XUHDR,?65,"Page # ",XUPA,!?20
+1 WRITE !?14,"This report was generated for the period",!?12,"beginning ",XUST," and ending ",XUEN
+2 if XUSORT="V"
WRITE !!,"VOL",?15,"Number of",?30,"Number of",?45,"Connect Time",!?15,"Sign-on's",?30,"Users",?45,"Hrs:Min.Sec"
+3 if XUSORT="U"
WRITE !!,"USER NAME",?20,"Connect time",?35,"No",!,?5,"VOL",?20,"Hrs:Min:Sec",?35,"sign-off"
+4 if XUSORT="S"
WRITE !!,"Service",?40,"Total",?60,"Total",!?37,"Hrs:Min.Sec",?59,"Sign On's"
+5 if XUSORT="D"
WRITE !!,"DEVICE NAME",?20,"Connect time",?35,"No",!,?5,"VOL",?20,"Hrs:Min:Sec",?35,"sign-off"
+6 WRITE !,XUEQ
SET XUPA=XUPA+1
+7 QUIT