IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamically pass table name to a query


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praveena avaluru

New User


Joined: 29 Sep 2010
Posts: 9
Location: bangalore

PostPosted: Tue Aug 30, 2011 6:22 pm
Reply with quote

Hi
I have a requirement to select some tables and get the count of the row for a certain timeline dynamically in a cobol program

Ex :

Select count(*) from :WS-TABLE-NME
where date < current_date


My workshop does not allow me to use dynamic sql. Please suggest me any other way possible.

Regards
Praveena Avaluru
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Aug 30, 2011 6:27 pm
Reply with quote

Put static queries for all the tables in one cobol program... or you can put in different cobol programs too...
Back to top
View user's profile Send private message
praveena avaluru

New User


Joined: 29 Sep 2010
Posts: 9
Location: bangalore

PostPosted: Tue Aug 30, 2011 6:59 pm
Reply with quote

There are more than 100 tables to be queried and the count can increase over a period of time.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Aug 30, 2011 7:02 pm
Reply with quote

So, how did those incompetent morons you work for come to give you a requirement and simultaneously forbid you to use the means of fulfilling it?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Aug 30, 2011 7:05 pm
Reply with quote

What do you do after you counts?

It wouldn't be bad idea to run all querys in batch for all the tables to get counts in one file.

Read this file in Cobol and do whatever you want.
Back to top
View user's profile Send private message
praveena avaluru

New User


Joined: 29 Sep 2010
Posts: 9
Location: bangalore

PostPosted: Tue Aug 30, 2011 7:06 pm
Reply with quote

Well thats is the reason i had to reach out to this fourm i guess to find if any alternative is possible icon_idea.gif
Back to top
View user's profile Send private message
praveena avaluru

New User


Joined: 29 Sep 2010
Posts: 9
Location: bangalore

PostPosted: Tue Aug 30, 2011 7:10 pm
Reply with quote

The request is to get the count of changes from a particular date
The date is part of input.


In anycase writing 100 queries is inevitable icon_sad.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 30, 2011 7:45 pm
Reply with quote

Quote:
The request is to get the count of changes from a particular date


that makes little or no sense.

since the only difference in the sql is the table name,
a quick and dirty REXX could build this for batch input, in a second.

although it would take longer than a second to write the rexx script - about 10 to 15 minutes.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Aug 31, 2011 2:43 pm
Reply with quote

By the way, all the 100 tables have the same column name for the date ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts RC query -Time column CA Products 3
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top