.title closef ; ; subroutine to close file opened with tools openf ; ; call sequence: call closef(rab) ; ; where rab is the integer descriptor returned by openf ; rab=4 ; offset from ap for rab address .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .enabl lsb .entry closef ^m brb 1$ ; branch to common code .entry st_closef ^m ; visible entry point 1$: movl @rab(ap),r2 ; place rab address in r2 movl rab$l_fab(r2),r3 ; fab address in r3 blbc rab$l_ctx(r2),10$ ; lbc ==> do not truncate file bbs #1,rab$l_ctx(r2),10$ ; bit 1 set ==> put was done $find rab=r2 ; position to first record $truncate rab=r2 ; truncate file 10$: clrl rab$l_ctx(r2) ; clear context $disconnect rab=r2 ; disconnect record stream blbc r0,error ; low bit clear in r0 => error $close fab=r3 ; close file blbc r0,error ; again check for error pushl r2 ; place rab address on stack calls #1,putrab ; return rab to linked list ret error: ret .end