function gotoframe, lu,icur,iwant,flnm,frame ; print,' ' icurrent = icur if iwant eq icurrent then goto,done if iwant lt icurrent then begin point_lun,lu,0 istat = rdascii(lu,flnm,frame) if istat ne 0 then begin print,'goto frame: could not reach desired frame ',iwant print,' (probably end of file -- hit OPEN to restart at beginning)' return,1 endif icurrent = 1 endif for i=icurrent+1,iwant do begin istat = rdascii(lu,flnm,frame) if istat ne 0 then begin print,'goto frame: could not reach desired frame ',iwant print,' (probably end of file -- hit OPEN to restart at beginning)' return,1 endif print,'Read frame ',i,' (searching forward to frame ',iwant,')' icur = i endfor done: printhdr, frame,flnm,icur return,0 end