Intel® Fortran Compiler 17.0 Developer Guide and Reference

PXFSETENV

POSIX Subroutine: Adds a new environment variable or sets the value of an environment variable.

Module

USE IFPOSIX

CALL PXFSETENV (name,lenname,new,lennew,ioverwrite,ierror)

name

(Input) Character. The name of the environment variable.

lenname

(Input) INTEGER(4). The length of name.

new

(Input) Character. The value of the environment variable.

lennew

(Input) INTEGER(4). The length of new.

ioverwrite

(Input) INTEGER(4). A flag indicating whether to change the value of the environment variable if it exists.

ierror

(Output) INTEGER(4). The error status.

If successful, ierror is set to zero; otherwise, an error code.

If name does not exist, PXFSETENV adds it with valuenew.

If name exists, PXFSETENV sets its value to new ifioverwrite is a nonzero number. If ioverwrite is zero, the value of name is not changed.

If lennew is equal to zero, PXFSETENV sets the value of the environment variable to a string equal to new after removing any leading or trailing blanks.

Example

program test2
use ifposix
character*10 name, new
integer lenname, lennew, ioverwrite, ierror
name = "FOR_NEW"
lenname = 7
new = "ON"
lennew = 2
ioverwrite = 1

CALL PXFSETENV (name, lenname, new, lennew, ioverwrite, ierror)
print *, "name= ", name
print *, "lenname= ", lenname
print *, "new= ", lenname
print *, "lennew= ", lenname
print *, "ierror= ", ierror
end

See Also