Progress
Language Reference


OS-COMMAND Statement

Interfaces
OS
SpeedScript
All
All
Yes

Escapes to the current operating system and executes an operating system command.

SYNTAX

OS-COMMAND
  [ SILENT | NO-WAIT ]
  [ NO-CONSOLE ] 
  [ command-token | VALUE ( expression ) ] ... 

SILENT

After processing an operating system command, the Progress shell pauses and prompts you to press SPACEBAR to continue. You can use the SILENT option to eliminate this pause. Use this option only if you are sure that the program, command, or batch file does not generate any output to the screen. Cannot be used with NO-WAIT.

NO-WAIT

In a multi-tasking environment, causes Progress to immediately pass control back to next statement after the OS-COMMAND without waiting for the operating system command to terminate. Cannot be used with SILENT.

NO-CONSOLE

While processing an operating system command, Progress creates a console window. The console window may not be cleaned up after the command is executed. You can use the NO-CONSOLE option to prevent this window from being created in the first place.

command-token | VALUE ( expression )

One or more command words and symbols that you want to pass the operating system to execute. The VALUE option generates the command tokens included in expression, a character string expression. The specified combination of command-token and VALUE(expression) options can form any legal combination of commands and command options permitted by the operating system.

EXAMPLE

There are two principal uses for the OS-COMMAND statement: to execute a Progress utility that has the same syntax on two or more different operating systems, and to execute an operating system statement input by a user.

In both instances, the OS-COMMAND statement eliminates the need to use the OPSYS statement to determine the operating system and then use conditional logic to execute the appropriate code. The OS-COMMAND statement, therefore, makes an application more portable.

This procedure prompts the user for an operating system command and then uses the OS-COMMAND statement to execute the command.

r-os-com.p
DEFINE VARIABLE comm-line AS CHARACTER FORMAT "x(70)".
REPEAT:
  UPDATE comm-line.
  OS-COMMAND VALUE(comm-line).
END. 

NOTES

SEE ALSO

DOS Statement, OPSYS Function, OS-ERROR Function, UNIX Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095