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

XBDHDSV.m

Go to the documentation of this file.
XBDHDSV ; IHS/ADC/GTH - COMPILES HEADER INFO FOR AUTO ENTRY INTO DIP ; [ 02/07/97   3:02 PM ]
 ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
 ;
 I '$D(^TMP("XBDH",$J,"HEADER")) Q
NEW ;
 NEW XBDHC,XBDHHDX,DIRPIPE,XBDHI,XBDHLJ,XBDHLPTH,XBDHMORE,XBDHN,XBDHNN,XBDHL,XBDHPDFN,XBDHRJ,XBDHSTG,XBDHTPTH,XBDHWW,XBDHX,XBDHY,I,J,L,P,X,Y,BY,DALL,DIC,DIJ,DP,DPP,FR,IOP,IOX,IOY,TO,XBDHCHLW,XBDHPDNA,%
INIT ;
 S ^TMP("XBDH",$J,"HELPR",0)="]",^(99)="",X=^TMP("XBDH",$J,"HEADER"),XBDHCHLW=1,XBDHPDFN=$P(X,U),XBDHPDNA=$P(X,U,2),XBDHTHLW=$P(X,U,3),V="|"
 KILL X
 S XBDHLPTH="",(XBDHN,XBDHI)=0
INCN ;
 S XBDHN=XBDHN+1
 G:'$D(^TMP("XBDH",$J,"HEADER",XBDHN)) CLOSE S XBDHX=^(XBDHN)
 D MUMPS,PRELIM
 S XBDHLPTH=XBDHTPTH
 D NORMAL
 G INCN
 ;
CLOSE ;
 I XBDHTPTH]"" S X=$L(XBDHTPTH,";")-1,Y="" F X=1:1:X D SET
 D STD
 S DIR(0)="YO",DIR("A")="Want to make any more changes",DIR("B")="NO"
 D ^DIR
 KILL DIR
 I Y=1 G EXIT
 I Y=U S XBDHQUIT="" Q
 KILL ^TMP("XBDH",$J,"SAVE")
EXIT ;
 Q
 ;
SET ;
 S XBDHI=XBDHI+1,^TMP("XBDH",$J,"HELPR",XBDHI)=Y
 Q
 ;
MUMPS ;
 S XBDHJ=""
 F L=0:0 S XBDHJ=$O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:";L")_XBDHLJ
 I XBDHRJ="+" S XBDHSTG=XBDHSTG_";R"_$P(XBDHX,V,4)
 S XBDHI=XBDHI+1,^TMP("XBDH",$J,"HELPR",XBDHI)=XBDHSTG
 Q
 ;
STD ;
 W !!,"I AM ABOUT TO PRINT A SAMPLE REPORT.",!
 S DIR(0)="YO",DIR("A")="For this demo, do you want the 'standard' print options",DIR("B")="YES",DIR("?")="Standard options: SORT BY '@NUMBER', DEVICE = 'HOME'"
 D ^DIR
 KILL DIR
 I Y=U S XBDHQUIT="" Q
 W !!,"HMMM, LET ME THINK ABOUT THIS...",!!
 I Y=1 S BY="NUMBER;@",FR="",TO="",IOP=$I,DUZ(0)="@"
DIP ;
 S DIC=^DIC(XBDHPDFN,0,"GL")
 S DIRPIPE="D ^XBDHDIP",L="]"
 KILL XBDHHDX
 D EN1^DIP
 Q
 ; 
NOTES ; 
 ; CONVERTS THE INFO FROM THE "HEADER" GLOBAL INTO FM SYNATX FOR THE "HELPR" GLOBAL
 ; INPUT = ^TMP("XBDH",$J,"HEADER",XBDHCHN)
 ; OUTPUT = ^TMP("XBDH",$J,"HELPR",N)
 ; ";L" IS SUPERCEEDED BY ";W" IF WORDWRAP IS IN EFFECT
 ; EN1^DIP LEAVES SOME LOCALS HANGING AROUND WHICH ARE KILLED IN DIP+2
 ;