Page 1 of 2

combing 3 lines from 3 files in to a single record

PostPosted: Thu Oct 10, 2013 7:13 pm
by rajaranganathan
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.

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

PostPosted: Thu Oct 10, 2013 7:27 pm
by Akatsukami
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?

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

PostPosted: Thu Oct 10, 2013 7:46 pm
by rajaranganathan
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 ?

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

PostPosted: Thu Oct 10, 2013 8:04 pm
by enrico-sorichetti
what about a one to one to one association based on the record sequence ???

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

PostPosted: Thu Oct 10, 2013 8:07 pm
by rajaranganathan
Hi Enrico,

I'm not clear with your question . could you please explain in detail ?

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

PostPosted: Thu Oct 10, 2013 8:14 pm
by dick scherrer
Hello,

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

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

PostPosted: Thu Oct 10, 2013 8:17 pm
by rajaranganathan
Hi Dick Scherrer,

If you don't mind , could you please help me with code or provide an code example?

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

PostPosted: Thu Oct 10, 2013 8:19 pm
by BillyBoyo
Are the RECFM and LRECL all the same?

Is that the complete content of the three files? Or are you just stripping totals?

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

PostPosted: Thu Oct 10, 2013 8:19 pm
by Akatsukami
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.

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

PostPosted: Thu Oct 10, 2013 8:21 pm
by rajaranganathan
Hi Billy Boyo,

Yes , all the 3 files are of same LRECL , they are 350 length.