FSCRPCWR ;SLC/STAFF-NOIS RPC Workload Review ;1/13/98 16:15
;;1.1;NOIS;;Sep 06, 1998
;
WORK(IN,OUT) ; from FSCRPX (RPCWorkload Review)
N CALL,COL,COLNUM,DATE,DATE0,DATE1,DATE2,FLDS,FMT,LASTNUM,LISTNUM,LISTFLAG,LNUM,MAX,NODE,NUM,SPEC,STOP,TYPE,WKLD
S STOP=0,MAX=2000
S LISTFLAG=+$G(^TMP("FSCRPC",$J,"INPUT",1)),DATE1=$P($G(^(1)),U,2),DATE2=$P($G(^(1)),U,3),FLDS=$P($G(^(1)),U,4)
I DATE1>DATE2 S DATE0=DATE2,DATE2=DATE1,DATE1=DATE0
S FMT="CUSTOM"
D INFO(.FMT,FLDS,.NODE,.TYPE)
S ^TMP("FSCRPC",$J,"OUTPUT",2)="0^1^Hours"
S ^TMP("FSCRPC",$J,"OUTPUT",3)="0^2^Date"
S ^TMP("FSCRPC",$J,"OUTPUT",4)="0^3^Spec"
S LASTNUM=4,LISTNUM=0,COLNUM=3
S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
.S COLNUM=COLNUM+1
.S LASTNUM=LASTNUM+1
.S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)="0^"_COLNUM_U_$P(FMT(COL),U,2)
I LISTFLAG D
.S LNUM=0 F S LNUM=$O(^TMP("FSC CURRENT LIST",$J,LNUM)) Q:LNUM<1 S CALL=+^(LNUM) D Q:STOP
..I $O(^TMP("FSCRPC",$J,"INPUT",1)) D Q
...S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S SPEC=+^(NUM) D Q:STOP
....I 'SPEC Q
....S DATE=0 F S DATE=$O(^FSCD("WKLD","AK",CALL,SPEC,DATE)) Q:DATE<1 S WKLD=^(DATE) D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
..S WKLD=0 F S WKLD=$O(^FSCD("WKLD","B",CALL,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
I 'LISTFLAG D
.I $O(^TMP("FSCRPC",$J,"INPUT",1)) D Q
..S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S SPEC=+^(NUM) D Q:STOP
...I 'SPEC Q
...S DATE=DATE1 F S DATE=$O(^FSCD("WKLD","AUD",SPEC,DATE)) Q:DATE<1 Q:DATE>DATE2 D Q:STOP
....S WKLD=0 F S WKLD=$O(^FSCD("WKLD","AUD",SPEC,DATE,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
.S DATE=DATE1 F S DATE=$O(^FSCD("WKLD","D",DATE)) Q:DATE<1 Q:DATE>DATE2 D Q:STOP
..S WKLD=0 F S WKLD=$O(^FSCD("WKLD","D",DATE,WKLD)) Q:WKLD<1 D SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM) I LASTNUM'<MAX S STOP=1 Q
S ^TMP("FSCRPC",$J,"OUTPUT",1)=(1+LISTNUM)_";"_(1+COLNUM)
Q
;
SETUP(WKLD,FMT,LASTNUM,LISTNUM) ;
N CALL,CALLID,COL,DATE,FIELD,HOURS,INVALID,SPEC,ZERO K FIELD
S ZERO=$G(^FSCD("WKLD",+WKLD,0))
S CALL=+ZERO,SPEC=+$P(ZERO,U,2),DATE=+$P(ZERO,U,3),HOURS=+$P(ZERO,U,4),INVALID=+$P(ZERO,U,5)
Q:'CALL Q:'DATE Q:'SPEC Q:'HOURS Q:INVALID
S CALLID=$P($G(^FSCD("CALL",CALL,0)),U)
S DATE=$$FMTE^XLFDT(DATE)
S SPEC=$P($G(^VA(200,SPEC,0)),U)
S LISTNUM=LISTNUM+1
S LASTNUM=LASTNUM+1
S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^0^"_CALLID
S LASTNUM=LASTNUM+1
S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^1^"_HOURS
S LASTNUM=LASTNUM+1
S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^2^"_DATE
S LASTNUM=LASTNUM+1
S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_"^3^"_SPEC
S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
.I '$L($P(FMT(COL),U,7)) S $P(FMT(COL),U,7)=" "
.S FIELD($P(FMT(COL),U,7))=""
D GET^FSCGET("CUSTOM",CALL,.FIELD)
S COL=0 F S COL=$O(FMT(COL)) Q:COL<1 D
.S LASTNUM=LASTNUM+1
.I $P(FMT(COL),U,7)="SUBJECT" D
..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_FIELD($P(FMT(COL),U,7))
.E D
..S ^TMP("FSCRPC",$J,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_$P(FIELD($P(FMT(COL),U,7)),U,2)
Q
;
INFO(FMT,FLDS,NODE,TYPE) ;
N CNT,FIELD,FORMAT,NUM,PIECE
S TYPE="FSC VIEW "
S NODE=TYPE_FMT
S NUM=3
I $E(FLDS)="{" D
.S FORMAT=+$P(FLDS,"{",2)
.S CNT=0 F S CNT=$O(^FSC("FORMAT",FORMAT,2,CNT)) Q:CNT<1 S FIELD=+^(CNT,0) D
..S NUM=NUM+1
..S FMT(NUM)=$G(^FSC("FLD",FIELD,0))
E D
.F PIECE=1:1 S FIELD=$P(FLDS,";",PIECE) Q:FIELD="" D
..S NUM=NUM+1
..S FMT(NUM)=$G(^FSC("FLD",+FIELD,0))
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCRPCWR 3628 printed Dec 13, 2024@02:19:59 Page 2
FSCRPCWR ;SLC/STAFF-NOIS RPC Workload Review ;1/13/98 16:15
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
WORK(IN,OUT) ; from FSCRPX (RPCWorkload Review)
+1 NEW CALL,COL,COLNUM,DATE,DATE0,DATE1,DATE2,FLDS,FMT,LASTNUM,LISTNUM,LISTFLAG,LNUM,MAX,NODE,NUM,SPEC,STOP,TYPE,WKLD
+2 SET STOP=0
SET MAX=2000
+3 SET LISTFLAG=+$GET(^TMP("FSCRPC",$JOB,"INPUT",1))
SET DATE1=$PIECE($GET(^(1)),U,2)
SET DATE2=$PIECE($GET(^(1)),U,3)
SET FLDS=$PIECE($GET(^(1)),U,4)
+4 IF DATE1>DATE2
SET DATE0=DATE2
SET DATE2=DATE1
SET DATE1=DATE0
+5 SET FMT="CUSTOM"
+6 DO INFO(.FMT,FLDS,.NODE,.TYPE)
+7 SET ^TMP("FSCRPC",$JOB,"OUTPUT",2)="0^1^Hours"
+8 SET ^TMP("FSCRPC",$JOB,"OUTPUT",3)="0^2^Date"
+9 SET ^TMP("FSCRPC",$JOB,"OUTPUT",4)="0^3^Spec"
+10 SET LASTNUM=4
SET LISTNUM=0
SET COLNUM=3
+11 SET COL=0
FOR
SET COL=$ORDER(FMT(COL))
if COL<1
QUIT
Begin DoDot:1
+12 SET COLNUM=COLNUM+1
+13 SET LASTNUM=LASTNUM+1
+14 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)="0^"_COLNUM_U_$PIECE(FMT(COL),U,2)
End DoDot:1
+15 IF LISTFLAG
Begin DoDot:1
+16 SET LNUM=0
FOR
SET LNUM=$ORDER(^TMP("FSC CURRENT LIST",$JOB,LNUM))
if LNUM<1
QUIT
SET CALL=+^(LNUM)
Begin DoDot:2
+17 IF $ORDER(^TMP("FSCRPC",$JOB,"INPUT",1))
Begin DoDot:3
+18 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET SPEC=+^(NUM)
Begin DoDot:4
+19 IF 'SPEC
QUIT
+20 SET DATE=0
FOR
SET DATE=$ORDER(^FSCD("WKLD","AK",CALL,SPEC,DATE))
if DATE<1
QUIT
SET WKLD=^(DATE)
DO SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM)
IF LASTNUM'<MAX
SET STOP=1
QUIT
End DoDot:4
if STOP
QUIT
End DoDot:3
QUIT
+21 SET WKLD=0
FOR
SET WKLD=$ORDER(^FSCD("WKLD","B",CALL,WKLD))
if WKLD<1
QUIT
DO SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM)
IF LASTNUM'<MAX
SET STOP=1
QUIT
End DoDot:2
if STOP
QUIT
End DoDot:1
+22 IF 'LISTFLAG
Begin DoDot:1
+23 IF $ORDER(^TMP("FSCRPC",$JOB,"INPUT",1))
Begin DoDot:2
+24 SET NUM=1
FOR
SET NUM=$ORDER(^TMP("FSCRPC",$JOB,"INPUT",NUM))
if NUM<1
QUIT
SET SPEC=+^(NUM)
Begin DoDot:3
+25 IF 'SPEC
QUIT
+26 SET DATE=DATE1
FOR
SET DATE=$ORDER(^FSCD("WKLD","AUD",SPEC,DATE))
if DATE<1
QUIT
if DATE>DATE2
QUIT
Begin DoDot:4
+27 SET WKLD=0
FOR
SET WKLD=$ORDER(^FSCD("WKLD","AUD",SPEC,DATE,WKLD))
if WKLD<1
QUIT
DO SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM)
IF LASTNUM'<MAX
SET STOP=1
QUIT
End DoDot:4
if STOP
QUIT
End DoDot:3
if STOP
QUIT
End DoDot:2
QUIT
+28 SET DATE=DATE1
FOR
SET DATE=$ORDER(^FSCD("WKLD","D",DATE))
if DATE<1
QUIT
if DATE>DATE2
QUIT
Begin DoDot:2
+29 SET WKLD=0
FOR
SET WKLD=$ORDER(^FSCD("WKLD","D",DATE,WKLD))
if WKLD<1
QUIT
DO SETUP(WKLD,.FMT,.LASTNUM,.LISTNUM)
IF LASTNUM'<MAX
SET STOP=1
QUIT
End DoDot:2
if STOP
QUIT
End DoDot:1
+30 SET ^TMP("FSCRPC",$JOB,"OUTPUT",1)=(1+LISTNUM)_";"_(1+COLNUM)
+31 QUIT
+32 ;
SETUP(WKLD,FMT,LASTNUM,LISTNUM) ;
+1 NEW CALL,CALLID,COL,DATE,FIELD,HOURS,INVALID,SPEC,ZERO
KILL FIELD
+2 SET ZERO=$GET(^FSCD("WKLD",+WKLD,0))
+3 SET CALL=+ZERO
SET SPEC=+$PIECE(ZERO,U,2)
SET DATE=+$PIECE(ZERO,U,3)
SET HOURS=+$PIECE(ZERO,U,4)
SET INVALID=+$PIECE(ZERO,U,5)
+4 if 'CALL
QUIT
if 'DATE
QUIT
if 'SPEC
QUIT
if 'HOURS
QUIT
if INVALID
QUIT
+5 SET CALLID=$PIECE($GET(^FSCD("CALL",CALL,0)),U)
+6 SET DATE=$$FMTE^XLFDT(DATE)
+7 SET SPEC=$PIECE($GET(^VA(200,SPEC,0)),U)
+8 SET LISTNUM=LISTNUM+1
+9 SET LASTNUM=LASTNUM+1
+10 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_"^0^"_CALLID
+11 SET LASTNUM=LASTNUM+1
+12 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_"^1^"_HOURS
+13 SET LASTNUM=LASTNUM+1
+14 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_"^2^"_DATE
+15 SET LASTNUM=LASTNUM+1
+16 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_"^3^"_SPEC
+17 SET COL=0
FOR
SET COL=$ORDER(FMT(COL))
if COL<1
QUIT
Begin DoDot:1
+18 IF '$LENGTH($PIECE(FMT(COL),U,7))
SET $PIECE(FMT(COL),U,7)=" "
+19 SET FIELD($PIECE(FMT(COL),U,7))=""
End DoDot:1
+20 DO GET^FSCGET("CUSTOM",CALL,.FIELD)
+21 SET COL=0
FOR
SET COL=$ORDER(FMT(COL))
if COL<1
QUIT
Begin DoDot:1
+22 SET LASTNUM=LASTNUM+1
+23 IF $PIECE(FMT(COL),U,7)="SUBJECT"
Begin DoDot:2
+24 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_FIELD($PIECE(FMT(COL),U,7))
End DoDot:2
+25 IF '$TEST
Begin DoDot:2
+26 SET ^TMP("FSCRPC",$JOB,"OUTPUT",LASTNUM)=LISTNUM_U_COL_U_$PIECE(FIELD($PIECE(FMT(COL),U,7)),U,2)
End DoDot:2
End DoDot:1
+27 QUIT
+28 ;
INFO(FMT,FLDS,NODE,TYPE) ;
+1 NEW CNT,FIELD,FORMAT,NUM,PIECE
+2 SET TYPE="FSC VIEW "
+3 SET NODE=TYPE_FMT
+4 SET NUM=3
+5 IF $EXTRACT(FLDS)="{"
Begin DoDot:1
+6 SET FORMAT=+$PIECE(FLDS,"{",2)
+7 SET CNT=0
FOR
SET CNT=$ORDER(^FSC("FORMAT",FORMAT,2,CNT))
if CNT<1
QUIT
SET FIELD=+^(CNT,0)
Begin DoDot:2
+8 SET NUM=NUM+1
+9 SET FMT(NUM)=$GET(^FSC("FLD",FIELD,0))
End DoDot:2
End DoDot:1
+10 IF '$TEST
Begin DoDot:1
+11 FOR PIECE=1:1
SET FIELD=$PIECE(FLDS,";",PIECE)
if FIELD=""
QUIT
Begin DoDot:2
+12 SET NUM=NUM+1
+13 SET FMT(NUM)=$GET(^FSC("FLD",+FIELD,0))
End DoDot:2
End DoDot:1
+14 QUIT
+15 ;