XBDHDSP ; IHS/ADC/GTH - PUTS SPACES BETWEEN HEADERS ; [ 02/07/97 3:02 PM ]
;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
;
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
XBDHDSP ; IHS/ADC/GTH - PUTS SPACES BETWEEN HEADERS ; [ 02/07/97 3:02 PM ]
+1 ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
+2 ;
NEW ;
+1 NEW XBDHCHN1,XBDHI,XBDHTH,XBDHREP
INIT ;
+1 SET XBDHTH=XBDHCHN-1
SET XBDHNSL=XBDHTHLW-XBDHCHLW
+2 IF $PIECE(^TMP("XBDH",$JOB,"HEADER",1),V,8)>0
GOTO EXIT
+3 SET $PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHTH),V,8)=0
+4 WRITE !!,"IT IS NOW TIME TO INSERT SPACES BETWEEN HEADER FIELDS",!
CQ ;
+1 SET DIR(0)="SO^1:REPATITIVE SPACING;2:MANUAL SPACING;3:AUTOMATIC SPACING"
SET DIR("A")="Your choice"
SET DIR("B")=1
SET DIR("?")="Automatic spacing puts maximum no. of spaces possible between fields."
+2 DO ^DIR
+3 KILL DIR
+4 SET XBDHX=Y
+5 IF XBDHX=""
GOTO AUTO
+6 IF XBDHX=1
GOTO REP
MANUAL ;
+1 SET XBDHCHN1=""
+2 FOR XBDHL=0:0
SET XBDHCHN1=$ORDER(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1))
IF XBDHCHN1=XBDHTH!(XBDHCHN1="")
GOTO EXIT
DO MAN
EXIT ;
+1 SET DIR("B")="NO"
SET DIR(0)="YO"
SET DIR("A")="Want to make any more spacing changes"
+2 DO ^DIR
+3 KILL DIR
+4 IF Y=1
WRITE !!
GOTO CQ
+5 IF Y=U
SET XBDHQUIT=""
QUIT
+6 QUIT
+7 ;
MAN ;
+1 SET XBDHY=$CHAR(64+XBDHCHN1)
SET XBDHZ=^TMP("XBDH",$JOB,"HEADER",XBDHCHN1)
+2 WRITE !!,"PUT SPACES AFTER HEADER """,$CHAR(64+XBDHCHN1),""""
+3 WRITE !,"TOTAL NUMBER OF UNUSED COLUMNS LEFT: ",XBDHNSL
+4 WRITE !,"TOTAL NUMBER OF HEADERS LEFT: ",XBDHTH+1-XBDHCHN1,!
SP ;
+1 SET DIR(0)="NO^::"
SET DIR("A")="How many spaces do you want after field "_$CHAR(64+XBDHCHN1)
+2 IF $GET(DIR("B"))]""
SET DIR("B")=XBDHX
+3 DO ^DIR
+4 KILL DIR
+5 SET XBDHX=Y
+6 IF XBDHX=""
SET XBDHCHN1=XBDHTH-1
QUIT
+7 IF XBDHX?1"^"1U
IF $EXTRACT(XBDHX,2)']$CHAR(64+XBDHTH)
IF ($ASCII(XBDHX)-64)'=XBDHTH
SET XBDHCHN1=$ASCII($EXTRACT(XBDHX,2))-64
GOTO MAN
+8 IF XBDHX'=+XBDHX
WRITE *7,*7,*13,$JUSTIFY("",IOM),*13
GOTO SP
+9 IF (XBDHX-$PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1),V,8))>XBDHNSL
WRITE *7,*7,*13,$JUSTIFY("",IOM),*13
GOTO SP
+10 SET XBDHY=$PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1),V,8)
SET $PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1),V,8)=XBDHX
SET XBDHNSL=XBDHNSL-XBDHX+XBDHY
+11 DO ^XBDHD1
+12 QUIT
+13 ;
AUTO ;
+1 SET XBDHNSL=(XBDHTHLW-XBDHCHLW)
SET XBDHY=XBDHNSL\(XBDHTH-1)
SET XBDHZ=XBDHNSL-(XBDHY*(XBDHTH-1))
SET XBDHCHN1=""
+2 FOR XBDHI=1:1
SET XBDHCHN1=$ORDER(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1))
IF XBDHCHN1=XBDHTH!(XBDHCHN1="")
QUIT
SET XBDHX=XBDHY
IF XBDHI'>XBDHZ
SET XBDHX=XBDHX+1
SET $PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1),V,8)=XBDHX
+3 SET XBDHNSL=0
+4 DO ^XBDHD1
+5 GOTO EXIT
+6 ;
REP ;
+1 WRITE !
+2 SET XBDHNSL=(XBDHTHLW-XBDHCHLW)
SET XBDHREP=XBDHNSL\(XBDHTH-1)
SET XBDHCHN1=""
EREP ;
+1 SET DIR(0)="NO^0:"_XBDHREP_":"
SET DIR("A")="How many spaces between each header field"
SET DIR("B")=XBDHREP
+2 DO ^DIR
+3 KILL DIR
+4 SET XBDHX=Y
+5 IF XBDHX'=+XBDHX
WRITE *7,*7,*13,$JUSTIFY("",IOM),*13
GOTO EREP
+6 IF XBDHX>XBDHREP
WRITE *7,*7,*13,$JUSTIFY("",IOM),*13
GOTO EREP
+7 IF XBDHX=""
SET XBDHX=0
+8 FOR XBDHI=1:1
SET XBDHCHN1=$ORDER(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1))
IF XBDHCHN1=XBDHTH!(XBDHCHN1="")
QUIT
IF XBDHCHN1'["."
SET $PIECE(^TMP("XBDH",$JOB,"HEADER",XBDHCHN1),V,8)=XBDHX
SET XBDHNSL=XBDHNSL-XBDHX
+9 DO ^XBDHD1
+10 GOTO EXIT
+11 ;
NOTES ;
+1 ; PUTS SPACES BETWEEN FIELDS ON THE HEADER LINE
+2 ; INPUT = XBDHCHLW,XBDHTHLW,XBDHCHN
+3 ; OUTPUT = 8TH PIECE OF ^TMP("XBDH",$J,"HEADER",XBDHCHN)
+4 ; IGNORES PURE MUMPS EXPRESSION AS DESIGNATED BY DECIMAL XBDHCHN