Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamically pass table name to a query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Dynamically pass table name to a query
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    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Tue Aug 30, 2011 7:02 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 1218
Location: Israel

PostPosted: Wed Aug 31, 2011 2:43 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us