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.
Question on Sequential file stage parsing
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 134
- Joined: Tue Jun 15, 2010 2:10 am
- Location: Bangalore
Question on Sequential file stage parsing
N.Srinivas
India.
India.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
One solution involves a BASIC Transformer stage or a server job.srinivas.nettalam wrote:If the record length is always same then we can pivot(horizontal) ,but the record length is unknown in this case.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.