Page 1 of 2

Its very urgent!!Please reply

Posted: Fri Jul 07, 2006 12:16 am
by poonamgoyal
Hi , I am quite new to datastage and i have a problem regarding transformation which is quite urgent to be resolved

1) Is there any function for calculating whether the given date is last day of month? like last_day in sql???

2) How to generate a no. of rows depending upon a difference in transformer stage? like what i want to do is depending upon difference of two date values i have to generate that much records except if that day is saturday, or sunday or the last day of month?



plz anyone help
a bunch of thanks in advance plz

Posted: Fri Jul 07, 2006 1:20 am
by poonamgoyal
pls do help as project timeline is quite a strict

Posted: Fri Jul 07, 2006 1:30 am
by poonamgoyal
source is a flat file loaded in a dataset and i need to perform the above conversion

Posted: Fri Jul 07, 2006 1:34 am
by bchau
You really shouldn't set your topic to "urgent" cuz everyone's issue is urgent in their own eyes. Your topic should be set to a brief discription of your problem. Saying that your problem is "urgent" will not make the users answer your questions any sooner. Please realize that most users do not get paid to support. They are just doing it out of the goodness of their heart. If you need quick responses, you are better off contacting your vendor as they are paid to support the software.

Please also be aware that a lot of the users are in the US and it is their sleepytime right now.

Regarding your issue, you could make a custom stage that would take in the start and end date. In your code for the "buildop" stage you can generate any number of records based on the days in between, weekends, and last day of the month.

Please refer to page 54-1 in the Parallel Job Developer's Guide on how to make custom stages.

Posted: Fri Jul 07, 2006 1:41 am
by poonamgoyal
bchau wrote:You really shouldn't set your topic to "urgent" cuz everyone's issue is urgent in their own eyes. Your topic should be set to a brief discription of your problem. Saying that your problem is "urgent" will not make the users answer your questions any sooner. Please realize that most users do not get paid to support. They are just doing it out of the goodness of their heart. If you need quick responses, you are better off contacting your vendor as they are paid to support the software.

Please also be aware that a lot of the users are in the US and it is their sleepytime right now.

Regarding your issue, you could make a custom stage that would take in the start and end date. In your code for the "buildop" stage you can generate any number of records based on the days in between, weekends, and last day of the month.

Please refer to page 54-1 in the Parallel Job Developer's Guide on how to make custom stages.




Thanks for your reply and suggestions too.. i ll follow them afterwards....client has said not to use any custom stages so any other option?

Posted: Fri Jul 07, 2006 1:55 am
by bchau
This can also be done in a routine where the routine returns a string that includes line feeds based on the number of days. The output of your transformer needs to only have 1 column and writes to a sequential file tho. I believe the custom stage would be better performancewise.

Posted: Fri Jul 07, 2006 2:02 am
by ArndW
I make it a point to avoid answering any posts that are urgent apart from a short admonition, but in this case I'll at least give a direction to look further

1) If you add a day to a date and compare the month to see if it is unequal to the original date's month then you have found the last day of the month.

2) It was urgent enough for you to post your question but obviously not urgent enough for you to use the SEARCH facility to find out that this question has been asked (and answered) several times before.

Posted: Fri Jul 07, 2006 2:10 am
by bchau
heh, i guess i'm too weak, eh? Couldn't resist not replying.

Posted: Fri Jul 07, 2006 2:21 am
by poonamgoyal
bchau wrote:heh, i guess i'm too weak, eh? Couldn't resist not replying.

Hey ArndW, i can't read ur answer its some premium content ...can u plz quote it...please

Posted: Fri Jul 07, 2006 2:32 am
by bchau
ahh, that is sneaky, I highly recommend becoming a charter member. It's great and you get to see everything?

Posted: Fri Jul 07, 2006 2:35 am
by poonamgoyal
can u please put the solution in quote so that i can view it for now please help me

Posted: Fri Jul 07, 2006 5:08 am
by ArndW
I marked the post as non-premium since it is not of premium content.

Posted: Fri Jul 07, 2006 5:16 am
by poonamgoyal
Hi ArndW, i m again saying sorry for choosing this title but i wasn't aware of these rules , n as its my first module in datastage i was nervous... i did a search on the topic but its for table formats and data in my case is in form of flat files so this is a different question... please help

Posted: Fri Jul 07, 2006 8:30 am
by ArndW
If your maximum number of days difference is some manageable amount (i.e. about one month), then you can have a transform or switch stage and use the value you calculate for days to specify output rows, then later on in the job collect those rows back to a single stream. This is the simplest way of doing this kind of thing if your maximum number is known.

Posted: Fri Jul 07, 2006 10:08 pm
by ray.wurlod
Add 31 days to the date (DateFromDaysSince() function). Extract the month and year components of that date (MonthFromDate() and YearFromDate() functions). Assemble the date of the first of that month (by using 1 as the day number with the derived year and month), assembled as a string. Subtract 1 from that date (DateFromDaysSince() function with -1 as the Days argument. Voila!