1 | VAUTL ;ALB/MRL - UTILITY FUNCTIONS; 13 APR 89
|
---|
2 | ;;5.3;Registration;;Aug 13, 1993
|
---|
3 | ;
|
---|
4 | FA ;Format Address
|
---|
5 | ;REQUIRED VARIABLES = VADN-Address node; VAD(1)=Start with Piece;
|
---|
6 | ;VAD(2)=Build array starting where
|
---|
7 | ;RETURNS 'VADD' Array containing formated address information
|
---|
8 | ;OPTIONAL = VAEXT-Numeric number of characters to extract
|
---|
9 | ;
|
---|
10 | F I=VAD(1):1:VAD(1)+2 I $P(VADN,"^",I)]"" S VADD(VAD(2))=$P(VADN,"^",I),VAD(2)=VAD(2)+2
|
---|
11 | I VAD(2)=1 S VADD(1)="NO STREET",VAD(2)=VAD(2)+2
|
---|
12 | S J=$S($D(^DIC(5,+$P(VADN,"^",VAD(1)+4),0)):$P(^(0),"^",2),1:"NO STATE"),J(1)=$P(VADN,"^",VAD(1)+3) S:J(1)']"" J(1)="NO CITY" S J(2)=$P(VADN,"^",VAD(1)+5) S:J(2)']"" J(2)="NO ZIP"
|
---|
13 | S VADD(VAD(2))=J(1)_","_J_" "_J(2) K I,J,VAD,VADN I $S('$D(VAEXT):1,'VAEXT:1,1:0) Q
|
---|
14 | ;
|
---|
15 | S I=0 F I1=0:0 S I=$O(VADD(I)) Q:I'>0 S VADD(I)=$E(VADD(I),1,VAEXT)
|
---|
16 | K I,I1,VAEXT Q
|
---|
17 | ;
|
---|
18 | PA ;Print Address
|
---|
19 | S I=0 F I1=0:0 S I=$O(VADD(I)) Q:I'>0 W:(I#2) ! S I2=$S((I#2):0,1:40) W ?I2,VADD(I)
|
---|
20 | K I,I1,I2,VADD Q
|
---|