Concatenating multiple lines into one line using loop

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
Suman
Participant
Posts: 53
Joined: Thu Oct 07, 2004 8:28 am

Concatenating multiple lines into one line using loop

Post by Suman »

Hi All,
Below is the scenario which we are trying to do using loop in 8.5 version. The functionality is achieved already using stage variables. We are looking for doing this in loop if possible.

Input File
PrimaryKey Data1
Pkey Data2
Pkey Data3
Pkey1 Data1
Pkey1 Data2
Pkey1 Data3

Output we want like this:
Pkey Data1PkeyData2PkeyData3
Pkey1Data1Pkey1Data2Pkey1Data3

Using the previous and current Pkey value can this be achieved through loop. We need if it is feasible or not using loop condition and variable.

Regards,
Suman
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes. What have you tried?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Suman
Participant
Posts: 53
Joined: Thu Oct 07, 2004 8:28 am

Post by Suman »

We tried with CurrPk=PrevPk in the loop condition and defining the PrevPK and CurrPk as stage variables and then defining a Loop Variable LoopVar to concatenate each recored with the previous concatenated value that is stored in the LoopVar. But, the loop is executed infinite times. Same thing is working in stage variables using key break logic.

Regards,
Suman
Post Reply