Progress
External Program
Interfaces


Returning Error Codes From a Top-level Function

There are two ways to return errors from a top-level function:

If you use the first technique, the PRODSP() dispatch routine returns a long data type value to Progress. Progress uses this value as a return code to determine whether the HLC routine dispatched by PRODSP() was successful. If the return code is 0, Progress considers the routine successful and continues processing. If the return code is non-zero, Progress considers the routine unsuccessful and raises an error condition. See the Progress Programming Handbook for more information on error processing.

The FUNCTEST macro ensures that the value returned from your top-level function is passed on as the return code of PRODSP(). However, you must make sure that your top-level function returns an appropriate value for the return code. For example, when your top-level function runs successfully, make sure that the last statement executes the equivalent of the following:

return 0; 

If you use the second method, you can set unique error codes that you can test from Progress and respond to each type of error as needed.

The first technique provides an efficient way to return to Progress when your HLC function encounters an unexpected error, such as an unsuccessful HLC library call. The second technique provides more fine-grained error processing, and allows your Progress procedure to handle conditions specific to your application.


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