Page 2 of 2

Posted: Sun Jul 09, 2006 9:25 pm
by poonamgoyal
Hi ray I again can't see it. premium content problem,can u plz again unmark it!!! and ArndW which statement to apply in transformer stage to generate a row... I am actually not getting it


I will give u the full statement my source flat file contains too many columns around 230 and there is one field current and if current=0 then there are two fields valid_from and valid_to and we are supposed to calculate the difference of two dates and then see if the days falling within these two dates are saturday or sunday or last day of month and for each date which is niether saturday, sunday nor the last day of month we r supposed to insert records for each such date .... i have applied all the rest of logic except the record insertion and thats what i want to know...so please help

Posted: Mon Jul 10, 2006 3:30 am
by ArndW
Let us assume you can have 1, 2 or 3 days difference. In you transform stage have one output link with the constraint DaysDiff<2, one with DaysDiff<3 and another with DaysDiff<4. Each of these three links go to a link collector.

When you have 2 days difference, the first two constraints will produce an output row and the last won't, so you get 2 output records after the collector.

Posted: Mon Jul 10, 2006 8:34 am
by Krazykoolrohit
try and handle this in unix, the date comparison. Add a parameter to the jobs which wil indicate the result of your calculation (done in unix) and then use that parameter ro generate rows.

Posted: Mon Jul 10, 2006 5:07 pm
by ray.wurlod
poonamgoyal wrote:Hi ray I again can't see it. premium content problem,can u plz again unmark it!!!
No, precisely because it IS premium content. It provides a succinct solution using intrinsic DataStage functions. Premium membership can be yours for less than $1 per week. Shudder at the thought of how much you would need to pay me to produce that solution commercially!

Posted: Tue Jul 11, 2006 12:38 am
by anujgarg
I think row generation can be done using routine.Either use parallel routine or use the server job for this and write a basic routine for that.

Posted: Tue Jul 11, 2006 12:52 am
by poonamgoyal
can't write routines...client said no for it

Posted: Tue Jul 11, 2006 1:07 am
by sanjay
still u problem is not solved.

Sanjay
poonamgoyal wrote:can't write routines...client said no for it

Posted: Tue Jul 11, 2006 4:55 am
by anujgarg
Do one thing In transformer stage use stage varables to generate new records and add that to existing record and seperate the records by newline char.

Posted: Tue Jul 11, 2006 5:19 am
by ray.wurlod
poonamgoyal wrote:can't write routines...client said no for it
What would you do if you were a mechanic and your client wanted you to repair an engine but forbade you to use a spanner? Sometimes you just have to challenge apparently arbitrary restrictions, particularly if there are no other solutions available.

Posted: Tue Jul 11, 2006 6:46 am
by DSguru2B
I have never seen, at any place, where "they" tell you how to do your work. That means "they" know a better way out and therefore "they" should get it working :evil:

Posted: Tue Jul 11, 2006 6:50 am
by chulett
Stick around, we "see" it all the time here...

"Suggest method A"

"Client has forbidden method A"

"How about method B then?

"Sorry, not allowed"

"How about you whack Client upside the head for us?"


:evil: :lol:

Posted: Tue Jul 11, 2006 7:00 am
by DSguru2B
chulett wrote:
"How about you whack Client upside the head for us?"

:evil: :lol:
I vote for that. :twisted:
No Craig, i have seen in here and only here. No where else. There have been times when whacky clients have tried to take me over, but i stuck to my word and after a wild goose chase when no other option was of avail, "they" had to resort to my way.

Posted: Tue Jul 11, 2006 8:02 pm
by kduke
Agreed! This client is stupid.

Posted: Wed Jul 12, 2006 5:13 am
by SettValleyConsulting
Is there any function for calculating whether the given date is last day of month? like last_day in sql???
Maybe I am missing something but I don't think Ray's premium solution works, or completely answers the question ...

I think Ray's solution returns the last day of month that a given date lies in (correct?), poonamgoyal asked for a function that indicates if a given day IS the last day of the month, not quite the same thing.

I won't quote the premium content verbatim but I think the solution does not always work as adding 31 days will sometimes jump forward two months ...eg

Start with 30 Jan 2006
Add 31 days = 02 Mar 2006
Get 1st day = 01 Mar 2006
Subtract 1 = 28 Feb 2006 <- wrong answer.

Arnd's idea of adding one day to the date and seeing if this triggers a change in the month is the most elegant solution, but if you really cannot use routines then to use a British expression you're basically stuffed.


"Shudder at the thought of how much you would need to pay me to produce that solution commercially"


Me too!