check column sorted

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

check column sorted

Post by PeterPol »

Hello,

I have an ODBC file for which I want to check and report if it is sorted on a certain column. How to do this?

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

Post by ray.wurlod »

Use stage variables in a Transformer stage to compare each row with the previous one in that column. If the direction of difference changes, then the answer is NO.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Just curious, why do you need to use ODBC for file? Is it not flat file?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Post by PeterPol »

hello,

No, the files I have to process are all FoxPro DBf files for which I need ODBC (stage).

Peter
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Fine. Option suggested by Ray would be more simple, when compare to others.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Post by PeterPol »

Hello,

The suggestion of ray works fine.

However, I wondered if it is possible to quit the transformer immediately if the direction of difference has changed? How?

Thanks,
Peter
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well I highly doubt you can quit the execution of just the transformer, what you could do is as soon as there is a direction change, send it down a second link with its property set to 'Abort after 1 row'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Compare stage reports direction of difference between two inputs. To use this you'd need to generate a sequential key on two copies of the sorted Data Set (Column Generator stages) with an offset of 1 between the two copies, then compare based on matching that key.
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