Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AMQQRMD

AMQQRMD.m

Go to the documentation of this file.
AMQQRMD ; IHS/CMI/THL - DATE BUCKETS ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;-----
 I AMQQCCLS="V" G:$D(AMQP(1)) START Q
 I '$D(AMQQHOLD)!('$D(AMQQUATN)) Q
 S %=$P($G(^UTILITY("AMQQ",$J,"AG",AMQQUATN,AMQQHOLD)),U,3)
 I '% Q
 S AMQP(1)=%
START I '$D(AMQQDZ) S (AMQQDZ,AMQQDX)=0
 S AMQQDZ=AMQQDZ+1
 I IOST["C-",AMQQDZ>1 W $C(13),AMQQDZ I AMQQDX W "  (",AMQQDX,")"
 I AMQQDZ>1 D SET Q
 I IOST["C-" W !!!!,"CRUNCH, CRUNCH....",!!
 D PRE
 D SET
EXIT K %,%H,%T,%Y,A,G,I,J,N,Z
 Q
 ;
FAIL S AMQQDX=AMQQDX+1
 I AMQQDZ>1 W $C(13),AMQQDZ,"  (",AMQQDX,")"
 Q
 ;
COUNT S (D1,AMQQDDS)=AMQQDDS\1
 S (D2,AMQQDDF)=AMQQDDF\1
 S Y=AMQQDDS
 X ^DD("DD")
 S AMQQDDS=Y
 S Y=AMQQDDF
 X ^DD("DD")
 S AMQQDDF=Y
 I (D2-D1)<8 K D1,D2 Q
 F Y=2,1 S X=@("D"_Y) D H^%DTC S X(Y)=%H
 S X(0)=%Y
 S X=X(2)-X(1)+1
 S Y=X\7
 S Z=X#7
 S %=$E("01234560123456",%Y+1,%Y+Z)
 S X=""
 F I=1:1:7 S X=X_(Y+(%[(I-1)))_U
 S AMQQDD=X K D1,D2
 Q
 ;
PRE K ^UTILITY("AMQQ",$J,"DOW")
 S AMQQDGR="^UTILITY(""AMQQ"",$J,""DOW"")"
 F I=0:1:23 S @AMQQDGR@("B",I)=0
 F I=0:1:6 S @AMQQDGR@("C",I)=0
 S AMQQDTOT=0
 Q
 ;
SET S %=+^AUPNVSIT(AMQP(1),0),AMQQDAY=%\1
 I %'["." D FAIL Q
 I '$D(AMQQDDS) S AMQQDDS=%
 I '$D(AMQQDDF) S AMQQDDF=%
 I %<AMQQDDS S AMQQDDS=%
 I %>AMQQDDF S AMQQDDF=%
 S %=$P(%,".",2)
 S %="."_%
 S %=$J(%,1,4)
 S AMQQDTIM=(%*100)\1
 S X=AMQQDAY
 D H^%DTC
 S AMQQDAY=%Y
 S %=$G(@AMQQDGR@("A",AMQQDTIM,AMQQDAY)),^(AMQQDAY)=%+1
 S %=$G(@AMQQDGR@("B",AMQQDTIM)),^(AMQQDTIM)=%+1
 S %=$G(@AMQQDGR@("C",AMQQDAY)),^(AMQQDAY)=%+1
 S AMQQDTOT=AMQQDTOT+1
 Q
 ;
PRINT I '$D(AMQQDDS) G PEXIT
 D COUNT
 D HEADER
 S AMQQDGR="^UTILITY(""AMQQ"",$J,""DOW"")"
 F AMQQDLIN=0:1:23 D:AMQQDLIN&'(AMQQDLIN#(IOSL-4)) PAUSE G:AMQQDLIN=999999 PEXIT D B1
 W !!,"TOTAL"
 S I=0
 F J=16:8 W ?J,@AMQQDGR@("C",I) S I=I+1 I I=7 W ?(J+8),AMQQDTOT Q
 I $D(AMQQDD) W !,"DAYS" S (I,N)=0 F J=16:8 S I=I+1 W ?J,$P(AMQQDD,U,I) S N=N+$P(AMQQDD,U,I) I I=7 W ?(J+8),N Q
 I $D(AMQQDD) W !,"AVERAGE" S I=0 F J=16:8 D AVE I I=7 W ?(J+8) S %=AMQQDTOT/N,%=$J(%,1,1) W % Q
 I IOST'?1"C-".E W @IOF D ^%ZISC G PEXIT
 D ^%ZISC
 R !!,"<>",AMQQDY:DTIME
PEXIT K X,Y,Z,A,G,AMQQDZ,AMQQDX,AMQQDLIN,N,AMQQDAY,AMQQDTIM,AMQQDTOT,%H,%Y,%T,AMQQDY,AMQQDGR,AMQQDDS,AMQQDDF,AMQQDD,AMQQRMFL
 Q
 ;
AVE S I=I+1
 I '$P(AMQQDD,U,I) S %=0
 E  S %=@AMQQDGR@("C",I-1)/$P(AMQQDD,U,I)
 S %=$J(%,1,1)
 W ?J,%
 Q
 ;
B1 S %=AMQQDLIN
 S %=%*100
 S X=%
 S Y=%+59
 S I=0
 I %<1000 S X="0"_X,Y="0"_Y
 I X="00" S X="0000",Y="0059"
 W !,X,"-",Y
 F J=16:8 W ?J,$S($D(@AMQQDGR@("A",AMQQDLIN,I)):^(I),1:".") S I=I+1 I I=7 W ?(J+8),@AMQQDGR@("B",AMQQDLIN) Q
 Q
 ;
PAUSE I IOST["C-" R !,"<>",AMQQRQ:DTIME S:'$T!(AMQQRQ=U) AMQQDLIN=999999 K AMQQRQ
 I AMQQDLIN=999999 Q
 D HEADER
 Q
 ;
 W !,"WORKLOAD DISTRIBUTION REPORT: ",AMQQDDS," to ",AMQQDDF,!
 W "VISIT TIME"
 S I=0
 F J=14:8 S I=I+1 W ?J,$P("SUN^MON^TUE^WED^THU^FRI^SAT",U,I) I I=7 W ?(J+8),"TOT" Q
 S AMQQDY=""
 S $P(AMQQDY,"-",80)=""
 W !,AMQQDY
 K AMQQRI,AMQQRJ,AMQQDY
 Q
 ;
WORKTASK S ZTRTN="WORKRUN^AMQQRMD"
 S ZTIO=ION
 S ZTDTH="NOW"
 S ZTDESC="Q-MAN WORKLOAD DISTRIBUTION REPORT"
 F I=1:1 S %=$P("AMQQRMFL;AMQV(;AMQQ200(;AMQQRV;AMQQNV;AMQQXV;^UTILITY(""AMQQ"",$J,;^UTILITY(""AMQQ RAND"",$J,;^UTILITY(""AMQQ TAX"",$J,",";",I) Q:%=""  S ZTSAVE(%)=""
 D ^%ZTLOAD
 D ^%ZISC
 W !!,$S($D(ZTSK):"Request queued!",1:"Request cancelled!"),!!!
 H 3
 Q
 ;
WORK ; ENTRY POINT FROM AMQQCMPL
 D DEV
 I $D(AMQQQUIT) Q
 S AMQQRMFL="^AMQQRMD"
 I $D(IO("Q")) D WORKTASK D ^%ZISC W @IOF Q
 U IO D WORKRUN D ^%ZISC
 Q
 ;
DEV W !!!
 S %ZIS="Q"
 D ^%ZIS
 I POP K DUOUT,DTOUT,POP S AMQQQUIT=""
 D PRINT^AMQQSEC E  W "  <= Not a secure device!!",*7 G DEV
 I $D(IO("Q")),IO=IO(0) W !!,"You can not queue a job to a slave printer..Try again",!!,*7 G DEV
 Q
 ;
WORKRUN W @IOF
 X AMQV(0)
 D PRINT
 I IOST["P-" W @IOF
 I $D(ZTQUEUED) D EXIT2^AMQQKILL S ZTREQ="@"
 Q
 ;