1 | BMXSQL4 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;
|
---|
2 | ;;4.1000;BMX;;Apr 17, 2011
|
---|
3 | ;
|
---|
4 | ;
|
---|
5 | JOIN ;EP - Join processing
|
---|
6 | ;Create a pointer chain back to the primary file
|
---|
7 | ;or to a reverse pointer file, E.G.:
|
---|
8 | ;Either executable code or an expression that returns the
|
---|
9 | ;IEN of the terminal pointed-to file
|
---|
10 | ;
|
---|
11 | ; S IEN1=$P(^DIZ(1000,IEN2,0),U,4)
|
---|
12 | ; I +IEN1 S IEN=$P(^AUTTLOC(IEN1,0),U,23)
|
---|
13 | ;
|
---|
14 | Q:'$D(BMXFJ("JOIN"))
|
---|
15 | N C,D,E,BMXSTOP,BMXPTF,BMXPTG,BMXPTL,BMXPTN,BMXPTP,BMXPTC
|
---|
16 | S C=0 F S C=$O(BMXFF(C)) Q:'+C D
|
---|
17 | . Q:'$D(BMXFF(C,"JOIN"))
|
---|
18 | . S BMXPTL=1,BMXPTC="",D=C ;Pointer level
|
---|
19 | . F S BMXPTF=$P(BMXFF(D),U,5) D Q:BMXPTF=BMXFO(1)
|
---|
20 | . . S BMXPTG=$P(BMXFF(D),U,7,99) ;Pf Global
|
---|
21 | . . S BMXPTN=$P(BMXFF(D,0),U,4) ;Pf Node
|
---|
22 | . . S BMXPTP=$P(BMXPTN,";",2) ;Pf Piece
|
---|
23 | . . S BMXPTN=$P(BMXPTN,";")
|
---|
24 | . . S BMXPTC="I +IEN"_BMXPTL_" S IEN"_(BMXPTL-1)_"=$P($G("_BMXPTG_"IEN"_BMXPTL_","_BMXPTN_")),U,"_BMXPTP_") "_BMXPTC
|
---|
25 | . . S BMXPTL=BMXPTL+1
|
---|
26 | . . ;S D To the index of the pointed to file's entry in BMXFF
|
---|
27 | . . Q:BMXPTF=BMXFO(1)
|
---|
28 | . . S E=0,BMXSTOP=0 F S E=$O(BMXFF(E)) Q:'+E Q:BMXSTOP D
|
---|
29 | . . . I $D(BMXFF(E,0)),+$P($P(BMXFF(E,0),U,2),"P",2)=BMXPTF S D=E,BMXSTOP=1 Q
|
---|
30 | . . . I $D(BMXFF(E,0)),BMXPTF=9000001,+$P($P(BMXFF(E,0),U,2),"P",2)=2 S D=E,BMXSTOP=1 Q ;IHS auto join PATIENT to VA PATIENT
|
---|
31 | . S BMXFF(C,"JOIN")=BMXPTC
|
---|
32 | . S BMXFF(C,"JOIN","IEN")="IEN"_(BMXPTL-1)
|
---|
33 | Q
|
---|