Error: Unexpected STATEMENT FUNCTION statement at (1)

Move the statement function data(i,j) = ... above the write(*,*) statement. I’m assuming the write is a remnant of a poor man’s debugging workflow. For more background, check the Oracle documentation on statement functions. Since these are really function-like definitions, they belong in the specification section, before any executable statements like write.

Btw, statement functions have been marked as obsolescent for a while. See Questions about statement functions - #6 by msz59

2 Likes