find day of week

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
mallikharjuna
Participant
Posts: 81
Joined: Thu Nov 30, 2006 7:46 am
Location: india

find day of week

Post by mallikharjuna »

Hi,

I have 2 jobs in sequence ,first job will execute daily and second job should execite if it is Saturday, how to implement in sequence? any built in function will help?

Thanks
Malli
MALLI
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The function

Code: Select all

OCONV(@DATE,'DW')
will return a number, 1-7 for Mon through Sun. Thus a query on this having a value = 6 will mean you are running on a Saturday.
mallikharjuna
Participant
Posts: 81
Joined: Thu Nov 30, 2006 7:46 am
Location: india

Post by mallikharjuna »

Thanks ArndW.I have used this function,working fine.I think the return code 1-7 for Sunday through Saturday, then Saturday=7.Please correct me if i am wrong.
MALLI
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Simple to test, write a datastage server function. I just did and it considers today, Tuesday, to be a 3. Thus in our installation Sunday is day 1. I had forgotten that this value can change. According to the UV/BASIC docs:
Requests only the day number within the week (1 through 7, where Sunday is 7). If NLS locales are enabled, uses the DAYS field in the NLS.LC.TIME file, where Sunday is 1.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or you could use Oconv(@DATE, "DWA") to get the day name, or Oconv(@DATE, "DWB") to get the abbreviated day name. Then the numeric value does not really come into play.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Both the day name and the abbreviated day name are dependent upon the NLS settings just as the "DW" is, so it is down to a matter of personal choice.
Post Reply