Operating System Commands

Uniface enables you to pass commands to the operating system and catch the returned output using the COMMAND and COMMANDOUT operations.

These operations can be called from ProcScript using the activate statement with the operating system command as a parameter. The maximum length of a command depends on the operating system.

Maximum Command Length
Operating System Maximum Length
Windows 8K
Unix/Linux 4K
iSeries 512 bytes

If the command length exceeds the operating system limit, the command will fail.

If the operating system command is not valid, an activation error occurs, and $status and $procerror are set to -150.

Services are not interactive, so you cannot use an OS service to run an interactive application. Instead, use the spawn ProcScript statement to execute an application.

By default, the OS service operations are run synchronously. To run asynchronously, you can use the /async switch in the activate statement. For example:

activate/async "OS".command ("at -fm myscript")

Related Topics