Generic DB2 SQLCODE handle for cobol
Posted: Thu Apr 05, 2012 4:57 pm
Hello!
Me and my colleague are wondering if it is at all possible to generically handle sqlcode.
What we want in fact is to call a routine that will get the parameters of where clause of an unsuccessful SQL.
I.E.:
So that MESSAGE contains something like 'PAR1: 7; PAR2: 16; PAR3 = 99;'
So, F1, guys!
Anything is helpful!
Thanks in advance!
Kind regards,
Mario.
Me and my colleague are wondering if it is at all possible to generically handle sqlcode.
What we want in fact is to call a routine that will get the parameters of where clause of an unsuccessful SQL.
I.E.:
EXEC SQL
SELECT 1 FROM SOME_TABLE
WHERE CENTER = :FIRM
AND UNIT = :ORG-UNIT
AND EMPLOYEE STATUS = :STATUS
END-EXEC
IF SQLCODE NOT = 0 THEN
PERFORM SQL-HANDLE
MOVE SQL-HANDLE-OUT TO MESSAGE
END-IF
SELECT 1 FROM SOME_TABLE
WHERE CENTER = :FIRM
AND UNIT = :ORG-UNIT
AND EMPLOYEE STATUS = :STATUS
END-EXEC
IF SQLCODE NOT = 0 THEN
PERFORM SQL-HANDLE
MOVE SQL-HANDLE-OUT TO MESSAGE
END-IF
So that MESSAGE contains something like 'PAR1: 7; PAR2: 16; PAR3 = 99;'
So, F1, guys!
Anything is helpful!
Thanks in advance!
Kind regards,
Mario.