Page 1 of 1

Passing parameters from COBOL to DB2 query

PostPosted: Tue Aug 19, 2008 4:06 pm
by karthickrajamani
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

Re: Passing parameters from COBOL to DB2 query

PostPosted: Tue Aug 19, 2008 6:28 pm
by MrSpock
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?