callCmd()

The sysLib.callCmd() system function runs a system command and waits until the command finishes before resuming processing. This function provides compatibility with the I4GL RUN statement. You can use this function to start non-EGL programs or scripts.

The system command that is run must be visible to the currently running program. For example, consider the following statement:
sysLib.callCmd("mySpecialProgram.exe")
The program "mySpecialProgram.exe" must be in a directory that the environment variable PATH points to. You can also specify the complete directory location, as in the following example:
sysLib.callCmd("program files/myWork/mySpecialProgram.exe")

Use the sysLib.startCmd() function to initiate a system command and continue processing without waiting.

Both sysLib.callCmd() and sysLib.startCmd() assign the value that the system command returns to the system variable sysVar.returnCode. The system command must return a value that is assignment compatible with the INT type.

Syntax

  sysLib.callCmd(
    command STRING in
    [, mode STRING in] )
command
Identifies the operating-system command or program name to invoke.
mode
This can be a literal or a variable containing one of the following words:
form
Short for formatted, also known as raw mode. Each character of input becomes available to the program as it is typed, and every key stroke is passed directly to the command specified.
line
No information is sent to the command specified until the Enter key is pressed.

Compatibility

Table 1. Compatibility considerations for callCmd()
Platform Issue
COBOL generation The sysLib.callCmd() function is supported on iSeries®, but not supported on zSeries® or VSE.
JavaScript generation The sysLib.callCmd() function is not supported.

Feedback