Programming Guide


Contains a return code from a stored procedure


Use @dmengreturn to get a stored procedure's return or status code. This variable is only available if your engine supports stored procedures and their return codes and if the Panther database driver supports stored procedure return codes.

Since database engines implement stored procedures differently, refer to the Database Drivers for engine-specific information and examples.

By default, Panther pauses the execution of a stored procedure if the procedure executes a SELECT statement and the number of rows in the select set is greater than the number of occurrences in the Panther destination variables. The application must execute DBMS CONTINUE or DBMS NEXT to resume execution. If the value of @dmengreturn is null after calling a stored procedure, the procedure might be pending. If the engine has completed the execution of the procedure, @dmretcode will contain the DM_END_OF_PROC code and @dmengreturn will contain the procedure's return code.

The value of this variable is cleared once another DBMS command is executed. If the application needs the value for a longer period of time, it should copy it to a standard Panther variable or some other static location.


# This is an example of a SYBASE stored procedure:
# create proc checkid @id int as
# if (SELECT COUNT (*) FROM titles WHERE title_id = @id) = 1
# return 1
# else
# return 2
DBMS RUN EXEC checkid :+title_id
if @dmengreturn == 1
call addrow
else if @dmengreturn == 2
msg emsg "Sorry, " title_id " is not a valid code."
proc addrow
(:+title_id, :+copy_num, 'O', 0)