[Migrated content. Thread originally posted on 29 November 2011]
Hi,I was just wondering if any one can advise on how to improve on SQL performance.
As the SQL database gets bigger then the number of records returned increases and the Visual Cobol App appears to slow down.
I use the OpenESQL Assistant to create my SQL cobol and embed in the program, see sample below:-
EXEC SQL
DECLARE CSR110 readonly CURSOR FOR SELECT
A.Co
,A.Code
,A.Type
,A.CodeDesc
,A.DateChanged
,A.Param
,A.NominalCode
FROM Codes A WITH (NOLOCK)
WHERE ( A.Co = :Codes-Co )
AND ( A.Type = :Codes-Type )
AND ( A.Code LIKE :ws-top-search )
ORDER BY A.CodeDesc DESC
END-EXEC
EXEC SQL OPEN CSR110 END-EXEC
PERFORM UNTIL SQLSTATE >= "02000"
EXEC SQL
FETCH CSR110 INTO
:Codes-Co
,:Codes-Code
,:Codes-Type
,:Codes-CodeDesc:Codes-CodeDesc-NULL
,:Codes-DateChanged:Codes-DateChanged-NULL
,:Codes-Param:Codes-Param-NULL
,:Codes-NominalCode:Codes-NominalCode-NULL
END-EXEC
*> Process data from FETCH
IF SQLSTATE
set Codes-Code to Codes-Code
END-IF
END-PERFORM
EXEC SQL CLOSE CSR110 END-EXEC
Any tricks or tips would be much appreciated.
Thanks
Neil.