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

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1DIFROMSY ;SFIRMFO/DCM/TKW-MOVE KEY FILE ENTRIES ;12:32 PM 31 Oct 2001
2 ;;22.0;VA FileMan;**1,11,92**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4DDKEYOUT(DIFRFILE,DIFRF2,DIFRTA) ; retrieve KEY entries for file
5 ; DIFRFILE=top level file number
6 ; DIFRF2=current file/subfile number
7 ; DIFRTA=Global reference of transport global
8 N DINODE,DIFRNAME,DIFRDO,DIFRD1,DIFRF,DIFRFLD,DIOUT,X,Y,DICNT1,DICNT2
9 S DIFRNAME="",DIOUT=0
10 F S DIFRNAME=$O(^DD("KEY","BB",DIFRF2,DIFRNAME)) Q:DIFRNAME="" D Q:DIOUT
11 . S DIFRD0=$O(^DD("KEY","BB",DIFRF2,DIFRNAME,0)) Q:'DIFRD0
12 . S (DIFRD1,DICNT1,DICNT2)=0
13 . F S DIFRD1=$O(^DD("KEY",DIFRD0,2,DIFRD1)) Q:'DIFRD1 D Q:DIOUT
14 . . S X=$G(^DD("KEY",DIFRD0,2,DIFRD1,0))
15 . . S DIFRF=$P(X,U,2),DIFRFLD=$P(X,U)
16 . . I 'DIFRF!('DIFRFLD) Q
17 . . S DICNT1=DICNT1+1,X=$$FNO^DILIBF(DIFRF)
18 . . I '$D(@DIFRTA@("^DD",X,DIFRF,DIFRFLD)) D Q
19 . . . Q:'DIFRFDD&($G(@DIFRTA@("FIA",X,DIFRF))'=0)
20 . . . D ERR1^DIFROMSX(DIFRF,DIFRFLD,DIFRNAME,"KEY") Q
21 . . S DICNT2=DICNT2+1
22 . Q:DIOUT I DICNT2=0,'DIFRFDD Q
23 . ;I DICNT1'=DICNT2 D ERR2^DIFROMSX(DIFRF2,DIFRNAME,"KEY") Q
24 . M @DIFRTA@("KEY",DIFRFILE,DIFRF2,DIFRNAME)=^DD("KEY",DIFRD0)
25 . S X=$NA(@DIFRTA@("KEY",DIFRFILE,DIFRF2,DIFRNAME,2))
26 . F Y="B","BB","S" K @X@(Y)
27 . K @DIFRTA@("KEY",DIFRFILE,DIFRF2,DIFRNAME,DIFRD0,3.1,"B")
28 . D IXPTR Q
29 Q
30IXPTR ; export index pointer
31 N DIIXPTR S DIIXPTR=$P(^DD("KEY",DIFRD0,0),U,4)
32 I 'DIIXPTR D ERR1(9546,DIFRF2,DIFRNAME) Q
33 N X,Y S X=$G(^DD("IX",DIIXPTR,0)),Y=$P(X,U,2),X=$P(X,U)
34 I (+$P(X,"E")'=X)!(Y="") D ERR1(9546,DIFRF2,DIFRNAME) Q
35 S @DIFRTA@("KEYPTR",DIFRFILE,DIFRF2,DIFRNAME)=X_"^"_Y
36 Q
37 ;
38DDKEYIN(DIFRFILE,DIFRF2,DIFRSA) ;
39 ; DIFRFILE=top level file#
40 ; DIFRF2=current file/subfile#
41 ; DIFRSA=global reference of transport global
42 I '$D(^DD(.31)) N DIFRER S DIFRER("FILE")=.31 D BLD^DIALOG(401,.DIFRER) Q
43 N DIFRIN,DIFRNAME,DIFRD1,DIOUT,DIFRIN1,DIFRF,DIFRFLD,DIFRKPTR,X
44 S DIFRIN=$NA(@DIFRSA@("KEY",DIFRFILE,DIFRF2))
45 S DIFRNAME=""
46 F S DIFRNAME=$O(@DIFRIN@(DIFRNAME)) Q:DIFRNAME="" D
47 . S (DIFRD1,DIOUT)=0,DIFRIN1=$NA(@DIFRIN@(DIFRNAME))
48 . F S DIFRD1=$O(@DIFRIN1@(2,DIFRD1)) Q:'DIFRD1 D Q:DIOUT
49 . . S X=$G(@DIFRIN1@(2,DIFRD1,0))
50 . . S DIFRF=$P(X,U,2),DIFRFLD=$P(X,U)
51 . . I 'DIFRF!('DIFRFLD) Q
52 . . I '$D(^DD(DIFRF,DIFRFLD,0)) D ERR3^DIFROMSX(DIFRF,DIFRFLD,DIFRNAME,"KEY")
53 . . Q
54 . Q:DIOUT
55 . S X=$G(@DIFRSA@("KEYPTR",DIFRFILE,DIFRF2,DIFRNAME)) D Q:DIOUT
56 . . I X="" D ERR1(9547,DIFRF2,DIFRNAME) Q
57 . . S DIFRKPTR=$O(^DD("IX","BB",$P(X,U),$P(X,U,2),0))
58 . . I 'DIFRKPTR D ERR1(9547,DIFRF2,DIFRNAME) Q
59 . . S $P(@DIFRIN1@(0),U,4)=DIFRKPTR Q
60 . N DIEN,DIK,DA,DIC,DO
61 . S DIEN=$O(^DD("KEY","BB",DIFRF2,DIFRNAME,0))
62 . I DIEN D N DINUM S DINUM=DIEN
63 . . S DIK="^DD(""KEY"",",DA=DIEN N DIEN D ^DIK Q
64 . S DIC="^DD(""KEY"",",DIC(0)="L",DIC("DR")=".02///^S X="_""""_DIFRNAME_"""",X=DIFRF2 D FILE^DICN S DIEN=+Y
65 . I DIEN'>0 D ERR4^DIFROMSX(DIFRF2,DIFRNAME,"KEY") Q
66 . M ^DD("KEY",DIEN)=@DIFRIN1
67 . K DIK,DA S DIK="^DD(""KEY"",",DA=DIEN D IX1^DIK
68 . Q
69 Q
70 ;
71ERR1(DIER,DIFRF2,DIFRNAME) ;
72 N DIFRER S DIFRER(1)=DIFRNAME
73 S DIFRER(2)=DIFRF2
74 D BLD^DIALOG(DIER,.DIFRER) S DIOUT=1 Q
75 ;
76 ;9543 Field |1| of file |2|, part of '|3|' |4| entry, is missing from the transport global...
77 ;9545 |1| entry |2| is not installed. The REFERENCE FIELD |3| in file |4| does not exist on the system.
78 ;9546 KEY '|1|' for file |2| cannot be transported, problem with Uniqueness Index for the KEY.
79 ;9547 Key '|1|' for file |2| not installed. Pointer to Uniqueness Index cannot be resolved.
80 ;9549 |1| "|2|" on file |3| not installed, FILE^DICN call failed.
81 ;
Note: See TracBrowser for help on using the repository browser.