LRERT ;DALOI/JDB - STS TEAM UTILITIES ;06/10/09 14:44
;;5.2;LAB SERVICE;**350**;Sep 27, 1994;Build 230
;
Q
;
BLDERTX(LRFILE,LRFIEN,LRDELIM,LRERT,LRTYPE,LRFLAGS) ;
; Constructs a string or array used for the ERT data extract
; FileMan safe
; Called by NOTIFY^LRSCTX1
; Inputs
; LRFILE: File #
; LRFIEN: Entry's IEN
; LRDELIM: Delimiter to use <dflt=|>
; LRERT:<byref> See Outputs
; LRTYPE: Return the string or the array elements
; : 1=String 2=Array <dflt=2>
; : Return data can be big so need to limit in order
; : to watch symbol table use.
; LRFLAGS: Controls behavior of the API
; : S=Populate SCT text with text from Lexicon
; Outputs
; The ERT extract string.
; The ERT array: ERT(1)=id ERT(2)=Entry name, etc..
; ERT extract format (from ^LRSRVR6)
; Station #-File #-IEN|Entry Name|SNOMED I|VUID|SNOMED CT|SNOMED CT TERM|Mapping Exception|Related Specimen|Related Specimen ID|Extract Ver|Term Status|
;
N LRCNT,LRDATA,LRDATA2,LRDSUB,LRI,LRMSG,LRSCT,LRSITE,LRT,LRX,LRY
N DA,DIC,DIE,DIERR,DIR,DR,X,X1,X2,Y
S LRT=$T ;preserve $T
S LRDELIM=$G(LRDELIM),LRTYPE=$G(LRTYPE,2)
S LRFLAGS=$G(LRFLAGS)_" " ;so LRFLAGS'="" for [ operations
I LRDELIM="" S LRDELIM="|"
S LRDSUB=LRDELIM
I LRDELIM="|" S LRDSUB="!" ;used for DELIM $TR
I LRDELIM="^" S LRDSUB="~"
;
; Initialize LRERT array. STS expects all elements to be defined or null
K LRERT
F LRI=1:1:11 S LRERT(LRI)=""
;
S LRX=$$KSP^XUPARAM("INST")
S LRX=$$NS^XUAF4(LRX)
S LRSITE=$P(LRX,"^",2)
S LRX=LRSITE_"-"_LRFILE_"-"_LRFIEN
S LRERT(1)=LRX
D GETS^DIQ(LRFILE,LRFIEN_",","@;.01;2;20;21","EI","LRDATA","LRMSG")
M LRDATA2=LRDATA(LRFILE,LRFIEN_",")
K LRDATA
S LRCNT=1
F LRI=.01,2,0,20 D ; 0=dummy placeholder for unused VUID field
. S LRCNT=LRCNT+1
. I LRI=0 Q
. S LRX=$G(LRDATA2(LRI,"E"))
. I LRI=2,LRX'="" D
. . I LRFILE=62 S LRX="" Q ;fld #2 not used in #62
. . I LRFILE>60.9,LRFILE<61.61 S LRY=((LRFILE*10)#610)+1,LRX=$E("TMEFDPJ",LRY)_"-"_LRX
. I LRX'="" S LRERT(LRCNT)=$TR(LRX,LRDELIM,LRDSUB)
;
; Send SCT term name if code and flag to send
S LRSCT=$G(LRDATA2(20,"E"))
I LRSCT'="",LRFLAGS["S" D
. K LRDATA
. S LRX=$$CODE^LRSCT(LRSCT,"SCT",,"LRDATA")
. Q:LRX<1
. S LRX=$G(LRDATA("F"))
. I LRX="" S LRX=$G(LRDATA("P"))
. I LRX'="" S LRERT(6)=$TR(LRX,LRDELIM,LRDSUB)
;
; If COLLECTION SAMPLE (#62) then send related specimen and specimen id
I LRFILE=62 D
. N LR61
. S LR61=$P($G(^LAB(LRFILE,LRFIEN,0)),"^",2) Q:LR61<1
. S LRERT(8)=$P($G(^LAB(61,LR61,0)),"^")
. S LRERT(9)=LRSITE_"-61-"_LR61
;
S LRERT(10)=$$VER^LRSRVR6
S LRERT(11)=$G(LRDATA2(21,"I"))
;
I LRTYPE=1 D
. S LRI=0
. F S LRI=$O(LRERT(LRI)) Q:LRI<1 S $P(LRERT,LRDELIM,LRI)=LRERT(LRI) K LRERT(LRI)
;
I LRT ;restore $T
Q $S(LRTYPE=1:LRERT,1:"")
;
;
TNUM(FILE,IEN,NOW,EXCTYP) ;
; Construct transaction number
; Inputs
; FILE: File #
; IEN: IEN of entry
; NOW: Date/Time of process <dflt=Now>
; EXCTYP: ERT Exception Type (1=load, 2=ref lab, 3=local edit)
; Returns Transaction number string
N TNUM,X
S FILE=$G(FILE)
S IEN=$G(IEN)
S NOW=$G(NOW)
S EXCTYP=$G(EXCTYP)
I NOW="" S NOW=$$NOW^XLFDT()
I EXCTYP'>0 Q ""
S X=$$KSP^XUPARAM("INST")
S X=$$NS^XUAF4(X)
S X=$P(X,"^",2)
; transaction #: Site-Exc Type-NOW-File#:IEN
S TNUM=X_"-"_EXCTYP_"-"_NOW_"-"_FILE_":"_IEN ;transaction #
S TNUM=$$UP^XLFSTR(TNUM)
Q TNUM
;
;
LOGIT(TEXT,IN,TMPNM) ;
; FileMan safe
; Adds data to the ^XTMP gobal.
; Inputs
; TEXT:<byref> Save symtbl space (dont manipulate)
; IN: <byref>
; IN("TNUM") - Transaction Number <req>
; IN("TDT") - Transaction date/time <opt>
; IN("FILE") targ file <req>
; IN("FIEN") ;targ file IEN <req>
; IN("SCT") ;SCT code <opt>
; IN("R6247") ;#62.49 IEN <opt>
; IN("STSEXC") ;STS exception type <req>
; IN("HDIERR") ;STS error flag <opt> 0 or 1
; IN("PREV","SCT")
; IN("PREV","TEXT")
; TMPNM:<opt> XTMP subscript <dflt=LRSCTX-STS>
; Outputs
; Record # or "0^err #^err msg"
N FILE,FIEN,LRLCK,REC,TEXT2,SCTCHNG,STR,STSEXC,TDT,TNUM,X
;
S TMPNM=$G(TMPNM)
I TMPNM="" S TMPNM="LRSCTX-STS"
;
; Update ^XTMP
S ^XTMP(TMPNM,0)=$$FMADD^XLFDT(DT,365)_U_$$NOW^XLFDT()_U_"STS Term/SCT Alerts"
S STR=$$TRIM^XLFSTR(TEXT)
S LRLCK=$NA(^XTMP(TMPNM))
S X=$$GETLOCK^LRUTIL(LRLCK,60)
I 'X Q "0^1^Failed to acquire lock."
S FILE=+$G(IN("FILE")),FIEN=+$G(IN("FIEN")),TNUM=$G(IN("TNUM"))
S TDT=$G(IN("TDT"))
I TDT="" S TDT=$$NOW^XLFDT()
S STSEXC=$G(IN("STSEXC"))
S:STSEXC="" STSEXC=0
I TNUM="" S TNUM=$$TNUM(FILE,FIEN,TDT,STSEXC) S LRERT("TNUM")=TNUM
;
S REC=+$O(^XTMP(TMPNM,"A"),-1)+1
S ^XTMP(TMPNM,REC,0)=$E(STR,1,200)
S ^XTMP(TMPNM,REC,1)=$E(STR,201,$L(STR))
S $P(^XTMP(TMPNM,REC,2),U,1)=TNUM ;transaction #
S $P(^XTMP(TMPNM,REC,2),U,2)=TDT ;transaction date/time
S $P(^XTMP(TMPNM,REC,2),U,3)=FILE ;targ file
S $P(^XTMP(TMPNM,REC,2),U,4)=FIEN ;targ file IEN
S $P(^XTMP(TMPNM,REC,2),U,5)=$G(IN("SCT")) ;SCT code
S $P(^XTMP(TMPNM,REC,2),U,6)=$G(IN("R6247")) ;#62.49 IEN
S $P(^XTMP(TMPNM,REC,2),U,7)=DUZ
S $P(^XTMP(TMPNM,REC,2),U,8)=STSEXC ;STS exception type
S X=""
I $G(IN("HDIERR"))'="" S X=IN("HDIERR")
I X="" I $D(IN("HDIERR")) S X=$S($D(IN("HDIERR")):1,1:0)
S $P(^XTMP(TMPNM,REC,2),U,9)=X ;STS error
S ^XTMP(TMPNM,REC,10)=$G(IN("PREV","SCT")) ;previous SCT code
S ^XTMP(TMPNM,REC,20)=$E($G(IN("PREV","TEXT")),1,200)
S ^XTMP(TMPNM,REC,21)=$E($G(IN("PREV","TEXT")),201,400)
S ^XTMP(TMPNM,REC,22)="" ;previous SCT FSN text
S ^XTMP(TMPNM,REC,23)="" ;SCT FSN text overflow
S ^XTMP(TMPNM,"B",$$UP^XLFSTR($E(STR,1,200)),REC)=""
S ^XTMP(TMPNM,"C",TNUM,REC)=""
S ^XTMP(TMPNM,"D",TDT,REC)=""
S ^XTMP(TMPNM,"E",+FILE,+FIEN,REC)=""
S ^XTMP(TMPNM,"F",STSEXC,REC)="" ;exception type xref
L -@LRLCK
Q REC
;
;
OK2LOG(TEXT,IN,TMPNM) ;
; FileMan safe
; Checks if this change needs to be logged.
; Inputs
; TEXT:<byref> Not manipulated (minimize symtbl use)
; IN:<byref>
; IN("FILE") <req>
; IN("SCT") <opt>
; IN("PREV","SCT") <opt>
; Outputs
; 1=OK to log or 0 with error code^error msg
; If "0^2^SCT changed" then this should still generate an alert
N X,I,STOP,STR,REC,TEXT2,STATUS,FILE
S TMPNM=$G(TMPNM)
I TMPNM="" S TMPNM="LRSCTX-STS"
S TEXT=$G(TEXT),FILE=$G(IN("FILE")),STATUS=1
S TEXT2=$$TRIM^XLFSTR(TEXT),TEXT2=$$UP^XLFSTR(TEXT2)
S STR=$E(TEXT2,1,200) ;some terms can be long and wont fit in a node
; check if this term has been sent already.
S I=0,STOP=0
F S I=$O(^XTMP(TMPNM,"B",STR,I)) Q:'I D Q:STOP
. I STR_$$UP^XLFSTR($G(^XTMP(TMPNM,I,1)))'=TEXT2 Q
. S DATA=$G(^XTMP(TMPNM,I,2))
. I $P(DATA,U,3)'=FILE Q
. S STOP=1
;
I STOP S STATUS="0^1^Alert already sent."
; did SCT change?
I STOP,$G(IN("PREV","SCT"))'=$G(IN("SCT")) S STATUS="0^2^SCT changed.",STOP=0
Q STATUS
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRERT 7064 printed Dec 13, 2024@02:14:39 Page 2
LRERT ;DALOI/JDB - STS TEAM UTILITIES ;06/10/09 14:44
+1 ;;5.2;LAB SERVICE;**350**;Sep 27, 1994;Build 230
+2 ;
+3 QUIT
+4 ;
BLDERTX(LRFILE,LRFIEN,LRDELIM,LRERT,LRTYPE,LRFLAGS) ;
+1 ; Constructs a string or array used for the ERT data extract
+2 ; FileMan safe
+3 ; Called by NOTIFY^LRSCTX1
+4 ; Inputs
+5 ; LRFILE: File #
+6 ; LRFIEN: Entry's IEN
+7 ; LRDELIM: Delimiter to use <dflt=|>
+8 ; LRERT:<byref> See Outputs
+9 ; LRTYPE: Return the string or the array elements
+10 ; : 1=String 2=Array <dflt=2>
+11 ; : Return data can be big so need to limit in order
+12 ; : to watch symbol table use.
+13 ; LRFLAGS: Controls behavior of the API
+14 ; : S=Populate SCT text with text from Lexicon
+15 ; Outputs
+16 ; The ERT extract string.
+17 ; The ERT array: ERT(1)=id ERT(2)=Entry name, etc..
+18 ; ERT extract format (from ^LRSRVR6)
+19 ; Station #-File #-IEN|Entry Name|SNOMED I|VUID|SNOMED CT|SNOMED CT TERM|Mapping Exception|Related Specimen|Related Specimen ID|Extract Ver|Term Status|
+20 ;
+21 NEW LRCNT,LRDATA,LRDATA2,LRDSUB,LRI,LRMSG,LRSCT,LRSITE,LRT,LRX,LRY
+22 NEW DA,DIC,DIE,DIERR,DIR,DR,X,X1,X2,Y
+23 ;preserve $T
SET LRT=$TEST
+24 SET LRDELIM=$GET(LRDELIM)
SET LRTYPE=$GET(LRTYPE,2)
+25 ;so LRFLAGS'="" for [ operations
SET LRFLAGS=$GET(LRFLAGS)_" "
+26 IF LRDELIM=""
SET LRDELIM="|"
+27 SET LRDSUB=LRDELIM
+28 ;used for DELIM $TR
IF LRDELIM="|"
SET LRDSUB="!"
+29 IF LRDELIM="^"
SET LRDSUB="~"
+30 ;
+31 ; Initialize LRERT array. STS expects all elements to be defined or null
+32 KILL LRERT
+33 FOR LRI=1:1:11
SET LRERT(LRI)=""
+34 ;
+35 SET LRX=$$KSP^XUPARAM("INST")
+36 SET LRX=$$NS^XUAF4(LRX)
+37 SET LRSITE=$PIECE(LRX,"^",2)
+38 SET LRX=LRSITE_"-"_LRFILE_"-"_LRFIEN
+39 SET LRERT(1)=LRX
+40 DO GETS^DIQ(LRFILE,LRFIEN_",","@;.01;2;20;21","EI","LRDATA","LRMSG")
+41 MERGE LRDATA2=LRDATA(LRFILE,LRFIEN_",")
+42 KILL LRDATA
+43 SET LRCNT=1
+44 ; 0=dummy placeholder for unused VUID field
FOR LRI=.01,2,0,20
Begin DoDot:1
+45 SET LRCNT=LRCNT+1
+46 IF LRI=0
QUIT
+47 SET LRX=$GET(LRDATA2(LRI,"E"))
+48 IF LRI=2
IF LRX'=""
Begin DoDot:2
+49 ;fld #2 not used in #62
IF LRFILE=62
SET LRX=""
QUIT
+50 IF LRFILE>60.9
IF LRFILE<61.61
SET LRY=((LRFILE*10)#610)+1
SET LRX=$EXTRACT("TMEFDPJ",LRY)_"-"_LRX
End DoDot:2
+51 IF LRX'=""
SET LRERT(LRCNT)=$TRANSLATE(LRX,LRDELIM,LRDSUB)
End DoDot:1
+52 ;
+53 ; Send SCT term name if code and flag to send
+54 SET LRSCT=$GET(LRDATA2(20,"E"))
+55 IF LRSCT'=""
IF LRFLAGS["S"
Begin DoDot:1
+56 KILL LRDATA
+57 SET LRX=$$CODE^LRSCT(LRSCT,"SCT",,"LRDATA")
+58 if LRX<1
QUIT
+59 SET LRX=$GET(LRDATA("F"))
+60 IF LRX=""
SET LRX=$GET(LRDATA("P"))
+61 IF LRX'=""
SET LRERT(6)=$TRANSLATE(LRX,LRDELIM,LRDSUB)
End DoDot:1
+62 ;
+63 ; If COLLECTION SAMPLE (#62) then send related specimen and specimen id
+64 IF LRFILE=62
Begin DoDot:1
+65 NEW LR61
+66 SET LR61=$PIECE($GET(^LAB(LRFILE,LRFIEN,0)),"^",2)
if LR61<1
QUIT
+67 SET LRERT(8)=$PIECE($GET(^LAB(61,LR61,0)),"^")
+68 SET LRERT(9)=LRSITE_"-61-"_LR61
End DoDot:1
+69 ;
+70 SET LRERT(10)=$$VER^LRSRVR6
+71 SET LRERT(11)=$GET(LRDATA2(21,"I"))
+72 ;
+73 IF LRTYPE=1
Begin DoDot:1
+74 SET LRI=0
+75 FOR
SET LRI=$ORDER(LRERT(LRI))
if LRI<1
QUIT
SET $PIECE(LRERT,LRDELIM,LRI)=LRERT(LRI)
KILL LRERT(LRI)
End DoDot:1
+76 ;
+77 ;restore $T
IF LRT
+78 QUIT $SELECT(LRTYPE=1:LRERT,1:"")
+79 ;
+80 ;
TNUM(FILE,IEN,NOW,EXCTYP) ;
+1 ; Construct transaction number
+2 ; Inputs
+3 ; FILE: File #
+4 ; IEN: IEN of entry
+5 ; NOW: Date/Time of process <dflt=Now>
+6 ; EXCTYP: ERT Exception Type (1=load, 2=ref lab, 3=local edit)
+7 ; Returns Transaction number string
+8 NEW TNUM,X
+9 SET FILE=$GET(FILE)
+10 SET IEN=$GET(IEN)
+11 SET NOW=$GET(NOW)
+12 SET EXCTYP=$GET(EXCTYP)
+13 IF NOW=""
SET NOW=$$NOW^XLFDT()
+14 IF EXCTYP'>0
QUIT ""
+15 SET X=$$KSP^XUPARAM("INST")
+16 SET X=$$NS^XUAF4(X)
+17 SET X=$PIECE(X,"^",2)
+18 ; transaction #: Site-Exc Type-NOW-File#:IEN
+19 ;transaction #
SET TNUM=X_"-"_EXCTYP_"-"_NOW_"-"_FILE_":"_IEN
+20 SET TNUM=$$UP^XLFSTR(TNUM)
+21 QUIT TNUM
+22 ;
+23 ;
LOGIT(TEXT,IN,TMPNM) ;
+1 ; FileMan safe
+2 ; Adds data to the ^XTMP gobal.
+3 ; Inputs
+4 ; TEXT:<byref> Save symtbl space (dont manipulate)
+5 ; IN: <byref>
+6 ; IN("TNUM") - Transaction Number <req>
+7 ; IN("TDT") - Transaction date/time <opt>
+8 ; IN("FILE") targ file <req>
+9 ; IN("FIEN") ;targ file IEN <req>
+10 ; IN("SCT") ;SCT code <opt>
+11 ; IN("R6247") ;#62.49 IEN <opt>
+12 ; IN("STSEXC") ;STS exception type <req>
+13 ; IN("HDIERR") ;STS error flag <opt> 0 or 1
+14 ; IN("PREV","SCT")
+15 ; IN("PREV","TEXT")
+16 ; TMPNM:<opt> XTMP subscript <dflt=LRSCTX-STS>
+17 ; Outputs
+18 ; Record # or "0^err #^err msg"
+19 NEW FILE,FIEN,LRLCK,REC,TEXT2,SCTCHNG,STR,STSEXC,TDT,TNUM,X
+20 ;
+21 SET TMPNM=$GET(TMPNM)
+22 IF TMPNM=""
SET TMPNM="LRSCTX-STS"
+23 ;
+24 ; Update ^XTMP
+25 SET ^XTMP(TMPNM,0)=$$FMADD^XLFDT(DT,365)_U_$$NOW^XLFDT()_U_"STS Term/SCT Alerts"
+26 SET STR=$$TRIM^XLFSTR(TEXT)
+27 SET LRLCK=$NAME(^XTMP(TMPNM))
+28 SET X=$$GETLOCK^LRUTIL(LRLCK,60)
+29 IF 'X
QUIT "0^1^Failed to acquire lock."
+30 SET FILE=+$GET(IN("FILE"))
SET FIEN=+$GET(IN("FIEN"))
SET TNUM=$GET(IN("TNUM"))
+31 SET TDT=$GET(IN("TDT"))
+32 IF TDT=""
SET TDT=$$NOW^XLFDT()
+33 SET STSEXC=$GET(IN("STSEXC"))
+34 if STSEXC=""
SET STSEXC=0
+35 IF TNUM=""
SET TNUM=$$TNUM(FILE,FIEN,TDT,STSEXC)
SET LRERT("TNUM")=TNUM
+36 ;
+37 SET REC=+$ORDER(^XTMP(TMPNM,"A"),-1)+1
+38 SET ^XTMP(TMPNM,REC,0)=$EXTRACT(STR,1,200)
+39 SET ^XTMP(TMPNM,REC,1)=$EXTRACT(STR,201,$LENGTH(STR))
+40 ;transaction #
SET $PIECE(^XTMP(TMPNM,REC,2),U,1)=TNUM
+41 ;transaction date/time
SET $PIECE(^XTMP(TMPNM,REC,2),U,2)=TDT
+42 ;targ file
SET $PIECE(^XTMP(TMPNM,REC,2),U,3)=FILE
+43 ;targ file IEN
SET $PIECE(^XTMP(TMPNM,REC,2),U,4)=FIEN
+44 ;SCT code
SET $PIECE(^XTMP(TMPNM,REC,2),U,5)=$GET(IN("SCT"))
+45 ;#62.49 IEN
SET $PIECE(^XTMP(TMPNM,REC,2),U,6)=$GET(IN("R6247"))
+46 SET $PIECE(^XTMP(TMPNM,REC,2),U,7)=DUZ
+47 ;STS exception type
SET $PIECE(^XTMP(TMPNM,REC,2),U,8)=STSEXC
+48 SET X=""
+49 IF $GET(IN("HDIERR"))'=""
SET X=IN("HDIERR")
+50 IF X=""
IF $DATA(IN("HDIERR"))
SET X=$SELECT($DATA(IN("HDIERR")):1,1:0)
+51 ;STS error
SET $PIECE(^XTMP(TMPNM,REC,2),U,9)=X
+52 ;previous SCT code
SET ^XTMP(TMPNM,REC,10)=$GET(IN("PREV","SCT"))
+53 SET ^XTMP(TMPNM,REC,20)=$EXTRACT($GET(IN("PREV","TEXT")),1,200)
+54 SET ^XTMP(TMPNM,REC,21)=$EXTRACT($GET(IN("PREV","TEXT")),201,400)
+55 ;previous SCT FSN text
SET ^XTMP(TMPNM,REC,22)=""
+56 ;SCT FSN text overflow
SET ^XTMP(TMPNM,REC,23)=""
+57 SET ^XTMP(TMPNM,"B",$$UP^XLFSTR($EXTRACT(STR,1,200)),REC)=""
+58 SET ^XTMP(TMPNM,"C",TNUM,REC)=""
+59 SET ^XTMP(TMPNM,"D",TDT,REC)=""
+60 SET ^XTMP(TMPNM,"E",+FILE,+FIEN,REC)=""
+61 ;exception type xref
SET ^XTMP(TMPNM,"F",STSEXC,REC)=""
+62 LOCK -@LRLCK
+63 QUIT REC
+64 ;
+65 ;
OK2LOG(TEXT,IN,TMPNM) ;
+1 ; FileMan safe
+2 ; Checks if this change needs to be logged.
+3 ; Inputs
+4 ; TEXT:<byref> Not manipulated (minimize symtbl use)
+5 ; IN:<byref>
+6 ; IN("FILE") <req>
+7 ; IN("SCT") <opt>
+8 ; IN("PREV","SCT") <opt>
+9 ; Outputs
+10 ; 1=OK to log or 0 with error code^error msg
+11 ; If "0^2^SCT changed" then this should still generate an alert
+12 NEW X,I,STOP,STR,REC,TEXT2,STATUS,FILE
+13 SET TMPNM=$GET(TMPNM)
+14 IF TMPNM=""
SET TMPNM="LRSCTX-STS"
+15 SET TEXT=$GET(TEXT)
SET FILE=$GET(IN("FILE"))
SET STATUS=1
+16 SET TEXT2=$$TRIM^XLFSTR(TEXT)
SET TEXT2=$$UP^XLFSTR(TEXT2)
+17 ;some terms can be long and wont fit in a node
SET STR=$EXTRACT(TEXT2,1,200)
+18 ; check if this term has been sent already.
+19 SET I=0
SET STOP=0
+20 FOR
SET I=$ORDER(^XTMP(TMPNM,"B",STR,I))
if 'I
QUIT
Begin DoDot:1
+21 IF STR_$$UP^XLFSTR($GET(^XTMP(TMPNM,I,1)))'=TEXT2
QUIT
+22 SET DATA=$GET(^XTMP(TMPNM,I,2))
+23 IF $PIECE(DATA,U,3)'=FILE
QUIT
+24 SET STOP=1
End DoDot:1
if STOP
QUIT
+25 ;
+26 IF STOP
SET STATUS="0^1^Alert already sent."
+27 ; did SCT change?
+28 IF STOP
IF $GET(IN("PREV","SCT"))'=$GET(IN("SCT"))
SET STATUS="0^2^SCT changed."
SET STOP=0
+29 QUIT STATUS