PXRMTEXT ; SLC/PKR - Text formatting utility routines. ;03/25/2009
;;2.0;CLINICAL REMINDERS;**6,12**;Feb 04, 2005;Build 73
;
;============================================
NEWLINE ;Put TEXT on a new line to the output, make sure it does not end
;with a " ".
N TLEN
;If there is no text in TEXT don't do anything.
I TEXT=INDSTR Q
S TLEN=$L(TEXT)
I $E(TEXT,TLEN)=" " S TEXT=$E(TEXT,1,TLEN-1)
S NOUT=NOUT+1,TEXTOUT(NOUT)=TEXT
S TEXT=INDSTR,CLEN=0
Q
;
;============================================
BLANK ;Add a blank line (line containing just " ") to the output.
S NOUT=NOUT+1,TEXTOUT(NOUT)=" "
S TEXT=INDSTR,CLEN=0
Q
;
;============================================
CHECKLEN(WORD) ;Check to see if adding the next word makes the line too long.
;If it does add it to the output and start a new line.
N LENWORD,SPLEFT,TLEN
S LENWORD=$L(WORD)
S TLEN=CLEN+LENWORD
I TLEN'>WIDTH D Q
. I WORD'[" " S WORD=WORD_" ",LENWORD=LENWORD+1
. S TEXT=TEXT_WORD,CLEN=CLEN+LENWORD
;Width exceeded.
;If at least 70% of the width is filled go ahead and break.
I CLEN>(0.7*WIDTH) D Q
. D NEWLINE
. I WORD'[" " S WORD=WORD_" ",LENWORD=LENWORD+1
. S TEXT=INDSTR_WORD,CLEN=LENWORD
S SPLEFT=WIDTH-CLEN+1
I (LENWORD-SPLEFT)<2 D Q
. D NEWLINE
. I WORD'[" " S WORD=WORD_" ",LENWORD=LENWORD+1
. S TEXT=INDSTR_WORD,CLEN=LENWORD
S TEXT=TEXT_$E(WORD,1,SPLEFT-1)
D NEWLINE
S WORD=$E(WORD,SPLEFT,LENWORD)
D CHECKLEN(WORD)
Q
;
;============================================
COLFMT(FMTSTR,TEXTSTR,PC,NL,OUTPUT) ;Columnar text formatter.
;FMTSTR - format string; ^ separated string for each column in the
;output. 35R2 defines a right justified column 35 characters wide
;with 2 blank spaces following. Columns can be centered (C) left
;justified (L) or right justified (R).
;TEXTSTR - string to be formated, text for each column separated by "^"
;PC - the pad character
;NL - number of lines of output
;OUTPUT - array containing output lines.
N COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW
N SP,TEMP,TEXT,TEXTOUT,WIDTH,WPSP
S NCOL=$L(FMTSTR,U),NROW=1
F IND=1:1:NCOL D
. S FMT=$P(FMTSTR,U,IND)
. S JUS(IND)=$S(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
. S WIDTH(IND)=$P(FMT,JUS(IND),1)
. S SP(IND)=$P(FMT,JUS(IND),2)
. S WPSP(IND)=WIDTH(IND)+SP(IND)
F IND=1:1:NCOL D
. S ENTRY=$S(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
. S TEMP=$P(TEXTSTR,U,IND)
. S LEN=$L(TEMP)
. I LEN'>WIDTH(IND) D
.. S TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
.. S COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
. I LEN>WIDTH(IND) D
.. D FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
.. F JND=1:1:NLO D
... S TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
... S COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
.. I NLO>NROW S NROW=NLO
F IND=1:1:NROW D
. S TEXT=""
. F JND=1:1:NCOL D
.. I $D(COLOUT(IND,JND)) S TEXT=TEXT_COLOUT(IND,JND)
.. E S TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
. S OUTPUT(IND)=TEXT
S NL=NROW
Q
;
;============================================
COLFMTA(FMTSTR,INPUT,PC,NL,OUTPUT) ;Columnar text formatter.
;Array version of COLFMT. Input array is ^TMP($J,INPUT,M) and
;output is ^TMP(OUTPUT,$J,N,0).
N COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW,NUM
N SP,TEMP,TEXT,WIDTH,WPSP
S NCOL=$L(FMTSTR,U)
F IND=1:1:NCOL D
. S FMT=$P(FMTSTR,U,IND)
. S JUS(IND)=$S(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
. S WIDTH(IND)=$P(FMT,JUS(IND),1)
. S SP(IND)=$P(FMT,JUS(IND),2)
. S WPSP(IND)=WIDTH(IND)+SP(IND)
S NL=0,NUM=""
F S NUM=$O(^TMP($J,INPUT,NUM)) Q:NUM="" D
. K COLOUT
. S NROW=1
. F IND=1:1:NCOL D
.. S ENTRY=$S(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
.. S TEMP=$P(^TMP($J,INPUT,NUM),U,IND)
.. S LEN=$L(TEMP)
.. I LEN'>WIDTH(IND) D
... S TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
... S COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
.. I LEN>WIDTH(IND) D
... D FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
... F JND=1:1:NLO D
.... S TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
.... S COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
... I NLO>NROW S NROW=NLO
. F IND=1:1:NROW D
.. S TEXT=""
.. F JND=1:1:NCOL D
... I $D(COLOUT(IND,JND)) S TEXT=TEXT_COLOUT(IND,JND)
... E S TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
.. S NL=NL+1,^TMP(OUTPUT,$J,NL,0)=TEXT
Q
;
;============================================
FORMAT(LM,RM,NIN,TEXTIN,NOUT,TEXTOUT) ;Format the text in TEXTIN so it has
;a left margin of LM and a right margin of RM. The formatted text
;is in TEXTOUT. "\\" is the end of line marker. Lines ending with
;"\\" will not have anything appended to them. A blank line can
;be created with a line containing just "\\". Lines containing
;nothing but whitespace will also act like a "\\".
I NIN=0 S NOUT=0 Q
N ACHAR,ALLWSP,CHAR,CLEN,END,IND,INDENT,INDSTR,JND
N LWSP,NWSP,START,TEMP,TEXT,TLEN,WIDTH,W1,W2,WORD
;Catalog the whitespace so we have places to break and look for
;end of line markers.
F IND=1:1:NIN D
. S TEMP=TEXTIN(IND)
. I TEMP="" S TEMP=" "
. S TLEN=$L(TEMP)
. S ALLWSP=1,NWSP=0
. F JND=1:1:TLEN D
.. S CHAR=$E(TEMP,JND)
.. S ACHAR=$A(CHAR)
.. I ACHAR>32 S ALLWSP=0
.. E S NWSP=NWSP+1,LWSP(IND,NWSP)=JND
.;Mark the end of the line unless it is already whitespace.
. I ACHAR>32 S NWSP=NWSP+1,LWSP(IND,NWSP)=TLEN
. S LWSP(IND)=NWSP
. I ALLWSP S LWSP(IND,"ALLWSP")=""
I LM<1 S LM=1
S WIDTH=RM-LM+1
S INDENT=LM-1
S INDSTR=""
F IND=1:1:INDENT S INDSTR=INDSTR_" "
S NOUT=0
S TEXT=INDSTR,CLEN=0
F IND=1:1:NIN D
.;If there is a blank line force whatever is in TEXT to be output by
.;calling NEWLINE and then add the blank.
. I $D(LWSP(IND,"ALLWSP")) D NEWLINE,BLANK Q
. S TEMP=TEXTIN(IND)
. S (END,NWSP)=0
. F NWSP=1:1:LWSP(IND) D
.. S START=END+1,END=LWSP(IND,NWSP)
.. S WORD=$E(TEMP,START,END)
.. I WORD["\\" D Q
... S W1=$P(WORD,"\\",1)
... D CHECKLEN(W1)
... D NEWLINE
... S W2=$P(WORD,"\\",2)
... I W2'="" D CHECKLEN(W2)
.. D CHECKLEN(WORD)
;Output the last line.
D NEWLINE
Q
;
;============================================
FORMATS(LM,RM,TEXTLINE,NOUT,TEXTOUT) ;Take a single line of input text
;and format it.
N TEXTIN
S TEXTIN(1)=TEXTLINE
D FORMAT(LM,RM,1,.TEXTIN,.NOUT,.TEXTOUT)
Q
;
;============================================
LMFMTSTR(VALMDDF,JSTR) ;The List Manager variable VALMDDF contains the
;list template caption column formatting information. It contains
;the starting column and the width in the form
;VALMDDF(COLUMN NAME)=COLUMN NAME^COLUMN^WIDTH^CAPTION^VIDEO^SCROLL
;LOCK. JUSSTR, which is optional,is the justification for each column;
;(L=left, C=center, R=right) the default is center. Use this information
;to build the format string for the column formatter COLFMT.
N CN,COL,FMTSTR,IND,JC,JUSSTR,PLCOL,SCOL,SP,TEMP,WIDTH
;Sort by columns
S IND=""
F S IND=$O(VALMDDF(IND)) Q:IND="" D
. S TEMP=VALMDDF(IND)
. S COL($P(TEMP,U,2))=$P(TEMP,U,3)
S JUSSTR=$G(JSTR)
S (CN,PLCOL,SCOL,SP)=0
S FMTSTR=""
S SCOL=0
F S SCOL=$O(COL(SCOL)) Q:SCOL="" D
. S CN=CN+1
. S WIDTH=COL(SCOL)
. I CN=1 S PLCOL=WIDTH
. E S SP=SCOL-PLCOL-1,FMTSTR=FMTSTR_SP_U,PLCOL=SCOL+WIDTH-1
. S JC=$E(JUSSTR,CN)
. I JC="" S JC="C"
. S TEMP=WIDTH_JC
. S FMTSTR=FMTSTR_TEMP
Q FMTSTR
;
PXRMTEXT ; SLC/PKR - Text formatting utility routines. ;03/25/2009
+1 ;;2.0;CLINICAL REMINDERS;**6,12**;Feb 04, 2005;Build 73
+2 ;
+3 ;============================================
NEWLINE ;Put TEXT on a new line to the output, make sure it does not end
+1 ;with a " ".
+2 NEW TLEN
+3 ;If there is no text in TEXT don't do anything.
+4 IF TEXT=INDSTR
QUIT
+5 SET TLEN=$LENGTH(TEXT)
+6 IF $EXTRACT(TEXT,TLEN)=" "
SET TEXT=$EXTRACT(TEXT,1,TLEN-1)
+7 SET NOUT=NOUT+1
SET TEXTOUT(NOUT)=TEXT
+8 SET TEXT=INDSTR
SET CLEN=0
+9 QUIT
+10 ;
+11 ;============================================
BLANK ;Add a blank line (line containing just " ") to the output.
+1 SET NOUT=NOUT+1
SET TEXTOUT(NOUT)=" "
+2 SET TEXT=INDSTR
SET CLEN=0
+3 QUIT
+4 ;
+5 ;============================================
CHECKLEN(WORD) ;Check to see if adding the next word makes the line too long.
+1 ;If it does add it to the output and start a new line.
+2 NEW LENWORD,SPLEFT,TLEN
+3 SET LENWORD=$LENGTH(WORD)
+4 SET TLEN=CLEN+LENWORD
+5 IF TLEN'>WIDTH
Begin DoDot:1
+6 IF WORD'[" "
SET WORD=WORD_" "
SET LENWORD=LENWORD+1
+7 SET TEXT=TEXT_WORD
SET CLEN=CLEN+LENWORD
End DoDot:1
QUIT
+8 ;Width exceeded.
+9 ;If at least 70% of the width is filled go ahead and break.
+10 IF CLEN>(0.7*WIDTH)
Begin DoDot:1
+11 DO NEWLINE
+12 IF WORD'[" "
SET WORD=WORD_" "
SET LENWORD=LENWORD+1
+13 SET TEXT=INDSTR_WORD
SET CLEN=LENWORD
End DoDot:1
QUIT
+14 SET SPLEFT=WIDTH-CLEN+1
+15 IF (LENWORD-SPLEFT)<2
Begin DoDot:1
+16 DO NEWLINE
+17 IF WORD'[" "
SET WORD=WORD_" "
SET LENWORD=LENWORD+1
+18 SET TEXT=INDSTR_WORD
SET CLEN=LENWORD
End DoDot:1
QUIT
+19 SET TEXT=TEXT_$EXTRACT(WORD,1,SPLEFT-1)
+20 DO NEWLINE
+21 SET WORD=$EXTRACT(WORD,SPLEFT,LENWORD)
+22 DO CHECKLEN(WORD)
+23 QUIT
+24 ;
+25 ;============================================
COLFMT(FMTSTR,TEXTSTR,PC,NL,OUTPUT) ;Columnar text formatter.
+1 ;FMTSTR - format string; ^ separated string for each column in the
+2 ;output. 35R2 defines a right justified column 35 characters wide
+3 ;with 2 blank spaces following. Columns can be centered (C) left
+4 ;justified (L) or right justified (R).
+5 ;TEXTSTR - string to be formated, text for each column separated by "^"
+6 ;PC - the pad character
+7 ;NL - number of lines of output
+8 ;OUTPUT - array containing output lines.
+9 NEW COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW
+10 NEW SP,TEMP,TEXT,TEXTOUT,WIDTH,WPSP
+11 SET NCOL=$LENGTH(FMTSTR,U)
SET NROW=1
+12 FOR IND=1:1:NCOL
Begin DoDot:1
+13 SET FMT=$PIECE(FMTSTR,U,IND)
+14 SET JUS(IND)=$SELECT(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
+15 SET WIDTH(IND)=$PIECE(FMT,JUS(IND),1)
+16 SET SP(IND)=$PIECE(FMT,JUS(IND),2)
+17 SET WPSP(IND)=WIDTH(IND)+SP(IND)
End DoDot:1
+18 FOR IND=1:1:NCOL
Begin DoDot:1
+19 SET ENTRY=$SELECT(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
+20 SET TEMP=$PIECE(TEXTSTR,U,IND)
+21 SET LEN=$LENGTH(TEMP)
+22 IF LEN'>WIDTH(IND)
Begin DoDot:2
+23 SET TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
+24 SET COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
End DoDot:2
+25 IF LEN>WIDTH(IND)
Begin DoDot:2
+26 DO FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
+27 FOR JND=1:1:NLO
Begin DoDot:3
+28 SET TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
+29 SET COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
End DoDot:3
+30 IF NLO>NROW
SET NROW=NLO
End DoDot:2
End DoDot:1
+31 FOR IND=1:1:NROW
Begin DoDot:1
+32 SET TEXT=""
+33 FOR JND=1:1:NCOL
Begin DoDot:2
+34 IF $DATA(COLOUT(IND,JND))
SET TEXT=TEXT_COLOUT(IND,JND)
+35 IF '$TEST
SET TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
End DoDot:2
+36 SET OUTPUT(IND)=TEXT
End DoDot:1
+37 SET NL=NROW
+38 QUIT
+39 ;
+40 ;============================================
COLFMTA(FMTSTR,INPUT,PC,NL,OUTPUT) ;Columnar text formatter.
+1 ;Array version of COLFMT. Input array is ^TMP($J,INPUT,M) and
+2 ;output is ^TMP(OUTPUT,$J,N,0).
+3 NEW COLOUT,ENTRY,FMT,JND,JUS,IND,LEN,NCOL,NLO,NROW,NUM
+4 NEW SP,TEMP,TEXT,WIDTH,WPSP
+5 SET NCOL=$LENGTH(FMTSTR,U)
+6 FOR IND=1:1:NCOL
Begin DoDot:1
+7 SET FMT=$PIECE(FMTSTR,U,IND)
+8 SET JUS(IND)=$SELECT(FMT["C":"C",FMT["L":"L",FMT["R":"R",1:"C")
+9 SET WIDTH(IND)=$PIECE(FMT,JUS(IND),1)
+10 SET SP(IND)=$PIECE(FMT,JUS(IND),2)
+11 SET WPSP(IND)=WIDTH(IND)+SP(IND)
End DoDot:1
+12 SET NL=0
SET NUM=""
+13 FOR
SET NUM=$ORDER(^TMP($JOB,INPUT,NUM))
IF NUM=""
QUIT
Begin DoDot:1
+14 KILL COLOUT
+15 SET NROW=1
+16 FOR IND=1:1:NCOL
Begin DoDot:2
+17 SET ENTRY=$SELECT(JUS(IND)="C":"CJ",JUS(IND)="L":"LJ",JUS(IND)="R":"RJ")
+18 SET TEMP=$PIECE(^TMP($JOB,INPUT,NUM),U,IND)
+19 SET LEN=$LENGTH(TEMP)
+20 IF LEN'>WIDTH(IND)
Begin DoDot:3
+21 SET TEMP=$$@ENTRY^XLFSTR(TEMP,WIDTH(IND),PC)
+22 SET COLOUT(1,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
End DoDot:3
+23 IF LEN>WIDTH(IND)
Begin DoDot:3
+24 DO FORMATS(1,WIDTH(IND),TEMP,.NLO,.TEXTOUT)
+25 FOR JND=1:1:NLO
Begin DoDot:4
+26 SET TEMP=$$@ENTRY^XLFSTR(TEXTOUT(JND),WIDTH(IND),PC)
+27 SET COLOUT(JND,IND)=TEMP_$$LJ^XLFSTR("",SP(IND)," ")
End DoDot:4
+28 IF NLO>NROW
SET NROW=NLO
End DoDot:3
End DoDot:2
+29 FOR IND=1:1:NROW
Begin DoDot:2
+30 SET TEXT=""
+31 FOR JND=1:1:NCOL
Begin DoDot:3
+32 IF $DATA(COLOUT(IND,JND))
SET TEXT=TEXT_COLOUT(IND,JND)
+33 IF '$TEST
SET TEXT=TEXT_$$LJ^XLFSTR("",(WPSP(JND))," ")
End DoDot:3
+34 SET NL=NL+1
SET ^TMP(OUTPUT,$JOB,NL,0)=TEXT
End DoDot:2
End DoDot:1
+35 QUIT
+36 ;
+37 ;============================================
FORMAT(LM,RM,NIN,TEXTIN,NOUT,TEXTOUT) ;Format the text in TEXTIN so it has
+1 ;a left margin of LM and a right margin of RM. The formatted text
+2 ;is in TEXTOUT. "\\" is the end of line marker. Lines ending with
+3 ;"\\" will not have anything appended to them. A blank line can
+4 ;be created with a line containing just "\\". Lines containing
+5 ;nothing but whitespace will also act like a "\\".
+6 IF NIN=0
SET NOUT=0
QUIT
+7 NEW ACHAR,ALLWSP,CHAR,CLEN,END,IND,INDENT,INDSTR,JND
+8 NEW LWSP,NWSP,START,TEMP,TEXT,TLEN,WIDTH,W1,W2,WORD
+9 ;Catalog the whitespace so we have places to break and look for
+10 ;end of line markers.
+11 FOR IND=1:1:NIN
Begin DoDot:1
+12 SET TEMP=TEXTIN(IND)
+13 IF TEMP=""
SET TEMP=" "
+14 SET TLEN=$LENGTH(TEMP)
+15 SET ALLWSP=1
SET NWSP=0
+16 FOR JND=1:1:TLEN
Begin DoDot:2
+17 SET CHAR=$EXTRACT(TEMP,JND)
+18 SET ACHAR=$ASCII(CHAR)
+19 IF ACHAR>32
SET ALLWSP=0
+20 IF '$TEST
SET NWSP=NWSP+1
SET LWSP(IND,NWSP)=JND
End DoDot:2
+21 ;Mark the end of the line unless it is already whitespace.
+22 IF ACHAR>32
SET NWSP=NWSP+1
SET LWSP(IND,NWSP)=TLEN
+23 SET LWSP(IND)=NWSP
+24 IF ALLWSP
SET LWSP(IND,"ALLWSP")=""
End DoDot:1
+25 IF LM<1
SET LM=1
+26 SET WIDTH=RM-LM+1
+27 SET INDENT=LM-1
+28 SET INDSTR=""
+29 FOR IND=1:1:INDENT
SET INDSTR=INDSTR_" "
+30 SET NOUT=0
+31 SET TEXT=INDSTR
SET CLEN=0
+32 FOR IND=1:1:NIN
Begin DoDot:1
+33 ;If there is a blank line force whatever is in TEXT to be output by
+34 ;calling NEWLINE and then add the blank.
+35 IF $DATA(LWSP(IND,"ALLWSP"))
DO NEWLINE
DO BLANK
QUIT
+36 SET TEMP=TEXTIN(IND)
+37 SET (END,NWSP)=0
+38 FOR NWSP=1:1:LWSP(IND)
Begin DoDot:2
+39 SET START=END+1
SET END=LWSP(IND,NWSP)
+40 SET WORD=$EXTRACT(TEMP,START,END)
+41 IF WORD["\\"
Begin DoDot:3
+42 SET W1=$PIECE(WORD,"\\",1)
+43 DO CHECKLEN(W1)
+44 DO NEWLINE
+45 SET W2=$PIECE(WORD,"\\",2)
+46 IF W2'=""
DO CHECKLEN(W2)
End DoDot:3
QUIT
+47 DO CHECKLEN(WORD)
End DoDot:2
End DoDot:1
+48 ;Output the last line.
+49 DO NEWLINE
+50 QUIT
+51 ;
+52 ;============================================
FORMATS(LM,RM,TEXTLINE,NOUT,TEXTOUT) ;Take a single line of input text
+1 ;and format it.
+2 NEW TEXTIN
+3 SET TEXTIN(1)=TEXTLINE
+4 DO FORMAT(LM,RM,1,.TEXTIN,.NOUT,.TEXTOUT)
+5 QUIT
+6 ;
+7 ;============================================
LMFMTSTR(VALMDDF,JSTR) ;The List Manager variable VALMDDF contains the
+1 ;list template caption column formatting information. It contains
+2 ;the starting column and the width in the form
+3 ;VALMDDF(COLUMN NAME)=COLUMN NAME^COLUMN^WIDTH^CAPTION^VIDEO^SCROLL
+4 ;LOCK. JUSSTR, which is optional,is the justification for each column;
+5 ;(L=left, C=center, R=right) the default is center. Use this information
+6 ;to build the format string for the column formatter COLFMT.
+7 NEW CN,COL,FMTSTR,IND,JC,JUSSTR,PLCOL,SCOL,SP,TEMP,WIDTH
+8 ;Sort by columns
+9 SET IND=""
+10 FOR
SET IND=$ORDER(VALMDDF(IND))
IF IND=""
QUIT
Begin DoDot:1
+11 SET TEMP=VALMDDF(IND)
+12 SET COL($PIECE(TEMP,U,2))=$PIECE(TEMP,U,3)
End DoDot:1
+13 SET JUSSTR=$GET(JSTR)
+14 SET (CN,PLCOL,SCOL,SP)=0
+15 SET FMTSTR=""
+16 SET SCOL=0
+17 FOR
SET SCOL=$ORDER(COL(SCOL))
IF SCOL=""
QUIT
Begin DoDot:1
+18 SET CN=CN+1
+19 SET WIDTH=COL(SCOL)
+20 IF CN=1
SET PLCOL=WIDTH
+21 IF '$TEST
SET SP=SCOL-PLCOL-1
SET FMTSTR=FMTSTR_SP_U
SET PLCOL=SCOL+WIDTH-1
+22 SET JC=$EXTRACT(JUSSTR,CN)
+23 IF JC=""
SET JC="C"
+24 SET TEMP=WIDTH_JC
+25 SET FMTSTR=FMTSTR_TEMP
End DoDot:1
+26 QUIT FMTSTR
+27 ;