IVMUCHK2 ;ALB/MLI - Filter Routine to Validate IVM Center Tranmissions, Cont ; September 3, 1994
;;Version 2.0 ; INCOME VERIFICATION MATCH ;**1**; 21-OCT-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
; This routine is a continuation of IVMUCHK. It performs checks on incoming means test
; transmissions to ensure they are accurate prior to their upload into DHCP.
;
;
ZIC(STRING,DEPIEN) ; check validity of ZIC segment
;
; Input: STRING as ZIC segment
; DEPIEN as the IEN of the dependent in the array, if applicable
;
; Output: ERROR message or null
;
N ERROR,FLAG
S ERROR="",X=$P(STRING,HLFS,2),FLAG=0
I $E(X,1,4)<1992!($E(X,1,2)>20)!($E(X,5,8)'="0000") S ERROR="Invalid Income Year in ZIC" G ZICQ
F I=3:1:20 I $$NUM($P(STRING,HLFS,I),7,2) S ERROR=$P($T(ZICFLD+I),";;",2)_" field content/length error" G:ERROR ZICQ
I ERROR]"" G ZICQ
I $G(DEPIEN) D I ERROR]"" G ZICQ
. F I=13,14 I $P(STRING,HLFS,I)]"" S ERROR="Dependents can't have medical or funeral expenses" Q
. I DEPIEN=SPOUSE,($P(STRING,HLFS,15)]"") S ERROR="No educational expenses for spouse" Q
. I DEPIEN'=SPOUSE D Q:ERROR]""
. . I $P(STRING,HLFS,15)&('$P(ARRAY(DEPIEN,"ZIR"),U,9)) S ERROR="Dependent Educational Exp. error-income not avail. to vet" Q
. . S X=$E($P(STRING,HLFS,2),1,4) D ^%DT S X=Y
. . I $P(STRING,HLFS,15)]"" S X=$P(^DG(43,1,"MT",X,0),U,17) I X'<$P(STRING,HLFS,9) S ERROR="Income does not exceed child exclusion amount-educational expense not allowed" Q
. . F I=16:1:20 I $P(STRING,HLFS,I)]"" S ERROR="No net worth figures allowed for dependent children"
I $P(STRING,HLFS,20)>$P(STRING,HLFS,19) S ERROR="Debts can't be greater than Other Property or Assets" G ZICQ
I 'DEP,$P(STRING,HLFS,14) S ERROR="Can't have funeral/burial expenses w/out dependents" G ZICQ
I '$G(DEPIEN) D I ERROR]"" G ZICQ
. I $P(ARRAY("ZMT"),HLFS,3)="C" Q
. S FLAG=0 F I=16:1:20 I $P(STRING,HLFS,I)]"" S FLAG=1 Q
. I 'FLAG,SPOUSE F I=16:1:20 I $P(ARRAY(SPOUSE,"ZIC"),HLFS,I)]"" S FLAG=1 Q
. I 'FLAG S ERROR="No property information exists for this test"
ZICQ Q ERROR
;
;
NUM(NUMBER,DIGIT,DECIMAL) ; function to determine if valid numeric value
;
; Input: NUMBER as data element to evaluate
; DIGIT as number of digits allowed
; DECIMAL as number of decimal places
;
N ERROR
S ERROR=0
I NUMBER'?.N.1".".2N S ERROR=1 G NUMQ
I $L($P(NUMBER,".",1))>DIGIT S ERROR=1 G NUMQ
I NUMBER<0 S ERROR=1
NUMQ Q ERROR
;
;
ZICFLD ; ZIC field names
;;
;;INCOME YEAR
;;SOCIAL SECURITY
;;US CIVIL SERVICE
;;US RAILROAD RETIREMENT
;;MILITARY RETIREMENT
;;UNEMPLOYMENT COMPENSATION
;;OTHER RETIREMENT
;;EMPLOYMENT INCOME
;;INTEREST, DIVIDEND, ANNUITY
;;WORKERS COMP/BLACK LUNG
;;OTHER INCOME
;;MEDICAL EXPENSES
;;FUNERAL AND BURIAL EXPENSES
;;EDUCATIONAL EXPENSES
;;CASH AMOUNT IN BANK ACCOUNTS
;;STOCKS AND BONDS
;;REAL PROPERTY
;;OTHER PROPERTY OR ASSETS
;;DEBTS
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIVMUCHK2 2991 printed Nov 22, 2024@17:12:53 Page 2
IVMUCHK2 ;ALB/MLI - Filter Routine to Validate IVM Center Tranmissions, Cont ; September 3, 1994
+1 ;;Version 2.0 ; INCOME VERIFICATION MATCH ;**1**; 21-OCT-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 ; This routine is a continuation of IVMUCHK. It performs checks on incoming means test
+5 ; transmissions to ensure they are accurate prior to their upload into DHCP.
+6 ;
+7 ;
ZIC(STRING,DEPIEN) ; check validity of ZIC segment
+1 ;
+2 ; Input: STRING as ZIC segment
+3 ; DEPIEN as the IEN of the dependent in the array, if applicable
+4 ;
+5 ; Output: ERROR message or null
+6 ;
+7 NEW ERROR,FLAG
+8 SET ERROR=""
SET X=$PIECE(STRING,HLFS,2)
SET FLAG=0
+9 IF $EXTRACT(X,1,4)<1992!($EXTRACT(X,1,2)>20)!($EXTRACT(X,5,8)'="0000")
SET ERROR="Invalid Income Year in ZIC"
GOTO ZICQ
+10 FOR I=3:1:20
IF $$NUM($PIECE(STRING,HLFS,I),7,2)
SET ERROR=$PIECE($TEXT(ZICFLD+I),";;",2)_" field content/length error"
if ERROR
GOTO ZICQ
+11 IF ERROR]""
GOTO ZICQ
+12 IF $GET(DEPIEN)
Begin DoDot:1
+13 FOR I=13,14
IF $PIECE(STRING,HLFS,I)]""
SET ERROR="Dependents can't have medical or funeral expenses"
QUIT
+14 IF DEPIEN=SPOUSE
IF ($PIECE(STRING,HLFS,15)]"")
SET ERROR="No educational expenses for spouse"
QUIT
+15 IF DEPIEN'=SPOUSE
Begin DoDot:2
+16 IF $PIECE(STRING,HLFS,15)&('$PIECE(ARRAY(DEPIEN,"ZIR"),U,9))
SET ERROR="Dependent Educational Exp. error-income not avail. to vet"
QUIT
+17 SET X=$EXTRACT($PIECE(STRING,HLFS,2),1,4)
DO ^%DT
SET X=Y
+18 IF $PIECE(STRING,HLFS,15)]""
SET X=$PIECE(^DG(43,1,"MT",X,0),U,17)
IF X'<$PIECE(STRING,HLFS,9)
SET ERROR="Income does not exceed child exclusion amount-educational expense not allowed"
QUIT
+19 FOR I=16:1:20
IF $PIECE(STRING,HLFS,I)]""
SET ERROR="No net worth figures allowed for dependent children"
End DoDot:2
if ERROR]""
QUIT
End DoDot:1
IF ERROR]""
GOTO ZICQ
+20 IF $PIECE(STRING,HLFS,20)>$PIECE(STRING,HLFS,19)
SET ERROR="Debts can't be greater than Other Property or Assets"
GOTO ZICQ
+21 IF 'DEP
IF $PIECE(STRING,HLFS,14)
SET ERROR="Can't have funeral/burial expenses w/out dependents"
GOTO ZICQ
+22 IF '$GET(DEPIEN)
Begin DoDot:1
+23 IF $PIECE(ARRAY("ZMT"),HLFS,3)="C"
QUIT
+24 SET FLAG=0
FOR I=16:1:20
IF $PIECE(STRING,HLFS,I)]""
SET FLAG=1
QUIT
+25 IF 'FLAG
IF SPOUSE
FOR I=16:1:20
IF $PIECE(ARRAY(SPOUSE,"ZIC"),HLFS,I)]""
SET FLAG=1
QUIT
+26 IF 'FLAG
SET ERROR="No property information exists for this test"
End DoDot:1
IF ERROR]""
GOTO ZICQ
ZICQ QUIT ERROR
+1 ;
+2 ;
NUM(NUMBER,DIGIT,DECIMAL) ; function to determine if valid numeric value
+1 ;
+2 ; Input: NUMBER as data element to evaluate
+3 ; DIGIT as number of digits allowed
+4 ; DECIMAL as number of decimal places
+5 ;
+6 NEW ERROR
+7 SET ERROR=0
+8 IF NUMBER'?.N.1".".2N
SET ERROR=1
GOTO NUMQ
+9 IF $LENGTH($PIECE(NUMBER,".",1))>DIGIT
SET ERROR=1
GOTO NUMQ
+10 IF NUMBER<0
SET ERROR=1
NUMQ QUIT ERROR
+1 ;
+2 ;
ZICFLD ; ZIC field names
+1 ;;
+2 ;;INCOME YEAR
+3 ;;SOCIAL SECURITY
+4 ;;US CIVIL SERVICE
+5 ;;US RAILROAD RETIREMENT
+6 ;;MILITARY RETIREMENT
+7 ;;UNEMPLOYMENT COMPENSATION
+8 ;;OTHER RETIREMENT
+9 ;;EMPLOYMENT INCOME
+10 ;;INTEREST, DIVIDEND, ANNUITY
+11 ;;WORKERS COMP/BLACK LUNG
+12 ;;OTHER INCOME
+13 ;;MEDICAL EXPENSES
+14 ;;FUNERAL AND BURIAL EXPENSES
+15 ;;EDUCATIONAL EXPENSES
+16 ;;CASH AMOUNT IN BANK ACCOUNTS
+17 ;;STOCKS AND BONDS
+18 ;;REAL PROPERTY
+19 ;;OTHER PROPERTY OR ASSETS
+20 ;;DEBTS