home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!aswx266
- From: aswx266@chpc.utexas.edu (Michael Lemke)
- Subject: Re: programming style question
- Message-ID: <1992Aug22.205756.21870@chpc.utexas.edu>
- Organization: The University of Texas System - CHPC
- References: <1992Aug13.081049.4648@newssrv.edvz.univie.ac.at> <1992Aug14.002538.3929@monu6.cc.monash.edu.au> <1992Aug21.184751.9673@draco.macsch.com>
- Date: Sat, 22 Aug 92 20:57:56 GMT
- Lines: 68
-
- In article <1992Aug21.184751.9673@draco.macsch.com> drd@macsch.com (Daniel R. Dawson) writes:
- >>pm@katz.cc.univie.ac.at (Peter Marksteiner) writes:
- >>>ecmtwhk@ccu1.aukuni.ac.nz (Thomas Koenig) writes:
- >>>
- >>>>It's a real shame that Unix does not have standard way of attatching
- >>>>FORTRAN units to file descriptors, that would make things much easier.
- >>>>Does POSIX have anything to say about that?
- >>>
- >>>Try symbolic links. For example,
- >>>
- >>> ln -s /whatever/pathname/you/want fort.3
- >>>
- >>>may not be as beautiful as
- >>>
- >>>//FT03F001 DD DSN=REVOLTING.MVS.DATASET,DISP=NEW
- >>>
- >>>but it works almost as well.
- >>
- >>Unfortunately `almost' is important here. One of the nice features of
- >>VMS (gargle) was the ability to use:
- >>
- >>$ define/user_mode 'P1'.dat for005
- >>$ define/user_mode 'P1'.out for006
- >>$ run myprog
- >>
- >>in a command procedure. The advantage here is that you can have that
- >>program running on at least two different sets of data in the same directory
- >>at the same time. The only way you can do this with symbolic links is to
- >>place the data files in different directories. A royal pain if you are
- >>doing a lot of batch processing, which I suspect applies to most serious
- >>FORTRAN users. A very bad design decision from a supposedly flexible
- >>operating system.
- >>
- >>I, and probably many others, get around the problem by passing the
- >>argument (P1, above) into the program using getarg, doing some string
- >>handling to create the file names and using open explicitly. Messy.
- >>
- >
- >Forget about using links, man!
- >
- >Here's how I'd handle this problem for Unix boxes:
- >
- >(C-Shell script fragment similar to the DCL script fragment above)
- >setenv FOR005 ${1}.dat
- >setenv FOR006 ${1}.out
- >myprog
- >unsetenv FOR005
- >unsetenv FOR006
- >
- >Then, in the Fortran, just use getenv() to get the filenames
- >for the open statements.
- >
- >Easy as pie!
-
- Except it is no standard Fortran anymore. And it won't run on VMS
- anymore either. Of course you can conconct a getenv function but that
- would have to be changed for the IBM again (can it be done?).
-
- But the actual solution for this particular problem is terribly easy in
- Unix:
-
- myprog <${1}.dat >${2}.out
-
- or whatever variables you want to use.
- --
- Michael Lemke
- Astronomy, UT Austin, Texas
- (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
-