Page 1 of 1

Passing result of DB2 TRUNC_TIMESTAMP in JCL steps

PostPosted: Thu Mar 27, 2014 3:17 pm
by Okonita
Hi all,
How can I dynamically pass the result of DB2 TRUNC_TIMESTAMP of any kind in my JCL steps?

I am looking to create a JCL stream that will do the following:

Step 1: Run a instream DB2 Param1 = Select TRUNC_TIMESTAMP(CURRENT TIMESTAMP,'MONTH'**) from SYSIBM.SYSDUMMY1;

Step 2: Param2 = Select TRUNC_TIMESTAMP(CURRENT TIMESTAMP + 1 month,'MONTH')- 1 MICROSECOND)** from SYSIBM.SYSDUMMY1;

Step 3: Select count(*) from HLVQUAL.TABLE_NAME where CREATE_TS between Param1 AND Param2

I will highly appreciate any examples, how-tos and other helpful comments to resove my issue.

Thanks everyone

Okonita

Re: Passing result of DB2 TRUNC_TIMESTAMP in JCL steps

PostPosted: Thu Mar 27, 2014 9:41 pm
by NicC
I suspect that you can do all that in the one query in DB2. However, if you need to do it as you have shown then you need to write your output from step 1 and step 2 into a file and read that into step 3 and build your select statement which means that you may need programs for all 3 steps because JCL alone cannot do it.