How to pass current date in sequence job

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

How to pass current date in sequence job

Post 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.
thompsonp
Premium Member
Premium Member
Posts: 205
Joined: Tue Mar 01, 2005 8:41 am

Post 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."
dsetlteam
Premium Member
Premium Member
Posts: 35
Joined: Mon Feb 10, 2014 10:14 pm
Location: USA

Post 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.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Thanks everyone!

Issue is resolved.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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]")
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply