Progress
DataServer for
Microsoft SQL Server
Guide


Retrieving Return Codes

A stored procedure might return a code that provides information. For example, it might indicate whether the stored procedure was successful or whether it encountered an error condition. The following example of 4GL code runs the stored procedure pcust. It uses the PROC–STATUS function and the CLOSE STORED–PROC statement to retrieve the return code and assign the value to the variable stat. The meaning of this return code is defined by the underlying data source:

/* Return status */

DEFINE VAR stat AS integer.
RUN STORED-PROCEDURE pcust (20, output 0, output 0).
FOR EACH proc-text-buffer:
 DISPLAY proc-text-buffer.   
END.
CLOSE STORED-PROC pcust stat = PROC-STATUS.
DISPLAY pcust.orders pcust.states stat. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095