J3/05-240r4 To: J3 From: Dan Nagle Subject: Execute an external program Date: 2005 August 10 Specifications of J3-003 Executes a command line externally to the program. Whether the command line is interpreted by a shell is unspecified. Require synchronous execution and allow asynchronous execution. If synchronous execution, allow recovery of the executed process exit status. Allow processor-dependent error conditions. If asynchronous execution is requested but the processor does not support asynchronous execution, (a) execute synchronously (b) set CMDSTAT, if present, to inform the user (c) set EXITSTAT if present. Syntax: add the intrinsic EXECUTE_COMMAND_LINE( COMMAND, WAIT, EXITSTAT, CMDSTAT, CMDMSG ) Edits: In Section 13.5.8, page 298, add to the list: [298:5+] Add: "EXECUTE_COMMAND_LINE execute a command line" In Section 13.7, add to the list of procedures: [315:24+] Add: "13.7.5+ EXECUTE_COMMAND_LINE( COMMAND [, WAIT, EXITSTAT, CMDSTAT, CMDMSG ] ) *Description.* Execute the command line specified by the string COMMAND. If the processor supports command line execution, it shall support synchronous and may support asynchronous execution of the command line. *Class.* Subroutine. *Arguments.* COMMAND shall be of type default character and shall be a scalar. It is an INTENT(IN) argument. Its value is the command line to be executed. The interpretation is processor-dependent. WAIT shall be of type default logical and shall (optional) be a scalar. It is an INTENT(IN) argument. If WAIT is present with the value false, and the processor supports asynchronous execution of the external command, the command is executed asynchronously; otherwise it is executed synchronously. EXITSTAT shall be of type default integer and shall (optional) be a scalar. It is an INTENT(INOUT) argument. If the command is executed synchronously, it is assigned the value of the processor-dependent exit status. Otherwise, the value of EXITSTAT is unchanged. CMDSTAT shall be of type default integer and shall (optional) be a scalar. It is an INTENT(OUT) argument. It is assigned the value -1 if the processor does not support command line execution, a processor-dependent positive value if an error condition occurs, or the value -2 if no error condition occurs but WAIT is present with the value false and the processor does not support asynchronous execution. Otherwise it is assigned the value 0. CMDMSG shall be of type default character and shall (optional) be a scalar. It is an INTENT(INOUT) argument. If an error condition occurs, it is assigned a processor-dependent explanatory message. Otherwise, it is unchanged. When the command is executed synchronously, EXECUTE_COMMAND_LINE returns after the command line has completed execution. Otherwise, EXECUTE_COMMAND_LINE returns without waiting. If an error occurs and CMDSTAT is not present, execution of the program is terminated."