VAFADDR ;ALB/MIR - ADDRESS UTILITIES (INPUT AND OUTPUT TRANSFORM) ; 25 JAN 93
;;5.3;Registration;;Aug 13, 1993
;
; This routine contains generic input and output transforms for the
; ZIP+extension fields which reside in DHCP
;
ZIPIN ; input transform for ZIP - massages user input and returns data
; in FileMan internal format (no '-'s)
;
; Input: X as user entered value
; Output: X as internal value of user input OR
; undefined if input from user was invalid
;
N %
I X'?.N F %=1:1:$L(X) I $E(X,%)?1P S X=$E(X,0,%-1)_$E(X,%+1,20),%=%-1
I X'?5N,(X'?9N) K X
Q
;
;
ZIPOUT ; output transform for ZIP - prints either ZIP or ZIP+4 (in 12345-1234)
; format.
;
; Input: Y as FileMan internal value
; Output: Y as external format (12345 or 12345-1234)
;
S Y=$E(Y,1,5)_$S($E(Y,6,9)]"":"-"_$E(Y,6,9),1:"")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFADDR 867 printed Oct 16, 2024@19:01:56 Page 2
VAFADDR ;ALB/MIR - ADDRESS UTILITIES (INPUT AND OUTPUT TRANSFORM) ; 25 JAN 93
+1 ;;5.3;Registration;;Aug 13, 1993
+2 ;
+3 ; This routine contains generic input and output transforms for the
+4 ; ZIP+extension fields which reside in DHCP
+5 ;
ZIPIN ; input transform for ZIP - massages user input and returns data
+1 ; in FileMan internal format (no '-'s)
+2 ;
+3 ; Input: X as user entered value
+4 ; Output: X as internal value of user input OR
+5 ; undefined if input from user was invalid
+6 ;
+7 NEW %
+8 IF X'?.N
FOR %=1:1:$LENGTH(X)
IF $EXTRACT(X,%)?1P
SET X=$EXTRACT(X,0,%-1)_$EXTRACT(X,%+1,20)
SET %=%-1
+9 IF X'?5N
IF (X'?9N)
KILL X
+10 QUIT
+11 ;
+12 ;
ZIPOUT ; output transform for ZIP - prints either ZIP or ZIP+4 (in 12345-1234)
+1 ; format.
+2 ;
+3 ; Input: Y as FileMan internal value
+4 ; Output: Y as external format (12345 or 12345-1234)
+5 ;
+6 SET Y=$EXTRACT(Y,1,5)_$SELECT($EXTRACT(Y,6,9)]"":"-"_$EXTRACT(Y,6,9),1:"")
+7 QUIT