logic required for increment field

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
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

logic required for increment field

Post by hargun »

hi,

i have extracting the data from DB2 and loading into oracle stage.


the out put i need is given below.

Code: Select all

No	      AP BK_NO	VER	SHORT_NAME	      DS_LOAN_DESC
10000241	1	1	1	     CIT FINANCE LLC	 PARTIC01
10000241	1	1	1	     BMO            	 PARTIC02
if no=10000241 and shortname=CIT FINANCE LLC then i need PARTIC01

similary if no=10000241 and shortname=CIT FINANCE LLC then i need PARTIC02


from source i am getting the DS_LOAN_DESC=PARTIC which i need to change to PARTIC01 and PARTIC02.

please help me on this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... that seems like a pretty straight-forward derivation to me. What have you tried? What issues are you seeing?
-craig

"You can never have too many knives" -- Logan Nine Fingers
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

i have tried with stage variable

select_stats.DS_LOAN_DESC='PARTIC' =stgvar
stgvar+1 =stgvar2


then in derivation using

if select_stats.OBG_NO= '10000241' then stgvar1 else select_stats.DS_LOAN_DESC


but this giving me the same result that is 'PARTIC'.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'd envisage a double-nested If..Then..Else as the right way to solve this one.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Agreed... no stage variables needed. And you need to use concatenation, not math for this.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hargun
Participant
Posts: 188
Joined: Mon May 16, 2011 7:41 pm
Location: United States

Post by hargun »

please check the if then else nested as per ray suggested

if select_stats.OBG_NO= '10000241' else if select_stats.DS_LOAN_DESC='PARTIC' then select_stats.DS_LOAN_DESC+1 else select_stats.DS_LOAN_DESC
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Re-read my post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're missing the THEN clause of the first IF.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply