J3/98-163r1 page 1 of 2 To: J3 From: R. Bleikamp/JOR Subject: Environment Variables / M.18b Date: 98-05-28 For a history of the previous work in this area, see papers 97-151r1, 97-153, 97-201, 97-203, and 98-115. Specification for Environment Variable support in F2000. - Add an intrinsic routine to get the "value" of a named (user specified) environment variable. - Pass in the name of the environment variable. Need to support (perhaps painfully) significant trailing blanks in the environment variable's name. - Return a character string representing the value of the environment variable. Some method of determining a non-existent variable (or unsupported functionality) is required. Some way of determining which (if any) trailing blanks are significant, as well as if the value returned had to be truncated. - Avoid commonly used names for this functionality, so existing programs will not be impacted. Syntax for Environment Variable support in F2000. call get_environment_variable (name, value [,length] [,trim_name]) name: a scalar character value (default kind), INTENT(IN). the name of the environment variable of interest. value: a scalar character variable (default kind), INTENT(OUT). the value of the environment variable specified by "name" is returned in this argument. When the value is shorter than LEN(value), the value is blank padded on the right. When the value is longer than LEN(value), the leftmost LEN(value) characters of the environment variables value will be stored in "value". When the environment variable does not exist, or does not have a value, "value" will be assigned all blanks. length: a scalar default integer variable, INTENT(OUT), OPTIONAL. When present, this variable is set to the length of the specified environment variable. When "length" is -1, the specified environment variable was not present. When "length" is -2, the processor does not support enviroment variables. The processor may return other other negative values for other error conditions. When "length" is zero, the specified environment variable was present, but had no value. J3/98-163r1 page 2 of 2 When "length" is positive, "value" contains the value of the specified environment variable. If the value of "length" is less than LEN(value), "value" is padded on the right with blanks. If "length" is greater than LEN(value), the returned value was truncated from the right. trim_name: a scalar logical value, INTENT(IN), OPTIONAL. When present with the value false, trailing blanks in "name" are considered significant if the processor supports significant trailing blanks in an environment variable name. Otherwise, trailing blanks in "name" are not considered part of the environment variable's name. Note: an environment variable is a named object, specifiable via some mechanism outside the scope of this standard. Edits: Insert above text in chapter 13 in the obvious place.