1 | HLCSORA1 ;ALB/MFK - REPORT FOR FILE #870 - 11/9/94
|
---|
2 | ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
|
---|
3 | ;Gather and sort for a custom report from the #870 file.
|
---|
4 | ;We want to be able to sort on various kinds of errors or statuses
|
---|
5 | START ;
|
---|
6 | N HLERR,HLSTAT,LINE,HLFILE,HLLINE,HLTMP,HLDIR,HLLINEN,HLNXT
|
---|
7 | N TMPLINE,START,END
|
---|
8 | S LINE="",$P(LINE,"-",IOM)=""
|
---|
9 | S HLERR=$P(HLSORT,"^",1)
|
---|
10 | S HLSTAT=$P(HLSORT,"^",2)
|
---|
11 | S HLLINEN=0
|
---|
12 | K ^TMP("HLCSORAT",$J)
|
---|
13 | I (HLQUEUE["1") S HLDIR=1 D LOOP
|
---|
14 | I (HLQUEUE["2") S HLDIR=2 D LOOP
|
---|
15 | ; KILL VARIABLES USED
|
---|
16 | K HLSORT,HLQUEUE,HLLL
|
---|
17 | Q
|
---|
18 | LOOP S HLFILE=0
|
---|
19 | ;START AFTER THE 0 NODE.
|
---|
20 | F S HLFILE=$O(^HLCS(870,HLLL,HLDIR,HLFILE)) Q:(HLFILE="B")!(HLFILE="") D
|
---|
21 | .S HLLINE=$G(^HLCS(870,HLLL,HLDIR,HLFILE,0))
|
---|
22 | .Q:((HLSTAT'="")&($P(HLLINE,"^",2)=""))
|
---|
23 | .Q:((HLERR'="")&($P(HLLINE,"^",3)=""))
|
---|
24 | .I ((HLERR[$P(HLLINE,"^",3))!(HLERR=""))&((HLSTAT[$P(HLLINE,"^",2))!(HLSTAT="")) D OUTPUT
|
---|
25 | Q
|
---|
26 | OUTPUT ;
|
---|
27 | S HLLINEN=HLLINEN+1
|
---|
28 | S ^TMP("HLCSORAT",$J,HLLINEN,1)=LINE
|
---|
29 | S ^TMP("HLCSORAT",$J,HLLINEN,2)=" Node: "_($P($G(^HLCS(870,HLLL,0)),"^",1))
|
---|
30 | S $P(X," ",41)=""
|
---|
31 | 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"))
|
---|
32 | S ^TMP("HLCSORAT",$J,HLLINEN,3)=" Message number: "_HLFILE
|
---|
33 | S ^TMP("HLCSORAT",$J,HLLINEN,4)=" Message status: "_$$STATUS($P(HLLINE,"^",2))
|
---|
34 | S ^TMP("HLCSORAT",$J,HLLINEN,5)=" Message error: "_$$ERROR($P(HLLINE,"^",3))
|
---|
35 | S ^TMP("HLCSORAT",$J,HLLINEN,6)=" Message text:"
|
---|
36 | S HLNXT=0
|
---|
37 | S HLTMP=7
|
---|
38 | F S HLNXT=$O(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT)) Q:(HLNXT="") D
|
---|
39 | .S START=1,END=(IOM-3)
|
---|
40 | .F S TMPLINE=$E(^HLCS(870,HLLL,HLDIR,HLFILE,1,HLNXT,0),START,END) Q:($L(TMPLINE)=0) D
|
---|
41 | ..S ^TMP("HLCSORAT",$J,HLLINEN,HLTMP)=TMPLINE
|
---|
42 | ..S START=START+(IOM-3),END=END+(IOM-3)
|
---|
43 | ..S HLTMP=HLTMP+1
|
---|
44 | Q
|
---|
45 | ERROR(ERR) ;
|
---|
46 | S ERR=$$EXPAND^HLUTIL1(870.019,2,ERR)
|
---|
47 | Q ERR
|
---|
48 | STATUS(STAT) ;
|
---|
49 | S STAT=$$EXPAND^HLUTIL1(870.01,1,STAT)
|
---|
50 | Q STAT
|
---|