BDGICS2 ; IHS/ANMC/LJF - DAY SURGERY CODING STATUS ; [ 04/08/2004 4:02 PM ]
;;5.3;PIMS;**1005,1010**;MAY 28, 2004
;IHS/OIT/LJF 02/16/2006 PATCH 1005 fixed logic for determining if uncoded
;cmi/anch/maw 10/20/2008 PATCH 1010 changed export date field from .14 to 1106
;
NEW BDGBM,BDGEM
S BDGBM=$$READ^BDGF("DO^::EP","Select Beginning Month") Q:BDGBM<1
S BDGEM=$$READ^BDGF("DO^::EP","Select Ending Month") Q:BDGEM<1
S BDGBM=$E(BDGBM,1,5)_"00",BDGEM=$E(BDGEM,1,5)_"31.24"
;
D ZIS^BDGF("PQ","EN^BDGICS2","DS CODING STATUS","BDGBM;BDGEM")
Q
;
;
EN ; -- main entry point for BDG IC CODE STATUS DS
NEW VALMCNT
I $E(IOST,1,2)="P-" S BDGPRT=1 D INIT,PRINT Q ;if printing to paper
D TERM^VALM0,CLEAR^VALM1
D EN^VALM("BDG IC CODE STATUS DS")
D CLEAR^VALM1
Q
;
HDR ; -- header code
NEW X
S VALMHDR(1)=$$SP(20)_$$CONF^BDGF
S X=$$GET1^DIQ(4,DUZ(2),.01),VALMHDR(2)=$$SP(79-$L(X)\2)_X
S X=$$RANGE^BDGF(BDGBM,(BDGEM\1))
S VALMHDR(3)=$$SP(79-$L(X)\2)_X
Q
;
INIT ; -- init variables and list array
I '$G(BDGPRT) D MSG^BDGF("Please wait while I compile the list...",2,0)
NEW DATE,TODAY,DFN,IEN,COUNT,VST,VH,MONTH,SUB,ADM,X,LINE,DSC,Y
K ^TMP("BDGICS2",$J),^TMP("BDGICS2A",$J)
S VALMCNT=0
;
; loop through day surgery visits for date range
S DATE=BDGBM,TODAY=DT+.24
F S DATE=$O(^AUPNVSIT("B",DATE)) Q:('DATE)!(DATE>BDGEM)!(DATE>TODAY) D
. S MONTH=$E(DATE,1,5)
. S VST=0 F S VST=$O(^AUPNVSIT("B",DATE,VST)) Q:'VST D
.. ;
.. Q:$P(^AUPNVSIT(VST,0),U,7)'="S" ;day surgery visits only
.. Q:$P(^AUPNVSIT(VST,0),U,11)=1 ;deleted
.. Q:$P(^AUPNVSIT(VST,0),U,6)'=DUZ(2) ;different location
.. ;
.. ;increment # day surgeries per month
.. S COUNT(MONTH,"DS")=$G(COUNT(MONTH,"DS"))+1
.. ;
.. ; check for errors if running VA Surgery
.. I $O(^SRF("ADS",0)) D
... S SRN=$O(^SRF("ADS",VST,0))
... I 'SRN D ERR("NO Surgery entry for visit",VST,DATE) Q
... I $$GET1^DIQ(130,SRN,.011,"I")'["DS" D ERR("Visit linked to "_$$GET1^DIQ(130,SRN,.011),VST,DATE) Q
... S SRRS=$$GET1^DIQ(130,SRN,9999999.06,"I") ;ds release status
... I SRRS="AD" D ERR("Surgery says unplanned admit",VST,DATE) Q
... I (SRRS="NS")!(SRRS="CA") D ERR("Surgery says "_$S(SRRS="NS":"No-show",1:"Cancelled"),VST,DATE) Q
.. ;
.. ; check if uncoded
.. S X=$O(^AUPNVPOV("AD",VST,0)),Y=$O(^AUPNVPRV("AD",VST,0))
.. ;I (X=""),(Y="") D UNCODED(DATE,VST) Q
.. I (X="")!(Y="") D UNCODED(DATE,VST) Q ;IHS/OIT/LJF 02/16/2006 PATCH 1005
.. ;
.. ; check if exported
.. S COUNT(MONTH,"COD")=$G(COUNT(MONTH,"COD"))+1
.. ;I $$GET1^DIQ(9000010,VST,.14)]"" S COUNT(MONTH,"EXP")=$G(COUNT(MONTH,"EXP"))+1 ;cmi/maw 10/20/2008 PATCH 1010 orig line
.. I $$GET1^DIQ(9000010,VST,1106)]"" S COUNT(MONTH,"EXP")=$G(COUNT(MONTH,"EXP"))+1 ;cmi/maw 10/20/2008 PATCH 1010 new export date field
;
; build display array
; monthly counts heading
S LINE=$$PAD($$PAD("Month/Year",13)_"# Surgeries",26)
S LINE=$$PAD(LINE_"# Coded",36)
S LINE=$$PAD($$PAD(LINE_"# Not-Coded",50)_"# Exported",62)
S LINE=LINE_"# Errors" D SET(LINE,.VALMCNT)
; monthly counts
S MON=0 F S MON=$O(COUNT(MON)) Q:'MON D
. S LINE=$$PAD($$FMTE^XLFDT(MON_"00"),15)
. F SUB="DS","COD","UNC","EXP","ERR" D
.. S LINE=LINE_$J(+$G(COUNT(MON,SUB)),4)_$$SP(8)
. D SET(LINE,.VALMCNT)
;
D SET($$REPEAT^XLFSTR("=",79),.VALMCNT)
S LINE=$$SP(15)
F SUB="DS","COD","UNC","EXP","ERR" D
. S TOTAL=0,MON=0
. F S MON=$O(COUNT(MON)) Q:'MON S TOTAL=$G(TOTAL)+$G(COUNT(MON,SUB))
. S LINE=LINE_$J(TOTAL,4)_$$SP(8)
D SET(LINE,.VALMCNT)
D SET("",.VALMCNT)
;
; list uncoded charts
; if any uncoded charts, print heading
I $D(^TMP("BDGICS2A",$J,"U")) D
. S LINE=$$PAD($$PAD("Surgery Date",15)_"Patient Name",45)
. S LINE=$$PAD(LINE_"Chart #",58)_"Srv"
. S LINE=$$PAD(LINE,64)_"Insurance"
. D SET("",.VALMCNT),SET(LINE,.VALMCNT)
;
S DATE=0 F S DATE=$O(^TMP("BDGICS2A",$J,"U",DATE)) Q:'DATE D
. S VST=0 F S VST=$O(^TMP("BDGICS2A",$J,"U",DATE,VST)) Q:'VST D
.. ;
.. S SRN=+$O(^SRF("ADS",VST,0)) ;surgery entry
.. S DFN=$$GET1^DIQ(9000010,VST,.05,"I") ;pat ien
.. ;
.. S LINE=$$PAD($$NUMDATE^BDGF(DATE\1),15) ;surgery date
.. S LINE=$$PAD(LINE_$E($$GET1^DIQ(2,DFN,.01),1,22),45) ;name
.. S LINE=$$PAD(LINE_$J($$HRCN^BDGF2(DFN,DUZ(2)),6),58)
.. S LINE=LINE_$E($$GET1^DIQ(130,SRN,.04),1,3) ;sur specialty
.. ;
.. ; add insurance coverage
.. S LINE=$$PAD(LINE,64)_$$INSUR^BDGF2(DFN,DATE)
.. D SET(LINE,.VALMCNT)
;
; add error charts to display listing
; if any errors, print heading
I $D(^TMP("BDGICS2A",$J,"E")) D
. I $E(IOST,1,2)="P-" D SET("@@@",.VALMCNT) ;mark errors for paper
. S LINE=$$PAD("Surgery Date",16)_"Patient Name"
. S LINE=$$PAD($$PAD(LINE,38)_"Chart #",48)_"Error Message"
. D SET("",.VALMCNT),SET(LINE,.VALMCNT)
;
S DATE=0 F S DATE=$O(^TMP("BDGICS2A",$J,"E",DATE)) Q:'DATE D
. S VST=0 F S VST=$O(^TMP("BDGICS2A",$J,"E",DATE,VST)) Q:'VST D
.. ;
.. S DFN=$$GET1^DIQ(9000010,VST,.05,"I") ;pat ien
.. S LINE=$$PAD($$NUMDATE^BDGF(DATE\1),16) ;sur date
.. S LINE=$$PAD(LINE_$E($$GET1^DIQ(2,DFN,.01),1,18),38) ;name
.. S LINE=LINE_$J($$HRCN^BDGF2(DFN,DUZ(2)),6) ;chart #
.. S LINE=$$PAD(LINE,48)_^TMP("BDGICS2A",$J,"E",DATE,VST) ;err msg
.. D SET(LINE,.VALMCNT)
;
I '$D(^TMP("BDGICS2",$J)) D SET("NO DATA FOUND",.VALMCNT)
K ^TMP("BDGICS2A",$J)
Q
;
ERR(MSG,VST,DATE) ; increment error count and save for listing
NEW MON
S MON=$E(DATE,1,5)
S COUNT(MON,"ERR")=$G(COUNT(MON,"ERR"))+1
S ^TMP("BDGICS2A",$J,"E",DATE,VST)=MSG
Q
;
UNCODED(DATE,VST) ; save uncoded visits by discharge date
NEW MON
S MON=$E(DATE,1,5)
S COUNT(MON,"UNC")=$G(COUNT(MON,"UNC"))+1
S ^TMP("BDGICS2A",$J,"U",DATE,VST)=""
Q
;
SET(DATA,NUM) ; put data line into display array
S NUM=NUM+1
S ^TMP("BDGICS2",$J,NUM,0)=DATA
Q
;
PRINT ; print report to paper
NEW BDGL,FIRST
U IO S FIRST=1 D HDG
S BDGL=0 F S BDGL=$O(^TMP("BDGICS2",$J,BDGL)) Q:'BDGL D
. I ^TMP("BDGICS2",$J,BDGL,0)="@@@" S FIRST=1 Q ;beginning of errors
. I $Y>(IOSL-4) D HDG
. W !,^TMP("BDGICS2",$J,BDGL,0)
D ^%ZISC,EXIT
Q
;
HDG ; heading when printing to paper
W @IOF W !?20,"DAY SURGERY CODING STATUS REPORT"
D HDR F I=1:1 Q:'$D(VALMHDR(I)) W !,VALMHDR(I)
I FIRST W !,$$REPEAT^XLFSTR("=",80),! S FIRST=0 Q
W !,"Surgery Date",?24,"Patient Name",?44,"Chart #"
W !?54,"Serv",?60,"Insurance",!,$$REPEAT^XLFSTR("=",80),!
Q
;
HELP ; -- help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ; -- exit code
K ^TMP("BDGICS2",$J) K BDGPRT
Q
;
EXPND ; -- expand code
Q
;
PAD(D,L) ;EP -- SUBRTN to pad length of data
; -- D=data L=length
Q $E(D_$$REPEAT^XLFSTR(" ",L),1,L)
;
SP(N) ; -- SUBRTN to pad N number of spaces
Q $$PAD(" ",N)
BDGICS2 ; IHS/ANMC/LJF - DAY SURGERY CODING STATUS ; [ 04/08/2004 4:02 PM ]
+1 ;;5.3;PIMS;**1005,1010**;MAY 28, 2004
+2 ;IHS/OIT/LJF 02/16/2006 PATCH 1005 fixed logic for determining if uncoded
+3 ;cmi/anch/maw 10/20/2008 PATCH 1010 changed export date field from .14 to 1106
+4 ;
+5 NEW BDGBM,BDGEM
+6 SET BDGBM=$$READ^BDGF("DO^::EP","Select Beginning Month")
IF BDGBM<1
QUIT
+7 SET BDGEM=$$READ^BDGF("DO^::EP","Select Ending Month")
IF BDGEM<1
QUIT
+8 SET BDGBM=$EXTRACT(BDGBM,1,5)_"00"
SET BDGEM=$EXTRACT(BDGEM,1,5)_"31.24"
+9 ;
+10 DO ZIS^BDGF("PQ","EN^BDGICS2","DS CODING STATUS","BDGBM;BDGEM")
+11 QUIT
+12 ;
+13 ;
EN ; -- main entry point for BDG IC CODE STATUS DS
+1 NEW VALMCNT
+2 ;if printing to paper
IF $EXTRACT(IOST,1,2)="P-"
SET BDGPRT=1
DO INIT
DO PRINT
QUIT
+3 DO TERM^VALM0
DO CLEAR^VALM1
+4 DO EN^VALM("BDG IC CODE STATUS DS")
+5 DO CLEAR^VALM1
+6 QUIT
+7 ;
HDR ; -- header code
+1 NEW X
+2 SET VALMHDR(1)=$$SP(20)_$$CONF^BDGF
+3 SET X=$$GET1^DIQ(4,DUZ(2),.01)
SET VALMHDR(2)=$$SP(79-$LENGTH(X)\2)_X
+4 SET X=$$RANGE^BDGF(BDGBM,(BDGEM\1))
+5 SET VALMHDR(3)=$$SP(79-$LENGTH(X)\2)_X
+6 QUIT
+7 ;
INIT ; -- init variables and list array
+1 IF '$GET(BDGPRT)
DO MSG^BDGF("Please wait while I compile the list...",2,0)
+2 NEW DATE,TODAY,DFN,IEN,COUNT,VST,VH,MONTH,SUB,ADM,X,LINE,DSC,Y
+3 KILL ^TMP("BDGICS2",$JOB),^TMP("BDGICS2A",$JOB)
+4 SET VALMCNT=0
+5 ;
+6 ; loop through day surgery visits for date range
+7 SET DATE=BDGBM
SET TODAY=DT+.24
+8 FOR
SET DATE=$ORDER(^AUPNVSIT("B",DATE))
IF ('DATE)!(DATE>BDGEM)!(DATE>TODAY)
QUIT
Begin DoDot:1
+9 SET MONTH=$EXTRACT(DATE,1,5)
+10 SET VST=0
FOR
SET VST=$ORDER(^AUPNVSIT("B",DATE,VST))
IF 'VST
QUIT
Begin DoDot:2
+11 ;
+12 ;day surgery visits only
IF $PIECE(^AUPNVSIT(VST,0),U,7)'="S"
QUIT
+13 ;deleted
IF $PIECE(^AUPNVSIT(VST,0),U,11)=1
QUIT
+14 ;different location
IF $PIECE(^AUPNVSIT(VST,0),U,6)'=DUZ(2)
QUIT
+15 ;
+16 ;increment # day surgeries per month
+17 SET COUNT(MONTH,"DS")=$GET(COUNT(MONTH,"DS"))+1
+18 ;
+19 ; check for errors if running VA Surgery
+20 IF $ORDER(^SRF("ADS",0))
Begin DoDot:3
+21 SET SRN=$ORDER(^SRF("ADS",VST,0))
+22 IF 'SRN
DO ERR("NO Surgery entry for visit",VST,DATE)
QUIT
+23 IF $$GET1^DIQ(130,SRN,.011,"I")'["DS"
DO ERR("Visit linked to "_$$GET1^DIQ(130,SRN,.011),VST,DATE)
QUIT
+24 ;ds release status
SET SRRS=$$GET1^DIQ(130,SRN,9999999.06,"I")
+25 IF SRRS="AD"
DO ERR("Surgery says unplanned admit",VST,DATE)
QUIT
+26 IF (SRRS="NS")!(SRRS="CA")
DO ERR("Surgery says "_$SELECT(SRRS="NS":"No-show",1:"Cancelled"),VST,DATE)
QUIT
End DoDot:3
+27 ;
+28 ; check if uncoded
+29 SET X=$ORDER(^AUPNVPOV("AD",VST,0))
SET Y=$ORDER(^AUPNVPRV("AD",VST,0))
+30 ;I (X=""),(Y="") D UNCODED(DATE,VST) Q
+31 ;IHS/OIT/LJF 02/16/2006 PATCH 1005
IF (X="")!(Y="")
DO UNCODED(DATE,VST)
QUIT
+32 ;
+33 ; check if exported
+34 SET COUNT(MONTH,"COD")=$GET(COUNT(MONTH,"COD"))+1
+35 ;I $$GET1^DIQ(9000010,VST,.14)]"" S COUNT(MONTH,"EXP")=$G(COUNT(MONTH,"EXP"))+1 ;cmi/maw 10/20/2008 PATCH 1010 orig line
+36 ;cmi/maw 10/20/2008 PATCH 1010 new export date field
IF $$GET1^DIQ(9000010,VST,1106)]""
SET COUNT(MONTH,"EXP")=$GET(COUNT(MONTH,"EXP"))+1
End DoDot:2
End DoDot:1
+37 ;
+38 ; build display array
+39 ; monthly counts heading
+40 SET LINE=$$PAD($$PAD("Month/Year",13)_"# Surgeries",26)
+41 SET LINE=$$PAD(LINE_"# Coded",36)
+42 SET LINE=$$PAD($$PAD(LINE_"# Not-Coded",50)_"# Exported",62)
+43 SET LINE=LINE_"# Errors"
DO SET(LINE,.VALMCNT)
+44 ; monthly counts
+45 SET MON=0
FOR
SET MON=$ORDER(COUNT(MON))
IF 'MON
QUIT
Begin DoDot:1
+46 SET LINE=$$PAD($$FMTE^XLFDT(MON_"00"),15)
+47 FOR SUB="DS","COD","UNC","EXP","ERR"
Begin DoDot:2
+48 SET LINE=LINE_$JUSTIFY(+$GET(COUNT(MON,SUB)),4)_$$SP(8)
End DoDot:2
+49 DO SET(LINE,.VALMCNT)
End DoDot:1
+50 ;
+51 DO SET($$REPEAT^XLFSTR("=",79),.VALMCNT)
+52 SET LINE=$$SP(15)
+53 FOR SUB="DS","COD","UNC","EXP","ERR"
Begin DoDot:1
+54 SET TOTAL=0
SET MON=0
+55 FOR
SET MON=$ORDER(COUNT(MON))
IF 'MON
QUIT
SET TOTAL=$GET(TOTAL)+$GET(COUNT(MON,SUB))
+56 SET LINE=LINE_$JUSTIFY(TOTAL,4)_$$SP(8)
End DoDot:1
+57 DO SET(LINE,.VALMCNT)
+58 DO SET("",.VALMCNT)
+59 ;
+60 ; list uncoded charts
+61 ; if any uncoded charts, print heading
+62 IF $DATA(^TMP("BDGICS2A",$JOB,"U"))
Begin DoDot:1
+63 SET LINE=$$PAD($$PAD("Surgery Date",15)_"Patient Name",45)
+64 SET LINE=$$PAD(LINE_"Chart #",58)_"Srv"
+65 SET LINE=$$PAD(LINE,64)_"Insurance"
+66 DO SET("",.VALMCNT)
DO SET(LINE,.VALMCNT)
End DoDot:1
+67 ;
+68 SET DATE=0
FOR
SET DATE=$ORDER(^TMP("BDGICS2A",$JOB,"U",DATE))
IF 'DATE
QUIT
Begin DoDot:1
+69 SET VST=0
FOR
SET VST=$ORDER(^TMP("BDGICS2A",$JOB,"U",DATE,VST))
IF 'VST
QUIT
Begin DoDot:2
+70 ;
+71 ;surgery entry
SET SRN=+$ORDER(^SRF("ADS",VST,0))
+72 ;pat ien
SET DFN=$$GET1^DIQ(9000010,VST,.05,"I")
+73 ;
+74 ;surgery date
SET LINE=$$PAD($$NUMDATE^BDGF(DATE\1),15)
+75 ;name
SET LINE=$$PAD(LINE_$EXTRACT($$GET1^DIQ(2,DFN,.01),1,22),45)
+76 SET LINE=$$PAD(LINE_$JUSTIFY($$HRCN^BDGF2(DFN,DUZ(2)),6),58)
+77 ;sur specialty
SET LINE=LINE_$EXTRACT($$GET1^DIQ(130,SRN,.04),1,3)
+78 ;
+79 ; add insurance coverage
+80 SET LINE=$$PAD(LINE,64)_$$INSUR^BDGF2(DFN,DATE)
+81 DO SET(LINE,.VALMCNT)
End DoDot:2
End DoDot:1
+82 ;
+83 ; add error charts to display listing
+84 ; if any errors, print heading
+85 IF $DATA(^TMP("BDGICS2A",$JOB,"E"))
Begin DoDot:1
+86 ;mark errors for paper
IF $EXTRACT(IOST,1,2)="P-"
DO SET("@@@",.VALMCNT)
+87 SET LINE=$$PAD("Surgery Date",16)_"Patient Name"
+88 SET LINE=$$PAD($$PAD(LINE,38)_"Chart #",48)_"Error Message"
+89 DO SET("",.VALMCNT)
DO SET(LINE,.VALMCNT)
End DoDot:1
+90 ;
+91 SET DATE=0
FOR
SET DATE=$ORDER(^TMP("BDGICS2A",$JOB,"E",DATE))
IF 'DATE
QUIT
Begin DoDot:1
+92 SET VST=0
FOR
SET VST=$ORDER(^TMP("BDGICS2A",$JOB,"E",DATE,VST))
IF 'VST
QUIT
Begin DoDot:2
+93 ;
+94 ;pat ien
SET DFN=$$GET1^DIQ(9000010,VST,.05,"I")
+95 ;sur date
SET LINE=$$PAD($$NUMDATE^BDGF(DATE\1),16)
+96 ;name
SET LINE=$$PAD(LINE_$EXTRACT($$GET1^DIQ(2,DFN,.01),1,18),38)
+97 ;chart #
SET LINE=LINE_$JUSTIFY($$HRCN^BDGF2(DFN,DUZ(2)),6)
+98 ;err msg
SET LINE=$$PAD(LINE,48)_^TMP("BDGICS2A",$JOB,"E",DATE,VST)
+99 DO SET(LINE,.VALMCNT)
End DoDot:2
End DoDot:1
+100 ;
+101 IF '$DATA(^TMP("BDGICS2",$JOB))
DO SET("NO DATA FOUND",.VALMCNT)
+102 KILL ^TMP("BDGICS2A",$JOB)
+103 QUIT
+104 ;
ERR(MSG,VST,DATE) ; increment error count and save for listing
+1 NEW MON
+2 SET MON=$EXTRACT(DATE,1,5)
+3 SET COUNT(MON,"ERR")=$GET(COUNT(MON,"ERR"))+1
+4 SET ^TMP("BDGICS2A",$JOB,"E",DATE,VST)=MSG
+5 QUIT
+6 ;
UNCODED(DATE,VST) ; save uncoded visits by discharge date
+1 NEW MON
+2 SET MON=$EXTRACT(DATE,1,5)
+3 SET COUNT(MON,"UNC")=$GET(COUNT(MON,"UNC"))+1
+4 SET ^TMP("BDGICS2A",$JOB,"U",DATE,VST)=""
+5 QUIT
+6 ;
SET(DATA,NUM) ; put data line into display array
+1 SET NUM=NUM+1
+2 SET ^TMP("BDGICS2",$JOB,NUM,0)=DATA
+3 QUIT
+4 ;
PRINT ; print report to paper
+1 NEW BDGL,FIRST
+2 USE IO
SET FIRST=1
DO HDG
+3 SET BDGL=0
FOR
SET BDGL=$ORDER(^TMP("BDGICS2",$JOB,BDGL))
IF 'BDGL
QUIT
Begin DoDot:1
+4 ;beginning of errors
IF ^TMP("BDGICS2",$JOB,BDGL,0)="@@@"
SET FIRST=1
QUIT
+5 IF $Y>(IOSL-4)
DO HDG
+6 WRITE !,^TMP("BDGICS2",$JOB,BDGL,0)
End DoDot:1
+7 DO ^%ZISC
DO EXIT
+8 QUIT
+9 ;
HDG ; heading when printing to paper
+1 WRITE @IOF
WRITE !?20,"DAY SURGERY CODING STATUS REPORT"
+2 DO HDR
FOR I=1:1
IF '$DATA(VALMHDR(I))
QUIT
WRITE !,VALMHDR(I)
+3 IF FIRST
WRITE !,$$REPEAT^XLFSTR("=",80),!
SET FIRST=0
QUIT
+4 WRITE !,"Surgery Date",?24,"Patient Name",?44,"Chart #"
+5 WRITE !?54,"Serv",?60,"Insurance",!,$$REPEAT^XLFSTR("=",80),!
+6 QUIT
+7 ;
HELP ; -- help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ; -- exit code
+1 KILL ^TMP("BDGICS2",$JOB)
KILL BDGPRT
+2 QUIT
+3 ;
EXPND ; -- expand code
+1 QUIT
+2 ;
PAD(D,L) ;EP -- SUBRTN to pad length of data
+1 ; -- D=data L=length
+2 QUIT $EXTRACT(D_$$REPEAT^XLFSTR(" ",L),1,L)
+3 ;
SP(N) ; -- SUBRTN to pad N number of spaces
+1 QUIT $$PAD(" ",N)