Routine returns a single line....

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dslearner
Premium Member
Premium Member
Posts: 67
Joined: Thu May 26, 2005 3:09 am

Routine returns a single line....

Post by dslearner »

Hi,

My Source is Dummy sequential file.

And My routine returns a single line like

record1|record2\record3|record4\record5|...

Target is Sequential file.

I should get all the odd numberrecords(For Eg:1,3,5..)into column1 and even number records(2,4,6..)into column2.


COLUMN1,COLUMN2
record1,record2
record3,record4..

Any help...

Thanks,
Dslea
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Do you know what is maximum number of values(ie columns ) you will have in your job
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
dslearner
Premium Member
Premium Member
Posts: 67
Joined: Thu May 26, 2005 3:09 am

Post by dslearner »

Yah..I have only two columns and the number records not known....
rleishman
Premium Member
Premium Member
Posts: 252
Joined: Mon Sep 19, 2005 10:28 pm
Location: Melbourne, Australia
Contact:

Post by rleishman »

Create a Transformer with two Stage Vars:
- Name = OddRow, Derivation = EvenRow
- Name = EvenRow, Derivation = InLink.ColName

In this way, EvenRow always contains the contents of the current row, and OddRow contains the contents of the previous row. Now, if you only output every second row, you'll get what you want.

Create an output link with two columns:
- Name = EVEN_ROW, Derivation = EvenRow
- Name = ODD_ROW, Derivation = OddRow

Add a constraint to the output link so that it only outputs even numbered rows:
Constraint: Mod(@INROWNUM, 2) = 0
Ross Leishman
Post Reply