XL Fortran for AIX 8.1

Language Reference

+-------------------------------IBM Extension--------------------------------+


GETENV(NAME, VALUE)

Determines the value of the specified environment variable.

NAME
is a character string that identifies the name of the operating-system environment variable. The string is case-significant. It is an INTENT(IN) argument that must be scalar of type default character.

VALUE
holds the value of the environment variable when the subroutine returns. It is an INTENT(OUT) argument that must be scalar of type default character.

Class

Subroutine

Result Value

The result is returned in the VALUE argument, not as a function result variable.

If the environment variable specified in the NAME argument does not exist, the VALUE argument contains blanks.

Examples

      CHARACTER (LEN=16)   ENVDATA
      CALL GETENV('HOME', VALUE=ENVDATA)
! Print the value.
      PRINT *, ENVDATA
! Show how it is blank-padded on the right.
      WRITE(*, '(Z32)') ENVDATA
      END

The following is sample output generated by the above program:

 /home/mark
2F686F6D652F6D61726B202020202020

Related Information

See the getenv subroutine in the Technical Reference: Base Operating System and Extensions Volume 1 for details about the operating-system-level implementation.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]