1 | GMTSORC ; SLC/JER,KER - Current Orders (V2.5) ; 09/21/2001
|
---|
2 | ;;2.7;Health Summary;**15,28,47**;Oct 20, 1995
|
---|
3 | ;
|
---|
4 | ; External References
|
---|
5 | ; DBIA 10141 $$VERSION^XPDUTL
|
---|
6 | ;
|
---|
7 | MAIN ; Controls branching and execution
|
---|
8 | I $$VERSION^XPDUTL("OR")'<3 G MAIN^GMTSORC3
|
---|
9 | Q
|
---|
10 | ;
|
---|
11 | WRAP(TEXT,LENGTH) ; Breaks text string into substrings
|
---|
12 | ;
|
---|
13 | ; Input
|
---|
14 | ; TEXT = Text String
|
---|
15 | ; LENGTH = Maximum Length of Substrings
|
---|
16 | ;
|
---|
17 | ; Output vertical bar delimted text
|
---|
18 | ; substring|substring|substring|substring|substring
|
---|
19 | ;
|
---|
20 | N GMTI,GMTJ,LINE,GMX,GMX1,GMX2,GMY
|
---|
21 | I $G(TEXT)']"" Q ""
|
---|
22 | F GMTI=1:1 D Q:GMTI=$L(TEXT," ")
|
---|
23 | . S GMX=$P(TEXT," ",GMTI)
|
---|
24 | . I $L(GMX)>LENGTH D
|
---|
25 | . . S GMX1=$E(GMX,1,LENGTH),GMX2=$E(GMX,LENGTH+1,$L(GMX))
|
---|
26 | . . S $P(TEXT," ",GMTI)=GMX1_" "_GMX2
|
---|
27 | S LINE=1,GMX(1)=$P(TEXT," ")
|
---|
28 | F GMTI=2:1 D Q:GMTI'<$L(TEXT," ")
|
---|
29 | . S:$L($G(GMX(LINE))_" "_$P(TEXT," ",GMTI))>LENGTH LINE=LINE+1,GMY=1
|
---|
30 | . S GMX(LINE)=$G(GMX(LINE))_$S(+$G(GMY):"",1:" ")_$P(TEXT," ",GMTI),GMY=0
|
---|
31 | 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)
|
---|
32 | Q TEXT
|
---|