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

DIAXT.m

Go to the documentation of this file.
DIAXT ;SFISC/DCM-GET EXTRACT TEMPLATE SPECS ;5/13/96  14:01
 ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
 ;;Per VA Directive 6402, this routine should not be modified.
 ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
 ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
 ;;Licensed under the terms of the Apache License, Version 2.0.
 ;
EN N DIAXI,DILL,DIAX
 S DIAXTTO="^TMP($J,""DIAXTTO"")",DIAXTFR="^TMP($J,""DIAXTFR"")"
 K @DIAXTTO,@DIAXTFR
 D SPEC
 Q
SPEC ;get specs
 D TOP,DR
 D NEXTLVL
 Q
TOP ;get base file specs from extract template
 N X
 S DIAXI=0
 S DIAXI=$O(^DIPT(DIAXT,1,DIAXI)) Q:DIAXI'>0  S X=^(DIAXI,0)
 S DILL=$P(X,U,2)
FILE S @DIAXTFR@(DIAXI,"FR")=+X
 S @DIAXTFR@(+X,"TO")=$P(X,U,9)
 S @DIAXTFR@(+X,"PRT")=$P(X,U,3)
 S @DIAXTFR@(+X,"P4")=$P(X,U,4)
 S @DIAXTFR@(+X,"P2")=$P(X,U,2)
 S @DIAXTFR@(+X,"P5")=$P(X,U,5)
 S @DIAXTFR@(+X,"P7")=$P(X,U,7)
 I DILL>1,$P(X,U,9)'=$P(X,U,10) S @DIAXTTO@(+$P(X,U,9),"PRT")=+$P(X,U,10)
 Q
DR ;get fields
 N DR,DRN,DRX,DRZ,FILE
 S DR="",DRN=1,DRZ=0,FILE=@DIAXTFR@(DILL,"FR")
 F  S DRZ=$O(^DIPT(DIAXT,1,DIAXI,"F",DRZ)) Q:'DRZ  I $D(^(DRZ,0)) S DRX=^(0) D
 . S DR=DR_+DRX_";",FILE=@DIAXTFR@(DIAXI,"FR")
 . S @DIAXTTO@(FIL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