Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!samsung!rex!uflorida!gatech!mcnc!ecsgate!ecsvax!uncw!session From: session@uncw.UUCP (Zack C. Sessions) Newsgroups: comp.lang.fortran Subject: Re: Read dimension Message-ID: <1012@uncw.UUCP> Date: 24 Feb 91 19:43:33 GMT References: <61477@eerie.acsu.Buffalo.EDU> Organization: Univ. of North Carolina at Wilmington Lines: 29 xiaofei@acsu.buffalo.edu (Xiaofei Wang) writes: >I have this question for a long time: >main program >parameter(m=10,n=5) >real a(m,n) >call subroutine(a,b) >end >I don't want to put m=10 n=5 to the program, I would like to >read into the program. so that I don't have to change program >every time. However a(m,n) has to be defined before read. >-- >xiaofei@acsu.buffalo.edu / rutgers!ub!xiaofei / v118raqa@ubvms.bitnet I am most familiar with VAX FORTRAN, but I think this applies to standard FORTRAN also, and that is, dynamic dimensioning simply is not supported by the language. You can dynamically define an array, but only in a subroutine, and the array is a passed argument. Best you can do with FORTRAN is define the arrays as large as they ever can get, then input the "current working value", then include some code which performs your own array-bounds checking. This isn't too much of a pain, especially on a virtual memory machine. Zack Sessions ...!ecsvax!uncw!session