Hi Sat,
Your IDMS SQL Stored Procedure program can set the SQLSTATE of your query just like IDMS Table Procedure programs can. The doc snippet below was taken from section entitled "Special Considerations for SQL-invoked External Routines" within the SQL Reference topic. Note that, "SQL-invoked External Routines" includes table procedures, procedures and functions. This section talks about error handling for sql-invoked external routines.
__________________________________________________________________________________________________
Error Handling
The SQL-invoked external routine has two arguments to signal an exception condition back to CA IDMS. These arguments consist of a five-character SQLSTATE code and an 80-byte message area. The following table lists valid SQLSTATE codes and their descriptions.
Value | Description |
00000 | Request was successful |
01Hxx | Request was successful but the SQL-invoked external routine generated a warning message |
02000 | No more rows to be returned |
38*** | The SQL-invoked external routine has detected an error during processing |
CA IDMS examines the SQLSTATE value to determine whether the operation was successful. An SQLSTATE value of 0200 indicates that all rows have been returned. It is meaningful only on a Next Row request and cannot be set while at the same time returning a row since CA IDMS ignores parameter arguments if an SQLSTATE value of 02000 is set.
If an SQLSTATE value indicates that an error or warning condition exists, CA IDMS embeds the message text returned by the SQL-invoked external routine in a standard DB message and returns it to the calling application through the message area of the SQLCA. It also translates the SQLSTATE value into one of the following SQLCODE values:
SQLSTATE Value | SQLCODE Value |
00000 | 0 |
01Hxx | 1 |
02000 | 100 |
38*** | -4 |
If the SQL-invoked external routine signals an error, CA IDMS automatically rolls out all database changes that the SQL-invoked external routine made while processing the SQL statement that caused the SQL-invoked external routine to be invoked. For example, if the invoking SQL statement was a searched update and ten rows had been updated before the error was detected, changes to all ten rows are rolled out automatically. Database changes made prior to the execution of the searched update statement are not rolled out.
________________________________________________________________________________________________________________
Thanks to Carla Pereira for providing this info...
Dave