FPUTENV: Assigning a Value to an Environment Variable

How to:

Available Operating Systems: IBM i (formerly referred to as i5/OS), Tandem, UNIX, Windows

Available Languages: reporting

The FPUTENV function assigns a character string to an environment variable. Use FPUTENV to set values that are used elsewhere in the system.

Limit: You cannot use FPUTENV to set or change FOCPRINT, FOCPATH, or USERPATH; once started, these variables are held in memory and not reread from the environment.


Top of page

x
Syntax: How to Assign a Value to an Environment Variable
FPUTENV (varname_length,'varname',value_length, 'value', output)

where:

varname_length

Integer

Is the maximum number of characters in the name of the environment variable.

varname

Alphanumeric

Is the name of the environment variable enclosed in single quotation marks. The name must be right-justified and padded with blanks to the maximum length specified by varname_length.

value_length

Is the maximum length of the environment variable value.

Note: The sum of varname_length and value_length cannot exceed 64.

value

Alphanumeric

Is the value you wish to assign to the environment variable. The string must be right-justified and contain no embedded blanks. Strings that contain embedded blanks are truncated at the first blank.

output

Integer

Is the return code. It can be the name of the field that contains the result, or the format of the output value enclosed in single quotation marks. If the variable is set successfully, the return code is 0. Any other value indicates a failure occurred.



Example: Assigning a Value to an Environment Variable

FPUTENV assigns the value FOCUS/Shell to the PS1 variable and stores it in a field with the format A12:

-SET &RC = FPUTENV(3,'PS1', 12 'FOCUS/Shell:', 'I4');

The request displays the following prompt when the user issues the UNIX shell command SH:

FOCUS/Shell:

WebFOCUS