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

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Pradeep Singh
Registered Member
Posts: 22
Joined: Thu Aug 21, 2014 7:12 am

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

Post 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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

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

Post 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
zprogrammer
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Pradeep Singh
Registered Member
Posts: 22
Joined: Thu Aug 21, 2014 7:12 am

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

Post by Pradeep Singh »

ThanksPandora-Box and Anuj.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”