User Tools

Site Tools


How can I use GAMS return codes in a batch file?

How can I use the error codes that are returned by GAMS?

Attached is a small example batch file that demonstrates some of the error codes that can be returned by calling GAMS. Here is a complete list of GAMS return codes.

gams %1 %2 %3 %4 %5
if errorlevel 1000 goto drivererr
if errorlevel 100  goto cgamsRC
if errorlevel 11   goto disk
if errorlevel 10   goto memory
if errorlevel 9    goto unexpected
if errorlevel 8    goto gamserr
if errorlevel 7    goto license
if errorlevel 6    goto paramerr
if errorlevel 5    goto fileerr
if errorlevel 4    goto limits
if errorlevel 3    goto execerr
if errorlevel 2    goto compileerr
if errorlevel 1    goto err

@echo honky dory
goto end

@echo driver error
goto end
@echo gams driver error
goto end
@echo out of disk
goto end
@echo out of memory
goto end
@echo unexpected cmex error
goto end
@echo gams error
goto end
@echo licensing error
goto end 
@echo (command line) parameter error
goto end
@echo file error
goto end
@echo system limits reached
goto end
@echo execution error
goto end
@echo compilation error
goto end
@echo internal control error
goto end
gams/use_gams_return_codes_in_a_batch_file.txt · Last modified: 2017/09/02 16:00 by support