stage variable question

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
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

stage variable question

Post by times29 »

Input_Lnk

Parent_code child_code CHILD_SK PARENT_SK
00.1 1
ABC.20 ABC 2
ABC.20 CDE.20 3
ABC.20 EFG.20 4
BDE.20 ABC.20 5

I am using stage varaible to get parent_sk like below

in stage varaible i said

Input_Link.child_code StageVar


In Transformer to populate PARENT_SK i said

IF (Input_Lnk.Parent_code= StageVar) THEN Input_Lnk.CHILD_SK ELSE 1

i am getting all parent_sk as 1

i should have get

Parent_code child_code CHILD_SK PARENT_SK
00.1 1 1
ABC.20 ABC 2 5
ABC.20 CDE.20 3 5
ABC.20 EFG.20 4 5
BDE.20 ABC.20 5 5
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Format your post using Code tags so it's clear what's happening. It's too difficult to fathom with the way you've presented your information.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

Post by times29 »

Code: Select all

Parent_code child_code CHILD_SK PARENT_SK
               00.1        1
ABC.20         ABC         2       null
ABC.20         CDE.20      3       null
ABC.20         EFG.20      4       null
BDE.20         ABC.20      5       null
i want to update parent_sk as below based upon join from parent_code with child_code:

Code: Select all

Parent_code child_code CHILD_SK PARENT_SK
               00.1        1       null
ABC.20         ABC         2       5
ABC.20         CDE.20      3       5
ABC.20         EFG.20      4       5
BDE.20         ABC.20      5       null

StageVar:

Input_Link.child_code StageVar


Transformer:

IF (Input_Lnk.Parent_code= StageVar) THEN Input_Lnk.CHILD_SK ELSE 1

i am getting all parent_sk as 1

battaliou
Participant
Posts: 155
Joined: Mon Feb 24, 2003 7:28 am
Location: London
Contact:

Post by battaliou »

I am reading this as follows:
IF (Input_Lnk.Parent_code= Input_Link.child_code) THEN Input_Lnk.CHILD_SK ELSE 1
3NF: Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key. So help me Codd.
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

Post by times29 »

Agree so what should it be
sam paul
Premium Member
Premium Member
Posts: 19
Joined: Mon Jan 26, 2009 1:31 pm
Location: Minneapolis, USA

stage variable question

Post by sam paul »

Based on the way I understood your question and input data, no Parent Code is matching with Child code, so it goes to ELSE part of your code and prints 1 which is correct. :)
Post Reply