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: 1746
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: 1224
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
No new posts Join in SQL Query vickey_dw DB2 1 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


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