J3/12-103r1 To: J3 From: Malcolm Cohen Subject: Interp STATUS of GET_ENVIRONMENT_VARIABLE Date: 2011 February 13 ---------------------------------------------------------------------- NUMBER: TITLE: STATUS of GET_ENVIRONMENT_VARIABLE KEYWORDS: GET_ENVIRONMENT_VARIABLE DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Assuming the processor supports environment variables, consider Program m197_m1 Call Get_Environment_Variable(Name='HOME',Length=n,Status=istatus) Print *,istatus If (istatus==0) Print *,n End Program If the environment variable HOME does not exist, this program is obviously standard-conforming and prints the value 1 (STATUS paragraph of 13.7.67). If the environment variable HOME does exist but has "no value", this program is obviously standard-conforming and prints the value 0 (STATUS paragraph) and then prints the value 0 (LENGTH paragraph). Aside: Indeed, if a VALUE argument is supplied, it seems that "no value" is the same as "zero-length value" in that no difference between them is discernable in a standard-conforming program. "Inconvenience 1": If the environment variable HOME does exist, and has a value whose length is zero, the program appears to be not standard-conforming as no interpretation is established: there is no specification of the value to be assigned to the STATUS argument. This relies on their being a difference between "no value" and "zero-length value". "Inconvenience 2": If the environment variable HOME does exist, and has a value whose length is not zero, the program is definitely not standard-conforming as no interpretation is established w.r.t. the STATUS argument. Thus, even though VALUE is optional, it would seem that it is not permitted to omit it except when enquiring the existence of an environment variable that does not exist. Was it really intended to be impossible to enquire the existence and length of the environment variable without attempting to fetch it? ANSWER: No, this was not intended. An edit is supplied to correct this. EDIT: [351:18] After "either has no value" change "or" to a comma. After "assigned to VALUE," insert "or the VALUE argument is not present,". SUBMITTED BY: Malcolm Cohen HISTORY: 12-103 m197 Submitted 12-103r1 m197 Revised Edit ----------------------------------------------------------------------