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