GMTSORC ; SLC/JER,KER - Current Orders (V2.5) ; 09/21/2001
;;2.7;Health Summary;**15,28,47**;Oct 20, 1995
;
; External References
; DBIA 10141 $$VERSION^XPDUTL
;
MAIN ; Controls branching and execution
I $$VERSION^XPDUTL("OR")'<3 G MAIN^GMTSORC3
Q
;
WRAP(TEXT,LENGTH) ; Breaks text string into substrings
;
; Input
; TEXT = Text String
; LENGTH = Maximum Length of Substrings
;
; Output vertical bar delimted text
; substring|substring|substring|substring|substring
;
N GMTI,GMTJ,LINE,GMX,GMX1,GMX2,GMY
I $G(TEXT)']"" Q ""
F GMTI=1:1 D Q:GMTI=$L(TEXT," ")
. S GMX=$P(TEXT," ",GMTI)
. I $L(GMX)>LENGTH D
. . S GMX1=$E(GMX,1,LENGTH),GMX2=$E(GMX,LENGTH+1,$L(GMX))
. . S $P(TEXT," ",GMTI)=GMX1_" "_GMX2
S LINE=1,GMX(1)=$P(TEXT," ")
F GMTI=2:1 D Q:GMTI'<$L(TEXT," ")
. S:$L($G(GMX(LINE))_" "_$P(TEXT," ",GMTI))>LENGTH LINE=LINE+1,GMY=1
. S GMX(LINE)=$G(GMX(LINE))_$S(+$G(GMY):"",1:" ")_$P(TEXT," ",GMTI),GMY=0
S GMTJ=0,TEXT="" F GMTI=1:1 S GMTJ=$O(GMX(GMTJ)) Q:+GMTJ'>0 S TEXT=TEXT_$S(GMTI=1:"",1:"|")_GMX(GMTJ)
Q TEXT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSORC 1228 printed Dec 13, 2024@01:58:33 Page 2
GMTSORC ; SLC/JER,KER - Current Orders (V2.5) ; 09/21/2001
+1 ;;2.7;Health Summary;**15,28,47**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10141 $$VERSION^XPDUTL
+5 ;
MAIN ; Controls branching and execution
+1 IF $$VERSION^XPDUTL("OR")'<3
GOTO MAIN^GMTSORC3
+2 QUIT
+3 ;
WRAP(TEXT,LENGTH) ; Breaks text string into substrings
+1 ;
+2 ; Input
+3 ; TEXT = Text String
+4 ; LENGTH = Maximum Length of Substrings
+5 ;
+6 ; Output vertical bar delimted text
+7 ; substring|substring|substring|substring|substring
+8 ;
+9 NEW GMTI,GMTJ,LINE,GMX,GMX1,GMX2,GMY
+10 IF $GET(TEXT)']""
QUIT ""
+11 FOR GMTI=1:1
Begin DoDot:1
+12 SET GMX=$PIECE(TEXT," ",GMTI)
+13 IF $LENGTH(GMX)>LENGTH
Begin DoDot:2
+14 SET GMX1=$EXTRACT(GMX,1,LENGTH)
SET GMX2=$EXTRACT(GMX,LENGTH+1,$LENGTH(GMX))
+15 SET $PIECE(TEXT," ",GMTI)=GMX1_" "_GMX2
End DoDot:2
End DoDot:1
if GMTI=$LENGTH(TEXT," ")
QUIT
+16 SET LINE=1
SET GMX(1)=$PIECE(TEXT," ")
+17 FOR GMTI=2:1
Begin DoDot:1
+18 if $LENGTH($GET(GMX(LINE))_" "_$PIECE(TEXT," ",GMTI))>LENGTH
SET LINE=LINE+1
SET GMY=1
+19 SET GMX(LINE)=$GET(GMX(LINE))_$SELECT(+$GET(GMY):"",1:" ")_$PIECE(TEXT," ",GMTI)
SET GMY=0
End DoDot:1
if GMTI'<$LENGTH(TEXT," ")
QUIT
+20 SET GMTJ=0
SET TEXT=""
FOR GMTI=1:1
SET GMTJ=$ORDER(GMX(GMTJ))
if +GMTJ'>0
QUIT
SET TEXT=TEXT_$SELECT(GMTI=1:"",1:"|")_GMX(GMTJ)
+21 QUIT TEXT