CRITICAL
Rule Definition
SQL statements in COBOL provide the best performance when they can be prepared by the DB2 precompiler prior to the COBOL compilation. Using the EGL prepare statement to prepare SQLstatements at runtime bypasses the DB2 precompiler.
Recommendation
Don’t use the prepare statement in applications intended for COBOL environments.
Remediation
Try to reduce the use of prepare statements.
Violation Code Sample
function test1()
stringExpression String= "delete from " +
"CASTTEST T1 "+
"where "+
"M= ?";
prepare preparedStatementIdentifier from stringExpression; // VIOLATION
execute preparedStatementIdentifier
using CASTTEST.T1;
end
Fixed Code Sample
function test1()
execute
#sql{
delete from
CASTTEST1 T1
where
M= CASTTESTT1.M
};
end
Reference
EGL Best Practices: Coding For Performance. November 10, 2009. Edition 2
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.