PSOQUTIL ;HINES/RMS - MISCELLANEOUS UTILITIES ; 30 Nov 2007 7:59 AM
;;7.0;OUTPATIENT PHARMACY;**294,282,631**;DEC 1997;Build 5
;
LSIG(SIG) ;EXPAND A SIG
S SGY="" F P=1:1:$L(SIG," ") S X=$P(SIG," ",P) D:X]"" ;
.;PSO*7*282 Intended Use Check
.N PSOIN S PSOIN=$O(^PS(51,"B",X,0)) I PSOIN,($P(^PS(51,PSOIN,0),"^",4)<2)&($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 $$UP^XLFSTR(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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOQUTIL 1057 printed Dec 13, 2024@02:33:24 Page 2
PSOQUTIL ;HINES/RMS - MISCELLANEOUS UTILITIES ; 30 Nov 2007 7:59 AM
+1 ;;7.0;OUTPATIENT PHARMACY;**294,282,631**;DEC 1997;Build 5
+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 ;PSO*7*282 Intended Use Check
+3 NEW PSOIN
SET PSOIN=$ORDER(^PS(51,"B",X,0))
IF PSOIN
IF ($PIECE(^PS(51,PSOIN,0),"^",4)<2)&($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)
+4 SET SGY=SGY_X_" "
End DoDot:1
+5 QUIT $$UP^XLFSTR(SGY)
+6 ;
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