Passing result of DB2 TRUNC_TIMESTAMP in JCL steps



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Passing result of DB2 TRUNC_TIMESTAMP in JCL steps

Postby Okonita » Thu Mar 27, 2014 3:17 pm

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
Okonita
 
Posts: 10
Joined: Thu Dec 13, 2007 4:53 am
Has thanked: 0 time
Been thanked: 0 time

Re: Passing result of DB2 TRUNC_TIMESTAMP in JCL steps

Postby NicC » Thu Mar 27, 2014 9:41 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post