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

INHPSAR.m

Go to the documentation of this file.
  1. INHPSAR ;WOM JPD; 29 Mar 96 11:31;Message Replication Application
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ; Associates all children of a parent INTERFACE TRANSACTION
  1. ; with an entry in the REPLICATION FILE
  1. ;
  1. ; Pick a parent. Then Pick Base.
  1. ; Software finds children of parent makes them replicants
  1. ; then stuffs Base Transaction into .02 of
  1. ; above message replicant file entries
  1. ; Then makes the children parents by removing parent field
  1. ;
  1. W !,"Not an entry point"
  1. Q
  1. EN N Y,INPT,INBS,INPTY0,INBSY0
  1. K ^UTILITY("INHPSAR",$J)
  1. W @IOF,!,$$CENTER^INHUTIL("Message Replication Application",80),!!
  1. ; Get Parent TT
  1. F Q:'$$PT(.Y) D BS(+Y,Y(0))
  1. K ^UTILITY("INHPSAR",$J)
  1. Q ;Exit here
  1. PT(Y) ;Get parent TT
  1. N DIC
  1. S DIC="^INRHT(",DIC(0)="AEQZ",DIC("S")="I $P(^(0),U,6)="""""
  1. S DIC("A")="Enter Parent Transaction Type: "
  1. D ^DIC
  1. Q (Y'=-1)
  1. BS(INPT,INPTY0) ;Get Base (REP)
  1. ; Input:
  1. ; INPT - Transaction Type
  1. ; INPTY0 - Zero node of Transacion Type
  1. N DIC,Y,INBS,INBS0
  1. S DIC="^INRHT(",DIC(0)="AEQZ",DIC("A")="Enter Base Transaction Type: "
  1. ;check so that no children pointing to it
  1. S DIC("S")="I '$D(^INRHT(""AC"",Y))"
  1. D ^DIC I Y=-1 Q
  1. D ASS(INPT,INPTY0,+Y,Y(0))
  1. Q
  1. ASS(INPT,INPTY0,INBS,INBSY0) ;Associate children of TT w/replicants
  1. ; Input:
  1. ; INPT - Transaction Type ien
  1. ; INPTY0 - Zero node of Transacion Type
  1. ; INBS - Base Transaction Type ien
  1. ; INBSY0 - Zero Node of Base Transaction Type
  1. N INCH,INY
  1. W !!,"You are about to associate all children of",!,"Interface Transaction Type ",$P(INPTY0,U),!,"with ",$P(INBSY0,U)," as replicants",!,"These are:",!
  1. ; loop cross ref of parent INPT looking for children
  1. S INCH="" F S INCH=$O(^INRHT("AC",INPT,INCH)) Q:INCH="" D
  1. .W !,INCH,?20,$P(^INRHT(INCH,0),U)
  1. .;child same as base
  1. .I INCH=INBS W !,"Note - Child of Parent same as Base Transaction - will not be processed" Q
  1. .;save children of parent INPT in Utility global
  1. .S ^UTILITY("INHPSAR",$J,INCH)=""
  1. ;check if children exist
  1. I '$D(^UTILITY("INHPSAR",$J)) W !,"No children found. Exiting!"
  1. E D
  1. .W !!,"Continue"
  1. .I '$$YN^%ZTF(0) W !,"Aborting!"
  1. .E D
  1. ..D ACTVAT(INPT,INPTY0)
  1. ..D CREAT(INPT,INPTY0,INBS,INBSY0)
  1. ..D SBT(INBS,$P(INPTY0,U))
  1. Q
  1. ACTVAT(INPT,INPTY0) ; Set parent to ACTIVE
  1. ; Input:
  1. ; INPT - Transaction Type
  1. ; INPTY0 - Zero node of Transacion Type
  1. N INY,DIE,DR
  1. S DIE="^INRHT(",DA=INPT,DR="S INY=0;.05///ACTIVE;S INY=1"
  1. D ^DIE
  1. I 'INY W !,"Unable to Activate Parent Transaction ",$P(INPTY0,U)
  1. Q
  1. CREAT(INPT,INPTY0,INBS,INBSY0) ; Create entry in REPLICATION FILE for each child of
  1. ;the parent and delete Parent Pointer from all children
  1. ; Input:
  1. ; INPT - Transaction Type ien
  1. ; INPTY0 - Zero node of Transacion Type
  1. ; INBS - Base Transaction Type ien
  1. ; INBSY0 - Zero Node of Base Transaction Type
  1. N INCH
  1. ;get all children of parent
  1. S INCH="" F S INCH=$O(^UTILITY("INHPSAR",$J,INCH)) Q:INCH="" D
  1. .D CRE(INCH,INBS),DEL(INCH) S ^UTILITY("INHPSAR",$J,INCH)=""
  1. ;
  1. W !!!!,"The Parent INTERFACE TRANSACTION TYPE ",$P(INPTY0,U),!," no longer has the children listed above"
  1. W !!,"These former Children Transaction Types are Replicants with the",!,"ORIGINATING TRANSACTION TYPE of ",$P(INBSY0,U),!
  1. Q
  1. DEL(DA) ; Makes child a parent
  1. ; Input: DA - IEN of child entry in INTERFACE TRANSACTION FILE
  1. ; to delete parent field
  1. N DIE,DR,INY
  1. S DIE="^INRHT(",DR="S INY=0;.06///@;S INY=1"
  1. D ^DIE
  1. I '$G(INY) W !,"Unable to delete child from parent ",DIE,DA
  1. Q
  1. CRE(INCH,INBS) ; Create entry in REPLICATION FILE
  1. ; Input: INCH - IEN of entry in INTERFACE TRANSACTION FILE
  1. ; and .01 field
  1. ; INBS - ORIGINATING TRANSACTION field
  1. ; Output: NONE
  1. N DA,DIC,DIE,DR,X,Y,INY
  1. S (DIC,DIE)="^INRHR(",DIC(0)="ZXL",X="`"_INCH
  1. ;look up child in INTERFACE REPLICATION FILE and laygo if not existing
  1. S DA=+$$DIC^INHSYS05(DIC,X,4020,DIC(0))
  1. I DA<1 W !,"Unable to replicate a child ",X Q
  1. ;Stuff Base TT into originating TT in INTERFACE MESSAGE REPLICATION FILE
  1. S DR="S INY=0;.02///`"_INBS_";S INY=1"
  1. D ^DIE
  1. I '$G(INY) W !,"NO DATA FILED for replicant ",DIE,INBS
  1. Q
  1. SBT(DA,PTT) ;Stuff Base transaction into parent
  1. ; Input:
  1. ; DA - ien of Base
  1. ; PTT - Name of Parent Transaction Type to stuff into Base .06 field
  1. N DIE,DR,INY
  1. S DIE="^INRHT(",DR=".06///@"
  1. D ^DIE
  1. S DR="S INY=0;.06///^S X=PTT;S INY=1"
  1. D ^DIE
  1. I '$G(INY) W !,"Unable to stuff Parent into Base"
  1. Q