combing 3 lines from 3 files in to a single record



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 7:13 pm

Hi All,

This is my first post here.. I take this opportunity to thank all of you!!

My requirement is like combining 3 files in to a single output file , that too, i need to take few values (positions) from each input file and form a single line output file.

Example:

Input file 1:
          DATE  TRANSACTION TYPE  TOTAL ORDERS  TOTAL UNITS
    ----------  ----------------  ------------  -----------
    2013-10-01  SHIPMENT             13,398        48,483
    2013-10-01  RETURN                1,785         1,785


Input file2 :
                               Cancld   OMS     OMS    OMS     OMS
 Dnld     Dnld Packed  Packed  Packed   Sold    Sold  Cncld   Cncld
Orders   Units Orders   Units   Units Orders   Units Orders   Units
 6,996  22,813  3,692  13,963     109 10,343  35,635    351     845


input file 3 :

Date        Total Orders Orders Shipped Orders Cancelled         Items Shipped
10/01/2013          404            671                5                   1059



Expected output file:

 13,398   48,483  10,343  35,635  671  1059           



The above values are from 3 different input files.
13,398  48,483 is from input file 1
10,343  35,635 is from input file 2
671  1059        is from input file 3.



Can anyone please help me with providing a code for this ASAP.
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby Akatsukami » Thu Oct 10, 2013 7:27 pm

Do not use the term "ASAP"; desperation on your part does not entail urgency on ours.

How can corresponding records in the three data sets be matched?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 7:46 pm

That's my major problem here, there is no proper or unique key to match these file.

Is there any way to get the desired output file ?
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby enrico-sorichetti » Thu Oct 10, 2013 8:04 pm

what about a one to one to one association based on the record sequence ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 8:07 pm

Hi Enrico,

I'm not clear with your question . could you please explain in detail ?
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby dick scherrer » Thu Oct 10, 2013 8:14 pm

Hello,

Assign each record a sequence number. Then join the files on this sequence number.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 8:17 pm

Hi Dick Scherrer,

If you don't mind , could you please help me with code or provide an code example?
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: combing 3 lines from 3 files in to a single record

Postby BillyBoyo » Thu Oct 10, 2013 8:19 pm

Are the RECFM and LRECL all the same?

Is that the complete content of the three files? Or are you just stripping totals?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: combing 3 lines from 3 files in to a single record

Postby Akatsukami » Thu Oct 10, 2013 8:19 pm

dick scherrer wrote:Hello,

Assign each record a sequence number. Then join the files on this sequence number.

That may not be useful; the first report appears to have two header lines, the second three, and the third one. Nor do we know page sizes, presence or absence of trailers, etc.

I think that it may be necessary to admit that some requirements cannot be fulfilled by "scraping" reports with *sort, but require actual data and actual programming.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: combing 3 lines from 3 files in to a single record

Postby rajaranganathan » Thu Oct 10, 2013 8:21 pm

Hi Billy Boyo,

Yes , all the 3 files are of same LRECL , they are 350 length.
rajaranganathan
 
Posts: 27
Joined: Thu Oct 10, 2013 6:44 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post