Function Status Codes

Function Status Codes

Dataport functions return only one output parameter, the function status code. This code reports whether the function call was successfully completed. If the function call fails, the status code indicates the problem. This status code can be used to pinpoint run-time errors in your program.

For example, assume the following call appears in your program:

state_id = stm_r_st ("%", &status);

The function requires a state name for the first input argument. In this case, the function returns a status code of 3, stm_illegal_name, because % is not a valid element name.

The status code is an integer value. Therefore, the status argument must be a variable declared to be of type int INTEGER. The Dataport provides predefined constants for the function status codes. This enables you to use the status name attached to each status code in your program.

Status codes have three severity levels:

S for success
W for warning
E for error

When a warning or error status is returned, attempts to execute statements using the return value of the function can produce erroneous or unexpected results. Therefore, you should check the return status codes to ensure that your function call is successful before using the returned values.

The following table lists the status codes and their severity levels.

 
UNIX: The STM_ROOT environment variable is not defined.
VMS: The STM$ROOT or STM$PM logical name does not exist.
The element is defined implicitly—it is an internally defined entity.