Page 2 of 2

Posted: Wed Mar 03, 2010 10:39 am
by ArndW
Why are you making this so complicated; the leap year logic is built into the DataStage date processing, so (as mentioned earlier), add one month to your date and then subtract a day and -voila- DataStage gives you a correct date, every time.

Posted: Wed Mar 03, 2010 12:09 pm
by priyadarshikunal
You made me write the code for you but test it if it works in every scenario (it expects input data in yyyymmdd or yyyymm format).

Code: Select all

datefromdayssince(-1,if InLink.DateString[5,2] =12 then InLink.DateString[1,4]+1:"-01-01" else InLink.DateString[1,4]:"-":right("00":InLink.DateString[5,2]+1,2):"-01")
This you could have done yourself if you would have thought about it after getting many leads in earlier posts and in that case you could have learned the basics.

You may have to do null handling if input contains null.

Posted: Wed Mar 03, 2010 12:12 pm
by chulett
Hmmm... just exactly how did they "make you" write the code for them? Did they find out where you live? :wink:

Posted: Wed Mar 03, 2010 12:23 pm
by priyadarshikunal
sometimes its annoying to make people understand the logic when they just want the code (not your lecture :wink: ). Just a reflex, nothing serious. I don't think they hired MI6 to hunt me down :wink:

Posted: Wed Mar 03, 2010 4:33 pm
by anbu
Its very simple in Unix

Code: Select all

echo $(cal 12 2008) | awk ' { print $NF } '