J3/01-341r1 Date: 31-Aug-2001 To: J3 From: Subgroup C Subj: Command line and environment intrinsics 1) The first dummy argument, NAME, of the GET_ENVIRONMENT_VARIABLE intrinsic subroutine is labeled in the Arguments description as optional, but the notation in [297:1] has the argument NAME outside the square brackets. A call to the subroutine without the NAME argument would seem to serve little purpose. The NAME argument should not be optional. Edit: [297:5] Remove '(optional)' 2) The GET_COMMAND and GET_COMMAND_ARGUMENT intrinsics both have intent(out) character variables which may be too small to hold the intended data. In that case, the data is truncated and the leading characters are assigned to the corresponding actual argument. This is not flagged as an error. The user can detect this situation by testing (len(arg) < length). The user should also check (status /= 0). The analogous POSIX pxf... routines return a non-zero status for the case that the data length was too large for the provided actual argument. Adopting this convention here would simplify usage of the routines since only the status value needs to be checked. I would propose using negative status values to indicate the actual argument length is too small, and using positive values to indicate an error. This is similar to the status values returned by I/O routines. Edit: [295:41-43] Replace the last two sentences with "It is assigned the value -1 if the length of the COMMAND argument is less than the significant length of the command. It is assigned a processor dependent positive value if the command retrieval fails. Otherwise it is assigned the value 0." Edit: [296:33-35] Replace the last two sentences with "It is assigned the value -1 if the length of the VALUE argument is less than the significant length of the command argument specified by NUMBER. It is assigned a processor-dependent positive value if the argument retrieval fails. Otherwise it is assigned the value 0." 3) The GET_ENVIRONMENT_VARIABLE intrinsic subroutine has an even more peculiar error detection process. Using the LENGTH argument for either a size or an error flag is a very different convention from that used in the command line routines. In addition, this routine suffers from the defect noted above of not flagging a short actual argument as an error. A status argument should be added to this routine and the argument meanings should be make similar to those for GET_COMMAND_ARGUMENT. Edits: [297:1] Replace '<>' with '<>' [297:13-19] Replace the final four sentences with "If the specified environment variable exists and has a value, LENGTH is set to the length of that value. If the specified environment variable does not exist, or if it exists and has no value, LENGTH is set to zero." [297:19+] "STATUS (optional) shall be scalar and of type default integer. It is an INTENT(OUT) argument. If the environment variable exists and either has no value or its value is sucessfully assigned to VALUE, STATUS is set to zero. It is the value -1 if the length of the VALUE argument is less than the length of the environment variable value. It is assigned the value 1 if the specified environment variable does not exist, and 2 if the processor does not support environment variables. Processor-dependent values greater than 2 may be returned for other error conditions.