User Tools

Site Tools


gams:use_gams_return_codes_in_a_batch_file

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

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