I have trouble finding ideas on how to merge two files only related by their "key" and an additional problem has been encountered because I will attempt to merge a FLATFILE and a VSAM.
Question #1: Is it possible to merge two different file formats using ICETOOL?
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
Quote:
Copy VSAM file data to FLAT file and then merge.
i do not believe you have to do that.
in addition, if the keys are numeric, i don't believe there is a problem on the different lengths.
but in the event there is, using ICETOOL, you can reformat one of the files and then do the JOINKEYS.
cyrus.e.cabrera,
based on the very simple data that you have provided,
you can use this as a starting point:
Found the solution. YES. The keys are incorrect on file2. it should be the on the same length as the file1's key. I used JOINKEY as a method under SORT Utility. By adding (JOIN UNPAIRED, F1, F2) after the joining, I can retain all the records even if it did not match the key from file2. Thanks for the help guys. If anyone needs the code for reference, here it is:
How can I redirect my output to the same input I provided?
Like for example, I used xxxx.file1 as an input to sorting and I want to redirect the output to xxxx.file1 itself.
How can I redirect my output to the same input I provided?
Perhaps better to think of this in a seperate step. What if your first step were to fall over after starting to write to your input file...
I agree Bill. I just realized it would be disastrous because you read your file then you write on it. It's erroneous logically I think.
Thank you for providing your comment.
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
Hi Dick,
I believe the length of the keys does matter
Code:
FIELDS
.-,-----.
V |
>>-FIELDS=----(----p,m,s-+--)----------------------------------><
Each pair of keys for the F1 and F2 files must match with respect to length and order, but can start in different positions. For example, if the first key for the F1 file is 5 bytes ascending and the second key for the F1 file is 3 bytes descending, the first key for the F2 file must be 5 bytes ascending and the second key for the F2 file must be 3 bytes descending.
If a variable-length record is too short to contain a key you specify, the short key value will be compared using binary zeros for the missing bytes.
p
specifies the starting position of the key. The first data byte of a fixed-length record is in position 1. The first data byte of a variable-length record is in position 5 after the 4-byte RDW. p can be 1 to 32752 but all fields must be completely contained within the first 32752 bytes of the record.
m
specifies the length of the key. The total length of all keys must not exceed 4080 bytes. All fields must be completely contained within the first 32752 bytes of the record.
The length for each pair of F1 and F2 keys must match.
s
specifies the order of the key. Use A for ascending or D for descending.
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
dbz wrote:
in addition, if the keys are numeric, i don't believe there is a problem on the different lengths.
but in the event there is, using ICETOOL, you can reformat one of the files and then do the JOINKEYS
no need to believe, you know,
i did not bother to look but provided a solution in the event that that a secondary solution was necessary.