source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7LOG.m@ 691

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1LA7LOG ;DALOI/JRR - Log events and errors from Lab Messaging ; Jan 12, 2004
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**17,27,67**;Sep 27, 1994
3 QUIT
4 ;
5CREATE(LA762485,LA7FLAG) ;
6 ; Creates an entry in the log file to record events or errors
7 ; while processing messages. The calling routine passes the
8 ; ien for a bulletin in file 62.485.
9 ; Requires the variables:
10 ; LA762485 = 'ien of bulletin in 62.485'
11 ; LA76248 = 'ien of config in 62.48 or null if none is defined'
12 ; LA7FLAG = 1 (return error msg text)
13 ;
14 ; logging turned off
15 I $G(LA7FLAG),'$P($G(^LAHM(62.48,+LA76248,0)),"^",4) Q ""
16 I '$P($G(^LAHM(62.48,+LA76248,0)),"^",4) Q
17 ;
18 N DA,DIE,DR,X,Y
19 N LA7,LA7DT,LA7NOW,LA7TIM,LA7TXT
20 ;
21 S LA7TXT=$P($G(^LAHM(62.485,LA762485,0)),"^",1,2)
22 S:LA7TXT="" LA7TXT="Log routine was called with a non-existent code number ("_LA762485_")."
23 I $G(^LAHM(62.485,LA762485,1))'="" X ^(1)
24 I $O(LA7TXT("")) D
25 . S LA7=""
26 . F S LA7=$O(LA7TXT(LA7)) Q:LA7="" D
27 . . S LA7TXT=$P(LA7TXT,"|"_LA7_"|")_LA7TXT(LA7)_$P(LA7TXT,"|"_LA7_"|",2)
28 ; Set current date/time.
29 S LA7NOW=$$HTFM^XLFDT($H),LA7DT=LA7NOW\1,LA7TM=LA7NOW#1
30 ;
31 ; Set lock on XTMP global.
32 L +^XTMP("LA7ERR^"_LA7DT,0):99
33 I '$D(^XTMP("LA7ERR^"_LA7DT,0)) S ^XTMP("LA7ERR^"_LA7DT,0)=$$HTFM^XLFDT($H+7,1)_"^"_LA7DT_"^"_"Lab Messaging Error Log"
34 F Q:'$D(^XTMP("LA7ERR^"_LA7DT,LA7TM)) S LA7TM=LA7TM+.0000001
35 S ^XTMP("LA7ERR^"_LA7DT,LA7TM)=$G(LA76248)_"^"_$G(LA76249)_"^"_LA7TXT
36 ; Release lock on XTMP global.
37 L -^XTMP("LA7ERR^"_LA7DT,0)
38 ;
39 ; change status to error.
40 I $G(LA76249) D
41 . N FDA,LA7DIE
42 . S FDA(1,62.49,LA76249_",",2)="E"
43 . D FILE^DIE("","FDA(1)","LA7DIE(1)")
44 ;
45 ; Send alert
46 I $P($G(^LAHM(62.485,LA762485,0)),"^",3),$D(^LAHM(62.48,+$G(LA76248),20,"B",2)) D XQA^LA7UXQA(2,$G(LA76248),$G(LA762485),$G(LA76249),$G(LA7AMSG))
47 ;
48 I $G(LA7FLAG) Q LA7TXT
49 Q
50 ;
51 ;
52PRINT ;Print the error log which is stored in ^XTMP. Errors are
53 ;logged only if the Debug Log field is turned on in 62.48
54 N DIR,LA7,LA76248,LA76249,LA7DT,LA7ETXT,LA7TM,LA7TXT,LA7XTMP
55 D DT^DICRW
56 S LA7XTMP="LA7ERR^"_DT
57 I '$O(^XTMP(LA7XTMP,0)) W !!,?5,"Nothing logged for Today!"
58 K DIR
59 S DIR("A")="Look at log for what date? "
60 S DIR("B")="TODAY"
61 S DIR("?")="^D HELP^%DTC"
62 S DIR(0)="DA^:DT:EX"
63 D ^DIR K DIR
64 Q:$D(DIRUT)
65 S LA7XTMP="LA7ERR^"_Y
66 I '$O(^XTMP(LA7XTMP,0)) D G PRINT
67 . W !!,?5,"Nothing logged for ",$$FMTE^XLFDT(Y)
68 S (LA76248,X,Y)=0 ; Find out if running multiple configurations.
69 F S X=$O(^LAHM(62.48,X)) Q:'X I $P($G(^LAHM(62.48,X,0)),"^",3) S Y=Y+1
70 I Y>1 D Q:'LA76248
71 . N DIC,X,Y
72 . S DIC="^LAHM(62.48,",DIC(0)="AEMQ",DIC("A")="Select CONFIGURATION: " D ^DIC
73 . I Y>0 S LA76248=+Y
74 S DIR(0)="Y",DIR("A")="Print message text with error",DIR("B")="YES",DIR("?",1)="Do you want the text of the message also printed with the error",DIR("?")="Answer 'Y' or 'N'" D ^DIR K DIR Q:$D(DIRUT)
75 S LA7ETXT=Y ; Flag to print message text with error.
76 S %ZIS="Q"
77 D ^%ZIS
78 I POP D HOME^%ZIS K DIR,%ZIS,DIRUT,LA7XTMP QUIT
79 K ZTSK
80 I $D(IO("Q")) D QUIT
81 . S ZTDESC="Lab Interface Error Log",ZTRTN="START^LA7LOG"
82 . S ZTSAVE("LA7XTMP")=LA7XTMP
83 . S ZTSAVE("LA76248")=LA76248
84 . S ZTSAVE("LA7ETXT")=LA7ETXT
85 . D ^%ZTLOAD
86 . I $D(ZTSK) U IO(0) W !?5,"Report queued...",!!
87 . D ^%ZISC K ZTDESC,ZTDTH,ZTSAVE,ZTRTN,ZTSK
88 U IO
89START ;
90 S LA7TM=""
91 W:$Y @IOF
92 F S LA7TM=$O(^XTMP(LA7XTMP,LA7TM),-1) Q:LA7TM=0 D Q:LA7QUIT
93 . S LA7QUIT=0
94 . I LA76248,+^XTMP(LA7XTMP,LA7TM),+^XTMP(LA7XTMP,LA7TM)'=LA76248 Q ; Error message not for requested configuration.
95 . S LA76249=+$P(^XTMP(LA7XTMP,LA7TM),"^",2)
96 . I $Y>(IOSL-5) D W @IOF Q:LA7QUIT
97 . . I '$D(ZTQUEUED),"Pp"'[$E(IOST) K DIR S DIR(0)="E" D ^DIR I 'Y S LA7QUIT=1 Q
98 . W:$X !! W $$FMTE^XLFDT($P(LA7XTMP,"^",2)+LA7TM)," "
99 . W $P(^XTMP(LA7XTMP,LA7TM),"^",3)," " S X=$P(^(LA7TM),"^",4,99)
100 . F LA7=1:1:$L(X," ") S Y=$P(X," ",LA7) W:($L(Y)+$X+1)>IOM ! W Y," "
101 . I 'LA76249!('LA7ETXT) Q ; Don't print message if no text or not requested.
102 . Q:'$O(^LAHM(62.49,LA76249,150,0))
103 . S LA7=0
104 . F S LA7=$O(^LAHM(62.49,LA76249,150,LA7)) Q:'LA7 D Q:LA7QUIT
105 . . S LA7SEG=$G(^LAHM(62.49,LA76249,150,LA7,0))
106 . . Q:LA7SEG=""
107 . . S LA7QUIT=0
108 . . I $Y>(IOSL-5) D W @IOF Q:LA7QUIT
109 . . . I '$D(ZTQUEUED),"Pp"'[$E(IOST) K DIR S DIR(0)="E" D ^DIR I 'Y S LA7QUIT=1 Q
110 . . Q:IOSL<4
111 . . S LA7FS=$E(LA7SEG,4)
112 . . W !
113 . . F I=1:1:$L(LA7SEG,LA7FS) S Y=$P(LA7SEG,LA7FS,I) W:($L(Y)+$X+1)>IOM ! W ?2,Y,LA7FS
114 I $D(ZTQUEUED) S ZTREQ="@"
115 E D ^%ZISC
116 K LA7,LA76248,LA76249,LA7FS,LA7QUIT,LA7SEG,LA7TM,LA7XTMP
117 K DIR,DIRUT,DTOUT,X,Y
118 Q
Note: See TracBrowser for help on using the repository browser.