We have a web application which calls a stored proc (external COBOL) program which runs horrendously slow. Database is 7.2 on OS390.

The idea of the procedure is.....

EXEC SQL DECLARE C1 CURSOR WITH RETURN FOR
select column2 from table where col1 = :ws-host-var <-- 30 CHARACTER FIELD

-- we are indexed on col1. The explain says we are using the index.

Now we run the same query in a SPUFI and the thing comes back in no time. We can do this in COBOL program as well. We can do this via a JDBC call as well. All have hard coded variables.

So then we attempted to write the same thing in a COBOL program and pass in a parameter to the program via JCL (ya know) and the thing runs just as slow as the stored proc.

Must be a COBOL thing? Or is it the parameter? If the parameters have low-values or spaces in it does it matter? Would it make it that slow?

There is about 1 million rows in the table and it takes 4 mins to come back.

Tim