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

INHPSAL1.m

Go to the documentation of this file.
  1. INHPSAL1 ;KN; 16 Apr 96 14:42; MFN Loader Activates Software Application
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. Q
  1. ;
  1. PROCINT(INTER,INPAR,INNAME,INDATA,INMESS) ;Process one interface
  1. ;This is called as the control routine for most interfaces
  1. ;Called from PROC^INHPSAL
  1. ;INPUT:
  1. ; INTER - interface application identifier
  1. ; INPAR - array of parameters
  1. ; INNAME - name of application
  1. ; INDATA - executable MUMPS code to get data array
  1. ; should leave data in the array INDAT
  1. ; INMESS - executable code to be done after the load is complete
  1. ;
  1. S INNAME=$G(INNAME),INTER=$G(INTER),INDATA=$G(INDATA),INMESS=$G(INMESS)
  1. Q:'$L(INTER) 0
  1. N INERR,INDAT
  1. S INERR=""
  1. ;Get default name
  1. S:'$L(INNAME) INNAME=$P($G(INPAR("APPL",INTER)),U)
  1. ;Create array of data for application
  1. K INDAT
  1. ;Check for custom defined data builder code
  1. I $L(INDATA) X INDATA I INERR W !,"ERROR: ",INNAME," - no action taken" S INERR=1 Q 0
  1. ;Execute standard data builder
  1. I '$L(INDATA) I '$$CREDAT(.INDAT) W !,"ERROR: Unable to create data array." S INERR=1 Q 0
  1. ;Process application
  1. W !!,"Processing ",INNAME
  1. D TT(INTER,.INDAT,.INPAR)
  1. ;Quit positive if no errors, null if errors encoutnered
  1. Q $S('INERR:1,1:0)
  1. ;
  1. TT(INTER,INDAT,INPAR) ;Transaction Types
  1. ;
  1. ;Process Transaction Type
  1. N INREC S INREC=0
  1. F S INREC=$O(INDAT(INTER,4000,INREC)) Q:'INREC S:'$$TTONE(INREC,+$G(INPAR("ACT"))) INERR=1
  1. ;
  1. Q
  1. ;
  1. TTONE(DA,INST) ;Process one transaction type
  1. ;
  1. N DIC,X,Y,DIE,DR,INSTMSG,INNAME
  1. S INST=+$G(INST)
  1. ;Quit if deactivating and suppress deactivation flag is set
  1. Q:'INST&$P($G(INDAT(INTER,4000,DA)),U,2) 1
  1. ;Quit if activating and suppress activation flag is set
  1. Q:INST&$P($G(INDAT(INTER,4000,DA)),U,3) 1
  1. S (INNAME,X)=$P($G(INDAT(INTER,4000,DA)),U,1),DIC=4000,DIC(0)="",Y=$$DIC^INHPSA(DIC,X,"",DIC(0)),DA=+Y
  1. I INNAME'=$P(Y,U,2) W !,"ERROR: Wanted transaction type ",INNAME," but found ",$P(Y,U,2)," (",+Y,")." Q 0
  1. I DA<0 W !,"ERROR: Transaction Type: ",INNAME," not found." Q 0
  1. ; Deactivate all the active children except the calling child
  1. Q:'$$TTCHILD(DA,INST) 0
  1. ; Set the destination according to user selection
  1. Q:'$$DSTEDT(DA,INST) 0
  1. ;
  1. Q 1
  1. ;
  1. TTCHILD(DA,INST) ;Deactivate all child transaction types except for
  1. ; the one selected by user
  1. ;DA - ien of child transaction type selected
  1. ;
  1. N INCHTT,INPATT
  1. ;find the parent of calling child INPATT
  1. S INCHTT=+DA,INPATT=+$P(^INRHT(DA,0),U,6)
  1. ;loop through all the children of this parent
  1. S TT="" F S TT=$O(^INRHT("AC",INPATT,TT)) Q:'TT D
  1. .; in case of not a calling child
  1. . I TT'=DA D
  1. ..; check if it is active, then deactivate it
  1. .. I $P($G(^INRHT(TT,0)),U,5) D
  1. ... Q:'$$TTEDT^INHPSA(TT,0)
  1. . E D
  1. ..; in case the calling child is not active, then activate it
  1. .. I '$P(^INRHT(TT,0),U,5) Q:'$$TTEDT^INHPSA(TT,1)
  1. Q 1
  1. ;
  1. DSTEDT(DA,INST) ;Edit destination
  1. ;
  1. N INTMP,INNEW,INNIEN
  1. ;INTMP is current destination ien
  1. ;INNEW is new destination the user want to change
  1. ;INNIEN is the new destination ien
  1. S INTMP=$P(^INRHT(DA,0),U,2),INNIEN=$G(INPAR("DESTIEN")),INNEW=$P(^INRHD(INNIEN,0),U,2)
  1. ;change the destination
  1. S DIE=4000,DR=".02///`"_INNIEN D ^DIE
  1. Q 1
  1. ;
  1. CREDAT(INDAT) ;Create data array of control records
  1. ;
  1. N INERR,L1,TXT S INERR=1
  1. ;Load data into array
  1. F LI=1:1 S TXT=$P($$TEXT^INHPSAL2(INTER,LI),";;",2,99) Q:'TXT I '$$LOAD^INHPSA(.INDAT,TXT,INTER) S INERR=0
  1. Q INERR
  1. ;