Equivalent of WeekdayFromDate in Job sequence

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
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Equivalent of WeekdayFromDate in Job sequence

Post 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
Last edited by RAJARP on Tue Apr 17, 2012 5:33 pm, edited 1 time in total.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post 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.
Choose a job you love, and you will never have to work a day in your life. - Confucius
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post 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
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post 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?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post 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?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DataStage doesn't generate the trailing linefeed - the cat command does.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

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