PSOQUTIL ;HINES/RMS - MISCELLANEOUS UTILITIES ; 30 Nov 2007 7:59 AM
;;7.0;OUTPATIENT PHARMACY;**294**;DEC 1997;Build 13
;
LSIG(SIG) ;EXPAND A SIG
S SGY="" F P=1:1:$L(SIG," ") S X=$P(SIG," ",P) D:X]"" ;
.I $D(^PS(51,"A",X)) S %=^(X),X=$P(%,"^") I $P(%,"^",2)]"" S Y=$P(SIG,"",P-1),Y=$E(Y,$L(Y)) S:Y>1 X=$P(%,"^",2)
.S SGY=SGY_X_" "
Q SGY
WRAPTEXT(TEXT,LIMIT,CSPACES) ;
;;FUNCTION TO DISPLAY (WRITE) TEXT WRAPPED TO A CERTAIN COLUMN LENGTH
;;DEFAULT=74 CHARACTERS WITH NO SPACES IN FRONT
N WORDS,COUNT,LINE,NEXTWORD
Q:$G(TEXT)']"" ""
S LIMIT=$G(LIMIT,74)
S CSPACES=$S($G(CSPACES):CSPACES,1:0)
S WORDS=$L(TEXT," ")
W !,$$REPEAT^XLFSTR(" ",CSPACES)
F COUNT=1:1:WORDS D
. S NEXTWORD=$P(TEXT," ",COUNT)
. Q:NEXTWORD="" ;TO REMOVE LEADING OR DOUBLE SPACES
. S LINE=$G(LINE)_NEXTWORD_" "
. I $L($G(LINE))>LIMIT&(COUNT'=WORDS) W !,$$REPEAT^XLFSTR(" ",CSPACES) K LINE
. W NEXTWORD_" "
Q
PSOQUTIL ;HINES/RMS - MISCELLANEOUS UTILITIES ; 30 Nov 2007 7:59 AM
+1 ;;7.0;OUTPATIENT PHARMACY;**294**;DEC 1997;Build 13
+2 ;
LSIG(SIG) ;EXPAND A SIG
+1 ;
SET SGY=""
FOR P=1:1:$LENGTH(SIG," ")
SET X=$PIECE(SIG," ",P)
IF X]""
Begin DoDot:1
+2 IF $DATA(^PS(51,"A",X))
SET %=^(X)
SET X=$PIECE(%,"^")
IF $PIECE(%,"^",2)]""
SET Y=$PIECE(SIG,"",P-1)
SET Y=$EXTRACT(Y,$LENGTH(Y))
IF Y>1
SET X=$PIECE(%,"^",2)
+3 SET SGY=SGY_X_" "
End DoDot:1
+4 QUIT SGY
WRAPTEXT(TEXT,LIMIT,CSPACES) ;
+1 ;;FUNCTION TO DISPLAY (WRITE) TEXT WRAPPED TO A CERTAIN COLUMN LENGTH
+2 ;;DEFAULT=74 CHARACTERS WITH NO SPACES IN FRONT
+3 NEW WORDS,COUNT,LINE,NEXTWORD
+4 IF $GET(TEXT)']""
QUIT ""
+5 SET LIMIT=$GET(LIMIT,74)
+6 SET CSPACES=$SELECT($GET(CSPACES):CSPACES,1:0)
+7 SET WORDS=$LENGTH(TEXT," ")
+8 WRITE !,$$REPEAT^XLFSTR(" ",CSPACES)
+9 FOR COUNT=1:1:WORDS
Begin DoDot:1
+10 SET NEXTWORD=$PIECE(TEXT," ",COUNT)
+11 ;TO REMOVE LEADING OR DOUBLE SPACES
IF NEXTWORD=""
QUIT
+12 SET LINE=$GET(LINE)_NEXTWORD_" "
+13 IF $LENGTH($GET(LINE))>LIMIT&(COUNT'=WORDS)
WRITE !,$$REPEAT^XLFSTR(" ",CSPACES)
KILL LINE
+14 WRITE NEXTWORD_" "
End DoDot:1
+15 QUIT