Find day of the next month

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Find day of the next month

Post by Jamesvanam »

Hi,
I'm trying to find the first day of the full month following a date(which is the input value).
not able to find the functions, could somebody please help
Thank you
James
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There are a couple of 'Built-In' Transforms you can look at to get some ideas:

MONTH.FIRST
MONTH.LAST

Both use ConvertMonth(), you could either leverage one of these or write something new to do what you need.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

Thanks Craig.
I'm sorry I forgot to mention I need the first day of the next full month or Quarter following the input date. I guess I'll have to write a new function

james
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No you don't.
MONTH.LAST(TheDate) gives you the last day of the month in which the date occurs, in internal format.
Therefore, (MONTH.LAST(TheDate) + 1) gives you the first day of the following month.
Quarters are a little trickier, you probably do need a custom routine. Examine the supplied routines as prototypes.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

Thanks Ray,
I wasn't able to figure out one thing from doc's for Quarter.Last transform. it says the input will take Input date format in (YYYY-MM) but it doesn't work when I give this format of the input date. does it need a input in the Quater format like year and Quarter.

and One More question can you tell me where I can find all the different Conversion codes for Iconv and Oconv, the docs on'y has a few. I was wondering if there are any more or that is it.
Thanks
vanam
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

I wrote a simple nextquarter routine. it works fine.
Thank you for your suggestion Ray,
Vanam
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When in Designer or Manager invoke Help.
Select the topic BASIC Tasks.
Drill down from there:
Data Formatting
Oconv
(read it all)
(at this point you will have all the codes - follow the hyperlink to each for detailed explanation and examples)

In the DataStage BASIC manual read the appendix called "Correlative and Conversion Codes" (Appendix C, from memory).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply