I'm currently moving some optimizations from Mathematica to FORTRAN. The number of variables in each function range from 100s to 1000s so I would like to use Mathematica as a parser to write most of the FORTRAN code. Here are some questions:

1) What is the longest line of code that FORTRAN will accept?

For example, One of the functions is 3019244 characters long. Each gradient component is about 10,000 characters. I know FORTRAN 77 would not allow it, but will FORTRAN 2008 allow a procedure with one line of code 3019244 characters long?

2) There are similar calculations in the gradient and the function, should I explicitly code these calculations and stick them in a common block or can the compiler find them? Will I run into bandwidth problems with several hundred thousand variables (double precision reals) in the common block?

2b) Is there a max number of lines of code in a procedure and if so, what is it?

3) Some of the optimizations are Least Squares so they can be unrolled over the domain space, this saves a great deal of time in Mathematica but uses a great deal of memory for the bytecode, Is it better to let the compiler unroll these functions or should I explicitly code them.?(With the result of that the above example will be a 24690689 character line of code.)