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

DDXP32.m

Go to the documentation of this file.
DDXP32 ;SFISC/DPC-CREATE EXPORT TEMPLATE (CONT) ;12:44 PM  7 Jun 1999
 ;;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.
 ;
CAPDT ;
 K DDXPFCAP,DDXPDT,DDXPATH N FCAP,NUMPC,C S C=","
 F DDXPCNDX=1:1:DDXPTOTF D
 . I DDXPNOUT(DDXPCNDX) Q
 . S DDXPX=^TMP($J,"TIN",DDXPCNDX),DDXPTGFL=DDXPFINO,NUMPC=0 K FCAP
 . D FLDFIND
 . S DDXPFCAP(DDXPCNDX)=FCAP(NUMPC)
 . F NUMPC=NUMPC-1:-1 Q:'$D(FCAP(NUMPC))  D
 . . S DDXPFCAP(DDXPCNDX)=DDXPFCAP(DDXPCNDX)_" in "_FCAP(NUMPC)_" subfile"
 . . Q
 . K FCAP,NUMPC
 . Q
 I $D(DDXPATH) D MULTVER
 K DDXPX,DDXPCNDX,DDXPTGFL,DDXPDD0 Q
FLDFIND ;
 S NUMPC=NUMPC+1
 I DDXPX=0 D  Q
 . S FCAP(NUMPC)="NUMBER",DDXPDT(DDXPCNDX)=4
 . Q
 I +DDXPX D
 . S DDXPDD0="^DD("_DDXPTGFL_","_+DDXPX_",0)"
 . Q
 I DDXPX=+DDXPX D  Q
 . S FCAP(NUMPC)=$P(@DDXPDD0,U,1)
 . S %=$P(@DDXPDD0,U,2),DDXPDT(DDXPCNDX)=$S(%["D":1,%["N":2,1:4) K %
 . Q
 I '+DDXPX D  Q
 . S DDXPDT(DDXPCNDX)=4
 . I $E(DDXPX)=Q S FCAP(NUMPC)=DDXPX Q
 . S %=$P(DDXPX,";Z;",2),%=$P(%,Q,2,99),%=$P(%,";",1),FCAP(NUMPC)=$E(%,1,($L(%)-1)) K %
 . Q
MULT ;
 S FCAP(NUMPC)=$P(@DDXPDD0,U,1)
 S DDXPTGFL=+$P(@DDXPDD0,U,2)
 I NUMPC=1 D
 . N %,I,DONE S %=$P(DDXPX,C,1,$L(DDXPX,C)-1),DONE=0
 . F I=2:1:$L(DDXPX,C) Q:DONE  D
 . . Q:+$P(%,C,I)
 . . S %=$P(%,C,1,I-1),DONE=1
 . . Q
 . S DDXPATH(DDXPCNDX)=%
 . Q
 S DDXPX=$P(DDXPX,C,2,99)
 G FLDFIND
SETFLD ;
 S %L=$S($D(DDXPFLEN):";2///^S X=DDXPFLEN(DDXPFLD)",1:"")
 S %F=$S($D(DDXPFFNM):";3///^S X=DDXPFFNM(DDXPFLD)",1:"")
 S (DIC,DIE)="^DIPT("_DDXPXTNO_",100,",DA(1)=DDXPXTNO,DIC("P")=$P(^DD(.4,100,0),U,2),DIC(0)="L" K DO
 F DDXPFLD=1:1:DDXPTOTF D
 . I DDXPNOUT(DDXPFLD) Q
 . S (DINUM,X)=DDXPFLD K DD D FILE^DICN
 . S DA=DDXPFLD,DR="1////^S X=DDXPDT(DDXPFLD)"_%L_%F D ^DIE
 . Q
 K DIE,DIC,X,Y,DA,DR,%L,%F
 Q
SETEMP ;
 S DR="2///NOW;4///"_DDXPFINO_";5///"_DUZ_";8///3;105////"_DDXPFMNO S:$G(DDXPATH) DR=DR_";115///"_DDXPATH
 S DA=DDXPXTNO,DIE="^DIPT(" D ^DIE K DIE,DA,DR
 ; Hard Set ReadAccess and WriteAccess
 I $D(^DIPT(DDXPXTNO,0))#2,$D(DUZ(0))#2 D
 . S $P(^DIPT(DDXPXTNO,0),U,3)=DUZ(0) ; Read Access
 . S $P(^DIPT(DDXPXTNO,0),U,6)=DUZ(0) ; Write Access
 S %X="^DIPT("_DDXPFDTM_",""DXS"",",%Y="^DIPT("_DDXPXTNO_",""DXS""," D %XY^%RCR K %X,%Y
 S ^DIPT(DDXPXTNO,"SUB")=1
 S ^DIPT(DDXPXTNO,"H")="@@"
 Q
MULTVER ;
 N I,MP,LP,MPC,LPC,NOMATCH S LP="",NOMATCH=0
 F I=1:1:DDXPTOTF D  Q:NOMATCH
 . S MP=$G(DDXPATH(I)) Q:'MP
 . I LP=MP Q
 . I 'LP S LP=MP Q
 . S LPC=$L(LP,C),MPC=$L(MP,C)
 . I LPC=MPC S NOMATCH=1 Q
 . I LPC>MPC D  Q
 . . I MP=$P(LP,C,1,MPC) Q
 . . S NOMATCH=1
 . . Q
 . I LP=$P(MP,C,1,LPC) S LP=MP Q
 . S NOMATCH=1
 . Q
 I 'NOMATCH S DDXPATH=LP Q
 W !!,$C(7),"The "_DDXPFDNM_" template has fields in more than one multiple path."
 W !,"Therefore, export of the data will not succeed."
 W !,"Refer to the VA FileMan User Manual for more details.",!
 S DDXPOUT=1
 Q
QUOT ;
 N QPC,Q1ST
 I DDXPDT(DDXPFLD)=2 Q
 S Q1ST=$S(DDXPNPC=DDXPRNPC:1,1:0)
 S QPC="W $C(34)"_$S(Q1ST&(DDXPFLD=1):"",1:";X")
 I Q1ST S DDXPNPC=QPC_T_DDXPNPC
 E  S DDXPNPC=DDXPNPC_T_QPC
 Q