Question on Sequential file stage parsing

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
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Question on Sequential file stage parsing

Post by srinivas.nettalam »

The input record in a seq. file is ABCDEFGH .can we get the output as
A
B
C
D
E
F
G
H? One of my colleagues asked me this and I replied that we can't.Probably it is one of the interview questions but is it really possible?
If the record length is always same then we can pivot(horizontal) ,but the record length is unknown in this case.
N.Srinivas
India.
debrujr
Participant
Posts: 56
Joined: Fri Jul 31, 2009 1:05 pm
Location: South

Post by debrujr »

Without actually trying it could you not disregard the thought of delimeters in your sequential file and set a field length of 1? Like I said I haven't tried it, but I would think some tinkering with that would allow it. If not then some use of the Restructure operators would allow it somehow. I have to say that it is possible.
xch2005
Participant
Posts: 85
Joined: Fri Apr 29, 2005 3:13 am
Location: India

Post by xch2005 »

Is the length fixed ie. (A...H) or dynamic?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

srinivas.nettalam wrote:If the record length is always same then we can pivot(horizontal) ,but the record length is unknown in this case.
One solution involves a BASIC Transformer stage or a server job.
Convert(@TM,@FM,Fold(InLink.TheString, "1L")) and write to a sequential file in which field delimiter is none and metadata consists of one Char(1) column.

Another solution involves using a parallel routine. That does much the same (inserts a line terminator between each pair of characters). You could achieve the same with, for example, a sed script invoked through an External Filter stage.
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