Paul, checkout the BASIC .pdf file that is under the
DataStage documentation on your Start button -->
Ardent DataStage -->Online Manuals --> Universe
documentation.
There are two functions called ICONV and OCONV with
which you want to become familiar. ICONV can be
handed a time and format string and it will turn it
into the integer number of seconds since midnight.
OCONV can be used to format the integer number of
seconds since midnight into any timestamp format you
desire. Using these two BASIC functions in a
DataStage user defined function can do pretty much any
tricks you desire.
Also, learn the TRIM, FIELD, CONVERT, CHANGE, COUNT,
and INDEX functions/statements. You will use these
90% of the time in any custom transformation function
you wish to write. You can use these to build a
custom library of routines that are modular and can be
used throughout your job designs to simplify your
coding experience.
One function I cant do without is one I call Exists.
The code is simply:
x=TRIM(Arg1)
If ISNULL(x) OR X= Then
Ans = @FALSE
End Else
Ans = @TRUE
End
I use this function to test for the existence of a
value, and in a constraint its easy to use. Youll
have to develop a few of these to solve your custom
time formats. Ive got a library of my own you can
have if youre interested. Send me an email if youre interested.
Good luck!
-Ken
--- Paul Ko wrote:
> Hello,
>
> I am not a good universe basic writer but I am just
> wondering if anybody has
> developed such a routine before that convert a
> specific time format into
> another format.
>
> What my requirement is to convert a time format
> HH:MMam/pm to HHMM.
>
> For example,
> 1) 9:34am to 934
> 2) 9:34pm to 2134
> 3) 12:12am to 0012
>
> Is there an existing Datastage function that can do
> this kind of time
> conversion?
>
> Cheers,
> Paul.
>
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/