Previous Topic: CLPNAME Statement—Identify i5/OS Program to RunNext Topic: COLUMNS Statement—Specify Line Width of List


CMDNAME Statement—Specify Commands to Run on Windows and UNIX

The CMDNAME statement specifies a command to run on a Windows or UNIX computer.

Supported Job Types

This statement is required for the Windows job type.

To run binary files on UNIX, this statement is required for the UNIX job type.

Note: All UNIX job definitions require a SCRIPTNAME statement or a CMDNAME statement. Use the SCRIPTNAME statement to run shell scripts and the CMDNAME statement to run binary files.

Syntax

This statement has the following format:

CMDNAME command_file
command_file

Specifies the full path and name of the command to run. It must be a legal executable Windows file name or a valid binary UNIX file name.

Limits: Up to 512 characters; case-sensitive

Notes:

UNIX Notes:

Windows Notes:

Example: Identify a Command to Run Within a Job

In this example, sort is the name of the command and c:\payroll\test is the path.

CMDNAME c:\payroll\test\sort

Example: Run a Visual Basic Script

In this example, the agent invokes the Visual Basic interpreter wscript.exe using the CMDNAME statement and passes the Visual Basic script notify.vbs as a parameter using the ARGS statement:

AGENT NT_NY
CMDNAME c:\winnt\system32\wscript.exe
ARGS c:\programs\vbs\notify.vbs

Example: Run a UNIX Command

This example runs the report command under the user1 user ID on agent UNIX_NY:

AGENT UNIX_NY
CMDNAME /mfg/report
USER user1

Example: Redirect I/O and Pipe Output

This example redirects I/O and pipes output from a command. The agent runs the UNIX command ps -ef|grep cybAgent and pipes output to the /tmp/log file. The shell interpreter is invoked in the CMDNAME statement and the command is included in the ARGS statement.

AGENT SUN30RD
CMDNAME /usr/bin/ksh
ARGS -c "ps -ef|grep cybAgent >>/tmp/log"
USER user1

Example: Specify a Script Name Without the Full Path

In this example, an agent named WINAGENT runs a script named procscript.bat. The path to procscript.bat is set in the system path on the agent computer and the agent is configured to search for paths to command and script files.

AGENT WINAGENT
CMDNAME procscript.bat