Top
Systemwalker Operation Manager  User's Guide
FUJITSU Software

A.6.2 Using Batch Files as Jobs [Windows version]

The following describes about creating the batch files to be processed by Jobscheduler easily.

Usually, when a certain operation is carried out, a series of processes are incorporated in sequence into one batch file. However, when using the Jobscheduler, batch files can be divided by the processes so that respective status may be easily monitored. This enables not only the monitoring but also the actions to be taken in response to abnormal situations to be handled more smoothly.

The following would be helpful when creating batch files to be registered in the Jobscheduler.

Completion codes for batch files

The return code for the last command (program) in a batch file will be carried over as the completion code for the batch file. To set an optional value as the completion code for a batch file, use the setecode command provided by the Jobscheduler. Specifically, manage the return code in the middle of the batch file and set the value as the final completion code of the batch file using the setecode command. The setecode command is stored in the MpWalker.JM\bin directory under the Systemwalker Operation Manager installation directory.

The following provides the command syntax of the setecode command and an example of a batch file using the setecode command.

Command syntax of the setecode command

setecode completion code (0 to 200)

Example of a batch file using the setecode command

echo off

rem job execution

application.exe <--Executes the program.
if errorlevel 2 goto ERR2 <-- Checks the return code.
if errorlevel 1 goto ERR1
rem application return code = 0
echo application is normal ended.
setecode 0 <-- Sets completion code 0.
exit

:ERR2
rem application return code >= 2
echo application is abnormal ended, code is 2 or over.
setecode 2 <-- Sets completion code 2.
exit

:ERR1
rem application return code = 1
echo application is abnormal ended, code is 1.
setecode 1 <-- Sets completion code 1.