C	This is a routine to handle the undeclared label
C	widths.

	Subroutine Labels

	Integer*2	asw

	Parameter (screen=1)

5	write (screen,10)
10	format (1x,'Label Width [3 or 4] > ',$)
	read (screen,*,err=999) asw

	if (asw .eq. 4) then
		call Labels4
		goto 999
	end if
	if (asw .eq. 3) then
		call Labels3
		goto 999
	end if

	write (screen,*) '%%%%% ERROR in width'
	goto 5

999	end

C	This is a routine to print out a file of labels for
C	four accounts accross.

	Subroutine Labels4

	Character*80	line
	Character*124	outline(3)
	Character*124	temp
	Character*12	user
	Character*30	pwd
	Character*4	box
	Integer*2	pos(4)
	Character*60	inName
	Character*60	outName
	Logical*1	exist
	Integer*2	length
	Integer*2	count

	Parameter (screen=1,in=2,out=3)

1	format (Q,A)
	exist=.FALSE.

	pos(1)=1
	pos(2)=32
	pos(3)=63
	pos(4)=94

	call initOut4(outline)

5	write (screen,10)
10	format (1x,'Output File Name                         > ',$)
	read (screen,1,err=9999) length,outName
	if (length .eq. 0) goto 5

15	write (screen,20)
20	format (1x,'Input File Name [MAKACT_WORK:Makact.com] > ',$)
	read (screen,1,err=5) length,inName
	if (length .eq. 0) then
		inName='MAKACT_WORK:MAKACT.COM'
	end if

	Open (unit=in,file=inName,status='old',
     +	carriagecontrol='list',err=999)

	if (.NOT. exist) then
		Open (unit=out,file=outName,status='new',
     +		carriagecontrol='list')
		exist=.TRUE.
	end if

	count=0
30	read (in,1,err=1000) length,line
	call str$Upcase(line,line)
	if (index(line,'ADD ') .eq. 1) then
		if (count .ge. 4) then 
			write (out,100) outline(1),
     +					outline(2),outline(3)
100			format (/,1A124,/,1A124,/,1A124,/,/)
			call initOut4(outline)
			count=0
		end if
		count=count+1
		temp=outline(1)
		user=line(5:16)
		temp(pos(count):pos(count)+4)='USER:'
		temp(pos(count)+5:pos(count)+17)=user
		outline(1)=temp
	end if

	if (index(line,'/PASSWORD=') .ge. 1) then
		temp=outline(2)
		begin=index(line,'=')+1
		end=begin+29
		pwd=line(begin:end)
		temp(pos(count):pos(count)+4)='PWD :'
		temp(pos(count)+5:pos(count)+30)=pwd
		outline(2)=temp
	end if

	if (index(line,'/DIRECTORY=') .ge. 1) then
		temp=outline(3)
		begin=index(line,']')-4
		end=begin+3
		box=line(begin:end)
		temp(pos(count):pos(count)+4)='BOX :'
		temp(pos(count)+5:pos(count)+9)=box
		outline(3)=temp
	end if

	goto 30

999	write (screen,123) inName
123	format (1x,'%%%%% ERROR in opening ',1A60)
	goto 15

1000	if (count .lt. 4) then 
		write (out,100) outline(1),outline(2),outline(3)
	end if

9999	end


	Subroutine initOut4(outline)

	Character*124	outline(3)
	Character*124	temp

	temp='                                                   '//
     +	'                                                         '//
     +	'                '

	outline(1)=temp
	outline(2)=temp
	outline(3)=temp

	end

C	This is a routine to print out a file of labels for
C	three accounts accross.

	Subroutine Labels3

	Character*80	line
	Character*108	outline(3)
	Character*108	temp
	Character*12	user
	Character*30	pwd
	Character*4	box
	Integer*2	pos(3)
	Character*60	inName
	Character*60	outName
	Logical*1	exist
	Integer*2	length
	Integer*2	count

	Parameter (screen=1,in=2,out=3)

1	format (Q,A)
	exist=.FALSE.

	pos(1)=2
	pos(2)=38
	pos(3)=74

	call initOut3(outline)

5	write (screen,10)
10	format (1x,'Output File Name                         > ',$)
	read (screen,1,err=9999) length,outName
	if (length .eq. 0) goto 5

15	write (screen,20)
20	format (1x,'Input File Name [MAKACT_WORK:Makact.com] > ',$)
	read (screen,1,err=5) length,inName
	if (length .eq. 0) then
		inName='MAKACT_WORK:MAKACT.COM'
	end if

	Open (unit=in,file=inName,status='old',
     +	carriagecontrol='list',err=999)

	if (.NOT. exist) then
		Open (unit=out,file=outName,status='new',
     +		carriagecontrol='list')
		exist=.TRUE.
	end if

	count=0
30	read (in,1,err=1000) length,line
	call str$Upcase(line,line)
	if (index(line,'ADD ') .eq. 1) then
		if (count .ge. 3) then 
			write (out,100) outline(1),
     +					outline(2),outline(3)
100			format (/,1A108,/,1A108,/,1A108,/,/)
			call initOut3(outline)
			count=0
		end if
		count=count+1
		temp=outline(1)
		user=line(5:16)
		temp(pos(count):pos(count)+4)='USER:'
		temp(pos(count)+5:pos(count)+17)=user
		outline(1)=temp
	end if

	if (index(line,'/PASSWORD=') .ge. 1) then
		temp=outline(2)
		begin=index(line,'=')+1
		end=begin+29
		pwd=line(begin:end)
		temp(pos(count):pos(count)+4)='PWD :'
		temp(pos(count)+5:pos(count)+35)=pwd
		outline(2)=temp
	end if

	if (index(line,'/DIRECTORY=') .ge. 1) then
		temp=outline(3)
		begin=index(line,']')-4
		end=begin+3
		box=line(begin:end)
		temp(pos(count):pos(count)+4)='BOX :'
		temp(pos(count)+5:pos(count)+9)=box
		outline(3)=temp
	end if

	goto 30

999	write (screen,123) inName
123	format (1x,'%%%%% ERROR in opening ',1A60)
	goto 15

1000	if (count .lt. 3) then 
		write (out,100) outline(1),outline(2),outline(3)
	end if

9999	end


	Subroutine initOut3(outline)

	Character*108	outline(3)
	Character*108	temp

	temp='                                                   '//
     +	'                                                         '

	outline(1)=temp
	outline(2)=temp
	outline(3)=temp

	end
