Matching a pattern 250 characters up and down stream

hii all

i have a file a which contains some thing like this
strand smthg position
+ yyx 3020

  •           yyw         10,000
    

now i have another file (file2) which contains the data starting from 1 to n positions

i want to refer first file if + appears it should go to eg 3020 position in file 2 and see for a pattern match say $abc at 250 characters after 3020 (i,e., 3270).

if " -" appears it shud go 250 characters before 3020 and search for the pattern $abc.
how can i do it

Please post a bit bigger datasets of your both input files and your expected output files.

Please use code tags when u submit ur data.

ya i am sorry. here is the data for file 1 having 3 columns

+ yyx 10
_ yyw 10,000
_ yyx 1,000
_ yyw 10,503
+ yyx 30298

2nd file has aababbabahhhnjkmlipolmkijnhbu.........................

first it should read the file1 3rd column (10) and check for first column (+) . if it is + it should move 250 characters a head of present position (10) in file 2 and check for a pattern say $abc. am i clear nw?

I'm thinking this would work quite well if the whole of file 2 could be loaded into memory, How many positions are in file2?

it would have a maximum of 3-4 billion. i can load it in server no prob with memory i guess