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

XPDTA.m

Go to the documentation of this file.
  1. XPDTA ;SFISC/RSD - Build Actions for Kernel Files ;02/14/2006
  1. ;;8.0;KERNEL;**15,44,58,131,229,393,498,539,713,796**;Jul 10, 1995;Build 4
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. Q
  1. ;^XTMP("XPDT",XPDA,"KRN",FILE,DA) is the global root
  1. ;DA=ien in ^XTMP,XPDNM=package name, XPDA=package ien in ^XPD(9.6,
  1. OPT ;options
  1. N %,%1,%2
  1. ;if link, kill everything and just process the menu items
  1. I XPDFL=2 D G OPTT
  1. .S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",19,DA,%)) Q:'% K:%'=10 ^(%)
  1. ;resolve Package (0;12), remove Creator (0;5)
  1. S %=^XTMP("XPDT",XPDA,"KRN",19,DA,0),$P(%,U,12)=$$PT("^DIC(9.4)",$P(%,U,12)),$P(%,U,5)=""
  1. ;resolve Help Frame (0;7), kill Permitted Devices (3.96;0) & queue node (200)
  1. S $P(%,U,7)=$$PT("^DIC(9.2)",$P(%,U,7)),^XTMP("XPDT",XPDA,"KRN",19,DA,0)=% K ^(3.96),^(200)
  1. ;resolve Server Bulletin (220;1), Server Mailgroup (220;3)
  1. I $D(^XTMP("XPDT",XPDA,"KRN",19,DA,220)) S %=^(220),$P(%,U)=$$PT("^XMB(3.6)",+%),$P(%,U,3)=$$PT("^XMB(3.8)",$P(%,U,3)),^XTMP("XPDT",XPDA,"KRN",19,DA,220)=%
  1. ;resolve RPC (RPC;0), must be type Broker
  1. I $D(^XTMP("XPDT",XPDA,"KRN",19,DA,"RPC")) K:$P(^(0),U,4)'="B" ^("RPC") D
  1. .;kill "B"=name x-ref, it will be re-indexed when installed
  1. .K ^XTMP("XPDT",XPDA,"KRN",19,DA,"RPC","B")
  1. .;loop thru RPCs and resolve (RPC;1)
  1. .S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",19,DA,"RPC",%)) Q:'% S %1=$G(^(%,0)) D
  1. ..S %2=$$PT("^XWB(8994)",+%1)
  1. ..;if can't resolve then delete
  1. ..I %2="" K ^XTMP("XPDT",XPDA,"KRN",19,DA,"RPC",%,0) Q
  1. ..;save the RPC name
  1. ..S $P(^XTMP("XPDT",XPDA,"KRN",19,DA,"RPC",%,0),U)=%2
  1. .Q
  1. OPTT ;Menus can only exist for options of type: menu,protocol,protocol menu,
  1. ;extended action, limited, window suite
  1. I "LMOQXZ"'[$P(^XTMP("XPDT",XPDA,"KRN",19,DA,0),U,4) K ^(10) Q
  1. ;kill "B"=name, "C"=synonyms x-ref, it will be re-indexed when installed
  1. K ^XTMP("XPDT",XPDA,"KRN",19,DA,10,"B"),^("C")
  1. ;loop thru 10=Menus and resolve Menu (10;1), kill if it doesn't resolve
  1. S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",19,DA,10,%)) Q:'% S %1=$G(^(%,0)) D
  1. .S %2=$$PT("^DIC(19)",+%1)
  1. .;items must be sent by themselves, check "B" x-ref
  1. .I $L(%2),$D(^XPD(9.6,XPDA,"KRN",19,"NM","B",%2)) S ^XTMP("XPDT",XPDA,"KRN",19,DA,10,%,U)=%2 Q
  1. .;if I couldn't resolve this option, then kill it
  1. .K ^XTMP("XPDT",XPDA,"KRN",19,DA,10,%)
  1. Q
  1. ;
  1. PRO ;protocols
  1. N %,%1,%2
  1. ;if link, kill everything and just process the item(10) and subscribers (775) multiples
  1. I XPDFL=2 D G PROT
  1. .S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",101,DA,%)) Q:'% K:%'=10&(%'=775) ^(%)
  1. ;resolve Package (0;12), remove Creator (0;5)
  1. S %=^XTMP("XPDT",XPDA,"KRN",101,DA,0),$P(%,U,12)=$$PT("^DIC(9.4)",$P(%,U,12)),$P(%,U,5)=""
  1. ;kill under Menus (10), "B"=name, "C"=synonyms
  1. S ^XTMP("XPDT",XPDA,"KRN",101,DA,0)=%
  1. ;resolve File Link (5;1), its a variable pointer
  1. S %=$P($G(^XTMP("XPDT",XPDA,"KRN",101,DA,5)),U),%1=$P(%,";",2)
  1. I %,$D(@("^"_%1_+%_",0)")) S $P(^XTMP("XPDT",XPDA,"KRN",101,DA,5),U)=$P(^(0),U)_";"_%1
  1. ;resolve HL7 fields, node 770
  1. S %=$G(^XTMP("XPDT",XPDA,"KRN",101,DA,770)) I $L(%) D S ^XTMP("XPDT",XPDA,"KRN",101,DA,770)=%
  1. .S $P(%,U)=$$PT("^HL(771)",$P(%,U)),$P(%,U,2)=$$PT("^HL(771)",$P(%,U,2))
  1. .S $P(%,U,3)=$$PT("^HL(771.2)",$P(%,U,3)),$P(%,U,11)=$$PT("^HL(771.2)",$P(%,U,11))
  1. .S $P(%,U,4)=$$PT("^HL(779.001)",$P(%,U,4)),$P(%,U,7)=$$PT("^HLCS(870)",$P(%,U,7))
  1. .S $P(%,U,8)=$$PT("^HL(779.003)",$P(%,U,8)),$P(%,U,9)=$$PT("^HL(779.003)",$P(%,U,9))
  1. .S $P(%,U,10)=$$PT("^HL(771.5)",$P(%,U,10))
  1. PROT ;loop thru 10=ITEM and 775=SUBSCRIBER and resolve Menu (10;1), kill if it doesn't resolve
  1. ;kill under Menus (10), "B"=name, "C"=synonyms
  1. I $D(^XTMP("XPDT",XPDA,"KRN",101,DA,10,0)) K ^("B"),^("C")
  1. S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",101,DA,10,%)) Q:'% S %1=$G(^(%,0)) D
  1. .;%2=.01 of Menu(protocol)
  1. .S %2=$$PT("^ORD(101)",+%1)
  1. .;Menu must also be sent by itself, check "B" x-ref
  1. .I $L(%2),$D(^XPD(9.6,XPDA,"KRN",101,"NM","B",%2)) S ^XTMP("XPDT",XPDA,"KRN",101,DA,10,%,U)=%2,$P(^XTMP("XPDT",XPDA,"KRN",101,DA,10,%,0),U,4)=$$PT("^ORD(101)",$P(%1,U,4)) Q
  1. .K ^XTMP("XPDT",XPDA,"KRN",101,DA,10,%)
  1. ;If type is Event Driver and sending Subscribers (775)
  1. I $P(^XTMP("XPDT",XPDA,"KRN",101,DA,0),U,4)="E" D
  1. . ;kill Menu multiple and Subscriber x-ref "B"=name
  1. . K ^XTMP("XPDT",XPDA,"KRN",101,DA,10),^(775,"B")
  1. . ;loop thru 775=Subscribers and resolve pointer (775;1)
  1. . S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",101,DA,775,%)) Q:'% S %1=$G(^(%,0)) D
  1. .. ;%2=.01 of subscriber(protocol)
  1. .. S %2=$$PT("^ORD(101)",+%1)
  1. .. ;protocol must also be sent by itself, check "B" x-ref
  1. .. I $L(%2),$D(^XPD(9.6,XPDA,"KRN",101,"NM","B",%2)) S ^XTMP("XPDT",XPDA,"KRN",101,DA,775,%,U)=%2 Q
  1. .. K ^XTMP("XPDT",XPDA,"KRN",101,DA,775,%)
  1. ;quit if no Access multiple
  1. Q:'$D(^XTMP("XPDT",XPDA,"KRN",101,DA,3,0)) K ^("B")
  1. ;loop thru Access and resolve (3;1), kill if it doesn't resolve
  1. S %=0 F S %=$O(^XTMP("XPDT",XPDA,"KRN",101,DA,3,%)) Q:'% S %1=$G(^(%,0)) D
  1. .;%2=.01 of Menu(protocol)
  1. .S %2=$$PT("^DIC(19.1)",+%1)
  1. .I $L(%2) S ^XTMP("XPDT",XPDA,"KRN",101,DA,3,%,0)=%2 Q
  1. .K ^XTMP("XPDT",XPDA,"KRN",101,DA,3,%)
  1. Q
  1. ;
  1. RTNE ;routine entry build action
  1. N %,X,XPD
  1. ;move routine to ^XTMP("XPDT",DPK1,"RTN",routine name
  1. ;routines will have the checksum in XTMP("XPDT",XPDA,"RTN",X) & in
  1. ;Build file
  1. S X=$P(^XTMP("XPDT",XPDA,"KRN",9.8,DA,0),U),XPD=^(-1)
  1. Q:X="" S %=$$LOAD(X,XPD),$P(^XPD(9.6,XPDA,"KRN",9.8,"NM",+$P(XPD,U,2),0),U,4)=%
  1. K ^XTMP("XPDT",XPDA,"KRN",9.8,DA)
  1. Q
  1. ;
  1. RTNF ;routine file build action
  1. N X,Y,% S Y=0
  1. ;the routines that are left in XTMP("XPDT",XPDA,"KRN",9.8) are to be
  1. ;deleted at site, move name field to RTN node
  1. F S Y=$O(^XTMP("XPDT",XPDA,"KRN",9.8,Y)) Q:'Y S %=^(Y,-1),X=^(0) D
  1. .I +%=1 S ^XTMP("XPDT",XPDA,"RTN",X)=%,^("RTN")=$G(^XTMP("XPDT",XPDA,"RTN"))+1
  1. ;kill everything
  1. K ^XTMP("XPDT",XPDA,"KRN",9.8)
  1. Q
  1. ;
  1. PT(GR,DA) ;GR=file global ref, DA=ien, return .01 value
  1. Q:'DA ""
  1. Q:GR="" ""
  1. I $D(@GR@(+DA,0))#2 Q $P(^(0),U)
  1. Q ""
  1. ;
  1. GR(FN) ;returns closed global root, FN=file number
  1. N Y
  1. Q:'$G(FN) ""
  1. S Y=$G(^DIC(FN,0,"GL")) Q:Y="" ""
  1. Q $E(Y,1,($L(Y)-1))_$S($L(Y,",")>1:")",1:"")
  1. ;
  1. LOAD(X,XPD) ;load routine X, XPD=action^ien in Build file
  1. ;XPD = 0-load, 1-delete, 2-skip, returns checksum
  1. ;quit if routine is already saved
  1. Q:$D(^XTMP("XPDT",XPDA,"RTN",X)) $P(^(X),U,3)
  1. X ^%ZOSF("TEST") E W !,X,?10," Failed %ZOSF(""TEST"")! " S XPDERR=1 Q "" ;p713 ;p796 add ""
  1. N DIF,XCNP,%N,%A,FDA,IEN,LN2
  1. S DIF="^XTMP(""XPDT"",XPDA,""RTN"",X,",XCNP=0
  1. X ^%ZOSF("LOAD")
  1. S $P(^XTMP("XPDT",XPDA,"RTN",X,2,0),";",7)="Build "_(+^XPD(9.6,XPDA,6.3)),LN2=^XTMP("XPDT",XPDA,"RTN",X,2,0)
  1. S IEN=$$FIND1^DIC(9.8,"","X",X)
  1. ;^XTMP("XPDT",XPDA,"RTN",X)=action^ien in Build^checksum
  1. S %N="B"_$$SUMB^XPDRSUM($NA(^XTMP("XPDT",XPDA,"RTN",X)))
  1. S $P(XPD,"^",3)=%N ;Make sure the Checksum is in the 3rd piece
  1. S ^XTMP("XPDT",XPDA,"RTN",X)=XPD
  1. ;update count node
  1. S ^("RTN")=$G(^XTMP("XPDT",XPDA,"RTN"))+1
  1. N XUA,XUB S (XUA,XUB)=""
  1. ;Update Dev Patch field in Routine file
  1. I IEN D
  1. . S XUB=$P(XPDT(XPDT),U,2) S:XUB["*" $P(XUB,"*",2)=+$P(XUB,"*",2)
  1. . S IEN="?+2,"_IEN_",",FDA(9.819,IEN,.01)=XUB
  1. . S FDA(9.819,IEN,2)=%N,FDA(9.819,IEN,3)=$P(LN2,";",5)
  1. . D UPDATE^DIE("","FDA","IEN")
  1. Q %N