VAQDBIH2 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
VALOCC(LIMIT,TYPEOCC) ;VALIDATE TIME LIMIT
;INPUT : LIMIT - Limit value to check for validity
; TYPEOCC - Flag indicating which limit to validate against
; 0 = Time limit (default)
; 1 = Occurrence limit
;OUTPUT : 0 - Limit is valid
; -1 - Limit is not valid or error
;NOTES : Time limits are 1-5 numerics followed be 'D' or 'M' or 'Y'
; : Occurrence limits are 1-5 numerics
;
;CHECK INPUT
Q:($G(LIMIT)="") -1
S TYPEOCC=+$G(TYPEOCC)
;DECLARE VARIABLES
N ANS,TMP
;VALIDATE TIME LIMIT
I ('TYPEOCC) D Q ANS
.S ANS=-1
.S TMP=$E(LIMIT,1,($L(LIMIT)-1))
.Q:(TMP'?1.5N)
.S TMP=$E(LIMIT,$L(LIMIT))
.I ((TMP="D")!(TMP="M")!(TMP="Y")) S ANS=0 Q
;VALIDATE OCCURRENCE LIMIT
Q:(LIMIT?1.5N) 0
Q -1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQDBIH2 907 printed Dec 13, 2024@02:24:59 Page 2
VAQDBIH2 ;JRP/ALB - GET INFO ABOUT HEALTH SUMMARY COMPONENT;09-SEP-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
VALOCC(LIMIT,TYPEOCC) ;VALIDATE TIME LIMIT
+1 ;INPUT : LIMIT - Limit value to check for validity
+2 ; TYPEOCC - Flag indicating which limit to validate against
+3 ; 0 = Time limit (default)
+4 ; 1 = Occurrence limit
+5 ;OUTPUT : 0 - Limit is valid
+6 ; -1 - Limit is not valid or error
+7 ;NOTES : Time limits are 1-5 numerics followed be 'D' or 'M' or 'Y'
+8 ; : Occurrence limits are 1-5 numerics
+9 ;
+10 ;CHECK INPUT
+11 if ($GET(LIMIT)="")
QUIT -1
+12 SET TYPEOCC=+$GET(TYPEOCC)
+13 ;DECLARE VARIABLES
+14 NEW ANS,TMP
+15 ;VALIDATE TIME LIMIT
+16 IF ('TYPEOCC)
Begin DoDot:1
+17 SET ANS=-1
+18 SET TMP=$EXTRACT(LIMIT,1,($LENGTH(LIMIT)-1))
+19 if (TMP'?1.5N)
QUIT
+20 SET TMP=$EXTRACT(LIMIT,$LENGTH(LIMIT))
+21 IF ((TMP="D")!(TMP="M")!(TMP="Y"))
SET ANS=0
QUIT
End DoDot:1
QUIT ANS
+22 ;VALIDATE OCCURRENCE LIMIT
+23 if (LIMIT?1.5N)
QUIT 0
+24 QUIT -1