fortran get system environment info in openvms

250 views Asked by At

Is it possible to get system environment information on Fortran 90 (OpenVMS operating system)? I use compiler VSI Fortran V8.3-104957-50Q83. I won't realize the next C-code on Fortran

char *bind_addr= getenv("MYSQL_TEST_BINDADDR");
1

There are 1 answers

0
Hein On BEST ANSWER

This topic is one in a series of questions on what appears to be a porting effort for an "C" application to Fortran on OpenVMS. In order to provide the best possible answers it may help to know a bit more background - WHY the effort is taking place, WHAT is the source platform?

That said, Environment Variables as most of us know them do NOT exist as such on OpenVMS. OpenVMS DCL SYMBOLS and User/group/system LOGICAL NAMES which can and will be treated as environment variables by support libraries such as available through the C-RTL, Perl and Python.

To define them, one expects a shell (DCL) action selecting either symbols or logical names as the vehicle. Knowing that mechanism the application to be ported may just want to call the native OpenVMS functions to get or set the values (SYS$TRNLNM, LIB$GET_SYMBOL, LIB$SET_SYMBOL).

Writing your own 'my_getenv' wrapper to call the C-RTL provided getenv may be a good solution if you have access to a C compiler.

Another workaround could be to reverse engineer and call the actual C support function (likely called DECC$GETENV - not verified!) this may require some initialization to be called first (again, not verified)

Surely there are more articles on this out there. Google? For some background on symbols and logicals the documentation and FAQ should help. For example - http://www.hoffmanlabs.org/vmsfaq/vmsfaq_012.html

Good luck, Hein.