	subroutine lpedit(in,lp,nfmt)
c *** 11-Nov-87 ***
	integer in(1620),lp(360,3),and,rshift
	logical nfmt
	parameter (mask=1023)
	la(k)=and(rshift(in(k),22),mask)
	lb(k)=and(rshift(in(k),11),mask)
	lc(k)=and(in(k),mask)
c
	j=0
	if (nfmt) then
	 do 19 i=4,810,9
	 j=j+1
	 lp(j,1)=la(i)
	 lp(j,2)=lb(i)
	 lp(j,3)=lc(i)
	 j=j+1
	 ii=i+1
	 lp(j,1)=la(ii)
	 lp(j,2)=lb(ii)
	 lp(j,3)=lc(ii)
	 j=j+1
	 ii=ii+2
	 lp(j,1)=la(ii)
	 lp(j,2)=lb(ii)
	 lp(j,3)=lc(ii)
	 j=j+1
	 ii=ii+1
	 lp(j,1)=lb(ii)
	 lp(j,2)=lc(ii)
19	 lp(j,3)=la(ii+1)
	else
	 do 29 i=5,1620,18
	 j=j+1
	 lp(j,1)=la(i)
	 lp(j,2)=lc(i)
	 lp(j,3)=lb(i+1)
	 j=j+1
	 lp(j,1)=lc(i+3)
	 lp(j,2)=lb(i+4)
	 lp(j,3)=la(i+5)
	 j=j+1
	 lp(j,1)=lb(i+8)
	 lp(j,2)=la(i+9)
	 lp(j,3)=lc(i+9)
	 j=j+1
	 lp(j,1)=lc(i+11)
	 lp(j,2)=lb(i+12)
29	 lp(j,3)=la(i+13)
	endif
	return
	end


