Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BMXSQL4

BMXSQL4.m

Go to the documentation of this file.
  1. BMXSQL4 ; IHS/OIT/HMW - BMX REMOTE PROCEDURE CALLS ;
  1. ;;4.0;BMX;;JUN 28, 2010
  1. ;
  1. ;
  1. JOIN ;EP - Join processing
  1. ;Create a pointer chain back to the primary file
  1. ;or to a reverse pointer file, E.G.:
  1. ;Either executable code or an expression that returns the
  1. ;IEN of the terminal pointed-to file
  1. ;
  1. ; S IEN1=$P(^DIZ(1000,IEN2,0),U,4)
  1. ; I +IEN1 S IEN=$P(^AUTTLOC(IEN1,0),U,23)
  1. ;
  1. Q:'$D(BMXFJ("JOIN"))
  1. N C,D,E,BMXSTOP,BMXPTF,BMXPTG,BMXPTL,BMXPTN,BMXPTP,BMXPTC
  1. S C=0 F S C=$O(BMXFF(C)) Q:'+C D
  1. . Q:'$D(BMXFF(C,"JOIN"))
  1. . S BMXPTL=1,BMXPTC="",D=C ;Pointer level
  1. . F S BMXPTF=$P(BMXFF(D),U,5) D Q:BMXPTF=BMXFO(1)
  1. . . S BMXPTG=$P(BMXFF(D),U,7,99) ;Pf Global
  1. . . S BMXPTN=$P(BMXFF(D,0),U,4) ;Pf Node
  1. . . S BMXPTP=$P(BMXPTN,";",2) ;Pf Piece
  1. . . S BMXPTN=$P(BMXPTN,";")
  1. . . S BMXPTC="I +IEN"_BMXPTL_" S IEN"_(BMXPTL-1)_"=$P($G("_BMXPTG_"IEN"_BMXPTL_","_BMXPTN_")),U,"_BMXPTP_") "_BMXPTC
  1. . . S BMXPTL=BMXPTL+1
  1. . . ;S D To the index of the pointed to file's entry in BMXFF
  1. . . Q:BMXPTF=BMXFO(1)
  1. . . S E=0,BMXSTOP=0 F S E=$O(BMXFF(E)) Q:'+E Q:BMXSTOP D
  1. . . . I $D(BMXFF(E,0)),+$P($P(BMXFF(E,0),U,2),"P",2)=BMXPTF S D=E,BMXSTOP=1 Q
  1. . . . 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
  1. . S BMXFF(C,"JOIN")=BMXPTC
  1. . S BMXFF(C,"JOIN","IEN")="IEN"_(BMXPTL-1)
  1. Q