Page 1 of 1

Equivalent of WeekdayFromDate in Job sequence

Posted: Tue Apr 17, 2012 5:16 pm
by RAJARP
Hi All,
I would like to know a way to implement the equivalent of 'Weekdayfromdate' function job sequence.Can this be achieved somehow in Job sequence?

Basically, I have the date in 'yyyy-mm-dd' format in a unix file.In the execute command activity, I can use

Code: Select all

cat  unixfilename
and pull the date value inside.But not sure How to get the 'day of the week' from the date.Based on the day, various triggers needs to be fired.


Thanks in advance,
Raja R P

Posted: Tue Apr 17, 2012 5:21 pm
by qt_ky
You can use the Oconv() BASIC function with date conversion codes like W for the day number of the week or WA for the name of the day of the week. See the DataStage BASIC Reference Guide for details.

Posted: Wed Apr 18, 2012 12:24 am
by RAJARP
Thanks for the pointer , Eric!!!!
I am able to do that by

Code: Select all

oconv(iconv(Trim(Convert(@FM,"",ExeCommand.$CommandOutput)),"D-YMD[4,2,2]"),"DWB")
where ExeCommand is a execute command activity where i am doing

Code: Select all

cat unixfilename

I found the below link useful
http://www.webelink.com/WL_info_view.as ... pick_oconv

Thanks once again,
Raja R P

Posted: Wed Apr 18, 2012 1:40 am
by vamsi.4a6
Could you please tell me what is the need for replacing @FM with " " and what will happen if we remove convert and trim functions in the above derivation?

Posted: Wed Apr 18, 2012 1:43 am
by ray.wurlod
The @FM is the trailing linefeed. If you don't remove that, then the Iconv() function won't work. Trim() gets rid of extraneous white space, just in case there is any.

Posted: Wed Apr 18, 2012 1:54 am
by vamsi.4a6
Thanks for quick reply
one small clarification and I saw so many posts in dsecxhange replacing @FM with '' incase of sequence jobs especially wherever ExeCommand.$CommandOutput is used.

1)In which scenario Datastage will generate trailing linefeed because I got confused when to replace @FM with '' ?

2)Is the generation of trailing linefeed is specific to the particular activity in Job sequence?

Posted: Wed Apr 18, 2012 2:58 am
by ray.wurlod
DataStage doesn't generate the trailing linefeed - the cat command does.

Posted: Wed Apr 18, 2012 7:26 am
by chulett
:!: vamsi.4a6 - Please stop quoting everything every time you post here, it creates unnecessary work for the moderator who (being an anal soul) has to constantly come along and clean up after you.

There is a perfectly lovely functional Reply to topic button, use that instead of Reply with quote... unless you have a good reason for quoting some or all of a previous message.