ACDFUNC ;IHS/ADC/EDE/KML - VARIOUS EXTRINSICS;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;;
DD(Y) ;EP-get external date
X ^DD("DD")
Q Y
SETS(X) ;EP-Convert sets to op format
;file is X(1), field is X(2), and code is X(3)
;
I X(3)="" S ACDX="UNKNOWN" Q ACDX
S ACDX=$P(^DD(X(1),X(2),0),U,3),ACDX=$P(ACDX,X(3)_":",2),ACDX=$P(ACDX,";") I ACDX="" S ACDX="UNKNOWN"
Q ACDX
;
LZERO(V,L) ;EP-left zero fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V="0"_V
Q V
RZERO(V,L) ;EP-right zero fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V=V_"0"
Q V
LBLNK(V,L) ;EP-left blank fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V=" "_V
Q V
RBLNK(V,L) ;EP-right blank fill
NEW %,I
S %=$L(V),Z=L-% F I=1:1:Z S V=V_" "
Q V
ACDFUNC ;IHS/ADC/EDE/KML - VARIOUS EXTRINSICS;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;;
DD(Y) ;EP-get external date
+1 XECUTE ^DD("DD")
+2 QUIT Y
SETS(X) ;EP-Convert sets to op format
+1 ;file is X(1), field is X(2), and code is X(3)
+2 ;
+3 IF X(3)=""
SET ACDX="UNKNOWN"
QUIT ACDX
+4 SET ACDX=$PIECE(^DD(X(1),X(2),0),U,3)
SET ACDX=$PIECE(ACDX,X(3)_":",2)
SET ACDX=$PIECE(ACDX,";")
IF ACDX=""
SET ACDX="UNKNOWN"
+5 QUIT ACDX
+6 ;
LZERO(V,L) ;EP-left zero fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V="0"_V
+3 QUIT V
RZERO(V,L) ;EP-right zero fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V=V_"0"
+3 QUIT V
LBLNK(V,L) ;EP-left blank fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V=" "_V
+3 QUIT V
RBLNK(V,L) ;EP-right blank fill
+1 NEW %,I
+2 SET %=$LENGTH(V)
SET Z=L-%
FOR I=1:1:Z
SET V=V_" "
+3 QUIT V