DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic is not resolved, but there is a WORKAROUND.
Author Message
ureddy



Group memberships:
Premium Members

Joined: 14 May 2008
Posts: 36

Points: 640

Post Posted: Thu Oct 01, 2015 6:39 pm Reply with quote    Back to top    

DataStage® Release: 8x
Job Type: Parallel
OS: Unix
Hi All,

I am trying to read a COBOL File with CFF stage. The file has multiple record types (AB00,AB01,AB02 etc). Each record type will have different length. Sample data is below.

Header -> Abc.txt20150210
Parent -> 00000AB00XXXXXXXX99TTTT
Child 1 -> 00000AB01yy1234
child 2 -> 00000AB02pp123456789
Parent -> 00000AB00ppppppppp77TTTT
Child 1 -> 00000AB01pp2345
child 2 -> 00000AB02ab123456789
Trailer -> Count AB00 2 AB01 2 AB02 2


So I want to add 18,2 position (99 / 77 value) of parent record to the immediate child records. Sample outout as below.


Child 1 -> 9900000AB01yy1234
child 2 -> 9900000AB02pp123456789
Child 1 -> 7700000AB01pp2345
child 2 -> 7700000AB02ab123456789

I have the copybooks for each record types and could able to read the data each record type-wise but I am not able to match parent record value to child as there is no common field between parent and its child so I need to go by the order of parent and child records present in the file.

I tried to read the entire file as single field and dump to sequential file and then loop through the file based on the parent record to make the desired output but due to different field lengths could not able to read the file properly. The order and fields position of records are interchanging (COMP fields also present).

My record schema for CFF stage is below.
{record_format={type=implicit}, delim=none, quote=none, binary, ebcdic, native_endian, charset='ASCL_ISO8859-1', round=round_inf, nofix_zero}

Can any one please let me know how can I get the desired output?

_________________
Reddy
FranklinE



Group memberships:
Premium Members

Joined: 25 Nov 2008
Posts: 732
Location: Malvern, PA
Points: 6948

Post Posted: Fri Oct 02, 2015 9:51 am Reply with quote    Back to top    

Reddy,

You really need a Cobol developer to work with you there. I and others can only offer limited help to you here.

First, don't call them parent and child. What you have are sub-headers (parent) with details (child).

Cobol handles this with standard practice, checking the record type of the next record read to determine branching (details) or returning to the top of the logic (new sub-trailer or eof/trailer). A Cobol developer can explain how that works, and you can work on translating that to DataStage code.

_________________
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: http://www.dsxchange.com/viewtopic.php?t=143596 Using CFF FAQ: http://www.dsxchange.com/viewtopic.php?t=157872
Rate this response:  
Not yet rated
ureddy



Group memberships:
Premium Members

Joined: 14 May 2008
Posts: 36

Points: 640

Post Posted: Fri Oct 02, 2015 12:19 pm Reply with quote    Back to top    

Thanks FranklinE for the explanation.
How can we read the file sequentially as is using CFF stage because i have different record layouts with different lengths. If I read the file as is then i can dump it to sequential file and do the rest of processing.

I asked the Mainframe developer to add the parent record indicator value to its child record but they are not ready to change the file layout due to much effort involved from their end.

_________________
Reddy
Rate this response:  
Not yet rated
FranklinE



Group memberships:
Premium Members

Joined: 25 Nov 2008
Posts: 732
Location: Malvern, PA
Points: 6948

Post Posted: Fri Oct 02, 2015 12:43 pm Reply with quote    Back to top    

You can use CFF as is with different lengths on each record type. I worked it out. Give it a try, and if you can't solve it in a few days post your errors and I should be able to help. Please note: I can't do your design for you.

ureddy wrote:
I asked the Mainframe developer to add the parent record indicator value to its child record but they are not ready to change the file layout due to much effort involved from their end.


Do what you can to get them to do it, however long it takes. I do understand their answer -- I hear it all the time Very Happy -- but Cobol file layouts should be standardized to a common record length just from best practice.

_________________
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: http://www.dsxchange.com/viewtopic.php?t=143596 Using CFF FAQ: http://www.dsxchange.com/viewtopic.php?t=157872
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54462
Location: Sydney, Australia
Points: 295347

Post Posted: Fri Oct 02, 2015 4:48 pm Reply with quote    Back to top    

Adding FILLER is neither difficult nor time consuming.

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
Rate this response:  
Not yet rated
FranklinE



Group memberships:
Premium Members

Joined: 25 Nov 2008
Posts: 732
Location: Malvern, PA
Points: 6948

Post Posted: Mon Oct 05, 2015 9:04 am Reply with quote    Back to top    

ray.wurlod wrote:
Adding FILLER is neither difficult nor time consuming.


To those responsible for doing it, it is work, and they really have better things to do with their time.

Mad

_________________
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: http://www.dsxchange.com/viewtopic.php?t=143596 Using CFF FAQ: http://www.dsxchange.com/viewtopic.php?t=157872
Rate this response:  
Not yet rated
ureddy



Group memberships:
Premium Members

Joined: 14 May 2008
Posts: 36

Points: 640

Post Posted: Sat Nov 10, 2018 9:42 pm Reply with quote    Back to top    

I know it is old post, but it may help others, so I am posting the work-around logic that worked well for me.

step 1. While reading the parent record in filter condition used RECORD_TYPE='AB00' Or RECORD_TYPE='AB01' Or RECORD_TYPE='AB02'.
So the output from the above step is: master record with 'AB00' record type and also Master record with record type 'AB01' value and 'AB02' value (3 records came).
In transformer use stage variables for numbering for these each record types and load to datasets.

step 2. Read the record type 'AB01' and 'AB02' separately to other datasets.

step 3. Join 1st step dataset with the second step datasets to get the required values from master to child records.

_________________
Reddy
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours