'create index file of year, lat, long and record number
on error goto handle
cls
input "Enter file name of ICES data records ";b$
open b$ for input as #1

i=instr (b$,".")
if i = 0 then
bout$=b$+".ind"
else
bout$=left$(b$,i-1)+".ind"

end if
Print "Index file is called ";bout$
open bout$ for output as #2
locate 8,10:print "Stations indexed"
rec=1
while not eof(1)
line input #1,a$
if (mid$(a$,80,1)="J" OR MID$(A$,80,1)="1") and rec =1 then
rem procede
else
if rec = 1 then
print mid$(a$,80,1):print rec
print "Sorry, not ICES type file, program aborted":end
end if
end if
if mid$(a$,80,1)="J" or mid$(a$,80,1)="1" then
   incr stn

yr=val(mid$(a$,20,2)):lat=val(mid$(a$,9,4)):lon=val(mid$(a$,13,5))
qu=val(mid$(a$,18,1))
if qu=1 then lon=-lon
 write #2,yr,lat,lon,rec

 locate 8,5:print stn;
end if
incr rec
wend

end

handle:
if err=53 then print "Input file not available":end
print "error is ";err
end