sort

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
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

sort

Post by veera24 »

hi all,
When I've tried to sort the time field using Sort Stage, it didn't get work out. So that I've converted the time field value using iconv function. Is there any direct way of sorting then pls. let me know.

Your time will be highly appreciated...

Thanks in advance...
veera...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.
DSRajesh
Premium Member
Premium Member
Posts: 297
Joined: Mon Feb 05, 2007 10:37 pm

Post by DSRajesh »

What exactly error you are facing when sorting and is the metadata for that date column is of what type as ARNDW says..........?
RD
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

ArndW wrote:Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.

no.. If i sort the timestamp field directly, then it didn get work out. I've kept the datatype as timestamp only. I meant to say it was not properly been sorted.
So that i've changed the value using iconv function then it went fine. Now my question is, whether sort stage will support for sorting timestamp field directly or should we use iconv function? Meanwhile if there is any other way of sorting the timestamp, pls. let me know.
veera24
Premium Member
Premium Member
Posts: 150
Joined: Thu Feb 07, 2008 9:37 pm
Location: NewYork

Post by veera24 »

ArndW wrote:Can you explain what didn't work? DataStage server internal time is an integer (number of seconds since midnight) so it will sort correctly. If you somehow declare this as a character then it will not sort appropriately, so part of the question back is to ask how you are sorting.
hi arndw,

Let me explain the situation in detail.

I was in need to sort the dates. My datatype was timestamp only. I've used sort stage to sort the data. But the output was not proper. I mean, it was not being sorted. So that i've used iconv function and then sorted.

What am asking is, why the data has not been sorted regularly when the value for the column was date (say, 1995-01-03). Should i always use iconv function or i use directly?

Hope you will get my point..

Your time will be highly appreciated.

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

Post by ray.wurlod »

It should not matter. The ISO 8601 standard prescribes yyyy-mm-dd and yyyy-mm-dd hh:mm:ss formats precisely because they can be sorted as strings without conversion.

Can you please explain, therefore, what you mean by "not working", preferably with examples?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Server has no concept of dates or timestamps. If you data is in the form "2008-07-01" (i.e. YYYY-MM-DD) then if you sort it, it will be done as a string and will sort correctly, this wouldn't work with a format of DD-MM-YYYY.
Post Reply