It's always appreciated when people post their solutions.DWS wrote:If anyone in future wants to know the exactlly steps, I could post those in the forum.
Seeking a best solution in DataStage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 91
- Joined: Wed Apr 20, 2005 7:59 pm
- Location: U.S.
Hi
You need to create 5 stage variables as:
You need to create 5 stage variables as:
You also need to create a loop variable as:(1). NumSavedRows
SaveInputRecord()
(2). IsBreak
LastRowInGroup(Input_Lnk.ETL_KEY)
(3). LastRowConcat
IF IsBreak Then '' ELSE LastRowConcat : Input_Lnk.DESCRIPTION
(4). ConcatDesc
IF IsBreak Then ConcatDesc : Input_Lnk.DESCRIPTION Else LastRowConcat
(5). NumRows
IF IsBreak THEN NumSavedRows ELSE 0
The output link asSavedRowIndex
GetSavedInputRecord()
The constraint will beEmpID ---Inutput_Lnk.EmpID
Name---Inutput_Lnk.Name
Description----ConcatDesc
The loop condition isLastRowInGroup(Input_Lnk.ETL_KEY)
@ITERATION <= NumRows
Run a problem
Hi Everyone,
I have to bring it back since I have run a problem.
I would like to share this with all of you and also want to get a solution for the problem.
The problem is:
I also wanted to know what the reason is?
Thank you very much in advance.
I have to bring it back since I have run a problem.
I would like to share this with all of you and also want to get a solution for the problem.
The problem is:
Does anyone has this experice and know how to solve this isssue?If the key has more than 1 rows in the source, then result of the concatenation of multiple rows is good. But it is not good when the key only has one row in the source.
I also wanted to know what the reason is?
Thank you very much in advance.
Here are the details:
Please note for output row 102, it should be Re-hied for Decs column, but it has appeared some additional text which it should not have.
Input:
--------------------------------------------
Emp_ID Name Seq_Num Desc(Varchar(10)
------ -------- ------- -----------------
100 Tiger W 1 I am
100 Tiger W 2 an
100 Tiger W 3 ETL
100 Tiger W 4 developer
100 Tiger W 5 working fr
100 Tiger W 6 om
100 Tiger W 7 home
100 Tiger W 8 everyday
100 Tiger W 9 from 10 am
100 Tiger W 10 to 10 pm.
101 Kevin Q. 1 Start from
101 Kevin Q. 2 June 2012.
102 John Smith 1 Re-hired
------------------------------------------------
Output
------------------------------------------------
Emp_ID Name Desc(Varchar(1000)
------ ---------- --------------------------------------------------------------------
100 Tiger W I am an ETL developer working from home everyday from 10 am to 10 pm.
101 Kevin Q. Start from June 2012.
102 John Smith XXXXXXXXXCCCCCVVVVVVV Re-hired.
Please note for output row 102, it should be Re-hied for Decs column, but it has appeared some additional text which it should not have.
Input:
--------------------------------------------
Emp_ID Name Seq_Num Desc(Varchar(10)
------ -------- ------- -----------------
100 Tiger W 1 I am
100 Tiger W 2 an
100 Tiger W 3 ETL
100 Tiger W 4 developer
100 Tiger W 5 working fr
100 Tiger W 6 om
100 Tiger W 7 home
100 Tiger W 8 everyday
100 Tiger W 9 from 10 am
100 Tiger W 10 to 10 pm.
101 Kevin Q. 1 Start from
101 Kevin Q. 2 June 2012.
102 John Smith 1 Re-hired
------------------------------------------------
Output
------------------------------------------------
Emp_ID Name Desc(Varchar(1000)
------ ---------- --------------------------------------------------------------------
100 Tiger W I am an ETL developer working from home everyday from 10 am to 10 pm.
101 Kevin Q. Start from June 2012.
102 John Smith XXXXXXXXXCCCCCVVVVVVV Re-hired.
Is "XXXXXXXXXCCCCCVVVVVVV" the actual output or did you just type that yourself? I don't see X, C or V in your data here........just wondering
Do you initialize the variables at the job start (Initial Value in the stage variable properties) and when your key changes? Something along the lines of:
(your code may vary...may be similar to DWS' examples)
Regards,
Do you initialize the variables at the job start (Initial Value in the stage variable properties) and when your key changes? Something along the lines of:
Code: Select all
if NewKey then input.Desc else svDesc : input.Desc
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The snoring sound made by a hibernating bear with a lisp?
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872