DVBAB82D ;BHAMOI/JFW - CAPRI CNH DELIMITED REPORTS ; 9/24/10 1:59pm
;;2.7;AMIE;**149,185**;Apr 10, 1995;Build 18
;Per VHA Directive 2004-038, this routine should not be modified.
;
;Input : DVBARPTID - Identifies report to delimit
; ^TMP("DVBA",$J,1) contains report in standard output
;Output: ^TMP("DVBADLMTD",$J) contains delimited report
;
DLMTRPT(DVBARPTID) ;delimit CNH report
N DVBADLMTR,DVBADRPT
S DVBADLMTR=",",DVBADRPT=$NA(^TMP("DVBADLMTD",$J))
K @DVBADRPT
;create specific delimited report
D @(DVBARPTID_"(DVBADLMTR,DVBADRPT)")
K ^TMP("DVBA",$J)
Q
;
11(DVBADLMTR,DVBADRPT) ;Nursing Home Roster Report Output
N DVBAI,DVBAX,DVBAQUIT,DVBASTR,DVBACNTR,DVBATMP,DVBAVEN,DVBAVENID
;check to see if any results found
I ('$D(^TMP("DVBA",$J,1,9))) D Q
.S @DVBADRPT@(1)="No data found."_$C(13)
D COLHDR52(DVBADLMTR,DVBADRPT) ;delimited column header info
S DVBACNTR=$O(@DVBADRPT@("A"),-1)+1
S DVBAI=8 F S DVBAI=$O(^TMP("DVBA",$J,1,DVBAI)) Q:'+DVBAI D
.S DVBASTR=$G(^TMP("DVBA",$J,1,DVBAI))
.;ignore blank lines (Seperates Entries) OR report headers
.Q:((DVBASTR="")!($E(DVBASTR,1,11)="VENDOR NAME")!($E(DVBASTR,1)=" ")!(DVBASTR[$C(10)))
.S DVBAVEN=$$TRUNC($E(DVBASTR,1,49)),DVBAVENID=$$TRUNC($E(DVBASTR,51,80))
.S DVBAQUIT=0,DVBAX=DVBAI
.;quit inner loop when no more veterans for specific vendor
.;or end of global array reached
.F S DVBAX=$O(^TMP("DVBA",$J,1,DVBAX)) Q:((DVBAQUIT)!('+DVBAX)) D
..S DVBASTR=$G(^TMP("DVBA",$J,1,DVBAX)),DVBATMP=""
..I ($E(DVBASTR,1)'=" ") S DVBAQUIT=1,DVBAI=DVBAX Q
..;Vendor Name^Vendor ID
..S DVBATMP=DVBAVEN_DVBADLMTR_DVBAVENID_DVBADLMTR
..;Veteran Name^Veteran ID^Admit DT^Auth. To Date
..S DVBATMP=DVBATMP_""""_$$TRUNC($E(DVBASTR,5,36))_""""_DVBADLMTR_$$TRUNC($E(DVBASTR,38,52))_DVBADLMTR
..S DVBATMP=DVBATMP_$$TRIM($$TRUNC($E(DVBASTR,54,64)))_DVBADLMTR_$$TRIM($$TRUNC($E(DVBASTR,66,80)))
..;Save off CNH info and increment counters
..S @DVBADRPT@(DVBACNTR)=DVBATMP_$C(13),DVBACNTR=DVBACNTR+1
Q
;
12(DVBADLMTR,DVBADRPT) ;CNH Admission/Discharge Report Output
N DVBAI,DVBASTR,DVBACNTR,DVBATMP
;check to see if any results found
I ('$D(^TMP("DVBA",$J,1,7))) D Q
.S @DVBADRPT@(1)="No data found for parameters entered."_$C(13)
D COLHDR53(DVBADLMTR,DVBADRPT) ;delimited column header info
S DVBACNTR=$O(@DVBADRPT@("A"),-1)+1
S DVBAI=6 F S DVBAI=$O(^TMP("DVBA",$J,1,DVBAI)) Q:'+DVBAI D
.S DVBASTR=$G(^TMP("DVBA",$J,1,DVBAI))
.;ignore blank lines (Seperates Entries) OR report headers
.Q:((DVBASTR="")!($E(DVBASTR,1)=" ")!(DVBASTR[$C(10)))
.S DVBATMP=""
.;Patient Name^Patient ID^Eligibility
.;S DVBATMP=$$TRUNC($E(DVBASTR,1,31))_DVBADLMTR_$$TRUNC($E(DVBASTR,33,47))_DVBADLMTR_$$TRUNC($E(DVBASTR,49,80))_DVBADLMTR
.S DVBATMP=""""_$$TRUNC($E(DVBASTR,1,31))_""""_DVBADLMTR_$$TRUNC($E(DVBASTR,33,47))_DVBADLMTR_$$TRUNC($E(DVBASTR,49,80))_DVBADLMTR
.S DVBAI=DVBAI+1,DVBASTR=$G(^TMP("DVBA",$J,1,DVBAI))
.;Activity Type^Date^Date/Time^Sub Type
.S DVBATMP=DVBATMP_$P($$TRIM(DVBASTR)," ")_DVBADLMTR_$$TRUNC($E(DVBASTR,20,35))_DVBADLMTR_$$TRUNC($E(DVBASTR,53,80))_DVBADLMTR
.S DVBAI=DVBAI+1,DVBASTR=$G(^TMP("DVBA",$J,1,DVBAI))
.;Nursing Home Information (ID^Name^Address^Phone) is optional
.D:(DVBASTR="")
..S DVBATMP=DVBATMP_DVBADLMTR_DVBADLMTR_DVBADLMTR
.D:(DVBASTR'="")
..S DVBATMP=DVBATMP_$$TRUNC($E(DVBASTR,43,80))_DVBADLMTR_$$TRUNC($E(DVBASTR,11,41))_DVBADLMTR
..S DVBASTR=$$TRIM($$TRUNC($G(^TMP("DVBA",$J,1,DVBAI+1))))
..S:(DVBASTR]"") DVBATMP=DVBATMP_DVBASTR_" " ;Address 1
..S DVBATMP=DVBATMP_$$TRIM($$TRUNC($G(^TMP("DVBA",$J,1,DVBAI+2))))_DVBADLMTR ;Address 2
..S DVBATMP=DVBATMP_$$TRIM($$TRUNC($P($G(^TMP("DVBA",$J,1,DVBAI+3)),":",2))) ;Phone
..S DVBAI=DVBAI+3
.;Save off CNH info and increment counters
.S @DVBADRPT@(DVBACNTR)=DVBATMP_$C(13),DVBACNTR=DVBACNTR+1
Q
;
;Input : DVBADLMTR - Delimiter to use between components
; DVBADRPT - Delimited Report container (Full Global Ref)
;Output: Delimited report info added to DVBADRPT
13(DVBADLMTR,DVBADRPT) ; CNH stays > 90 days Report Output
N DVBAI,DVBASTR,DVBACNTR,DVBATMP
;check to see if any results found
I ($G(^TMP("DVBA",$J,1,9))="") D Q
.S @DVBADRPT@(1)="No data found for parameter entered."_$C(13)
D COLHDR50(DVBADLMTR,DVBADRPT) ;delimited column header info
S DVBACNTR=$O(@DVBADRPT@("A"),-1)+1
S DVBAI=8 F S DVBAI=$O(^TMP("DVBA",$J,1,DVBAI)) Q:'+DVBAI D
.S DVBASTR=$G(^TMP("DVBA",$J,1,DVBAI))
.Q:(DVBASTR["***LOS =") ;end of report info
.;ignore blank lines OR report headers
.Q:((DVBASTR="")!($E(DVBASTR,1,7)="VETERAN")!($E(DVBASTR,1)=" ")!(DVBASTR[$C(10)))
.S DVBATMP=""
.;Veteran^Pt.ID^Marital St.^Adm. Date^LOS^Vendor
.S DVBATMP=""""_$$TRUNC($E(DVBASTR,1,17))_""""_DVBADLMTR_$$TRUNC($E(DVBASTR,19,31))_DVBADLMTR
.S DVBATMP=DVBATMP_$$TRUNC($E(DVBASTR,33,34))_DVBADLMTR_$$TRUNC($E(DVBASTR,36,44))_DVBADLMTR
.S DVBATMP=DVBATMP_$$TRIM($$TRUNC($E(DVBASTR,46,52)))_DVBADLMTR_$$TRUNC($E(DVBASTR,54,80))
.;Save off CNH info and increment counters
.S @DVBADRPT@(DVBACNTR)=DVBATMP_$C(13),DVBACNTR=DVBACNTR+1
Q
;
;Delimited Column header for CNH stays in excess of 90 days Report
COLHDR50(DVBADLMTR,DVBADRPT) ;
N DVBAHDR
S DVBAHDR="Veteran"_DVBADLMTR_"Pt. ID"_DVBADLMTR_"Marital St."_DVBADLMTR
S DVBAHDR=DVBAHDR_"Adm. Date"_DVBADLMTR_"LOS"_DVBADLMTR_"Vendor"
S @DVBADRPT@($O(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$C(13)
Q
;
;Delimited Column header for Nursing Home Roster Report
COLHDR52(DVBADLMTR,DVBADRPT) ;
N DVBAHDR
S DVBAHDR="Vendor Name"_DVBADLMTR_"Vendor ID"_DVBADLMTR_"Veteran Name"_DVBADLMTR
S DVBAHDR=DVBAHDR_"Veteran ID"_DVBADLMTR_"Admit DT"_DVBADLMTR_"Auth. To Date"
S @DVBADRPT@($O(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$C(13)
Q
;
;Delimited Column header for Admission/Discharge Report
COLHDR53(DVBADLMTR,DVBADRPT) ;
N DVBAHDR
S DVBAHDR="Patient Name"_DVBADLMTR_"Patient ID"_DVBADLMTR_"Eligibility"_DVBADLMTR
S DVBAHDR=DVBAHDR_"Activity Type"_DVBADLMTR_"Actvity Date/Time"_DVBADLMTR
S DVBAHDR=DVBAHDR_"Activity Sub Type"_DVBADLMTR_"CNH ID"_DVBADLMTR
S DVBAHDR=DVBAHDR_"CNH Name"_DVBADLMTR_"CNH Address"_DVBADLMTR_"CNH Phone #"
S @DVBADRPT@($O(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$C(13)
Q
;
;Input : DVBASTR - string to check for trailing spaces
;Output: String with trailing spaces, Line/Form feeds removed
TRUNC(DVBASTR) ;remove trailing spaces and line/form feeds in string
N DVBAX
Q:(DVBASTR="") ""
F DVBAX=$L(DVBASTR):-1:0 Q:(($E(DVBASTR,DVBAX,DVBAX)'=" ")&(($E(DVBASTR,DVBAX,DVBAX))'[$C(13))&($E(DVBASTR,DVBAX,DVBAX)'[$C(12)))
Q ($E(DVBASTR,1,DVBAX))
;
;Input : DVBASTR - string to check for leading spaces
;Output: String with leading spaces removed
TRIM(DVBASTR) ;remove leading spaces in string
N DVBAX
Q:(DVBASTR="") ""
F DVBAX=1:1:$L(DVBASTR) Q:($E(DVBASTR,DVBAX,DVBAX)?1AN)
Q ($E(DVBASTR,DVBAX,$L(DVBASTR)))
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBAB82D 6915 printed Dec 13, 2024@01:40:38 Page 2
DVBAB82D ;BHAMOI/JFW - CAPRI CNH DELIMITED REPORTS ; 9/24/10 1:59pm
+1 ;;2.7;AMIE;**149,185**;Apr 10, 1995;Build 18
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ;Input : DVBARPTID - Identifies report to delimit
+5 ; ^TMP("DVBA",$J,1) contains report in standard output
+6 ;Output: ^TMP("DVBADLMTD",$J) contains delimited report
+7 ;
DLMTRPT(DVBARPTID) ;delimit CNH report
+1 NEW DVBADLMTR,DVBADRPT
+2 SET DVBADLMTR=","
SET DVBADRPT=$NAME(^TMP("DVBADLMTD",$JOB))
+3 KILL @DVBADRPT
+4 ;create specific delimited report
+5 DO @(DVBARPTID_"(DVBADLMTR,DVBADRPT)")
+6 KILL ^TMP("DVBA",$JOB)
+7 QUIT
+8 ;
11(DVBADLMTR,DVBADRPT) ;Nursing Home Roster Report Output
+1 NEW DVBAI,DVBAX,DVBAQUIT,DVBASTR,DVBACNTR,DVBATMP,DVBAVEN,DVBAVENID
+2 ;check to see if any results found
+3 IF ('$DATA(^TMP("DVBA",$JOB,1,9)))
Begin DoDot:1
+4 SET @DVBADRPT@(1)="No data found."_$CHAR(13)
End DoDot:1
QUIT
+5 ;delimited column header info
DO COLHDR52(DVBADLMTR,DVBADRPT)
+6 SET DVBACNTR=$ORDER(@DVBADRPT@("A"),-1)+1
+7 SET DVBAI=8
FOR
SET DVBAI=$ORDER(^TMP("DVBA",$JOB,1,DVBAI))
if '+DVBAI
QUIT
Begin DoDot:1
+8 SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAI))
+9 ;ignore blank lines (Seperates Entries) OR report headers
+10 if ((DVBASTR="")!($EXTRACT(DVBASTR,1,11)="VENDOR NAME")!($EXTRACT(DVBASTR,1)=" ")!(DVBASTR[$CHAR(10)))
QUIT
+11 SET DVBAVEN=$$TRUNC($EXTRACT(DVBASTR,1,49))
SET DVBAVENID=$$TRUNC($EXTRACT(DVBASTR,51,80))
+12 SET DVBAQUIT=0
SET DVBAX=DVBAI
+13 ;quit inner loop when no more veterans for specific vendor
+14 ;or end of global array reached
+15 FOR
SET DVBAX=$ORDER(^TMP("DVBA",$JOB,1,DVBAX))
if ((DVBAQUIT)!('+DVBAX))
QUIT
Begin DoDot:2
+16 SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAX))
SET DVBATMP=""
+17 IF ($EXTRACT(DVBASTR,1)'=" ")
SET DVBAQUIT=1
SET DVBAI=DVBAX
QUIT
+18 ;Vendor Name^Vendor ID
+19 SET DVBATMP=DVBAVEN_DVBADLMTR_DVBAVENID_DVBADLMTR
+20 ;Veteran Name^Veteran ID^Admit DT^Auth. To Date
+21 SET DVBATMP=DVBATMP_""""_$$TRUNC($EXTRACT(DVBASTR,5,36))_""""_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,38,52))_DVBADLMTR
+22 SET DVBATMP=DVBATMP_$$TRIM($$TRUNC($EXTRACT(DVBASTR,54,64)))_DVBADLMTR_$$TRIM($$TRUNC($EXTRACT(DVBASTR,66,80)))
+23 ;Save off CNH info and increment counters
+24 SET @DVBADRPT@(DVBACNTR)=DVBATMP_$CHAR(13)
SET DVBACNTR=DVBACNTR+1
End DoDot:2
End DoDot:1
+25 QUIT
+26 ;
12(DVBADLMTR,DVBADRPT) ;CNH Admission/Discharge Report Output
+1 NEW DVBAI,DVBASTR,DVBACNTR,DVBATMP
+2 ;check to see if any results found
+3 IF ('$DATA(^TMP("DVBA",$JOB,1,7)))
Begin DoDot:1
+4 SET @DVBADRPT@(1)="No data found for parameters entered."_$CHAR(13)
End DoDot:1
QUIT
+5 ;delimited column header info
DO COLHDR53(DVBADLMTR,DVBADRPT)
+6 SET DVBACNTR=$ORDER(@DVBADRPT@("A"),-1)+1
+7 SET DVBAI=6
FOR
SET DVBAI=$ORDER(^TMP("DVBA",$JOB,1,DVBAI))
if '+DVBAI
QUIT
Begin DoDot:1
+8 SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAI))
+9 ;ignore blank lines (Seperates Entries) OR report headers
+10 if ((DVBASTR="")!($EXTRACT(DVBASTR,1)=" ")!(DVBASTR[$CHAR(10)))
QUIT
+11 SET DVBATMP=""
+12 ;Patient Name^Patient ID^Eligibility
+13 ;S DVBATMP=$$TRUNC($E(DVBASTR,1,31))_DVBADLMTR_$$TRUNC($E(DVBASTR,33,47))_DVBADLMTR_$$TRUNC($E(DVBASTR,49,80))_DVBADLMTR
+14 SET DVBATMP=""""_$$TRUNC($EXTRACT(DVBASTR,1,31))_""""_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,33,47))_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,49,80))_DVBADLMTR
+15 SET DVBAI=DVBAI+1
SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAI))
+16 ;Activity Type^Date^Date/Time^Sub Type
+17 SET DVBATMP=DVBATMP_$PIECE($$TRIM(DVBASTR)," ")_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,20,35))_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,53,80))_DVBADLMTR
+18 SET DVBAI=DVBAI+1
SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAI))
+19 ;Nursing Home Information (ID^Name^Address^Phone) is optional
+20 if (DVBASTR="")
Begin DoDot:2
+21 SET DVBATMP=DVBATMP_DVBADLMTR_DVBADLMTR_DVBADLMTR
End DoDot:2
+22 if (DVBASTR'="")
Begin DoDot:2
+23 SET DVBATMP=DVBATMP_$$TRUNC($EXTRACT(DVBASTR,43,80))_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,11,41))_DVBADLMTR
+24 SET DVBASTR=$$TRIM($$TRUNC($GET(^TMP("DVBA",$JOB,1,DVBAI+1))))
+25 ;Address 1
if (DVBASTR]"")
SET DVBATMP=DVBATMP_DVBASTR_" "
+26 ;Address 2
SET DVBATMP=DVBATMP_$$TRIM($$TRUNC($GET(^TMP("DVBA",$JOB,1,DVBAI+2))))_DVBADLMTR
+27 ;Phone
SET DVBATMP=DVBATMP_$$TRIM($$TRUNC($PIECE($GET(^TMP("DVBA",$JOB,1,DVBAI+3)),":",2)))
+28 SET DVBAI=DVBAI+3
End DoDot:2
+29 ;Save off CNH info and increment counters
+30 SET @DVBADRPT@(DVBACNTR)=DVBATMP_$CHAR(13)
SET DVBACNTR=DVBACNTR+1
End DoDot:1
+31 QUIT
+32 ;
+33 ;Input : DVBADLMTR - Delimiter to use between components
+34 ; DVBADRPT - Delimited Report container (Full Global Ref)
+35 ;Output: Delimited report info added to DVBADRPT
13(DVBADLMTR,DVBADRPT) ; CNH stays > 90 days Report Output
+1 NEW DVBAI,DVBASTR,DVBACNTR,DVBATMP
+2 ;check to see if any results found
+3 IF ($GET(^TMP("DVBA",$JOB,1,9))="")
Begin DoDot:1
+4 SET @DVBADRPT@(1)="No data found for parameter entered."_$CHAR(13)
End DoDot:1
QUIT
+5 ;delimited column header info
DO COLHDR50(DVBADLMTR,DVBADRPT)
+6 SET DVBACNTR=$ORDER(@DVBADRPT@("A"),-1)+1
+7 SET DVBAI=8
FOR
SET DVBAI=$ORDER(^TMP("DVBA",$JOB,1,DVBAI))
if '+DVBAI
QUIT
Begin DoDot:1
+8 SET DVBASTR=$GET(^TMP("DVBA",$JOB,1,DVBAI))
+9 ;end of report info
if (DVBASTR["***LOS =")
QUIT
+10 ;ignore blank lines OR report headers
+11 if ((DVBASTR="")!($EXTRACT(DVBASTR,1,7)="VETERAN")!($EXTRACT(DVBASTR,1)=" ")!(DVBASTR[$CHAR(10)))
QUIT
+12 SET DVBATMP=""
+13 ;Veteran^Pt.ID^Marital St.^Adm. Date^LOS^Vendor
+14 SET DVBATMP=""""_$$TRUNC($EXTRACT(DVBASTR,1,17))_""""_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,19,31))_DVBADLMTR
+15 SET DVBATMP=DVBATMP_$$TRUNC($EXTRACT(DVBASTR,33,34))_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,36,44))_DVBADLMTR
+16 SET DVBATMP=DVBATMP_$$TRIM($$TRUNC($EXTRACT(DVBASTR,46,52)))_DVBADLMTR_$$TRUNC($EXTRACT(DVBASTR,54,80))
+17 ;Save off CNH info and increment counters
+18 SET @DVBADRPT@(DVBACNTR)=DVBATMP_$CHAR(13)
SET DVBACNTR=DVBACNTR+1
End DoDot:1
+19 QUIT
+20 ;
+21 ;Delimited Column header for CNH stays in excess of 90 days Report
COLHDR50(DVBADLMTR,DVBADRPT) ;
+1 NEW DVBAHDR
+2 SET DVBAHDR="Veteran"_DVBADLMTR_"Pt. ID"_DVBADLMTR_"Marital St."_DVBADLMTR
+3 SET DVBAHDR=DVBAHDR_"Adm. Date"_DVBADLMTR_"LOS"_DVBADLMTR_"Vendor"
+4 SET @DVBADRPT@($ORDER(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$CHAR(13)
+5 QUIT
+6 ;
+7 ;Delimited Column header for Nursing Home Roster Report
COLHDR52(DVBADLMTR,DVBADRPT) ;
+1 NEW DVBAHDR
+2 SET DVBAHDR="Vendor Name"_DVBADLMTR_"Vendor ID"_DVBADLMTR_"Veteran Name"_DVBADLMTR
+3 SET DVBAHDR=DVBAHDR_"Veteran ID"_DVBADLMTR_"Admit DT"_DVBADLMTR_"Auth. To Date"
+4 SET @DVBADRPT@($ORDER(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$CHAR(13)
+5 QUIT
+6 ;
+7 ;Delimited Column header for Admission/Discharge Report
COLHDR53(DVBADLMTR,DVBADRPT) ;
+1 NEW DVBAHDR
+2 SET DVBAHDR="Patient Name"_DVBADLMTR_"Patient ID"_DVBADLMTR_"Eligibility"_DVBADLMTR
+3 SET DVBAHDR=DVBAHDR_"Activity Type"_DVBADLMTR_"Actvity Date/Time"_DVBADLMTR
+4 SET DVBAHDR=DVBAHDR_"Activity Sub Type"_DVBADLMTR_"CNH ID"_DVBADLMTR
+5 SET DVBAHDR=DVBAHDR_"CNH Name"_DVBADLMTR_"CNH Address"_DVBADLMTR_"CNH Phone #"
+6 SET @DVBADRPT@($ORDER(@DVBADRPT@("A"),-1)+1)=DVBAHDR_$CHAR(13)
+7 QUIT
+8 ;
+9 ;Input : DVBASTR - string to check for trailing spaces
+10 ;Output: String with trailing spaces, Line/Form feeds removed
TRUNC(DVBASTR) ;remove trailing spaces and line/form feeds in string
+1 NEW DVBAX
+2 if (DVBASTR="")
QUIT ""
+3 FOR DVBAX=$LENGTH(DVBASTR):-1:0
if (($EXTRACT(DVBASTR,DVBAX,DVBAX)'=" ")&(($EXTRACT(DVBASTR,DVBAX,DVBAX))'[$CHAR(13))&($EXTRACT(DVBASTR,DVBAX,DVBAX)'[$CHAR(12)))
QUIT
+4 QUIT ($EXTRACT(DVBASTR,1,DVBAX))
+5 ;
+6 ;Input : DVBASTR - string to check for leading spaces
+7 ;Output: String with leading spaces removed
TRIM(DVBASTR) ;remove leading spaces in string
+1 NEW DVBAX
+2 if (DVBASTR="")
QUIT ""
+3 FOR DVBAX=1:1:$LENGTH(DVBASTR)
if ($EXTRACT(DVBASTR,DVBAX,DVBAX)?1AN)
QUIT
+4 QUIT ($EXTRACT(DVBASTR,DVBAX,$LENGTH(DVBASTR)))