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

DIARR6.m

Go to the documentation of this file.
DIARR6 ;SFISC/DCM-PROCESS ARCHIVED FILE WITH INDEX ;11/18/92  11:49 AM
 ;;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.
 ;
 S DIARFILE=$P(DIARL,U,3),DIARFN=+$P(DIARL,U,2)
 S DIARREC=$P(DIARL,U,4,99)
 F DIARXX=1:1 S DIARFLD=$P(DIARREC,U,DIARXX) Q:DIARFLD=""  S DIARFNO=$P(DIARFLD,":"),DIARFNA=$P(DIARFLD,":",2) D
 . I +DIARFNO=.01 S DIAR01=DIARFNA
 . S DIARPC(DIARXX)=DIARFNO_U_DIARFNA
 . S:+DIARFNO'=.01 DIARID(DIARFNO)=DIARFNA_U_DIARFNO
 . S DIARCNT=DIARXX
 . Q
 S DIARCTR=0,DIARFLGT=0
 F  X DIARX Q:DIARL["$DAT"  S DIARCTR=DIARCTR+1 F DIARXX=1:1:DIARCNT S DIARFLD=$P(DIARL,U,DIARXX) S DIARFNA=$P(DIARPC(DIARXX),U,2),DIARFNO=+DIARPC(DIARXX),^TMP("DIARHLP",$J,DIARCTR,DIARFNO)=DIARFNA_" = "_DIARFLD D FLGTH
 Q
 ;
FLGTH S $P(DIARPC(DIARXX),U,3)=$S($L(DIARFLD)>+$P(DIARPC(DIARXX),U,3):$L(DIARFLD),1:+$P(DIARPC(DIARXX),U,3))
 Q
 ;
PROC S DIARIXCT=0 K DIARRF
PROC1 F  X DIARX Q:DIARL["$DAT"  G PROC1:DIARL["$INDEX" D PROC2 D MATCH^DIARR2 K:'$G(DIARIXX(DIARIXCT)) DIARIXX(DIARIXCT) G PROC1
 Q:'$D(DIARIXX)
 S (DIARIXCT,DIARXX)=1 D:$G(DIARIXX(DIARIXCT)) FOUND
 F  S DIARXX=$O(DIARIXX(DIARXX)) Q:DIARXX'>0  D PROC1A
 Q
 ;
PROC1A F  X DIARX Q:DIARL["#$#"  I DIARL["$DAT" S DIARIXCT=DIARIXCT+1 I DIARIXCT=DIARXX D FOUND Q
 Q
 ;
PROC2 K DIARA S DIARIXCT=DIARIXCT+1,DIARIXX(DIARIXCT)=""
 F DIARXX=1:1:DIARCNT S DIARVAL=$P(DIARL,U,DIARXX) D PROC2A
 Q
 ;
PROC2A I +$P(DIARPC(DIARXX),U)=.01 S DIARA(.01)=DIARVAL Q
 S DIARA("ID",+$P(DIARPC(DIARXX),U))=DIARVAL
 Q
 ;
FOUND K ^TMP("DIARFG",$J) S DIARZ=1 D SET
 F DIARZ=DIARZ+1:1 X DIARX D SET I DIARL["$END DAT" Q
 F DIARZ=1:1 S DIARY=$P(DIARIXX(DIARIXCT),",",DIARZ) Q:DIARY=""  S DIARRF(DIARY)=$S($D(DIARRF(DIARY)):DIARRF(DIARY)+1,1:0) D SETFG
 Q
 ;
SET S ^TMP("DIARFG",$J,DIARZ)=DIARL
 Q
 ;
SETFG S %X="^TMP(""DIARFG"",$J,",%Y="^TMP(""DIAR"",$J,DIARY,DIARRF(DIARY)," D %XY^%RCR
 Q