View previous topic :: View next topic
|
Author |
Message |
babu_hi
New User
Joined: 11 Apr 2006 Posts: 93
|
|
|
|
I have a sub program with cursor diclaration,now i want to return the sqlcode and sqlerrmsg to main program.i have declared linkage section like this,
05 LK-MESSAGE-TEXT PIC X(80).
05 LK-SQLCODE PIC S9(9) COMP-4.
05 LK-SQLERRM.
49 LK-SQLERRML PIC S9(4) COMP-4.
49 LK-SQLERRMC PIC X(70).
Here for excample i am handling open cursor error,
EXEC SQL
OPEN CONTROL_TABLE_CSR
END-EXEC.
IF SQLCODE NOT = +0
MOVE 'OPEN CURSOR ERROR' TO LK-MESSAGE-TEXT
MOVE ’04’ TO LK-RETURN-STATUS
MOVE SQLCODE TO LK-SQLCODE
END-IF.
but how can i use for error handle with LK-SQLERRM variable in this case. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
If you have mis-designed these programs so much that you can't provide proper error handling, suggest that you pass the sqlca as a parm. then in the sub-module, use the sqlca in linkage. that way you don't have to fool around with sql return codes. |
|
Back to top |
|
|
|