VistA-IHS-VA_UTILITIES-XB/XBDHDSP.m

75 lines
2.7 KiB
Mathematica
Raw Normal View History

XBDHDSP ; IHS/ADC/GTH - PUTS SPACES BETWEEN HEADERS ; [ 02/07/97 3:02 PM ]
;;4.0;XB;;Jul 20, 2009;Build 2
;
NEW ;
NEW XBDHCHN1,XBDHI,XBDHTH,XBDHREP
INIT ;
S XBDHTH=XBDHCHN-1,XBDHNSL=XBDHTHLW-XBDHCHLW
I $P(^TMP("XBDH",$J,"HEADER",1),V,8)>0 G EXIT
S $P(^TMP("XBDH",$J,"HEADER",XBDHTH),V,8)=0
W !!,"IT IS NOW TIME TO INSERT SPACES BETWEEN HEADER FIELDS",!
CQ ;
S DIR(0)="SO^1:REPATITIVE SPACING;2:MANUAL SPACING;3:AUTOMATIC SPACING",DIR("A")="Your choice",DIR("B")=1,DIR("?")="Automatic spacing puts maximum no. of spaces possible between fields."
D ^DIR
KILL DIR
S XBDHX=Y
I XBDHX="" G AUTO
I XBDHX=1 G REP
MANUAL ;
S XBDHCHN1=""
F XBDHL=0:0 S XBDHCHN1=$O(^TMP("XBDH",$J,"HEADER",XBDHCHN1)) G:XBDHCHN1=XBDHTH!(XBDHCHN1="") EXIT D MAN
EXIT ;
S DIR("B")="NO",DIR(0)="YO",DIR("A")="Want to make any more spacing changes"
D ^DIR
KILL DIR
I Y=1 W !! G CQ
I Y=U S XBDHQUIT="" Q
Q
;
MAN ;
S XBDHY=$C(64+XBDHCHN1),XBDHZ=^TMP("XBDH",$J,"HEADER",XBDHCHN1)
W !!,"PUT SPACES AFTER HEADER """,$C(64+XBDHCHN1),""""
W !,"TOTAL NUMBER OF UNUSED COLUMNS LEFT: ",XBDHNSL
W !,"TOTAL NUMBER OF HEADERS LEFT: ",XBDHTH+1-XBDHCHN1,!
SP ;
S DIR(0)="NO^::",DIR("A")="How many spaces do you want after field "_$C(64+XBDHCHN1)
S:$G(DIR("B"))]"" DIR("B")=XBDHX
D ^DIR
KILL DIR
S XBDHX=Y
I XBDHX="" S XBDHCHN1=XBDHTH-1 Q
I XBDHX?1"^"1U,$E(XBDHX,2)']$C(64+XBDHTH),($A(XBDHX)-64)'=XBDHTH S XBDHCHN1=$A($E(XBDHX,2))-64 G MAN
I XBDHX'=+XBDHX W *7,*7,*13,$J("",IOM),*13 G SP
I (XBDHX-$P(^TMP("XBDH",$J,"HEADER",XBDHCHN1),V,8))>XBDHNSL W *7,*7,*13,$J("",IOM),*13 G SP
S XBDHY=$P(^TMP("XBDH",$J,"HEADER",XBDHCHN1),V,8),$P(^TMP("XBDH",$J,"HEADER",XBDHCHN1),V,8)=XBDHX,XBDHNSL=XBDHNSL-XBDHX+XBDHY
D ^XBDHD1
Q
;
AUTO ;
S XBDHNSL=(XBDHTHLW-XBDHCHLW),XBDHY=XBDHNSL\(XBDHTH-1),XBDHZ=XBDHNSL-(XBDHY*(XBDHTH-1)),XBDHCHN1=""
F XBDHI=1:1 S XBDHCHN1=$O(^TMP("XBDH",$J,"HEADER",XBDHCHN1)) Q:XBDHCHN1=XBDHTH!(XBDHCHN1="") S XBDHX=XBDHY S:XBDHI'>XBDHZ XBDHX=XBDHX+1 S $P(^TMP("XBDH",$J,"HEADER",XBDHCHN1),V,8)=XBDHX
S XBDHNSL=0
D ^XBDHD1
G EXIT
;
REP ;
W !
S XBDHNSL=(XBDHTHLW-XBDHCHLW),XBDHREP=XBDHNSL\(XBDHTH-1),XBDHCHN1=""
EREP ;
S DIR(0)="NO^0:"_XBDHREP_":",DIR("A")="How many spaces between each header field",DIR("B")=XBDHREP
D ^DIR
KILL DIR
S XBDHX=Y
I XBDHX'=+XBDHX W *7,*7,*13,$J("",IOM),*13 G EREP
I XBDHX>XBDHREP W *7,*7,*13,$J("",IOM),*13 G EREP
I XBDHX="" S XBDHX=0
F XBDHI=1:1 S XBDHCHN1=$O(^TMP("XBDH",$J,"HEADER",XBDHCHN1)) Q:XBDHCHN1=XBDHTH!(XBDHCHN1="") S:XBDHCHN1'["." $P(^TMP("XBDH",$J,"HEADER",XBDHCHN1),V,8)=XBDHX,XBDHNSL=XBDHNSL-XBDHX
D ^XBDHD1
G EXIT
;
NOTES ;
; PUTS SPACES BETWEEN FIELDS ON THE HEADER LINE
; INPUT = XBDHCHLW,XBDHTHLW,XBDHCHN
; OUTPUT = 8TH PIECE OF ^TMP("XBDH",$J,"HEADER",XBDHCHN)
; IGNORES PURE MUMPS EXPRESSION AS DESIGNATED BY DECIMAL XBDHCHN