These solutions are required when the sequential key must be unique across multiple loads. The next sequential number is stored in a file allowing the sequential key to be preserved for subsequent runs. This key can be preset or reset programmatically if desired. When you require a system generated sequential key for a table this method will allow you to control the starting number & preserve the next sequential for use in subsequent loads.
After you have your output columns defined open the transformer stage (double click on the transformer symbol) & open the stage variables properties box.
Openning the stage variables properties box is openned by RIGHT-clicking on the stage variables box within the transformer GUI. If your stage variables box is not displayed in the transformer press the "Show/Hide Stage variables" button on the transformer toolbar .
In the stage variables box enter a meaningful name for the variable which will contain the Sequential key & set it's initial value to 0 (zero).

Enter the derivation for the Stage variable which, in this case is the KeyMgtGetNextValue routine provided in the sdk (Software Developers Kit) routine category. The routine can be selected from the dropdown by RIGHT-clicking on the derivation column This routine, circled below as viewed from datastage Manager, is supplied with Datastage along with sourcecode to allow you to modify it for your needs.

Now all that is left is to use the variable in the derivation of your key field as shown below.

Each time you call the KeyMgtGetNextValue("TableName") the key will be incremented. You can experiment with the this method & Simple Sequential Key method to determine which is best for your situation.


