	.title	f11hdr
	.mcall	fdof$l,nbof$l,ofnb$,close$,fdop$r
	fdof$l
	nbof$l
ap=%5
lun=2
dev=4
unt=6
fsw=10
fid=12
dsc=14
buf=16
ok=0
err=-3
rattbk:	.word	0,attctl,0,0,0,0
attctl:	.byte	-9.,10.
	.word	stblk
	.byte	-10.,0
buffer:	.word	0
	.word	0
stblk:	.blkw	5
f11hdr::
	mov	@lun(ap),r2		; place lun in r2 for gtfdb
	call	gtfdb
	tst	r0
	bne	5$
	jmp	10$
5$:
	fdop$r	r0,@lun(ap)
	mov	#stblk,f.stbk(r0)
	mov	r0,r1
	add	#f.fnb,r1
	tst	@fsw(ap)		; see if should use fid
	beq	20$
	mov	fid(ap),r2
	mov	r1,r3
	add	#n.fid,r3
	mov	r3,rattbk
	mov	(r2)+,(r3)+
	mov	(r2)+,(r3)+
	mov	(r2),(r3)
	mov	@dev(ap),n.dvnm(r1)
	mov	@unt(ap),n.unit(r1)
	br	30$
20$:
	mov	dsc(ap),r2
	clr	r3
	call	.parse
	bcs	10$
30$:
	ofnb$	r0,#fo.rd!fa.shr,,,,#fd.rwm
	bcs	10$
	mov	buf(ap),buffer
	mov	#io.rat,r1
	mov	#3,r2
	mov	#rattbk,r3
	call	.xqio
	close$	r0
	mov	#ok,r0
	return
10$:
	mov	#err,r0
	return
	.end
