Joined: 04 Apr 2007 Posts: 37 Location: Lisbon, Portugal
Hi
I have two files with some fields that are common to them.
Is there a way of selecting only the records of one file that have the common fields equal to file 2?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed that your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I also assumed, as shown in your example, that there are no duplicate records within input file1 and no duplicate records within input file2.
Joined: 04 Apr 2007 Posts: 37 Location: Lisbon, Portugal
Thanks Frank
I think that I might have duplicate records within one of the files but, I will try that.
We are no very familiar with ICETOOL. Can you give me the link to the manual, just to read it?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I think that I might have duplicate records within one of the files but, I will try that.
If you have duplicate records in one of the files, you will probably need a different DFSORT/ICETOOL solution. Show a better example (with duplicates) of the records in your input files and what you expect for output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field.
Quote:
We are no very familiar with ICETOOL. Can you give me the link to the manual, just to read it?
DFSORT's ICETOOL is fully documented in Chapter 6 of "z/OS DFSORT Application Programming Guide" which you can access, along with all of the other DFSORT books, from:
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, from the link above.
Joined: 04 Apr 2007 Posts: 37 Location: Lisbon, Portugal
Quote:
If you have duplicate records in one of the files, you will probably need a different DFSORT/ICETOOL solution. Show a better example (with duplicates) of the records in your input files and what you expect for output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of each relevant field.
Input file 1 is FB and 535 in length.
Input file 2 is FB and 84 in length.
The matching fields for file 1 are, with displacement, length and type:
1,3,PD
50,9,PD
75,16,CH
and for file 2 :
18,4,CH
27,17,CH
45,16,CH
I think that, because the matching fields are of different types, they must be converted first, so the types are identical. Am I right?
And yes, I can have duplicate records on file 1 but, in that case I want all the matching records in the output, including the duplicated.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I think that, because the matching fields are of different types, they must be converted first, so the types are identical. Am I right?
Yes. You say that the first two fields are PD vs CH. PD is numeric. Are the CH fields actually ZD (numeric) or some other type of character values?
Please show a good example of the records in each input file (with duplicates where appropriate) and what you expect for output. Show the PD fields in hex or as P'd...d'. Explain the "rules" for getting from input to output.
Joined: 04 Apr 2007 Posts: 37 Location: Lisbon, Portugal
Yes the CH fields are numeric (ZD).
As I'm already home, I will get some concrete cases tomorrow as soon as I get to the office.
I took a look at the manual and, I really enjoyed it.
It can save you lots of time and effort in development.
Thanks
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I took a look at the manual and, I really enjoyed it.
It can save you lots of time and effort in development.
Wow. You don't often hear somebody say they enjoyed an IBM manual. As the developer who wrote the DFSORT books and added many of the new functions over the years, I appreciate the kind words.
Joined: 04 Apr 2007 Posts: 37 Location: Lisbon, Portugal
Quote:
You don't often hear somebody say they enjoyed an IBM manual.
Yes, it's not very usual to year that. I see the reading of manuals as a way to get more knowledge on a particular matter. And if you find there some stuff that you really didn't know about and, additionally it saves you time and effort, it's great.
I want records 1 and 2 from file 1, because all 3 fields match (Fld1, Fld2 and Fld3) with record 1 from file 2.
In record 3, Fld 2 doesn't match so, it won't pass. Record 4 should also be on the output file, because all 3 selection fields match those in record 3 from file 2.
I think that it may be difficult to do without programming.