Generating surrogate keys (DataStage®)

To generate surrogate keys, add a Surrogate Key Generator stage to a job with a single output link to another stage.

About this task

If you want to pass input columns to the next stage in the job, the Surrogate Key Generator stage can also have an input link.

Procedure

  1. Open the Surrogate Key Generator details pane.
  2. On the Stage tab, in the Properties section, define the stage properties:
    1. Select the source type.
    2. Specify a source name in the Source name field.
    3. Type a name for the surrogate key column in the Generated output column name property.
    4. Specify how keys are generated:
      • To generate keys in sequence from the highest value that was last used, set the Generate key from last highest value property to Yes. Any gaps in the keyrange are ignored.
      • To specify a value to initialize the key source, add the File Initial Value property to the Additional properties (optional) group, and specify the start value for key generation.
    5. If there is no input link, add the Number of Records property to the Additional properties (optional) group, and specify how many records to generate.
    6. Optional: In the Advanced section, change the processing settings for the stage.
  3. Optional: If the stage has an input link, on the Input tab, define the input data:
    1. In the Partitioning section, change the partition settings for the input link.
    2. In the Columns section, configure columns as needed.
    3. On the Advanced tab, change the buffer settings for the input link.
  4. On the Output tab, define the output data:
    1. If the stage has an input link, you can map input columns to the output link by opening the Columns section and clicking Edit.
    2. Optional: On the Advanced tab, change the buffer settings for the output link.
  5. Click Save to save your changes and to close the Surrogate Key Generator details pane.