HLCSORA1 ;ALB/MFK - REPORT FOR FILE #870 - 11/9/94
;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
;Gather and sort for a custom report from the #870 file.
;We want to be able to sort on various kinds of errors or statuses
START ;
N HLERR,HLSTAT,LINE,HLFILE,HLLINE,HLTMP,HLDIR,HLLINEN,HLNXT
N TMPLINE,START,END
S LINE="",$P(LINE,"-",IOM)=""
S HLERR=$P(HLSORT,"^",1)
S HLSTAT=$P(HLSORT,"^",2)
S HLLINEN=0
K ^TMP("HLCSORAT",$J)
I (HLQUEUE["1") S HLDIR=1 D LOOP
I (HLQUEUE["2") S HLDIR=2 D LOOP
; KILL VARIABLES USED
K HLSORT,HLQUEUE,HLLL
Q
LOOP S HLFILE=0
;START AFTER THE 0 NODE.
F S HLFILE=$O(^HLCS(870,HLLL,HLDIR,HLFILE)) Q:(HLFILE="B")!(HLFILE="") D
.S HLLINE=$G(^HLCS(870,HLLL,HLDIR,HLFILE,0))
.Q:((HLSTAT'="")&($P(HLLINE,"^",2)=""))
.Q:((HLERR'="")&($P(HLLINE,"^",3)=""))
.I ((HLERR[$P(HLLINE,"^",3))!(HLERR=""))&((HLSTAT[$P(HLLINE,"^",2))!(HLSTAT="")) D OUTPUT
Q
OUTPUT ;
S HLLINEN=HLLINEN+1
S ^TMP("HLCSORAT",$J,HLLINEN,1)=LINE
S ^TMP("HLCSORAT",$J,HLLINEN,2)=" Node: "_($P($G(^HLCS(870,HLLL,0)),"^",1))
S $P(X," ",41)=""
S ^TMP("HLCSORAT",$J,HLLINEN,2)=^TMP("HLCSORAT",$J,HLLINEN,2)_$E(X,1,40-$L(^TMP("HLCSORAT",$J,HLLINEN,2)))_"Queue: "_($S(HLDIR=1:"In",HLDIR=2:"Out"))
S ^TMP("HLCSORAT",$J,HLLINEN,3)=" Message number: "_HLFILE
S ^TMP("HLCSORAT",$J,HLLINEN,4)=" Message status: "_$$STATUS($P(HLLINE,"^",2))
S ^TMP("HLCSORAT",$J,HLLINEN,5)=" Message error: "_$$ERROR($P(HLLINE,"^",3))
S ^TMP("HLCSORAT",$J,HLLINEN,6)=" Message text:"
S HLNXT=0
S HLTMP=7
F S HLNXT=$O(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT)) Q:(HLNXT="") D
.S START=1,END=(IOM-3)
.F S TMPLINE=$E(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT,0),START,END) Q:($L(TMPLINE)=0) D
..S ^TMP("HLCSORAT",$J,HLLINEN,HLTMP)=TMPLINE
..S START=START+(IOM-3),END=END+(IOM-3)
..S HLTMP=HLTMP+1
Q
ERROR(ERR) ;
S ERR=$$EXPAND^HLUTIL1(870.019,2,ERR)
Q ERR
STATUS(STAT) ;
S STAT=$$EXPAND^HLUTIL1(870.01,1,STAT)
Q STAT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLCSORA1 1972 printed Oct 16, 2024@17:57:34 Page 2
HLCSORA1 ;ALB/MFK - REPORT FOR FILE #870 - 11/9/94
+1 ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
+2 ;Gather and sort for a custom report from the #870 file.
+3 ;We want to be able to sort on various kinds of errors or statuses
START ;
+1 NEW HLERR,HLSTAT,LINE,HLFILE,HLLINE,HLTMP,HLDIR,HLLINEN,HLNXT
+2 NEW TMPLINE,START,END
+3 SET LINE=""
SET $PIECE(LINE,"-",IOM)=""
+4 SET HLERR=$PIECE(HLSORT,"^",1)
+5 SET HLSTAT=$PIECE(HLSORT,"^",2)
+6 SET HLLINEN=0
+7 KILL ^TMP("HLCSORAT",$JOB)
+8 IF (HLQUEUE["1")
SET HLDIR=1
DO LOOP
+9 IF (HLQUEUE["2")
SET HLDIR=2
DO LOOP
+10 ; KILL VARIABLES USED
+11 KILL HLSORT,HLQUEUE,HLLL
+12 QUIT
LOOP SET HLFILE=0
+1 ;START AFTER THE 0 NODE.
+2 FOR
SET HLFILE=$ORDER(^HLCS(870,HLLL,HLDIR,HLFILE))
if (HLFILE="B")!(HLFILE="")
QUIT
Begin DoDot:1
+3 SET HLLINE=$GET(^HLCS(870,HLLL,HLDIR,HLFILE,0))
+4 if ((HLSTAT'="")&($PIECE(HLLINE,"^",2)=""))
QUIT
+5 if ((HLERR'="")&($PIECE(HLLINE,"^",3)=""))
QUIT
+6 IF ((HLERR[$PIECE(HLLINE,"^",3))!(HLERR=""))&((HLSTAT[$PIECE(HLLINE,"^",2))!(HLSTAT=""))
DO OUTPUT
End DoDot:1
+7 QUIT
OUTPUT ;
+1 SET HLLINEN=HLLINEN+1
+2 SET ^TMP("HLCSORAT",$JOB,HLLINEN,1)=LINE
+3 SET ^TMP("HLCSORAT",$JOB,HLLINEN,2)=" Node: "_($PIECE($GET(^HLCS(870,HLLL,0)),"^",1))
+4 SET $PIECE(X," ",41)=""
+5 SET ^TMP("HLCSORAT",$JOB,HLLINEN,2)=^TMP("HLCSORAT",$JOB,HLLINEN,2)_$EXTRACT(X,1,40-$LENGTH(^TMP("HLCSORAT",$JOB,HLLINEN,2)))_"Queue: "_($SELECT(HLDIR=1:"In",HLDIR=2:"Out"))
+6 SET ^TMP("HLCSORAT",$JOB,HLLINEN,3)=" Message number: "_HLFILE
+7 SET ^TMP("HLCSORAT",$JOB,HLLINEN,4)=" Message status: "_$$STATUS($PIECE(HLLINE,"^",2))
+8 SET ^TMP("HLCSORAT",$JOB,HLLINEN,5)=" Message error: "_$$ERROR($PIECE(HLLINE,"^",3))
+9 SET ^TMP("HLCSORAT",$JOB,HLLINEN,6)=" Message text:"
+10 SET HLNXT=0
+11 SET HLTMP=7
+12 FOR
SET HLNXT=$ORDER(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT))
if (HLNXT="")
QUIT
Begin DoDot:1
+13 SET START=1
SET END=(IOM-3)
+14 FOR
SET TMPLINE=$EXTRACT(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT,0),START,END)
if ($LENGTH(TMPLINE)=0)
QUIT
Begin DoDot:2
+15 SET ^TMP("HLCSORAT",$JOB,HLLINEN,HLTMP)=TMPLINE
+16 SET START=START+(IOM-3)
SET END=END+(IOM-3)
+17 SET HLTMP=HLTMP+1
End DoDot:2
End DoDot:1
+18 QUIT
ERROR(ERR) ;
+1 SET ERR=$$EXPAND^HLUTIL1(870.019,2,ERR)
+2 QUIT ERR
STATUS(STAT) ;
+1 SET STAT=$$EXPAND^HLUTIL1(870.01,1,STAT)
+2 QUIT STAT