Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

SYSTEMQQ

Portability Function: Executes a system command by passing a command string to the operating system's command interpreter.

Module

USE IFPORT

result = SYSTEMQQ (commandline)

commandline

(Input) Character*(*). Command to be passed to the operating system.

Results

The result type is LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..

The SYSTEMQQ function lets you pass operating-system commands as well as programs. SYSTEMQQ refers to the COMSPEC and PATH environment variables that locate the command interpreter file (usually named COMMAND.COM).

On Windows systems, the calling process waits until the command terminates. To insure compatibility and consistent behavior, an image can be invoked directly by using the Windows API CreateProcess( ) in your Fortran code.

If the function fails, call GETLASTERRORQQ to determine the reason. One of the following errors can be returned:

  • ERR$2BIG - The argument list exceeds 128 bytes, or the space required for the environment formation exceeds 32K.

  • ERR$NOINT - The command interpreter cannot be found.

  • ERR$NOEXEC - The command interpreter file has an invalid format and is not executable.

  • ERR$NOMEM - Not enough memory is available to execute the command; or the available memory has been corrupted; or an invalid block exists, indicating that the process making the call was not allocated properly.

The command line character limit for the SYSTEMQQ function is the same limit that your operating system command interpreter accepts.

Example

 USE IFPORT
 LOGICAL(4) result
 result = SYSTEMQQ('copy c:\bin\fmath.dat &
                         c:\dat\fmath2.dat')

See Also