DMS Help
DMS Help

Exit Codes

 

 

DMS Auto execution commands have exit codes for SQL and Text importing as well as for Schedule Runs and Auto reporting. 


The "exit code" is stored in a shell variable named errorlevel.  The errorlevel is set at the end of a console application.

 

Use the if command keyword errorlevel for comparison:

if errorlevel <n> (<statements>)
 

Which will execute statements when the errorlevel is greater than or equal to n.

A shell variable named errorlevel contains the value as a string and can be dereferenced by surrounding it with %.

 

For example, if importing jobs you can trap the error:

if %errorlevel%==0 (echo "Process completed without error.")

else if %errorlevel%==1 (echo "Unknown error/abnormal termination.")

else if %errorlevel%==2 ( echo "Command file not found.")

else if %errorlevel%==3 ( echo "Invalid auto import SQL Script name or text file name.")

else if %errorlevel%==10 ( echo "Import warnings occurred but there are no errors.")

else if %errorlevel%==11 ( echo "Import errors occurred and there may be warnings as well.")
 

To ensure that Windows waits for the correct DMS error code, the /Wait command should be used on the command line as in:

"C:\Dynafact\DMS\DMSEnt.exe" "UserIniFolder=C:\Dynafact\Production\DMS\User" "AutoUserName=DMS" "DatabaseName=DMSProduction" "AutoSQLImportJobs=C:\Dynafact\JobSQLImport.txt" "AutoLogOut" /wait

 

The exit codes are as follows:

SQL & Text Imports

0            Process completed without error

1            Unknown error/abnormal termination

2            Command file not found

3            Invalid auto import SQL Script name or text file name

10          Import warnings occurred but there are no errors

11          Import errors occurred and there may be warnings as well

 

Scheduler

0            Process completed without error

1            Unknown error/abnormal termination

2            Invalid auto schedule run command

4            Invalid auto schedule run start date

10          Schedule warnings occurred but there are no errors

11          Schedule errors occurred and there may be warnings as well
 

Auto Reports

          Unknown error/abnormal termination

7            Report name was not given for the AutoReport command (see status file)

8            Cannot find Action Name for the AutoReport command (see status file)