Xref: utzoo comp.lang.fortran:2377 comp.os.vms:17004 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!adm!cmcl2!lanl!alpha!jkw From: jkw@alpha.lanl.gov (Jay Wooten) Newsgroups: comp.lang.fortran,comp.os.vms Subject: Re: Question about variables local to subroutine Keywords: Local variables, subroutines Message-ID: <955@alpha.lanl.gov> Date: 23 Aug 89 17:48:30 GMT References: <24891@iuvax.cs.indiana.edu> Organization: Los Alamos National Laboratory Lines: 28 In article <24891@iuvax.cs.indiana.edu>, templon@silver.bacs.indiana.edu (jeffrey templon) writes: > > I would like to know one simple (I hope) thing: what happens if you set > the value of a variable (local) in a subroutine, exit the subroutine, and > come back later? Is it the same value, zero, or worse? I read all TFMs > I could find and saw no answer to this one. I am using VAX Fortran, > I could find and saw no answer to this one. I am using VAX Fortran, > whatever version runs on VMS V4.6. Thanks for any help you can send. > > Jeff Templon Look in the "Programming in VAX FORTRAN" manual under the description of the SAVE statement (pp. 8-24 and 8-25 in the 4.0 version): "The SAVE statement causes the definition of data entities to be retained after execution of a RETURN or END statement in a subprogram." ... "NOTE: It is not necessary to use SAVE statements in VAX FORTRAN programs. The definitions of data entities are retained automatically by VAX FORTRAN, making the use of SAVE statements a redundant exercise [unless you want to port your program to a non-VMS system]." In my experience, variables in a VMS FORTRAN subprogram are always the same values as you left them the last time. ~~~~~~ Inquiring minds want to know ! ~~~~~~ Jay Wooten Los Alamos National Lab ARPA: jkw@lanl.gov