** Test Program C dimension x(50),y(50), complex*16 z(50) print *, 'Enter number of elements to process read *, num do 5 i = 1,num x(i) = i y(i) = i 5 continue do 10 i = 1,num z(i) = sqrt(cmplx(x(i),y(i))) print *, 'Complex Number Output print * print *, ' x y z ' print * write(6,'(2(f7.3,2x),5x,''('',f5.1,'','',f5.1,'' )'')') 1 ((x(i),y(i),z(i),i=1,num) endIf we compile this program using the utility program "error" by typing
f77 main.f |& errorthe file "main.f" is overwritten with diagnostic messages indicating those lines with syntax errors. Note the use of the "|" followed by the "&". Here is the file main.f after the compilation.
C** Test Program C C###3 [Sunf77] Error: syntax error at or near end of statement% dimension x(50),y(50), complex*16 z(50) C###5 [Sunf77] Error: unbalanced quotes; closing quote supplied% print *, 'Enter number of elements to process read *, num do 5 i = 1,num x(i) = i y(i) = i 5 continue C###11 [Sunf77] Error: do not closed% C###11 [Sunf77] Error: missing statement number 10% do 10 i = 1,num z(i) = sqrt(cmplx(x(i),y(i))) C###13 [Sunf77] Error: unbalanced quotes; closing quote supplied% print *, 'Complex Number Output print * print *, ' x y z ' print * C###17 [Sunf77] Error: unclassifiable statement% C###17 [Sunf77] Error: unbalanced parentheses, statement skipped% write(6,'(2(f7.3,2x),5x,''('',f5.1,'','',f5.1,'' )'')') 1 ((x(i),y(i),z(i),i=1,num) endYou can now edit the file and make the indicated corrections. If you use the editor "vi", you can have the compilation output immediately go into the vi editor by using the option "-v". For example,
f77 main.f |& error -vFor a complete description of the error utility see the man pages or the SPARCompiler FORTRAN User's Guide.
****************************************************************** * * * Correspondence to VS FORTRAN * * * ****************************************************************** * * * VS FORTRAN UNIX * * ========== ==== * * * * The following command compiles The following command * * the program "main fortran a" and compiles the program * * produces the listing file, "main "main.f"and superimposes * * listing a" which contains the any syntax errors that * * source program and any syntax occurred during the * * errors that wre found during compilation onto the * * the compilation. source file as comments. * * * * fortvs2 main f77 main.f |& error * * * * Note the use of the "&" * * * * * ******************************************************************