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.