source: FOIAVistA/tag/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XDRDVAL.m@ 1540

Last change on this file since 1540 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1XDRDVAL ;CIOFO-SF.SEA/JLI - Check validity of data elements ;10/02/2000 08:00
2 ;;7.3;TOOLKIT;**23,32,51**;Apr 25, 1995
3 ;;
4 Q
5 ;
6DOENTRY(FILE,IEN,OUTROOT,HELP) ; ENTRY POINT TO PROCESS A SINGLE ENTRY
7 ;N DATAROOT,MESGROOT,TEMPROOT,IENS,FIELD,X
8 N ZTQUEUED ;S ZTQUEUED=1
9 S DATAROOT=$NA(^TMP($J,"XDRDVAL","DATA"))
10 S MESGROOT=$NA(^TMP($J,"XDRDVAL","MESG"))
11 S TEMPROOT=$NA(^TMP($J,"XDRDVAL","TEMP"))
12 K @DATAROOT,@MESGROOT,@TEMPROOT
13 D DOGETS
14 I $D(@TEMPROOT) D VALIDATE(TEMPROOT,$NA(@MESGROOT@(IEN,"VAL")))
15 M @OUTROOT@(IEN)=@MESGROOT@(IEN)
16 Q
17DOGETS ;
18 D GETS^DIQ(FILE,IEN,"**","EIN",DATAROOT,MESGROOT)
19 ;I $D(@MESGROOT@("DIERR"))>1 M @OUTROOT@(FILE,IEN,"GET","DIERR")=@MESGROOT@("DIERR")
20 K @MESGROOT
21 F FILE=0:0 S FILE=$O(@DATAROOT@(FILE)) Q:FILE'>0 D
22 . S IENS="" F S IENS=$O(@DATAROOT@(FILE,IENS)) Q:IENS="" D
23 . . F FIELD=0:0 S FIELD=$O(@DATAROOT@(FILE,IENS,FIELD)) Q:FIELD'>0 D
24 . . . I FILE=70.03,FIELD=.01 Q ; RADIOLOGY LOGIC REQUIRES USER INPUT
25 . . . I $O(@DATAROOT@(FILE,IENS,FIELD,""))>0 K @DATAROOT@(FILE,IENS,FIELD) Q ; WORD PROCESSING FIELDS - SKIP
26 . . . S Y=$G(@DATAROOT@(FILE,IENS,FIELD,"I")) I Y="" Q ; SKIP COMPUTED FIELDS
27 . . . S X=$G(@DATAROOT@(FILE,IENS,FIELD,"E"))
28 . . . S @TEMPROOT@(FILE,IENS,FIELD)=$S(X=Y:X,1:X_U_Y)
29 . . . Q
30 . . Q
31 . Q
32 Q
33 ;
34VALIDATE(DATA,MESG) ; VALIDATE DATA IN 'DATA' RETURN ERRORS IN 'MESG'
35 ;N FILE,FIELD,RESULT,VAL,IENS,I,XDRDVALF,TOPFILE,FIRSTLVL
36 S XDRDVALF=1
37 F FILE=0:0 S FILE=$O(@DATA@(FILE)) Q:FILE'>0 D
38 . S TOPFILE=($G(^DD(FILE,0,"UP"))'>0),FIRSTLVL=0
39 . I 'TOPFILE S I=$G(^DD(FILE,0,"UP")) I $G(^DD(I,0,"UP"))'>0 S FIRSTLVL=1
40 . S IENS="" F S IENS=$O(@DATA@(FILE,IENS)) Q:IENS="" D
41 . . F FIELD=0:0 S FIELD=$O(@DATA@(FILE,IENS,FIELD)) Q:FIELD'>0 D
42 . . . S (X,VAL)=$P(@DATA@(FILE,IENS,FIELD),U)
43 . . . S YVAL=$S(@DATA@(FILE,IENS,FIELD)[U:$P(@DATA@(FILE,IENS,FIELD),U,2),1:X)
44 . . . I 'TOPFILE,(FIRSTLVL&(FIELD'=.01))!'FIRSTLVL Q
45 . . . I FILE=2.101,FIELD=.01 Q ; DISPOSITON DATE/TIME HAS SPCL PROCESSING
46 . . . I FILE=2,FIELD=63 Q ; LAB POINTER HAS SPCL PROCESSING
47 . . . I FILE=2,FIELD=.09 Q ; SSN WILL BE ENTERED AS INTERNAL VALUE
48 . . . I FILE=2,$P(^DD(FILE,FIELD,0),U,5,99)["DGLOCK2" Q ;no NOK
49 . . . I FILE=354,FIELD=.03 Q ; COPAY EXEMPT STATUS DATE -- BAD
50 . . . D CHKVALID(MESG,FILE,IENS,FIELD,VAL,YVAL)
51 . . . Q
52 . . Q
53 . Q
54 Q
55 ;
56CHKVALID(MESG,FILE,IENS,FIELD,EXTVAL,INTVAL,HELP) ;
57 ;
58 Q:FIELD=.001
59 I $$NEWERR^%ZTER() N $ETRAP,$ESTACK S $ETRAP="D ERR^XDRDVAL"
60 E S X="ERR^XDRDVAL",@^%ZOSF("TRAP")
61 S IOP="XDRBROWSER1" D ^%ZIS Q:POP U IO
62 S XMESG=$NA(^TMP("XDRDVAL-M")) K @XMESG
63 S ^TMP($J,"LAST","FILE")=FILE,^("IENS")=IENS,^("FIELD")=FIELD,^("X")=EXTVAL,^("Y")=INTVAL
64 S Y1=EXTVAL D
65 . S RESULT="^"
66 . I $P(^DD(FILE,FIELD,0),U,2)["S" S Y1=INTVAL
67 . I $P(^DD(FILE,FIELD,0),U,2)["V" D
68 . . N Z S Z=$P(INTVAL,";",2) Q:Z=""
69 . . S Z=$P($G(@("^"_Z_"0)")),U,1)
70 . . S Y1=Z_".`"_$P(INTVAL,";")
71 . . Q
72 . N DA,D0,DIC,DIE
73 . D MAKEGLO(FILE,IENS,.DIC,.DA) Q:DA'>0
74 . S D0=$P(IENS,",",$L(IENS,",")-1),DIE=DIC,DIC(0)=""
75 . S EXCODE=$P(^DD(FILE,FIELD,0),U,5,999)
76 . I $P(^DD(FILE,FIELD,0),U,2)["P" S Y1=$S(FILE=2.001:"",1:"`")_INTVAL,Y=INTVAL S Z=U_$P(^(0),U,3),DIC=Z I $D(@(Z_INTVAL_",0)")) S RESULT="" Q
77 . S X=Y1,FILEA=FILE X EXCODE I $D(X) S RESULT=""
78 . Q
79 I $G(RESULT)="^",$G(HELP)["E" M @MESG@(FILE,IENS,FIELD)=^TMP("XDRDVAL-M")
80 K @XMESG
81 I RESULT="",FIELD=.01 D CHKNM ; CHECK FOR ,0,"NM", PROBLEM
82 I $G(RESULT)="^" S @MESG@(FILE,IENS,FIELD,"INVALID")=INTVAL_$S(INTVAL'=EXTVAL:U_EXTVAL,1:"")
83 U IO D ^%ZISC K ^TMP("DDB",$J,1)
84 F I=2:1 Q:'$D(^TMP("DDB",$J,I)) S ^(I-1)=^TMP("DDB",$J,I) K ^(I)
85 I $D(^TMP("DDB",$J)) M @MESG@(FILE,IENS,FIELD,"NOTE")=^TMP("DDB",$J)
86 Q
87 ;
88MAKEGLO(FILENUM,IENS,GLOB,DASTR) ;
89 N I,ERRFLG,DAVAL,J,FILE,FLD,NODE
90 S GLOB="",ERRFLG=0 K DASTR
91 F I=1:1 S FILE=FILENUM,DAVAL(I)=+IENS Q:$D(^DIC(FILE,0,"GL")) D Q:ERRFLG
92 . S FILENUM=$G(^DD(FILE,0,"UP")) I FILENUM="" S ERRFLG=1 Q
93 . S FLD=$O(^DD(FILENUM,"SB",FILE,0)) I FLD'>0 S ERRFLG=1 Q
94 . S NODE=$P($P($G(^DD(FILENUM,FLD,0)),U,4),";") I NODE="" S ERRFLG=1 Q
95 . S GLOB=""""_NODE_""","_$S(GLOB="":"",1:DAVAL(I)_",")_GLOB
96 . S IENS=$P(IENS,",",2,99)
97 . Q
98 I ERRFLG S DASTR=-1,GLOB="" Q
99 S GLOB=^DIC(FILE,0,"GL")_$S(GLOB="":"",1:DAVAL(I)_",")_GLOB
100 F J=2:1:I S DASTR(J-1)=DAVAL(J)
101 S DASTR=DAVAL(1)
102 Q
103 ;
104CHKNM ; CHECK FOR PROBLEM WITH NM NODE OF SUBFILE NOT BEING CORRECT
105 N UFILE,UNAME,UFLD
106 S UFILE=$G(^DD(FILE,0,"UP")) I UFILE'>0 Q
107 S UFLD=$O(^DD(UFILE,"SB",FILE,"")) Q:UFLD'>0
108 S UNAME=$P(^DD(UFILE,UFLD,0),U)
109 I $O(^DD(FILE,0,"NM",""))'=UNAME D
110 . S RESULT="^"
111 . W !,"First entry in ^DD("_FILE_",0,""NM"", does not match field name "_UNAME_" in file "_UFILE_". This will be rejected by UPDATE^DIE."
112 Q
113 ;
114ERR ; On an error mark status as error, and save the error message
115 ;
116 K X S RESULT="^"
117 S $ECODE=""
118 S ^TMP("DDB",$J,2)=$ZE
119 Q
120 ;
121OPEN ;
122 S DDBRZIS=1,DDBDMSG=""
123 I '$D(XDRDVALF) U IO(0) W !,"...ONE MOMENT..." U IO
124 Q
125 ;
126CLOSE ;
127 S DDBRZIS=$G(DDBRZIS,1)
128 N C,CHAR,DDBROS,EOF,X
129 K ^TMP("DDB",$J)
130 S DDBROS=^%ZOSF("OS"),EOF="EOF-End Of File"
131 S CHAR="" F I=1:1:31 S CHAR=CHAR_$C(I)
132 U IO W !,EOF,!
133 S DDBRZIS("REWIND")=$$REWIND^%ZIS(IO,IOT,IOPAR)
134 I 'DDBRZIS("REWIND") S DDBRZIS=0 U IO(0) W $C(7),!!?5,"<< UNABLE TO REWIND FILE>>",! H 3 Q
135 U IO
136 S C=0
137 F R X:1 Q:X="EOF-End Of File" D
138 .S X=$TR(X,CHAR)
139 .S:X']"" X=" "
140 .S C=C+1,^TMP("DDB",$J,C)=$E(X,1,255) Q
141 .Q
142 Q
143 Q
Note: See TracBrowser for help on using the repository browser.