write('filename: ');readln(f2name);writeln;assign(f2,f2name);reset(f2);
etc.
Please, have a look at this to see a file example in Pascal.