XBDHD1	; IHS/ADC/GTH - COMPILES HEADER LINE ; [ 02/07/97   3:02 PM ]
	;;4.0;XB;;Jul 20, 2009;Build 2
	;
NEW	;
	NEW XBDHCHN2,XBDHHDPD,XBDHHDSP,XBDHL1,XBDHL2,XBDHL3,DX,DY
INIT	;
	W @IOF
	X XBDHWOFF
	S (XBDHL1,XBDHL2,XBDHL3,XBDHCHN2)="",XBDHCHLW=0,DX=0,XBDHNSL=XBDHTHLW
	F XBDHL=0:0 S XBDHCHN2=$O(^TMP("XBDH",$J,"HEADER",XBDHCHN2)) Q:XBDHCHN2=""  D:((XBDHCHN2\1)=XBDHCHN2) VAR W "."
	W @IOF
WLINE	;
	F XBDHZ=1:1:4 Q:XBDHZ>(((XBDHTHLW-1)\80)+1)  D LINE
FIN	;
	S DY=(3*XBDHZ)+1,XBDHX="",$P(XBDHX,"-",79)=""
	X IOXY
	W XBDHX,!
EXIT	;
	Q
	; 
LINE	;
	S DY=(XBDHZ*3)-2,XBDHX=80*XBDHZ
	F XBDHY="XBDHL1","XBDHL3" S DY=DY+1 X IOXY W $E(@XBDHY,XBDHX-79,XBDHX)
	Q
	; 
VAR	;
	S XBDHHDR=$P(^TMP("XBDH",$J,"HEADER",XBDHCHN2),V,3),XBDHHDW=$P(^(XBDHCHN2),V,4),XBDHHDPD=$P(^(XBDHCHN2),V,5),XBDHHDSP=$P(^(XBDHCHN2),V,8),XBDHCHLW=XBDHCHLW+XBDHHDW,XBDHCHN=XBDHCHN2,XBDHNSL=XBDHNSL-(XBDHHDW+XBDHHDSP)
	S XBDHL1=XBDHL1_$J("",XBDHHDPD)_XBDHHDR_$J("",(XBDHHDW-$L(XBDHHDR)-XBDHHDPD+XBDHHDSP))
	S XBDHXX=$C(64+XBDHCHN2)
	I $D(XBDHECHN),XBDHECHN=XBDHCHN2 S XBDHXX="^"
	S XBDHX="",$P(XBDHX,XBDHXX,XBDHHDW+1)="",XBDHY="",$P(XBDHY,".",XBDHHDSP+1)="" S XBDHL2=XBDHL2_XBDHX_XBDHY
L3	;
	S XBDHX="",$P(XBDHX,".",(XBDHTHLW+1-$L(XBDHL2)))="",XBDHL3=XBDHL2_XBDHX
	KILL XBDHXX,XBDHX,XBDHY
	Q
	; 
NOTES	; 
	; WRITES THE CURRENT HEADER LINE AT THE TOP OF THE SCREEN
	; INPUT = ^TMP("XBDH",$J,"HEADER",N),XBDHTHLW
	; OUTPUT = XBDHHDSP,XBDHHDPD
	; ALSO WRITES THE FIELD BOUNDARY LINE (AAAAAABBBCCCCC...) BELOW THE HEADER LINE
	; THIS ROUTINE IS CALLED EVERY TIME THE HEADER LINE IS CHANGED BY THE EDITING PROCESS
