Sub-Record occurs 6 times in main record....Cobol file

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
anu123
Premium Member
Premium Member
Posts: 143
Joined: Sun Feb 05, 2006 1:05 pm
Location: Columbus, OH, USA

Sub-Record occurs 6 times in main record....Cobol file

Post by anu123 »

Good morning gurus.

In my cobol source file, I have a Sub-Record in Main-Record.Sub-Record contains 5 columns and this Sub-Record occurs for 6 times in Main-Record.I need to load this Sub-Record info into a seperate table.

My question is.....
How to load these 6 Sub-Records(containing 5 columns each) which are in a single row in source file,into my table as 6 seperate rows.(I have some other keys apart from these 5 columns to make each row unique).

thanks in advance,
Thank you,
Anu
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

You can use row splitter to split your 6 concatenated subrecord rows into a 6 seperate rows.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Your case is of Horizontal pivoting.
You can use Pivot stage for this.
Search the fourm for Pivot stage.
Success consists of getting up just one more time than you fall.
anu123
Premium Member
Premium Member
Posts: 143
Joined: Sun Feb 05, 2006 1:05 pm
Location: Columbus, OH, USA

Post by anu123 »

balajisr wrote:You can use row splitter to split your 6 concatenated subrecord rows into a 6 seperate rows.
Balaji,

Could you please elaborate a bit more on how to split them into 6 seperate rows...

lovejha2:

I work in that direction and let u update, thanks,
Thank you,
Anu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you use a Complex Flat File stage you can specify exactly how the repeating group is to be handled - in your case normalized.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

anu123 wrote:
balajisr wrote:You can use row splitter to split your 6 concatenated subrecord rows into a 6 seperate rows.
Balaji,

Could you please elaborate a bit more on how to split them into 6 seperate rows...

lovejha2:

I work in that direction and let u update, thanks,
Anu,

Row splitter is a stage which comes as part of plug in. It basically reads a string and splits the string into required number of columns of columns

Eg. Input String: 10x10y10z(Has three rows with two columns each concatenated into one string)

With "multiple lines" option in splitter stage
Your output will be
Key Col1
10 x
10 y
10 Z

You can view the documentation of this stage in plug in book shelf.
thurmy34
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 31, 2006 8:27 am
Location: Paris

Post by thurmy34 »

Anu,
If you have a copybook,just import it in DS (without the comments) and load it in a CFF stage.
The redefine columns will appear like regular ones.
You have to pay attention if the redefine is include in a occurs.
In that case the redefine column is set to the column of the first occurs.
You can fix that with the edit row command in the CFF stage.
anu123
Premium Member
Premium Member
Posts: 143
Joined: Sun Feb 05, 2006 1:05 pm
Location: Columbus, OH, USA

Post by anu123 »

thurmy34 wrote:Anu,
If you have a copybook,just import it in DS (without the comments) and load it in a CFF stage.
The redefine columns will appear like regular ones.
You have to pay attention if the redefine is include in a occurs.
In that case the redefine column is set to the column of the first occurs.
You can fix that with the edit row command in the CFF stage.
thanks every one. I do not have Cobol File Definitions(.cfd). So Iam reading the source as a fixed width file from Sequential Stage.actually Sub-record is in OCCURS. I am working on to use Row-Splitter.

please guide if you have any other options...

thanks in advacne
Thank you,
Anu
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

ray.wurlod wrote:If you use a Complex Flat File stage you can specify exactly how the repeating group is to be handled - in your case normalized.
Ray, can you please elaborate on this a little bit more..I use complex flat file stage for my cobol file and I''m interesting in knowing how repeating groups handling by CFF is to be done. Thanks in advance. -Vj
Post Reply