Outline of a Simple ESP Function

An ESP function should follow a certain structure with regard to its interaction with the Open Server API.

The structure should be:
  1. Get the number of parameters.
  2. Get the values of the input/output parameters and bind them to local variables.
  3. Use the input parameter values to perform processing, and store the results in local variables.
  4. Initialize any output parameters with appropriate values, bind them with local variables, and transfer them to the client.
  5. Use srv_sendinfo to send the returned row to the client.
  6. Use srv_sendstatus to send the status to the client.
  7. Use srv_senddone to inform the client that processing is done.
  8. If there is an error condition, use srv_sendinfo to send the error message to the client.

See the Open Server Server-Library/C Reference Manual for documentation of the Open Server routines.