source: WorldVistAEHR/trunk/r/BAR_CODE_MED_ADMIN-ALPB-PSB/ALPBELOG.m@ 846

Last change on this file since 846 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1ALPBELOG ;OIFO-DALLAS MW,SED,KC - BCBU LOG PROCESSOR ;01/01/03
2 ;;3.0;BAR CODE MED ADMIN;**8**;Mar 2004
3 ;
4 ; This utility processes error log entries from the
5 ; ERROR LOG section of the BCMA BACKUP PARAMETERS file
6 ;
7EN ; -- main entry point for ALPB ERROR LOG
8 D EN^VALM("PSB ERROR LOG")
9 Q
10 ;
11HDR ; -- header code
12 S VALMHDR(1)="Listing of data update filing errors (Error Log is in file 53.71)"
13 Q
14 ;
15INIT ; -- init variables and list array
16 K ^TMP("ALPBELOG",$J)
17 S ALPBPARM=+$O(^ALPB(53.71,0))
18 I ALPBPARM'>0 D Q
19 .S ^TMP("ALPBELOG",$J,1,0)="BCMA BACKUP PARAMETERS FILE IS NOT SET UP CORRECTLY."
20 .K ALPBPARM
21 .S VALMCNT=1
22 I $O(^ALPB(53.71,"C",""))="" D Q
23 .S ^TMP("ALPBELOG",$J,1,0)="There are no errors in the log."
24 .S VALMCNT=1
25 ;
26 S ALPBLINE=0
27 S ALPBIEN=""
28 F S ALPBIEN=$O(^ALPB(53.71,"C",ALPBIEN)) Q:ALPBIEN="" D
29 .I ALPBIEN>0 D CLEAN^ALPBUTL1(ALPBIEN)
30 .I ALPBIEN>0&('$D(^ALPB(53.7,ALPBIEN,0))) Q
31 .S ALPBPDAT=$G(^ALPB(53.7,ALPBIEN,0))
32 .I ALPBPDAT="" S ALPBPDAT="SYSTEM/FILER ERROR^"
33 .S ALPBLINE=ALPBLINE+1
34 .S ALPBDATA(ALPBLINE,0)=" "_$P(ALPBPDAT,U)
35 .I $P(ALPBPDAT,U,2)'="" S ALPBDATA(ALPBLINE,0)=ALPBDATA(ALPBLINE,0)_$P(ALPBPDAT,U,2)
36 .S ALPBX=0
37 .F S ALPBX=$O(^ALPB(53.71,"C",ALPBIEN,ALPBX)) Q:'ALPBX D
38 ..S ALPBEIEN=0
39 ..F S ALPBEIEN=$O(^ALPB(53.71,"C",ALPBIEN,ALPBX,ALPBEIEN)) Q:'ALPBEIEN D
40 ...;
41 ...M ALPBEDAT=^ALPB(53.71,ALPBPARM,1,ALPBEIEN)
42 ...S ALPBLINE=ALPBLINE+1
43 ...S ALPBDATA(ALPBLINE,0)=" Log Ref#: "_ALPBEIEN
44 ...S ALPBLINE=ALPBLINE+1
45 ...S ALPBDATA(ALPBLINE,0)=" Log Date: "_$$FDATE^ALPBUTL($P(ALPBEDAT(0),U))
46 ...S ALPBLINE=ALPBLINE+1
47 ...S ALPBDATA(ALPBLINE,0)=" Order Number: "_$P($G(^ALPB(53.7,ALPBIEN,2,+$P(ALPBEDAT(0),U,3),0),"<undefined>"),U)
48 ...S ALPBLINE=ALPBLINE+1
49 ...S ALPBDATA(ALPBLINE,0)=" HL7 Msg IEN: "_$P(ALPBEDAT(0),U,4)
50 ...I $G(^HL(772,+$P(ALPBEDAT(0),U,4),0))="" S ALPBDATA(ALPBLINE,0)=ALPBDATA(ALPBLINE,0)_" <--no longer in file 772"
51 ...S ALPBLINE=ALPBLINE+1
52 ...S ALPBDATA(ALPBLINE,0)=" HL7 Segment: "_$P(ALPBEDAT(0),U,5)
53 ...S ALPBLINE=ALPBLINE+1
54 ...S ALPBDATA(ALPBLINE,0)=" Segment Data: "
55 ...I $D(ALPBEDAT(1)) D
56 ....I $L(ALPBEDAT(1))<66 S ALPBDATA(ALPBLINE,0)=ALPBDATA(ALPBLINE,0)_ALPBEDAT(1)
57 ....I $L(ALPBEDAT(1))>65&($L(ALPBEDAT(1))<131) D
58 .....S ALPBDATA(ALPBLINE,0)=ALPBDATA(ALPBLINE,0)_$E(ALPBEDAT(1),1,65)
59 .....S ALPBLINE=ALPBLINE+1
60 .....S ALPBDATA(ALPBLINE,0)=$$PAD^ALPBUTL($G(ALPBDATA(ALPBLINE,0)),16)_$E(ALPBEDAT(1),66,130)
61 .....I $L(ALPBEDAT(1))>130 D
62 ......S ALPBLINE=ALPBLINE+1
63 ......S ALPBDATA(ALPBLINE,0)=$$PAD^ALPBUTL($G(ALPBDATA(ALPBLINE,0)),16)_$E(ALPBEDAT(1),130,180)
64 ...S ALPBY=0
65 ...F S ALPBY=$O(ALPBEDAT(2,ALPBY)) Q:'ALPBY D
66 ....S ALPBLINE=ALPBLINE+1
67 ....S ALPBDATA(ALPBLINE,0)=" Error Code: "_$P(ALPBEDAT(2,ALPBY,0),U)
68 ....S ALPBZ=0
69 ....F S ALPBZ=$O(ALPBEDAT(2,ALPBY,1,ALPBZ)) Q:'ALPBZ D
70 .....S ALPBLINE=ALPBLINE+1
71 .....S $P(ALPBDATA(ALPBLINE,0)," ",16)=ALPBEDAT(2,ALPBY,1,ALPBZ,0)
72 ....K ALPBZ
73 ...K ALPBY
74 ...S ALPBLINE=ALPBLINE+1
75 ...S ALPBDATA(ALPBLINE,0)=""
76 ...M ^TMP("ALPBELOG",$J)=ALPBDATA
77 ...K ALPBDATA,ALPBEDAT
78 ..K ALPBEIEN,ALPBPDAT
79 .K ALPBX
80 S VALMCNT=ALPBLINE
81 K ALPBIEN,ALPBLINE
82 Q
83 ;
84HELP ; -- help code
85 S X="?" D DISP^XQORM1 W !!
86 Q
87 ;
88EXIT ; -- exit code
89 K ^TMP("ALPBELOG",$J)
90 Q
91 ;
92EXPND ; -- expand code
93 Q
94 ;
95DELONE ; select and delete a log entry...
96 N ALPBPARM,DIR,DIRUT,DTOUT,X,Y
97 S ALPBPARM=+$O(^ALPB(53.71,0))
98 I ALPBPARM'>0 Q
99 S DIR(0)="FAO^1:9999999^K:'$D(^ALPB(53.71,ALPBPARM,1,+X)) X"
100 S DIR("A")="Select Log's REF# TO DELETE: "
101 S DIR("?")="Select a Log entry by the 'Log Ref#' NUMBER shown in the display"
102 D ^DIR K DIR
103 I $D(DIRUT) Q
104 I +Y>0 D DELERR^ALPBUTL2(+Y)
105 D INIT
106 Q
107 ;
108DELALL ; purge all errors from the log...
109 N ALPBPARM,ALPBX,DIR,DIRUT,DTOUT,X,Y
110 S ALPBPARM=+$O(^ALPB(53.71,0))
111 I ALPBPARM'>0 Q
112 S DIR(0)="YA"
113 S DIR("A")="Are you SURE you wish to purge all Error Log entries? "
114 S DIR("B")="NO"
115 D ^DIR K DIR
116 I $D(DIRUT)!(Y'=1) K DIRUT,DTOUT,X,Y Q
117 S ALPBX=0
118 F S ALPBX=$O(^ALPB(53.71,ALPBPARM,1,ALPBX)) Q:'ALPBX D DELERR^ALPBUTL2(ALPBX)
119 D INIT
120 Q
Note: See TracBrowser for help on using the repository browser.