Page 1 of 1

How to concatenate data in column wise format

PostPosted: Thu Apr 14, 2011 12:37 am
by ana
Hi,

I need to concatenate data from two different files in a column wise manner as shown in the below example. File 1 and File 2 has no common key. Also I have around 30,000 records in both the files.

Example:

Input:
File 1 -->
AAAAA
BBBBB
CCCCC
DDDDD

File 2 -->
11111
22222
33333
44444

Output:
AAAAA11111
BBBBB22222
CCCCC33333
DDDDD44444

Thanks,
Ana

Re: How to concatenate data in column wise format

PostPosted: Thu Apr 14, 2011 1:01 am
by NicC
I suggest that you look at some of the other sort topics and see how much information you are missing in your post and then do another post with the missing info.

Re: How to concatenate data in column wise format

PostPosted: Thu Apr 14, 2011 1:25 am
by ana
Thanks Nic, hope I will not miss any information this time.

I need to concatenate data from two different files in a column wise manner as shown in the below example. File 1 and File 2 has no common key.

File 1: 5 bytes, FB format
Record layout:
AAAAA
BBBBB

File 2: 14 bytes, FB format
Record layout:
11111111111111
22222222222222

Output file: 19 bytes, FB format
Record layout:
AAAAA11111111111111
BBBBB22222222222222

Please let me know if I am still missing any information.

Thanks,
Ana

Re: How to concatenate data in column wise format

PostPosted: Thu Apr 14, 2011 9:56 am
by NicC
You show both files as having the same number of records - but what if they do not?
You just join the records from file 1 with file 2 regardless of whether the data for the 2 records relate to the same entity or not? Seems pointless unless this is just learning exercise for JOINKEYS for which there are many solutions in the forum.

Re: How to concatenate data in column wise format

PostPosted: Thu Apr 14, 2011 11:31 am
by ana
Hi Nic,

Both the files have same number of records. The first record in the File 1 is related to the first record in File 2 and this goes on till the last record.
I can only use JOINKEYS if there were any common keys between File 1 and File 2.

Any suggestions would be very helpful.

Thanks,
Ana

Re: How to concatenate data in column wise format

PostPosted: Fri Apr 29, 2011 8:33 pm
by Alissa Margulies
Hello Ana.

One way to accomplish this task is to pre-process each of the input files and insert a sequence number. In another step, you can JOIN on that SEQNUM field, and then strip it out using the REFORMAT statement.

Regards,

Re: How to concatenate data in column wise format

PostPosted: Tue May 03, 2011 1:48 am
by ana
Thanks you Alissa, this is working now.

Regards,
Anamika