BLRUTIL7 ;IHS/MSC/MKK - MISC IHS LAB UTILITIES (Cont) ; 13-Oct-2017 14:04 ; MKK
;;5.2;IHS LABORATORY;**1035,1041**;NOV 01, 1997;Build 23
;
EEP ; Ersatz EP
D EEP^BLRGMENU
Q
;
OVERFLOW(TEST) ; EP - Send ALERT and E-MAIL to LMI Mail Group due to Max # BLR Errors in Error Trap
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,TEST,U,XPARSYS,XQXFLG)
S MESSAGE="RPMS Lab to PCC Linker **HALTED**"
S FROMWHOM="Lab to PCC Linker"
S TAB=$J("",2),LINE=0
;
D AROUNDIT(.MSGARRAY,.LINE,"RPMS LAB TO PCC LINKER HALTED",55)
;
D ADDLINE(.MSGARRAY,.LINE)
D ADDLINE(.MSGARRAY,.LINE,TAB_"The RPMS Lab to PCC Linker has been *HALTED* by too")
D ADDLINE(.MSGARRAY,.LINE,TAB_"many BLR errors in the Error Trap.")
D ADDLINE(.MSGARRAY,.LINE)
D ADDLINE(.MSGARRAY,.LINE,TAB_"No Lab Data will be sent to PCC until this has been")
D ADDLINE(.MSGARRAY,.LINE,TAB_"resolved.")
;
; If TEST, then just display information to the screen and Quit.
I +$G(TEST) D ^XBCLS W "SUBJECT:",MESSAGE,!,"FROMWHOM:",FROMWHOM,! D EN^DDIOL(.MSGARRAY) W !! Q
;
; Send ALERT and MailMan Message to LMI Mail Group.
D MAILALMI^BLRUTIL3(MESSAGE,.MSGARRAY,FROMWHOM,1)
Q
;
AROUNDIT(MSGARRAY,LINE,STR,MAX) ; EP - Create a "Box" Message in an Array
NEW AROUND,GAPSTARS,J,MAXIT,ROWSTARS
S MAXIT="@"
F J=1:1:$L(STR) S MAXIT=MAXIT_$E(STR,J,J)_"@"
S AROUND=$TR($J("",8+$L(MAXIT))," ","@")
S MAXIT="@@!!"_$TR(MAXIT," ","@")_"!!@@"
I $L(MAXIT)'<(MAX-4) D
. S AROUND=$TR($J("",10+$L(STR))," ","@")
. S MAXIT="@@!!@"_$TR(STR," ","@")_"@!!@@"
;
S MAX=$G(MAX,IOM)
S ROWSTARS=$TR($J("",MAX)," ","*")
S GAPSTARS=$TR($$CJ^XLFSTR(AROUND,MAX)," @","* ")
D ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
D ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
D ADDLINE(.MSGARRAY,.LINE,GAPSTARS)
D ADDLINE(.MSGARRAY,.LINE,$TR($$CJ^XLFSTR(MAXIT,MAX)," @","* "))
D ADDLINE(.MSGARRAY,.LINE,GAPSTARS)
D ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
D ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
Q
;
ADDLINE(MSGARRAY,LINE,STR) ; EP - Add a String to a line in an ARRAY
S STR=$G(STR,$J("",5))
S LINE=1+$G(LINE),MSGARRAY(LINE)=STR
Q
;
LONGALRT(ALRTSUBJ,NOUSER,ALERTMSG,SPECIFIC) ; EP - Alert that includes full message
NEW (ALERTMSG,ALRTSUBJ,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,NOUSER,SPECIFIC,U,XPARSYS,XQXFLG)
;
S XQAID="BLR"
S XQAMSG=ALRTSUBJ
M XQATEXT=ALERTMSG
;
; If the SPECIFIC variable is set, send alert to ONLY that one user
S XQA($G(SPECIFIC,"G.LMI"))=""
;
; If User not part of LMI Mail Group, send them alert also, but
; If-And-Only-If the NOUSER variable is null.
S:$G(NOUSER)=""&($$NINLMI^BLRUTIL3(DUZ)) XQA(DUZ)=""
;
S X=$$SETUP1^XQALERT
K XQA,XQAMSG
Q:X
;
NEW SUBSCRPT
S SUBSCRPT="BLRLINKU Alert^"_+$H_"^"_$J
S ^XTMP(SUBSCRPT,0)=$$FMADD^XLFDT($$DT^XLFDT,90)_"^"_$$DT^XLFDT_"^"_"Lab Package Alert."
S ^XTMP(SUBSCRPT,1)="Alert was not sent."
S ^XTMP(SUBSCRPT,2)=" Message that should have been sent follows:"
S ^XTMP(SUBSCRPT,3)=" SUBJ:"_ALRTSUBJ
I $L(ALERTMSG(1))<1 S ^XTMP(SUBSCRPT,4)=" MESSAGE:"_ALERTMSG,LINE=5
I $L($G(ALERTMSG(1))) D
. S ^XTMP(SUBSCRPT,4)=" MESSAGE:"_ALERTMSG(1)
. S ARRAYLNE=1,LINE=4
. F S ARRAYLNE=$O(ALERTMSG(ARRAYLNE)) Q:ARRAYLNE<1 D
.. S ^XTMP(SUBSCRPT,ARRAYLNE)=" "_ALERTMSG(ARRAYLNE)
.. S LINE=LINE+1
;
S ^XTMP(SUBSCRPT,LINE)=" ALERT Error Message Follows:"
S LINE=LINE+1
S ^XTMP(SUBSCRPT,LINE)=" "_XQALERR
Q
;
;
OERRSTSC(ODT,SN) ; EP - Change OERR Status from PENDING to DISCOUNTINUED - ALL tests on the Order
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,ODT,SN,U,XPARSYS,XQXFLG)
S CONTROL="OC"
D NEW^LR7OB1(ODT,SN,CONTROL,,,1)
Q
;
;
OERRSTSO(LRODT,LRSN,LROT) ; EP - Change OERR Status from PENDING to DISCOUNTINUED - Specific Test
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LROT,LRSN,U,XPARSYS,XQXFLG)
S LROTIEN=LROT_","_LRSN_","_LRODT
S ORIFN=$$GET1^DIQ(69.03,LROTIEN,6)
Q:$L(ORIFN)<1
;
S F60IEN=$$GET1^DIQ(69.03,.01,LROTIEN,"I")
Q:$L(F60IEN)<1
;
S II(F60IEN)="",LRSTATUS=1
S CONTROL="OC"
D NEW^LR7OB1(LRODT,LRSN,CONTROL,,.II,LRSTATUS)
Q
;
FORCEIT(LABEL,ARRY1,ARRY2,ARRY3) ; EP - Force the Audting of Varibles, even if TAKE SNAPSHOTS is set to OFF
; Code cloned from ENTRYAUD^BLRUTIL
;
; D DISABLE^%NOJRN ; Disable Journaling of ^BLRENTRY global
D:$G(^%ZOSF("OS"))["OpenM" DISABLE^%NOJRN ; Disable Journaling of ^BLRENTRY global - IHS/MSC/MKK - LR*5.2*1041 - Cache/Ensemble only
;
N ORIGX,ORIGY,%ORIG ; Want to see what %, X & Y variables are
M ORIGX=X,ORIGY=Y
M:$D(%) %ORIG=%
NEW %
M:$D(%ORIG) %=%ORIG
;
N X,Y,NOW,ENTRYNUM,STARTTIM,NOWTIM
S NOW=$$NOW^XLFDT
S ENTRYNUM=$G(^BLRENTRY)+1
S NOWTIM=$P($H,",",2)
S $P(^BLRENTRY,U)=ENTRYNUM
S ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL)=""
;
; D CAPVARS^BLRUTIL("BLRVARS","^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL)")
;
; I $L($G(ARRY1)) D ; Have an array that needs to be monitored; Merge it
; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY1)=@ARRY1
;
; I $L($G(ARRY2)) D ; Have another array that needs to be monitored; Merge it
; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY2)=@ARRY2
;
; I $L($G(ARRY3)) D ; Have another array that needs to be monitored; Merge it
; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY3)=@ARRY3
;
; M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"DUZ")=DUZ ; Always merge in the DUZ array
; I $D(ORIGX)>1 M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"ORIGX")=ORIGX
; I $D(ORIGY)>1 M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"ORIGY")=ORIGY
;
; ----- BEGIN IHS/MSC/MKK - LR*5.2*1041 - Use Kernel Call. It handles ALL arrays automatically.
S X="^BLRENTRY("_DUZ_","_NOW_","_ENTRYNUM_","_$C(34)_LABEL_$C(34)_","
D DOLRO^%ZOSV
; ----- END IHS/MSC/MKK - LR*5.2*1041 - Use Kernel Call
;
D GETSTACK^BLRUTIL6 ; Merge in the $STACK
;
; D ENABLE^%NOJRN ; Enable Journaling again
D:$G(^%ZOSF("OS"))["OpenM" ENABLE^%NOJRN ; Enable Journaling again - IHS/MSC/MKK - LR*5.2*1041 - Cache/Ensemble only
Q
;
;
REFLABT ; EP - REFerence LAB Tests
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
;
D SETBLRVS("REFLABT")
;
S HEADER(1)="Reference Lab Tests"
S HEADER(2)=$$GET1^DIQ(9009026,+$G(^BLRSITE(DUZ(2),"RL")),.01)
;
D HEADERDT^BLRGMENU
D HEADONE^BLRGMENU(.HDRONE)
;
S HEADER(3)=" "
F J=5,27,49 S $E(HEADER(4),J)="PrntName",$E(HEADER(4),J+10)="F60 IEN"
;
S MAXLINES=IOSL-4,LINES=MAXLINES+10
S (CNT,F60CNT,PG)=0
S QFLG="NO"
;
S F60IEN=.9999999
F S F60IEN=$O(^LAB(60,F60IEN)) Q:F60IEN<1!(QFLG="Q") D
. S F60CNT=F60CNT+1
. Q:$$REFLAB^BLRUTIL6(DUZ(2),F60IEN)<1
. ;
. I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE) Q:QFLG="Q" W ?4
. ;
. S CNT=CNT+1
. W $$LJ^XLFSTR($$LJ^XLFSTR($$GET1^DIQ(60,F60IEN,51),9)_"["_F60IEN_"]",22)
. I $X>55 W !,?4 S LINES=LINES+1
;
I CNT<1 D HEADERDT^BLRGMENU
;
W !!,?4,F60CNT," Tests analyzed."
W !!,?9,$S(CNT<1:"No",1:CNT)," Reference Lab Test",$$PLURAL(CNT),"."
D PRESSKEY^BLRGMENU(4)
Q
;
;
; ============================= UTILITIES =============================
;
BADSTUFF(MSG,TAB) ; EP - Simple Message that "ends" with "Routine Ends" string.
S:+$G(TAB)<1 TAB=4
W !!,?TAB,$$TRIM^XLFSTR(MSG,"LR"," ")," Routine Ends."
D PRESSKEY^BLRGMENU(TAB+5)
Q
;
BADSTUFQ(MSG,TAB) ; EP - Simple Message. Calls BADSTUFF. Quits with "Q"
D BADSTUFF(MSG,$G(TAB))
Q "Q"
;
BADSTUFN(MSG,TAB) ; EP - Simple Message. Calls BADSTUFF. Quits with Null string
D BADSTUFF(MSG,$G(TAB))
Q ""
;
BADSTUF2(MSG,TAB) ; EP - Simple Message. Displays MSG string only.
S TAB=$S($L($G(TAB)):TAB,1:4)
W !!,?TAB,$$TRIM^XLFSTR(MSG,"LR"," ")
D PRESSKEY^BLRGMENU(TAB+5)
Q
;
BADSTF2N(MSG,TAB) ; EP - Simple Message. Calls BADSTUF2. Quits with Null string
D BADSTUF2(MSG,$G(TAB))
Q ""
;
BADSTF2Q(MSG,TAB) ; EP - Simple Message. Calls BADSTUF2. Quits with "Q"
D BADSTUF2(MSG,$G(TAB))
Q "Q"
;
PROMPTO(MSG,TAB) ; EP - prompt only.
S TAB=$S($L($G(TAB)):TAB,1:4)
W !!,?TAB,MSG
D PRESSKEY^BLRGMENU(TAB+5)
Q
;
PROMPTON(MSG,TAB) ; EP - Calls PROMPTO. Quits with null
D PROMPTO(MSG,$G(TAB))
Q ""
;
PROMPTOQ(MSG,TAB) ; EP - Calls PROMPTO. Quits with "Q"
D PROMPTO(MSG,$G(TAB))
Q "Q"
;
SHOUTMSG(STR,RM) ; EP - Return a string like >>>> STR <<<<
; RM = Right Margin (how long the string will be)
NEW HALFLEN,J,STRLEN,TMPSTR
;
S RM=$G(RM,IOM)
;
S HALFLEN=(RM\2)-(($L(STR)+2)\2)
S TMPSTR=$TR($J("",HALFLEN)," ",">")
S TMPSTR=TMPSTR_" "_STR_" "
S STRLEN=$L(TMPSTR)
F J=STRLEN:1:(RM-1) S TMPSTR=TMPSTR_"<"
Q TMPSTR
;
PURGALRT ; EP - Purge ALL Alerts for user
D RECIPURG^XQALBUTL(DUZ)
W !!,?14,"Alerts Purged for DUZ:",DUZ
D PRESSKEY^BLRGMENU(9)
Q
;
GETUCIS(ARRAY) ; EP - Create an Array of UCIs
Q:$G(^%ZOSF("OS"))'["OpenM" 0 ; MSC/MKK - LR*5.2*1041 - Only for Cache systems.
;
NEW obj,X
NEW CNT,UCI,MSG,MSGLINE
;
S CNT=0
SET obj=##class(%ResultSet).%New("%SYS.Namespace:List")
D obj.Execute()
S X=$G(obj.Data,"none")
SET X=1
F Q:X="" D
. D obj.Next()
. S X=$G(obj.Data("Nsp"))
. Q:X=""
. ;
. S UCI=X
. ;
. Q:'$$CHEKIT(X)
. ;
. S ARRAY(UCI)=""
. S CNT=CNT+1
;
I CNT<1 D
. W !,?4,"No UCIs could be determined on this system.",!
. D PRESSKEY^BLRGMENU(4)
;
D:$D(MSG) SENDMAIL^BLRUTIL3("UCI Error",.MSG,"BZHHUTLU")
;
Q CNT
;
CHEKIT(UCI) ; EP - Checking to make sure UCI doesn't throw an error
NEW ERRMSG,errobj,NOW,X
;
TRY {
S X=$O(^[UCI]XPD(9.7,"B","LR*5.2*1099"),-1)
} CATCH errobj {
S ERRMSG=errobj.Name
}
;
Q:$D(ERRMSG)<1 1
;
I $D(MSG) S MSGLINE=$O(MSG("A"),-1)
E D
. S MSG(1)="Error Occurred during UCI processing"
. S MSG(2)=" "
. S MSGLINE=2
;
S MSGLINE=MSGLINE+1
S $E(MSG(MSGLINE),5)="UCI:"_UCI_" Error:"_ERRMSG
;
Q 0
;
URGCHK(ORDERNUM) ; EP - Check the Urgency of an Order and, if STAT, send ALERT to LMI Mail Group
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,ORDERNUM,U,XPARSYS,XQXFLG)
;
S (LRODT,URGENCY)=0
F S LRODT=$O(^LRO(69,"C",ORDERNUM,LRODT)) Q:LRODT<1!(URGENCY) D
. S LRSP=0
. F S LRSP=$O(^LRO(69,"C",ORDERNUM,LRODT,LRSP)) Q:LRSP<1!(URGENCY) D
.. I $$GET1^DIQ(69.03,LRSP_","_LRODT,1)["STAT" S URGENCY=URGENCY+1
;
D:URGENCY SNDALERT^BLRUTIL3("Order # "_ORDERNUM_" is a STAT Order.",1)
Q
;
;
STATORDA(LRODT,LRSP,STATUS) ; EP - If STAT Order from EHR, send ALERT to LMI Mail Group
NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LRSP,STATUS,U,XPARSYS,XQXFLG)
;
S STATIEN=$$FIND1^DIC(62.05,,,"STAT") ; Get the IEN of the STAT urgency
Q:STATIEN<1 ; If no STAT urgency, skip
;
Q:STATUS'=STATIEN ; If STATUS not STAT, skip
;
; Status is STAT, so send alert
;
S ORDERNUM=$$GET1^DIQ(69.01,LRSP_","_LRODT,9.5)
Q:ORDERNUM<1 ; If no Order Number, skip
;
D SNDALERT^BLRUTIL3("Order # "_ORDERNUM_" is a STAT Order.",1)
Q
;
MAKESTR(ARRAY) ; EP - Pass in Word Processing Array and return String
NEW (ARRAY,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
;
S STRING="",LINE=0
F S LINE=$O(ARRAY(LINE)) Q:LINE<1 S STRING=STRING_($$TRIM^XLFSTR(ARRAY(LINE),"R"," "))_" "
Q $$TRIM^XLFSTR(STRING,"LR"," ")
;
NOSNAPS ; EP - Make certain TAKE SNAPSHOTS field in BLR MASTER CONTROL file is OFF. This should be queued.
NEW CNT,DESC,FDA,IEN,STR
;
S:$D(ZTQUEUED) ZTREQ="@"
;
S (CNT,IEN)=0
F S IEN=$O(^BLRSITE(IEN)) Q:IEN<1 D
. Q:+$$GET1^DIQ(9009029,IEN,"TAKE SNAPSHOTS","I")<1
. ;
. S CNT=CNT+1,CNT(IEN)=""
. K FDA
. S FDA(9009029,IEN_",",1)=0
. D FILE^DIE(,"FDA","ERRS")
;
Q:CNT<1 ; If no update, just return
;
S STR(1)="File 9009029 'TAKE SNAPSHOTS' Field Set to OFF for the following:"
S IEN=0
F S IEN=$O(CNT(IEN)) Q:IEN<1 D
. S STR(IEN+2)=$J("",5)_$$GET1^DIQ(9009029,IEN,.01)
;
D SENDMAIL^BLRUTIL3("TAKE SNAPSHOTS OFF",.STR,"BLRUTIL7",1)
Q
;
;
GLODUMP ; EP - "Dump" a global using $Q
NEW FRSTPART,GLOVAR,STR1
;
D ^XBFMK
S DIR(0)="FO",DIR("A")="Global"
D ^DIR
I $L(X)<1!(+$G(DIRUT)) D BADSTUFF("No/Invalid Input.") Q
;
; S GLOBAL=X
S GLOVAR=X ; IHS/MSC/MKK - LR*5.2*1041
I $E(GLOVAR)'=U S GLOVAR=U_GLOVAR
;
S FRSTPART=$P(GLOVAR,")")
S STR1=$Q(@GLOVAR@(""))
I STR1="" D BADSTUFF("No data found for "_GLOVAR_".") Q
;
W !!,STR1,"=" D LINEWRAP^BLRGMENU($X,@STR1,(IOM-$X)) W !
F S STR1=$Q(@STR1) Q:STR1=""!(STR1'[FRSTPART) W ?4,STR1,"=" D LINEWRAP^BLRGMENU($X,@STR1,(IOM-$X)) W !
D PRESSKEY^BLRGMENU(9)
Q
;
SETBLRVS(TWO) ; EP - Set BLRVERN variable(s)
S BLRVERN=$P($P($T(+1),";")," ")
S:$L($G(TWO)) BLRVERN2=TWO
Q
;
PLURAL(CNT) ; EP - Return "" if CNT=1, else return "s".
; Q $S(CNT>1:"s",1:"")
Q $S(CNT=1:"",1:"s") ; MSC/MKK - LR*5.2*1041
;
PLURALI(CNT) ; EP - Return the letter "y" if CNT=1, else return "ies".
; Q $S(CNT>1:"ies",1:"y")
Q $S(CNT=1:"y",1:"ies") ; MSC/MKK - LR*5.2*1041
;
LJZEROF(NUM,JW) ; EP - Left Justify, ZERO Fill - JW = Justify Width
Q $TR($$LJ^XLFSTR(NUM,JW)," ","0")
;
RJZEROF(NUM,JW) ; EP - Right Justify, ZERO Fill
Q $TR($$RJ^XLFSTR(NUM,JW)," ","0")
;
RESETERM ; EP - Reset Terminal Characteristics for a Terminal session
W *27,"[0m",!,$C(27),"[?7h" ; Resets and ensures "Auto Wrap" is ON
Q
;
AUTOWRAP ; EP - Reset Auto-wrap for a Terminal Session
W $C(27),"[?7h"
Q
BLRUTIL7 ;IHS/MSC/MKK - MISC IHS LAB UTILITIES (Cont) ; 13-Oct-2017 14:04 ; MKK
+1 ;;5.2;IHS LABORATORY;**1035,1041**;NOV 01, 1997;Build 23
+2 ;
EEP ; Ersatz EP
+1 DO EEP^BLRGMENU
+2 QUIT
+3 ;
OVERFLOW(TEST) ; EP - Send ALERT and E-MAIL to LMI Mail Group due to Max # BLR Errors in Error Trap
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,TEST,U,XPARSYS,XQXFLG)
+2 SET MESSAGE="RPMS Lab to PCC Linker **HALTED**"
+3 SET FROMWHOM="Lab to PCC Linker"
+4 SET TAB=$JUSTIFY("",2)
SET LINE=0
+5 ;
+6 DO AROUNDIT(.MSGARRAY,.LINE,"RPMS LAB TO PCC LINKER HALTED",55)
+7 ;
+8 DO ADDLINE(.MSGARRAY,.LINE)
+9 DO ADDLINE(.MSGARRAY,.LINE,TAB_"The RPMS Lab to PCC Linker has been *HALTED* by too")
+10 DO ADDLINE(.MSGARRAY,.LINE,TAB_"many BLR errors in the Error Trap.")
+11 DO ADDLINE(.MSGARRAY,.LINE)
+12 DO ADDLINE(.MSGARRAY,.LINE,TAB_"No Lab Data will be sent to PCC until this has been")
+13 DO ADDLINE(.MSGARRAY,.LINE,TAB_"resolved.")
+14 ;
+15 ; If TEST, then just display information to the screen and Quit.
+16 IF +$GET(TEST)
DO ^XBCLS
WRITE "SUBJECT:",MESSAGE,!,"FROMWHOM:",FROMWHOM,!
DO EN^DDIOL(.MSGARRAY)
WRITE !!
QUIT
+17 ;
+18 ; Send ALERT and MailMan Message to LMI Mail Group.
+19 DO MAILALMI^BLRUTIL3(MESSAGE,.MSGARRAY,FROMWHOM,1)
+20 QUIT
+21 ;
AROUNDIT(MSGARRAY,LINE,STR,MAX) ; EP - Create a "Box" Message in an Array
+1 NEW AROUND,GAPSTARS,J,MAXIT,ROWSTARS
+2 SET MAXIT="@"
+3 FOR J=1:1:$LENGTH(STR)
SET MAXIT=MAXIT_$EXTRACT(STR,J,J)_"@"
+4 SET AROUND=$TRANSLATE($JUSTIFY("",8+$LENGTH(MAXIT))," ","@")
+5 SET MAXIT="@@!!"_$TRANSLATE(MAXIT," ","@")_"!!@@"
+6 IF $LENGTH(MAXIT)'<(MAX-4)
Begin DoDot:1
+7 SET AROUND=$TRANSLATE($JUSTIFY("",10+$LENGTH(STR))," ","@")
+8 SET MAXIT="@@!!@"_$TRANSLATE(STR," ","@")_"@!!@@"
End DoDot:1
+9 ;
+10 SET MAX=$GET(MAX,IOM)
+11 SET ROWSTARS=$TRANSLATE($JUSTIFY("",MAX)," ","*")
+12 SET GAPSTARS=$TRANSLATE($$CJ^XLFSTR(AROUND,MAX)," @","* ")
+13 DO ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
+14 DO ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
+15 DO ADDLINE(.MSGARRAY,.LINE,GAPSTARS)
+16 DO ADDLINE(.MSGARRAY,.LINE,$TRANSLATE($$CJ^XLFSTR(MAXIT,MAX)," @","* "))
+17 DO ADDLINE(.MSGARRAY,.LINE,GAPSTARS)
+18 DO ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
+19 DO ADDLINE(.MSGARRAY,.LINE,ROWSTARS)
+20 QUIT
+21 ;
ADDLINE(MSGARRAY,LINE,STR) ; EP - Add a String to a line in an ARRAY
+1 SET STR=$GET(STR,$JUSTIFY("",5))
+2 SET LINE=1+$GET(LINE)
SET MSGARRAY(LINE)=STR
+3 QUIT
+4 ;
LONGALRT(ALRTSUBJ,NOUSER,ALERTMSG,SPECIFIC) ; EP - Alert that includes full message
+1 NEW (ALERTMSG,ALRTSUBJ,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,NOUSER,SPECIFIC,U,XPARSYS,XQXFLG)
+2 ;
+3 SET XQAID="BLR"
+4 SET XQAMSG=ALRTSUBJ
+5 MERGE XQATEXT=ALERTMSG
+6 ;
+7 ; If the SPECIFIC variable is set, send alert to ONLY that one user
+8 SET XQA($GET(SPECIFIC,"G.LMI"))=""
+9 ;
+10 ; If User not part of LMI Mail Group, send them alert also, but
+11 ; If-And-Only-If the NOUSER variable is null.
+12 IF $GET(NOUSER)=""&($$NINLMI^BLRUTIL3(DUZ))
SET XQA(DUZ)=""
+13 ;
+14 SET X=$$SETUP1^XQALERT
+15 KILL XQA,XQAMSG
+16 IF X
QUIT
+17 ;
+18 NEW SUBSCRPT
+19 SET SUBSCRPT="BLRLINKU Alert^"_+$HOROLOG_"^"_$JOB
+20 SET ^XTMP(SUBSCRPT,0)=$$FMADD^XLFDT($$DT^XLFDT,90)_"^"_$$DT^XLFDT_"^"_"Lab Package Alert."
+21 SET ^XTMP(SUBSCRPT,1)="Alert was not sent."
+22 SET ^XTMP(SUBSCRPT,2)=" Message that should have been sent follows:"
+23 SET ^XTMP(SUBSCRPT,3)=" SUBJ:"_ALRTSUBJ
+24 IF $LENGTH(ALERTMSG(1))<1
SET ^XTMP(SUBSCRPT,4)=" MESSAGE:"_ALERTMSG
SET LINE=5
+25 IF $LENGTH($GET(ALERTMSG(1)))
Begin DoDot:1
+26 SET ^XTMP(SUBSCRPT,4)=" MESSAGE:"_ALERTMSG(1)
+27 SET ARRAYLNE=1
SET LINE=4
+28 FOR
SET ARRAYLNE=$ORDER(ALERTMSG(ARRAYLNE))
IF ARRAYLNE<1
QUIT
Begin DoDot:2
+29 SET ^XTMP(SUBSCRPT,ARRAYLNE)=" "_ALERTMSG(ARRAYLNE)
+30 SET LINE=LINE+1
End DoDot:2
End DoDot:1
+31 ;
+32 SET ^XTMP(SUBSCRPT,LINE)=" ALERT Error Message Follows:"
+33 SET LINE=LINE+1
+34 SET ^XTMP(SUBSCRPT,LINE)=" "_XQALERR
+35 QUIT
+36 ;
+37 ;
OERRSTSC(ODT,SN) ; EP - Change OERR Status from PENDING to DISCOUNTINUED - ALL tests on the Order
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,ODT,SN,U,XPARSYS,XQXFLG)
+2 SET CONTROL="OC"
+3 DO NEW^LR7OB1(ODT,SN,CONTROL,,,1)
+4 QUIT
+5 ;
+6 ;
OERRSTSO(LRODT,LRSN,LROT) ; EP - Change OERR Status from PENDING to DISCOUNTINUED - Specific Test
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LROT,LRSN,U,XPARSYS,XQXFLG)
+2 SET LROTIEN=LROT_","_LRSN_","_LRODT
+3 SET ORIFN=$$GET1^DIQ(69.03,LROTIEN,6)
+4 IF $LENGTH(ORIFN)<1
QUIT
+5 ;
+6 SET F60IEN=$$GET1^DIQ(69.03,.01,LROTIEN,"I")
+7 IF $LENGTH(F60IEN)<1
QUIT
+8 ;
+9 SET II(F60IEN)=""
SET LRSTATUS=1
+10 SET CONTROL="OC"
+11 DO NEW^LR7OB1(LRODT,LRSN,CONTROL,,.II,LRSTATUS)
+12 QUIT
+13 ;
FORCEIT(LABEL,ARRY1,ARRY2,ARRY3) ; EP - Force the Audting of Varibles, even if TAKE SNAPSHOTS is set to OFF
+1 ; Code cloned from ENTRYAUD^BLRUTIL
+2 ;
+3 ; D DISABLE^%NOJRN ; Disable Journaling of ^BLRENTRY global
+4 ; Disable Journaling of ^BLRENTRY global - IHS/MSC/MKK - LR*5.2*1041 - Cache/Ensemble only
IF $GET(^%ZOSF("OS"))["OpenM"
DO DISABLE^%NOJRN
+5 ;
+6 ; Want to see what %, X & Y variables are
NEW ORIGX,ORIGY,%ORIG
+7 MERGE ORIGX=X,ORIGY=Y
+8 IF $DATA(%)
MERGE %ORIG=%
+9 NEW %
+10 IF $DATA(%ORIG)
MERGE %=%ORIG
+11 ;
+12 NEW X,Y,NOW,ENTRYNUM,STARTTIM,NOWTIM
+13 SET NOW=$$NOW^XLFDT
+14 SET ENTRYNUM=$GET(^BLRENTRY)+1
+15 SET NOWTIM=$PIECE($HOROLOG,",",2)
+16 SET $PIECE(^BLRENTRY,U)=ENTRYNUM
+17 SET ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL)=""
+18 ;
+19 ; D CAPVARS^BLRUTIL("BLRVARS","^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL)")
+20 ;
+21 ; I $L($G(ARRY1)) D ; Have an array that needs to be monitored; Merge it
+22 ; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY1)=@ARRY1
+23 ;
+24 ; I $L($G(ARRY2)) D ; Have another array that needs to be monitored; Merge it
+25 ; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY2)=@ARRY2
+26 ;
+27 ; I $L($G(ARRY3)) D ; Have another array that needs to be monitored; Merge it
+28 ; . M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,ARRY3)=@ARRY3
+29 ;
+30 ; M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"DUZ")=DUZ ; Always merge in the DUZ array
+31 ; I $D(ORIGX)>1 M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"ORIGX")=ORIGX
+32 ; I $D(ORIGY)>1 M ^BLRENTRY(DUZ,NOW,ENTRYNUM,LABEL,"ORIGY")=ORIGY
+33 ;
+34 ; ----- BEGIN IHS/MSC/MKK - LR*5.2*1041 - Use Kernel Call. It handles ALL arrays automatically.
+35 SET X="^BLRENTRY("_DUZ_","_NOW_","_ENTRYNUM_","_$CHAR(34)_LABEL_$CHAR(34)_","
+36 DO DOLRO^%ZOSV
+37 ; ----- END IHS/MSC/MKK - LR*5.2*1041 - Use Kernel Call
+38 ;
+39 ; Merge in the $STACK
DO GETSTACK^BLRUTIL6
+40 ;
+41 ; D ENABLE^%NOJRN ; Enable Journaling again
+42 ; Enable Journaling again - IHS/MSC/MKK - LR*5.2*1041 - Cache/Ensemble only
IF $GET(^%ZOSF("OS"))["OpenM"
DO ENABLE^%NOJRN
+43 QUIT
+44 ;
+45 ;
REFLABT ; EP - REFerence LAB Tests
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
+2 ;
+3 DO SETBLRVS("REFLABT")
+4 ;
+5 SET HEADER(1)="Reference Lab Tests"
+6 SET HEADER(2)=$$GET1^DIQ(9009026,+$GET(^BLRSITE(DUZ(2),"RL")),.01)
+7 ;
+8 DO HEADERDT^BLRGMENU
+9 DO HEADONE^BLRGMENU(.HDRONE)
+10 ;
+11 SET HEADER(3)=" "
+12 FOR J=5,27,49
SET $EXTRACT(HEADER(4),J)="PrntName"
SET $EXTRACT(HEADER(4),J+10)="F60 IEN"
+13 ;
+14 SET MAXLINES=IOSL-4
SET LINES=MAXLINES+10
+15 SET (CNT,F60CNT,PG)=0
+16 SET QFLG="NO"
+17 ;
+18 SET F60IEN=.9999999
+19 FOR
SET F60IEN=$ORDER(^LAB(60,F60IEN))
IF F60IEN<1!(QFLG="Q")
QUIT
Begin DoDot:1
+20 SET F60CNT=F60CNT+1
+21 IF $$REFLAB^BLRUTIL6(DUZ(2),F60IEN)<1
QUIT
+22 ;
+23 IF LINES>MAXLINES
DO HEADERPG^BLRGMENU(.PG,.QFLG,HDRONE)
IF QFLG="Q"
QUIT
WRITE ?4
+24 ;
+25 SET CNT=CNT+1
+26 WRITE $$LJ^XLFSTR($$LJ^XLFSTR($$GET1^DIQ(60,F60IEN,51),9)_"["_F60IEN_"]",22)
+27 IF $X>55
WRITE !,?4
SET LINES=LINES+1
End DoDot:1
+28 ;
+29 IF CNT<1
DO HEADERDT^BLRGMENU
+30 ;
+31 WRITE !!,?4,F60CNT," Tests analyzed."
+32 WRITE !!,?9,$SELECT(CNT<1:"No",1:CNT)," Reference Lab Test",$$PLURAL(CNT),"."
+33 DO PRESSKEY^BLRGMENU(4)
+34 QUIT
+35 ;
+36 ;
+37 ; ============================= UTILITIES =============================
+38 ;
BADSTUFF(MSG,TAB) ; EP - Simple Message that "ends" with "Routine Ends" string.
+1 IF +$GET(TAB)<1
SET TAB=4
+2 WRITE !!,?TAB,$$TRIM^XLFSTR(MSG,"LR"," ")," Routine Ends."
+3 DO PRESSKEY^BLRGMENU(TAB+5)
+4 QUIT
+5 ;
BADSTUFQ(MSG,TAB) ; EP - Simple Message. Calls BADSTUFF. Quits with "Q"
+1 DO BADSTUFF(MSG,$GET(TAB))
+2 QUIT "Q"
+3 ;
BADSTUFN(MSG,TAB) ; EP - Simple Message. Calls BADSTUFF. Quits with Null string
+1 DO BADSTUFF(MSG,$GET(TAB))
+2 QUIT ""
+3 ;
BADSTUF2(MSG,TAB) ; EP - Simple Message. Displays MSG string only.
+1 SET TAB=$SELECT($LENGTH($GET(TAB)):TAB,1:4)
+2 WRITE !!,?TAB,$$TRIM^XLFSTR(MSG,"LR"," ")
+3 DO PRESSKEY^BLRGMENU(TAB+5)
+4 QUIT
+5 ;
BADSTF2N(MSG,TAB) ; EP - Simple Message. Calls BADSTUF2. Quits with Null string
+1 DO BADSTUF2(MSG,$GET(TAB))
+2 QUIT ""
+3 ;
BADSTF2Q(MSG,TAB) ; EP - Simple Message. Calls BADSTUF2. Quits with "Q"
+1 DO BADSTUF2(MSG,$GET(TAB))
+2 QUIT "Q"
+3 ;
PROMPTO(MSG,TAB) ; EP - prompt only.
+1 SET TAB=$SELECT($LENGTH($GET(TAB)):TAB,1:4)
+2 WRITE !!,?TAB,MSG
+3 DO PRESSKEY^BLRGMENU(TAB+5)
+4 QUIT
+5 ;
PROMPTON(MSG,TAB) ; EP - Calls PROMPTO. Quits with null
+1 DO PROMPTO(MSG,$GET(TAB))
+2 QUIT ""
+3 ;
PROMPTOQ(MSG,TAB) ; EP - Calls PROMPTO. Quits with "Q"
+1 DO PROMPTO(MSG,$GET(TAB))
+2 QUIT "Q"
+3 ;
SHOUTMSG(STR,RM) ; EP - Return a string like >>>> STR <<<<
+1 ; RM = Right Margin (how long the string will be)
+2 NEW HALFLEN,J,STRLEN,TMPSTR
+3 ;
+4 SET RM=$GET(RM,IOM)
+5 ;
+6 SET HALFLEN=(RM\2)-(($LENGTH(STR)+2)\2)
+7 SET TMPSTR=$TRANSLATE($JUSTIFY("",HALFLEN)," ",">")
+8 SET TMPSTR=TMPSTR_" "_STR_" "
+9 SET STRLEN=$LENGTH(TMPSTR)
+10 FOR J=STRLEN:1:(RM-1)
SET TMPSTR=TMPSTR_"<"
+11 QUIT TMPSTR
+12 ;
PURGALRT ; EP - Purge ALL Alerts for user
+1 DO RECIPURG^XQALBUTL(DUZ)
+2 WRITE !!,?14,"Alerts Purged for DUZ:",DUZ
+3 DO PRESSKEY^BLRGMENU(9)
+4 QUIT
+5 ;
GETUCIS(ARRAY) ; EP - Create an Array of UCIs
+1 ; MSC/MKK - LR*5.2*1041 - Only for Cache systems.
IF $GET(^%ZOSF("OS"))'["OpenM"
QUIT 0
+2 ;
+3 NEW obj,X
+4 NEW CNT,UCI,MSG,MSGLINE
+5 ;
+6 SET CNT=0
+7 SET obj=##class(%ResultSet).%New("%SYS.Namespace:List")
+8 DO obj.Execute()
+9 SET X=$GET(obj.Data,"none")
+10 SET X=1
+11 FOR
IF X=""
QUIT
Begin DoDot:1
+12 DO obj.Next()
+13 SET X=$GET(obj.Data("Nsp"))
+14 IF X=""
QUIT
+15 ;
+16 SET UCI=X
+17 ;
+18 IF '$$CHEKIT(X)
QUIT
+19 ;
+20 SET ARRAY(UCI)=""
+21 SET CNT=CNT+1
End DoDot:1
+22 ;
+23 IF CNT<1
Begin DoDot:1
+24 WRITE !,?4,"No UCIs could be determined on this system.",!
+25 DO PRESSKEY^BLRGMENU(4)
End DoDot:1
+26 ;
+27 IF $DATA(MSG)
DO SENDMAIL^BLRUTIL3("UCI Error",.MSG,"BZHHUTLU")
+28 ;
+29 QUIT CNT
+30 ;
CHEKIT(UCI) ; EP - Checking to make sure UCI doesn't throw an error
+1 NEW ERRMSG,errobj,NOW,X
+2 ;
+3
*** ERROR ***
+4
*** ERROR ***
+5
*** ERROR ***
+6
*** ERROR ***
+7
*** ERROR ***
+8 ;
+9 IF $DATA(ERRMSG)<1
QUIT 1
+10 ;
+11 IF $DATA(MSG)
SET MSGLINE=$ORDER(MSG("A"),-1)
+12 IF '$TEST
Begin DoDot:1
+13 SET MSG(1)="Error Occurred during UCI processing"
+14 SET MSG(2)=" "
+15 SET MSGLINE=2
End DoDot:1
+16 ;
+17 SET MSGLINE=MSGLINE+1
+18 SET $EXTRACT(MSG(MSGLINE),5)="UCI:"_UCI_" Error:"_ERRMSG
+19 ;
+20 QUIT 0
+21 ;
URGCHK(ORDERNUM) ; EP - Check the Urgency of an Order and, if STAT, send ALERT to LMI Mail Group
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,ORDERNUM,U,XPARSYS,XQXFLG)
+2 ;
+3 SET (LRODT,URGENCY)=0
+4 FOR
SET LRODT=$ORDER(^LRO(69,"C",ORDERNUM,LRODT))
IF LRODT<1!(URGENCY)
QUIT
Begin DoDot:1
+5 SET LRSP=0
+6 FOR
SET LRSP=$ORDER(^LRO(69,"C",ORDERNUM,LRODT,LRSP))
IF LRSP<1!(URGENCY)
QUIT
Begin DoDot:2
+7 IF $$GET1^DIQ(69.03,LRSP_","_LRODT,1)["STAT"
SET URGENCY=URGENCY+1
End DoDot:2
End DoDot:1
+8 ;
+9 IF URGENCY
DO SNDALERT^BLRUTIL3("Order # "_ORDERNUM_" is a STAT Order.",1)
+10 QUIT
+11 ;
+12 ;
STATORDA(LRODT,LRSP,STATUS) ; EP - If STAT Order from EHR, send ALERT to LMI Mail Group
+1 NEW (DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,LRODT,LRSP,STATUS,U,XPARSYS,XQXFLG)
+2 ;
+3 ; Get the IEN of the STAT urgency
SET STATIEN=$$FIND1^DIC(62.05,,,"STAT")
+4 ; If no STAT urgency, skip
IF STATIEN<1
QUIT
+5 ;
+6 ; If STATUS not STAT, skip
IF STATUS'=STATIEN
QUIT
+7 ;
+8 ; Status is STAT, so send alert
+9 ;
+10 SET ORDERNUM=$$GET1^DIQ(69.01,LRSP_","_LRODT,9.5)
+11 ; If no Order Number, skip
IF ORDERNUM<1
QUIT
+12 ;
+13 DO SNDALERT^BLRUTIL3("Order # "_ORDERNUM_" is a STAT Order.",1)
+14 QUIT
+15 ;
MAKESTR(ARRAY) ; EP - Pass in Word Processing Array and return String
+1 NEW (ARRAY,DILOCKTM,DISYS,DT,DTIME,DUZ,IO,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,U,XPARSYS,XQXFLG)
+2 ;
+3 SET STRING=""
SET LINE=0
+4 FOR
SET LINE=$ORDER(ARRAY(LINE))
IF LINE<1
QUIT
SET STRING=STRING_($$TRIM^XLFSTR(ARRAY(LINE),"R"," "))_" "
+5 QUIT $$TRIM^XLFSTR(STRING,"LR"," ")
+6 ;
NOSNAPS ; EP - Make certain TAKE SNAPSHOTS field in BLR MASTER CONTROL file is OFF. This should be queued.
+1 NEW CNT,DESC,FDA,IEN,STR
+2 ;
+3 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+4 ;
+5 SET (CNT,IEN)=0
+6 FOR
SET IEN=$ORDER(^BLRSITE(IEN))
IF IEN<1
QUIT
Begin DoDot:1
+7 IF +$$GET1^DIQ(9009029,IEN,"TAKE SNAPSHOTS","I")<1
QUIT
+8 ;
+9 SET CNT=CNT+1
SET CNT(IEN)=""
+10 KILL FDA
+11 SET FDA(9009029,IEN_",",1)=0
+12 DO FILE^DIE(,"FDA","ERRS")
End DoDot:1
+13 ;
+14 ; If no update, just return
IF CNT<1
QUIT
+15 ;
+16 SET STR(1)="File 9009029 'TAKE SNAPSHOTS' Field Set to OFF for the following:"
+17 SET IEN=0
+18 FOR
SET IEN=$ORDER(CNT(IEN))
IF IEN<1
QUIT
Begin DoDot:1
+19 SET STR(IEN+2)=$JUSTIFY("",5)_$$GET1^DIQ(9009029,IEN,.01)
End DoDot:1
+20 ;
+21 DO SENDMAIL^BLRUTIL3("TAKE SNAPSHOTS OFF",.STR,"BLRUTIL7",1)
+22 QUIT
+23 ;
+24 ;
GLODUMP ; EP - "Dump" a global using $Q
+1 NEW FRSTPART,GLOVAR,STR1
+2 ;
+3 DO ^XBFMK
+4 SET DIR(0)="FO"
SET DIR("A")="Global"
+5 DO ^DIR
+6 IF $LENGTH(X)<1!(+$GET(DIRUT))
DO BADSTUFF("No/Invalid Input.")
QUIT
+7 ;
+8 ; S GLOBAL=X
+9 ; IHS/MSC/MKK - LR*5.2*1041
SET GLOVAR=X
+10 IF $EXTRACT(GLOVAR)'=U
SET GLOVAR=U_GLOVAR
+11 ;
+12 SET FRSTPART=$PIECE(GLOVAR,")")
+13 SET STR1=$QUERY(@GLOVAR@(""))
+14 IF STR1=""
DO BADSTUFF("No data found for "_GLOVAR_".")
QUIT
+15 ;
+16 WRITE !!,STR1,"="
DO LINEWRAP^BLRGMENU($X,@STR1,(IOM-$X))
WRITE !
+17 FOR
SET STR1=$QUERY(@STR1)
IF STR1=""!(STR1'[FRSTPART)
QUIT
WRITE ?4,STR1,"="
DO LINEWRAP^BLRGMENU($X,@STR1,(IOM-$X))
WRITE !
+18 DO PRESSKEY^BLRGMENU(9)
+19 QUIT
+20 ;
SETBLRVS(TWO) ; EP - Set BLRVERN variable(s)
+1 SET BLRVERN=$PIECE($PIECE($TEXT(+1),";")," ")
+2 IF $LENGTH($GET(TWO))
SET BLRVERN2=TWO
+3 QUIT
+4 ;
PLURAL(CNT) ; EP - Return "" if CNT=1, else return "s".
+1 ; Q $S(CNT>1:"s",1:"")
+2 ; MSC/MKK - LR*5.2*1041
QUIT $SELECT(CNT=1:"",1:"s")
+3 ;
PLURALI(CNT) ; EP - Return the letter "y" if CNT=1, else return "ies".
+1 ; Q $S(CNT>1:"ies",1:"y")
+2 ; MSC/MKK - LR*5.2*1041
QUIT $SELECT(CNT=1:"y",1:"ies")
+3 ;
LJZEROF(NUM,JW) ; EP - Left Justify, ZERO Fill - JW = Justify Width
+1 QUIT $TRANSLATE($$LJ^XLFSTR(NUM,JW)," ","0")
+2 ;
RJZEROF(NUM,JW) ; EP - Right Justify, ZERO Fill
+1 QUIT $TRANSLATE($$RJ^XLFSTR(NUM,JW)," ","0")
+2 ;
RESETERM ; EP - Reset Terminal Characteristics for a Terminal session
+1 ; Resets and ensures "Auto Wrap" is ON
WRITE *27,"[0m",!,$CHAR(27),"[?7h"
+2 QUIT
+3 ;
AUTOWRAP ; EP - Reset Auto-wrap for a Terminal Session
+1 WRITE $CHAR(27),"[?7h"
+2 QUIT