Passing parameters from COBOL to DB2 query



IBM's flagship relational database management system

Passing parameters from COBOL to DB2 query

Postby karthickrajamani » Tue Aug 19, 2008 4:06 pm

HI All,

I need to pass a parameter to a DB2 query from my COBOL program. I am not aware of how this can be done. My requirement is given a table and number of days, the program should archive all the data before that date and then purge it, i.e. if i give 10 days today(19 Aug), all data before 9 Aug should be archived and purged from the table. The way i thought of proceeding with this is by accepting the tablename and number of days as input from JCL and then pass it as parameters to a query and then fetch the data using a cursor and archive it and similarly purge it.

I will be thankful for any help, be it on how to pass parameters to a query or any change in my overall logic.

Thanks,
Karthick
karthickrajamani
 
Posts: 3
Joined: Tue Aug 19, 2008 3:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Passing parameters from COBOL to DB2 query

Postby MrSpock » Tue Aug 19, 2008 6:28 pm

karthickrajamani wrote:The way i thought of proceeding with this is by accepting the tablename and number of days as input from JCL and then pass it as parameters to a query and then fetch the data using a cursor and archive it and similarly purge it.


It's not quite clear what you're getting at here. If by "accepting the tablename and number of days as input from JCL" you mean that you'll be reading those details from a dataset, or as input to a program from a "PARM=" statement in the JCL, then I don't see a problem. Although, wouldn't it be easier to just have your COBOL program output the entire contents of the query to a dataset so that you don't need to pass them at all?
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post