Re: FORTRAN file handling question (130 Views)
Reply
Occasional Contributor
Alex Rauket
Posts: 7
Registered: ‎12-06-2005
Message 1 of 4 (130 Views)
Accepted Solution

FORTRAN file handling question

Hello.

I have an interesting problem, but I seems to be complicated to explain so bear with me.

I have a FORTRAN program (to which I cannot access the source and can only execute from a remote directory). This program creates output files as part of its execution. If you run this program using a path from another directory (for example: /var/tmp > /A/B/MyProgram) the output files will be created in the directory the program is called from (in this case /var/tmp).

My question is, is there any way to direct the output to another directory, different to the one I am calling it from?

The problem is that I am calling this program from another program that runs in a directory and I want the output to go into another directory, without having to copy the files after the program runs (there is lots of output > 10GB) an I would like to keep this program as fast as possible.

Thanks for any help you can give.
Honored Contributor
Peter Godron
Posts: 4,470
Registered: ‎02-13-2002
Message 2 of 4 (130 Views)

Re: FORTRAN file handling question

Alex,
pretty tricky if you have not got access to source code.
I'd try
1. target directory as a parameter
2. create a link in the target directory pointing to the directory where the program is called from. So no copying of data !!

Let us know if it works.
Occasional Contributor
Alex Rauket
Posts: 7
Registered: ‎12-06-2005
Message 3 of 4 (130 Views)

Re: FORTRAN file handling question

Thanks but there's a potential problem that I didn't explain.

My programs runs many cases so the problem arises that if I link the directories, all of my output directories will just be the last run case, right?
Honored Contributor
Peter Godron
Posts: 4,470
Registered: ‎02-13-2002
Message 4 of 4 (130 Views)

Re: FORTRAN file handling question

Alex,
in that case:
1. Run the program from dir A
2. Rename the output file with the rename command, which will just chnage the name (nice and quick)
3. Create the link in the target output directory back to the newly renamed file

You can now run your program again and go throught the same loop.

Have you had any success with supplying the output dir as a parameter.

Another idea may be to cd to the intended output dir and then run your command
along the lines:
cd outputdir
/A/B/MyProgram
cd -
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.