Page 1 of 1

How to pass current date in sequence job

Posted: Wed Apr 02, 2014 3:47 am
by prasson_ibm
Hi all,

I have a requirement where i have preupdate,main loading job and post update.

My requirement is to stored the current date before main job starts loading and pass this as a parameter to post update job in job sequence.

To achieve this,i have used user variable activity stage between preupdate and main job and created one variable as
CURR_DT=Date()
But when i am passing this variable to post update job parameter

CURR_DT(Type=date)=Curr_Dt_Vrb.CURR_DT sequence is failing at post update flow with error:-

JobControl (@Ofin_Submit_Job): Will execute error activity: Exception_Handle

when i change the data type of parameter CURR_DT(Type=String)=Curr_Dt_Vrb.CURR_DT

it passes the interger value CUR_DT=16894,which is not expected.


Can soneone give a look in this.

Posted: Wed Apr 02, 2014 3:54 am
by thompsonp
Take a look in the manual at how the function behaves:

"Use the DATE function to return the numeric value of the internal system date. Although the DATE function takes no arguments, parentheses are required to identify it as a function.

The internal format for the date is based on a reference date of December 31, 1967, which is day 0. All dates thereafter are positive numbers representing the number of days elapsed since day 0. All dates before day 0 are negative numbers representing the number of days before day 0."

Posted: Wed Apr 02, 2014 5:32 am
by dsetlteam
Either use a execute command activity and get the current date OR If you want to use only user variable activity then try something with Oconv,Iconv

Oconv((Iconv(datehere,"D-YMD[4,2,2]")) ,"D-YMD[4,2,2]")

That should get you the date in the yyyy-mm-dd format.

Posted: Wed Apr 02, 2014 7:24 am
by prasson_ibm
Thanks everyone!

Issue is resolved.

Posted: Wed Apr 02, 2014 8:09 am
by chulett
Hmmm... what did you actually use for the "datehere" part of the posted code?

Code: Select all

Oconv((Iconv(datehere,"D-YMD[4,2,2]")) ,"D-YMD[4,2,2]")
If you used Date() as mentioned in your first post then the inner IConv is actually doing nothing as the conversion cannot be made, meaning the internal number is passed unchanged to OConv. Actually, sorry but the code as posted doesn't make sense. It takes a string in "YYYY-MM-DD", converts it to an internal date and then converts it back into a string in "YYYY-MM-DD" format. :?

This would be more appropriate if that output format is what you need:

Code: Select all

Oconv(Date(),"D-YMD[4,2,2]")