GET DIAGNOSTICS, but its not returning anything. Could someone tell me why? And/Or give me a different alternative?
I have the procedure defined as:
CREATE PROCEDURE PROG1
(
IN IN_YEAR CHAR(04),
IN IN_TXRP_STM_TY_CD CHAR(01),
IN IN_REPTBLE_CD CHAR(01),
IN IN_PAYR_ID CHAR(04),
IN IN_TXRP_AC_NO CHAR(09),
IN IN_SEC_NBR CHAR(05),
IN IN_TRADE_DATE CHAR(10),
IN IN_SETLE_DATE CHAR(10),
IN IN_MNY_IND CHAR(01),
IN IN_MNY_AMT_TOLRNCE DEC(15,2),
IN IN_QTY_IND CHAR(01),
IN IN_DIF_QTY_TOLRNCE DEC(15,4),
IN IN_PENDING_ID CHAR(01),
IN IN_REMARK_CD CHAR(03),
IN IN_STATUS_ID CHAR(01),
IN IN_NETWORK_ID CHAR(20),
IN IN_PAGE_NBR DEC(15,0),
IN IN_NBR_OF_LINES SMALLINT,
OUT OUT_CNTR INTEGER
)
RESULT SETS 1
EXTERNAL NAME 'PROG1'
LANGUAGE COBOL
COLLID MYID
WLM ENVIRONMENT TESTENV
STAY RESIDENT NO
ASUTIME LIMIT 950000
PROGRAM TYPE MAIN
COMMIT ON RETURN NO;
(
IN IN_YEAR CHAR(04),
IN IN_TXRP_STM_TY_CD CHAR(01),
IN IN_REPTBLE_CD CHAR(01),
IN IN_PAYR_ID CHAR(04),
IN IN_TXRP_AC_NO CHAR(09),
IN IN_SEC_NBR CHAR(05),
IN IN_TRADE_DATE CHAR(10),
IN IN_SETLE_DATE CHAR(10),
IN IN_MNY_IND CHAR(01),
IN IN_MNY_AMT_TOLRNCE DEC(15,2),
IN IN_QTY_IND CHAR(01),
IN IN_DIF_QTY_TOLRNCE DEC(15,4),
IN IN_PENDING_ID CHAR(01),
IN IN_REMARK_CD CHAR(03),
IN IN_STATUS_ID CHAR(01),
IN IN_NETWORK_ID CHAR(20),
IN IN_PAGE_NBR DEC(15,0),
IN IN_NBR_OF_LINES SMALLINT,
OUT OUT_CNTR INTEGER
)
RESULT SETS 1
EXTERNAL NAME 'PROG1'
LANGUAGE COBOL
COLLID MYID
WLM ENVIRONMENT TESTENV
STAY RESIDENT NO
ASUTIME LIMIT 950000
PROGRAM TYPE MAIN
COMMIT ON RETURN NO;
The COBOL member has the following:
05 WS-OUT-CNTR PIC S9(9) BINARY VALUE ZEROS.
DECLARE BRK_RECS CURSOR
WITH HOLD
WITH RETURN
FOR
SELECT
T1.col1
, T1.col2
, T2.col1
, T3.col4
FROM
Table1 T1
INNER JOIN
Table2 T2
ON T1.COL1 = T2.COL5
AND T1.COL8 = T2.COL8
INNER JOIN
Table3 T3
ON T1.COL1 = T3.COL1
AND T1.COL3 = T2.COL5
END_EXEC
EXEC SQL
OPEN BRK_RECS
END-EXEC
EVALUATE SQLCODE
WHEN +0
EXEC SQL
GET DIAGNOSTICS :WS-OUT-CNTR = ROW_COUNT
END-EXEC
WHEN OTHER
DECLARE BRK_RECS CURSOR
WITH HOLD
WITH RETURN
FOR
SELECT
T1.col1
, T1.col2
, T2.col1
, T3.col4
FROM
Table1 T1
INNER JOIN
Table2 T2
ON T1.COL1 = T2.COL5
AND T1.COL8 = T2.COL8
INNER JOIN
Table3 T3
ON T1.COL1 = T3.COL1
AND T1.COL3 = T2.COL5
END_EXEC
EXEC SQL
OPEN BRK_RECS
END-EXEC
EVALUATE SQLCODE
WHEN +0
EXEC SQL
GET DIAGNOSTICS :WS-OUT-CNTR = ROW_COUNT
END-EXEC
WHEN OTHER