Posted: Tue Nov 18, 2014 7:56 am Post subject: Combine data from 2 files without a key in Easytrieve
I have two files, no fields in common. I need to combine information from File A with File B. For every record in File A, I need to add information from every record in File B.
How can this be accomplished in Easytrieve?
It's easy with JOINKEYS in SORT. Easytrieve's matching doesn't work the same way. To do it in Easytrieve, you'd have to store all the records in a table.
You make the criteria. You add (or use if existing) a byte, temporarily, to each record on both files. That byte only has one value. You specify that byte for the JOINKEYS. Eh, voila! Full Cartesian Join.
However, you want information from every record on file two updates on every record on file one. Didn't read that fully before. What types of volumes do you have for each file? Fixed, or variable records? I think if you can use ICETOOL's RESIZE to get file two into a single (or not many) conglomerated record it should ease the coding (in SORT or in Easytrieve Plus).
Can you show some sample representative data and expected output?
can't show too much representative data, proprietary information and all. But, can can mock up a similar situation:
File A Account Shares Last Trade File B LastName FirstName
What I want to see (and yes, this is just to illustrate what I have to do, the information has nothing to do with accounts and names)
FileO Account LastName FirstName
File A can have thousands of records, File B can have anywhere from 2 to 1000 records.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Nov 18, 2014 12:01 pm Post subject:
jwdaughtrey,
As William pointed out with easytrieve you need to read the file entirely as table and then perform the match for every record.
However it is quite simple with DFSORT Joinkeys. we add a psuedo key at the end of every record in both files. Remember that this joining of every record with every other record in file 2 will result in a Cartesian join. Here is a sample.
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