source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIV.m@ 1742

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1DIV ;SFISC/GFT-VERIFY FLDS ;10:06 AM 28 Jun 1999
2 ;;22.0;VA FileMan;**7**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 N DIUTIL,DIVDAT,DIVFIL,DIVMODE,DIVPG,POP S DIUTIL="VERIFY FIELDS"
5 K J
6 S Q="""",S=";",V=0,P=0,I(0)=DIU,@("(A,J(0))=+$P("_DIU_"0),U,2)")
7 I $O(^(0))'>0 W $C(7)," NO ENTRIES ON FILE!" Q
8DIC S DIC="^DD(A,",DIC(0)="EZ",DIC("W")="W:$P(^(0),U,2) "" (multiple)"""
9 S DIC("S")="S %=$P(^(0),U,2) I %'[""C"",$S('%:1,1:$P(^DD(+%,.01,0),U,2)'[""W"")"
10 W !,"VERIFY WHICH "_$P(^DD(A,0),U)_": " R X:DTIME Q:U[X
11 I X="ALL" D ALL G Q:$D(DIRUT) I Y S DIVMODE="A" D DEVSEL G:$G(POP) Q D INIT,FLDS G Q^DIVR:DQI'>0!$D(DIRUT)
12 D ^DIC K DQI,^UTILITY("DIVR",$J)
13 I Y<0 W:X?1."?" !?3,"You may enter ALL to verify every field at this level of the file.",! G DIC
14 S DR=$P(Y(0),U,2) I DR S J(V)=A,P=+Y,V=V+1,A=+DR,I(V)=$P($P(Y(0),U,4),S,1) S:+I(V)'=I(V) I(V)=Q_I(V)_Q G DIC
15 D DEVSEL G:$G(POP) Q D INIT
161 F T="N","D","P","S","V","F" Q:DR[T
17 F W="FREE TEXT","SET OF CODES","DATE","NUMERIC","POINTER","VARIABLE POINTER","K" I T[$E(W) S:W="K" W="MUMPS" W " ",W Q
18 K DA S DIVZ=$P(Y(0),U,3),DDC=$P(Y(0),U,5,99),(DIFLD,DA)=+Y
19 G ^DIVR
20 ;
21Q K DIR,DIRUT,N,P,Q,S,V,C
22 Q
23 ;
24ALL S DIR(0)="Y",DIR("??")="^D H^DIV"
25 S DIR("A")="DO YOU MEAN ALL THE FIELDS IN THE FILE"
26 D ^DIR K DIR S X="ALL"
27 Q
28 ;
29FLDS S DQI=0 F S DQI=$O(^DD(A,DQI)) Q:DQI'>0 S Y=DQI,Y(0)=^(Y,0),DR=$P(Y(0),U,2) D Q:$D(DIRUT)
30 .I DR,$P(^DD(+DR,.01,0),U,2)["W" Q
31 .I DR D NEXTLVL Q
32 .I DR'["C" D Q:$D(DIRUT) W "--",$P(Y(0),U),"--" D 1 Q
33 .. N DIVI F DIVI=1:1:3 D LF^DIVR Q:$D(DIRUT)
34 Q
35NEXTLVL ;
36 N A,P,DE,DA,DQI,I,J,V S DQI=0
37 S A=+DR,P=+Y N Y,DR D IJ^DIVU(A)
38 D FLDS
39 Q
40H W !!?5,"YES means that every field at this level in the file will"
41 W !?5,"be checked to see if it conforms to the input transform."
42 W !!?5,"NO means that ALL will be used to lookup a field in the"
43 W !?5,"file which begins with the letters ALL, e.g., ALLERGIES."
44 Q
45VER(DIVRFILE,DIVRREC,DIVRDR,DIVROUT) ;
46 ;DIVRFILE = (sub)file number
47 ;DIVRREC = template, or ien-string of records to be verified
48 ;DIVRDR = list of fields to be verified (defaults to ALL)
49 ;DIVROUT = output array listing the records that had problems
50 G ^DIVR1
51DIVROUT I $G(DIVROUT)="" D X Q
52 I $E(DIVROUT)="[" D Q
53 . N Y,COUNT,Z
54 . D DIBT^DIVU(DIVROUT,.Y,DIVRFI0) Q:Y'>0
55 . K ^DIBT(+Y,1)
56 . S (COUNT,Z)=0
57 . F S Z=$O(^TMP("DIVR1",$J,Z)) Q:Z="" S COUNT=COUNT+1,^DIBT(+Y,1,Z)=""
58 . I COUNT S ^DIBT(+Y,"QR")=DT_U_COUNT
59 . D X
60 M @DIVROUT@(1)=^TMP("DIVR1",$J)
61X K ^TMP("DIVR1",$J)
62 Q
63 ;
64INIT ;Get header info and print first header
65 N %,%H,X,Y
66 K DIRUT
67 ;
68 S %H=$H D YX^%DTC
69 S DIVDAT=$P(Y,"@")_" "_$P($P(Y,"@",2),":",1,2)_" PAGE "
70 ;
71 I $D(^DIC(A,0))#2 S DIVFIL=$P(^(0),U)_" FILE (#"_A_")"
72 E I $D(^DD(A,0,"NM")) S DIVFIL=$O(^("NM",""))_" SUB-FILE (#"_A_")"
73 E S DIVFIL=""
74 ;
75 U IO
76 W:IOST?1"C-".E @IOF
77 D HDR^DIVR
78 Q
79 ;
80DEVSEL ;Prompt for device
81 D Q:$G(POP)
82 . N %ZIS,A,I,J,T,V,X,Y,Z
83 . S %ZIS=$E("Q",$D(^%ZTSK)>0)
84 . W ! D ^%ZIS
85 ;
86 I $D(IO("Q")),$D(^%ZTSK) D S POP=1
87 . S ZTRTN="ENQUEUE^DIV"
88 . S ZTDESC="Verify Fields Report for File #"_A
89 . N %,DIVA,DIVI,DIVJ,DIVT,DIVV,DIVY,DIVZ
90 . M DIVA=A,DIVI=I,DIVJ=J,DIVT=T,DIVV=V,DIVY=Y,DIVZ=Z
91 . F %="DIU","DIUTIL","DIVMODE","DIVA","DIVI","DIVI(","DIVJ","DIVJ(","DIVV","DIVZ" S ZTSAVE(%)=""
92 . I $G(DIVMODE)'="A" F %="DIVY","DIVY(","DR" S ZTSAVE(%)=""
93 . I $G(DIVMODE)="C" F %="DA","DDC","DIFLD","DIVT" S ZTSAVE(%)=""
94 . D ^%ZTLOAD
95 . I $D(ZTSK)#2 W !,"Report queued!",!,"Task number: "_$G(ZTSK),!
96 . E W !,"Report canceled!",!
97 . K ZTSK
98 . S IOP="HOME" D ^%ZIS
99 Q
100 ;
101ENQUEUE ;Entry point for queued reports
102 M A=DIVA,I=DIVI,J=DIVJ,T=DIVT,V=DIVV,Y=DIVY,Z=DIVZ
103 K DIVA,DIVI,DIVJ,DIVT,DIVV,DIVY,DIVZ
104 S Q="""",S=";"
105 ;
106 D INIT
107 I $G(DIVMODE)="A" D FLDS,Q^DIVR Q
108 I $G(DIVMODE)="C" D ^DIVR Q
109 D 1
110 Q
Note: See TracBrowser for help on using the repository browser.