GETENV(NAME, VALUE) (IBM extension)

Purpose

Returns the value of the specified environment variable.

Note: This is an IBM extension. It is recommended that you use the GET_ENVIRONMENT_VARIABLE intrinsic procedure for portability.

Class

Subroutine

Argument type and attributes

NAME
An INTENT(IN) CHARACTER scalar. Its value is a character string that identifies the name of the operating-system environment variable. The string is case-significant.
VALUE
An INTENT(OUT) CHARACTER scalar. It holds the value of the environment variable when the subroutine returns.

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 AIX® Technical Reference: Base Operating System and Extensions Volume 1 for details about the operating-system-level implementation.