Staging Variable Length (Resolved)

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
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Staging Variable Length (Resolved)

Post by datastagedummy »

What is the default length for a staging variable in a Server Job on DataStage6

I have to pick up the unique values from my source flat file I am using a combination of Sort and RowProcCompareWithPreviousValue()

The Data is
380440802865249131
380440802865249149
380440802865249149

and when I pass this data through RowProcCompareWithPreviousValue() what I get is

0
1
1

Where as looking at the data I would expect the output to be

0
0
1

Thanks in advance.

_________________________________________________________________
Resolution

It was not a staging variable issue but an issue with using the RowProcCompareWithPreviousValue() which I assume only works with the first 14 chars (is it bcoz of the COMMON variable ???), but thanks to the guru's in the forum using the Compare function I was able to resolve my issue.

Thanks a lot Ray & VMC
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This isn't so much an issue of maximum length as of precision.
The default precision in DataStage is configurable up to 57 digits, but defaults to 14.
You can use the Compare() function or the string math SSub() function to do unlimited-precision comparisons.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
datastagedummy
Participant
Posts: 56
Joined: Thu Feb 13, 2003 6:08 pm
Location: USA

Post by datastagedummy »

but how do i use Compare with the previous value ?
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Yes your ID fields are too long and the stage variable compare is truncating your IDs. I just read Ray's reply and here is how to use his recommendation:

Stage Variable Name Derivation
------------------- ----------
UniqueFlag compare(input.ID, OldId)
OldId input.ID

UniqueFlag will now be set to -1 when the key is less than the old key, 0 when they are the same and 1 when the new key is greater than the old key.

Vincent McBurney
Data Integration Services
www.intramatix.com
Post Reply