Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!mit-eddie!uw-beaver!ubc-cs!sol.UVic.CA!klassen From: klassen@sol.UVic.CA (Melvin Klassen) Newsgroups: comp.lang.fortran Subject: Re: Read dimension Summary: no "pure" Fortran solution exists Message-ID: <1991Feb26.014132.2704@sol.UVic.CA> Date: 26 Feb 91 01:41:32 GMT References: <61477@eerie.acsu.Buffalo.EDU> Organization: University of Victoria, Victoria B.C. CANADA Lines: 26 xiaofei@acsu.buffalo.edu (Xiaofei Wang) writes: > >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. >-- Years ago, for the IBM OS/VS1 and VM/CMS environments, our group wrote a collection of Fortran-callable assembly-language routines to allocate/release storage, and to indirectly call a Fortran subroutine. For example: EXTERNAL MYSUB READ(*,*) M,N IBytes=M*N*4 CALL IADDR (M, IM, N, IN) CALL GETSP (IER, ISTOR, IBytes) CALL EXSUBR (MYSUB, IM, IN, ISTOR) CALL FREESP (ISTOR, IBytes) END SUBROUTINE MYSUB (M, N, STOR) REAL STOR(M,N) END