MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to Automate this?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Jan 24, 2008 10:10 am    Post subject: How to Automate this? Reply with quote

Hi,

We have a DB2-COBOL program that uses a SQL query (Cursor) to pull information from a DB2 table then proceeds further.

This SQL query pulls data based on a where condition (AAC = '1','2','3')

The thing about this program is, it often undergoes changes whenever the client asks a new AAC is to be added to the program to be pulled out into the report.

We want to automize this process. I mean, instead of each time retreiving it to test, code it, productionize it, we want a way through which the program retreival from Endevor is avoided and client can enter the AAC by themselves.

Please suggest.

TIA.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Thu Jan 24, 2008 10:14 am    Post subject: Reply with quote

i'm not sure understanding your request
but i think it's easy to be done using dynamical SQL, prepare the SQL statement after reading input
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Thu Jan 24, 2008 10:18 am    Post subject: Re: How to Automate this? Reply with quote

ranga_subham wrote:
Hi,

We have a DB2-COBOL program that uses a SQL query (Cursor) to pull information from a DB2 table then proceeds further.

This SQL query pulls data based on a where condition (AAC = '1','2','3')

The thing about this program is, it often undergoes changes whenever the client asks a new AAC is to be added to the program to be pulled out into the report.

We want to automize this process. I mean, instead of each time retreiving it to test, code it, productionize it, we want a way through which the program retreival from Endevor is avoided and client can enter the AAC by themselves.

Please suggest.

TIA.


Create a table with the AAC that need to be processed and use that to drive the report program. You would have to add a new process to allow the client to maintain the AAC table.
Or create a procedure for the client to request the report and pass the AAC as a parameter. It wouldn't require dynamic SQL just use a host variable to specify the AAC.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jan 24, 2008 6:25 pm    Post subject: Reply with quote

ranga_subham,

Quote:
This SQL query pulls data based on a where condition (AAC = '1','2','3')


Move the account values to a File which will be appended with every new account you add to it. Now read this file as input and open the cursor with cond AAC = ' account # from file' and you repeat the process until the end of the file. In that way you never have to change the program at all

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Jan 29, 2008 5:48 am    Post subject: Reply with quote

Kolusu,

Will we have several OPEN, FETCH & CLOSE because we will process each AAC one time? bonk Shocked

How about if a given AAC is not found in the database (I assume that we will have to handle the Not Found condition and proceed to next read !!) Neutral Exclamation Question

May I ask you to elaborate on your suggestion please. Very Happy

TIA.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jan 29, 2008 11:05 am    Post subject: Reply with quote

Quote:
Will we have several OPEN, FETCH & CLOSE because we will process each AAC one time? bonk :shocked



ranga_subham,

of course we will have multiple open/fetch/close. Given that you don't want to do any of the following what other options have you got?

1. Dynamic Sql
2. Add a new column on the table
3. Change the pgm every time a new account is added

Trust me the overhead of open and close isn't gonna hurt your performance unless you process like a million accounts.

And for the second Q, it is the duty of the programmer to handle exceptions.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Jan 29, 2008 2:30 pm    Post subject: Reply with quote

A slight modification on Kolusu's idea. Create a DECLARED GLOBAL TEMPORARY TABLE in your program. Read the records from the file and insert rows to the temp tbl. Modify the cursor SQL to join to the temp table on the account. Same idea with a minor twist might save a couple lines of code.
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Jan 31, 2008 5:42 am    Post subject: Reply with quote

Thanks to Kolusu & jsharon1248. Smile
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group