Page 1 of 1

Write DB2 query in a sub-program or main program?

Posted: Fri Jan 02, 2015 3:24 pm
by Pradeep Singh
Hi,

I've a requirement in which I need to execute some DB2 queries. The proramming language will be COBOL. Now I think of two things:

1. I can write all my DB2 queries in a single COBOL program and get it all done. But the program will be very lenghty and complexto understand.

2. In other choice, I can write a cobol sub-program which will have DB2 queries and when I need to execute a query, I will call this cobol sub-program from the main COBOL program.

Now as the second option can provide me more modularity, I think but which is more efficient in these two? Performance is a number one priority in this project.

Please share your suggestions.

Re: Write DB2 query in a sub-program or main program?

Posted: Fri Jan 02, 2015 7:42 pm
by zprogrammer
The use of option 1 and 2 might not produce much difference in terms of CPU time..

What you could try is think of options to execute programs concurrenyly that would save some elapsed time atleast

Re: Write DB2 query in a sub-program or main program?

Posted: Tue Jan 06, 2015 12:13 pm
by Anuj Dhawan
I find this to be a bit tricky situation to suggest you a straight choice between 1 and 2.

CPU savings, in this case, should not be of significant impact unless you're using very heavy DB2 queries.

We're in 2015 - many of the DB2 queries, anyways, will be off-loaded to zIIP/zAAP, when needed, if they are available at your shop. OTOH, in general - for COBOL, statically linked/edited programs will be fast as 'all the modules' are in memory at the same time but it might have its own overheads (though we'll skip that discussion as that sound way beyond the scope of this thread), however, from a maintainability point of view having two modules might be an option.

Having given you all that mixed answers - suggest you create a set of all the queries and execute them in QMF or SPUFI. Observe their CPU usage and check if they are in the range allowed at your shop. If they are, I think, option 2 should be fine else explore option 1.

In nut shell, it'd need some experiment at your end.

Re: Write DB2 query in a sub-program or main program?

Posted: Tue Jan 06, 2015 6:48 pm
by Pradeep Singh
ThanksPandora-Box and Anuj.