Search code examples
fortrancommand-line-argumentsopenvms

How to get command line arguments in OpenVMS Fortran?


I need to realize c-code in fortran 90 standard and stopped on next problem. How get and use command line arguments. I found

GET_COMMAND_ARGUMENT

getarg

But it doesn't work in the openvms system with fortran 90 compiler. There is another way to get command line arguments in Fortran?

Example in C

   int main(int argc, char **argv)
{
  if (argc > 1)
....
}

Example (which doesn't work "

ILINK-W-NUDFSYMS, 2 undefined symbols:
%ILINK-I-UDFSYM, GETARG
%ILINK-I-UDFSYM, IARGC
%ILINK-W-USEUNDEF, undefined symbol IARGC referenced )

PROGRAM bulk1
    INTEGER :: i
    CHARACTER(len=32) :: arg

    DO i = 1, iargc()
    CALL getarg(i, arg)
    WRITE (*,*) arg
    END DO
END PROGRAM

Solution

  • "How do I access the program command line?" is likely to feature high on any Fortran related FAQ. Unfortunately, the equally frequent answer is "It depends". Up to and including Fortran 95, there has been no standard method of command-line access. While the F2003 standard finally addresses this requirement, it is reasonable to assume that F2003 compilers will not be in general usage for some time. In the meantime, this leaves the Fortran community with its existing hotchpotch of inconsistent solutions for several years to come.

    You can use this library http://www.winteracter.com/f2kcli/index.htm