Column Generator

 

The Column Generator is a Processing (active) stage in Data Stage used to create new columns or assign calculated/constant values to existing columns without writing complex Transformer logic.


What does Column Generator do?

It allows you to:

  • Add new columns
  • Assign constant values
  • Perform simple expressions
  • Generate system-based values (date, timestamp, job name, etc.)

It works row by row, just like a lightweight Transformer.


Common use cases

1️. Add constant values

COUNTRY = 'INDIA'

SOURCE_SYSTEM = 'HR_APP'

2️. Add system-generated values

LOAD_DATE = CURRENT_DATE

LOAD_TS   = CURRENT_TIMESTAMP

JOB_NAME  = DSJOBNAME

3️. Simple calculations

TOTAL_SALARY = BASIC + HRA + BONUS

TAX_AMOUNT   = SALARY * 0.1

4️. Create audit columns (very common in ETL)

  • CREATED_DATE
  • UPDATED_DATE
  • BATCH_ID
  • RUN_ID

When to use Column Generator vs Transformer

Column Generator

Transformer

Simple logic

Complex logic

Constants & basic expressions

IF-ELSE, Lookups

Faster & lightweight

More flexible

Easy to configure

More control

Best practice:
Use Column Generator for simple additions and Transformer only when logic becomes complex.


Key points to remember

  • It does not filter rows
  • It does not change row count
  • Expressions use Data Stage expression language
  • Cannot perform lookup or joins

Simple example flow:

Sequential File

      |

Column Generator

(Add LOAD_DATE, BATCH_ID)

      |

Target Table


 


No comments:

Post a Comment

Most Recent posts

Head Stage

  The Head stage in IBM Data Stage is a Processing (active) stage used to limit the number of rows passed to the next stage. It is mainly us...