Hai..,
I need to know is there any utility in JCL which can compare a column of one file with the column of another file and writes the record in a third file if the values of the columns are same.
Joined: 31 May 2006 Posts: 200 Location: Netherlands
If the key matches it will write the record from first file to the third file. What is your requirement?
Is it to copy the first file's record to third or second file's record to the third on finding the match.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can do this with the SPLICE operator of DFSORT's ICETOOL. For an example, see the "Create files with matching and non-matching records (without and with duplicates)" Smart DFSORT Trick at:
If you need more specific help, give more details of what you want to do exactly. Show an example of the records in each input file and what you want for output. If their are duplicates within input file1, show that in the example. If there are duplicates within input file2, show that in the example. Give the starting position, length and format of the relevant fields. Give the RECFM and LRECL of the input files.
I tried the icetool jcl which was available in the link .I t worked well.
Can you please clarify a few things
* Can you please explain the splice step( particularly the keyword 'with')
* In case the starting postion of the value which is compared varies in both files
eg:
Vicky in first file starts at 1st position of the record
and Vicky in second file starts at no 5 position
what needs to be done
* The Outrec field in the outfil statement allows us to write only one field..can we have more than one field .
* In case the starting postion of the value which is compared varies in both files
eg:
Vicky in first file starts at 1st position of the record
and Vicky in second file starts at no 5 position
what needs to be done
This is just an example. You can extend it in many ways. If the field to be compared is not in the same place in both files, you would reformat the records of one file to have the field in the same place as in the other file. In your example, you could reformat the first file field to position 5, or the second file field to position 1.
Quote:
* The Outrec field in the outfil statement allows us to write only one field..can we have more than one field .
OUTFIL can be used to write as many fields as you like.
Again, if you need more specific help, give more details of what you want to do exactly. Show an example of the records in each input file and what you want for output. If their are duplicates within input file1, show that in the example. If there are duplicates within input file2, show that in the example. Give the starting position, length and format of the relevant fields. Give the RECFM and LRECL of the input files.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
I went through the link you mentioned.Now my requirement is to compare a column value of one variable length file with the column of a second file which is of fixed length.
The output file must have a particular column of the first file for those records whose column value matches with that of the column of the second file.
eg..,
Highligted fileds in the files are to be compared , and the output should have the vlaues from file 1 for the matching records.
Record length of file1 ( VB) is 1024
record length of file2 (FB) is 100
Thanks in Advance!
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You'll need to convert the FB file to a VB file with the column to be matched in the same place as for the VB input file. You can use OUTFIL FTOV to do that. It will add a 4 byte RDW to each FB input record to create a VB record.
In your example, I can't really tell which file is which or what you want for output. If you need more help, show a better example (without the screen shots) of the records in each input file and the expected output, and indicate the starting position, length and format of each relevant field in the input files.
Input file 1: Record length -- 1024
Input file 2 :
Record length --- 100
Output file : Record length --1024 ( same as first input file)
(Matching record starting position -- 53
length -12)
i.e., record starting from position 53 and length 12 of the input file1 has to be matched with the record starting from postion 53 and length 12 of the input file 2.
Output file when the record matches should contain records from input file 1 strating from position 10 to 20 ,30 to 35, and 53 to 65.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I don't understand. You show three records with 999775 in file1 and one record with 999775 in file2, but for output you only show the first record from file1 with 999775? Do you only want the first record from file1 for each match, or do you want all of the records from file1 with each match?
Also, you say the matching field is 12 bytes long, but in your example you show 999775 which is only 6 bytes long.
It would help if you showed a more complete example including records in file1 with and without a match in file2, and the complete expected output, and explained the "rules" you want to use to get from input to output.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
ramp_senti,
Here's a DFSORT/ICETOOL job that will do what I think you're asking for. Note that the output records will be sorted by the key (e.g. 999745 record before 999775 records). If you want the output records in their original order, we'll need to add a sequence number and do another sort on it. But try this version first to see whether or not it gives you the output records you want without worrying about their sequence yet.
We have no problems in the matched records output(out1).
but in the output of unmatching records (out2) the first record is missing, and only the second record gets displayed