Here is my requirement:
I have two input files
input 1: length 38 bytes
input 2: length 1 byte (Basically its a data card having value from 1-9)
I need to compare the (21,1,ch) of input 1 with (1,1,ch) of input 2 and include only those records (of the file input 1) in the output file whose key matches with the key of the record in file input 2.
How can this be done using sort or ICETOOL.
Can my requirements be done using SORT CARD??
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I'd not really call that "comparing files". Also your subject does not convey much meaning.
Personally, I'd do it in two steps, setting up a SYMNAME for the value on your single record file in the first step and INCLUDE with that SYMNAME in the second step.
There are examples in the forum, usually with a date record.
@Bill: I saw the link <http://ibmmainframes.com/about28075.html> and will try it in my case. Hope it works.
I want to have solution using ICETOOL only, can you help me in this.?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I think, once you get it working with Sort, you could use an ICETOOL function with a USING and have the statements in your control file for the two steps. There may be other ways.
Edit, there are more recent examples than the one you chose, but that's not a problem.
Saini19,
Are you always going to have 1 record in the 1 byte file or is it possible to have multiple records? If you can have multiple records in the 1 byte file, please show an example of input records and expected output.
@Saiprasadh: Thanks for the help.
I'll try this in my case. Hope it works fine.
@Sqlcode1: Yes, 1 byte file will always have 1 record.
@Bill/Skolusu:Input2 file may have any digit from 1-7, but at a time it will have only one record, not particularly fixed to numeral '1' only. It may have values as '2', '3' and so on till '7'.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Remember the idea is for you to find and amend a sort deck which can take a single record file (or the first record of a multi-record file) and from the contents of that generate the symbol/SYMNAMES for the step that is doing the work.
Let's see how long it takes to find one, starting, now...
OK, I knew where to look, how to use the search on the DFSORT forum, or the SEARCH on the top of each page. But, it is not difficult to get practice of. Then next time, you might find the solution all on your own, and two days faster than doing it this way.
We don't mind, we don't get paid either way. But learning how to get to what you want is a valuable skill which will benefit you time and again in your career.
Now, do you want me to fix the code up for you? Or do you want to do it yourself? Get the buzz you get from that? Having done it yourself, have it in the back of your mind for other solutions? Wonder what SYMNAMES are and look them up and find out what they can do for you?
Or do you want to sit there and moan mildly that no-one has made the complete code for you yet, even though you've had all the "hints" necessary?
@Bill: As mentioned in my last comment, I am trying it on my end as well. You should not have assumed that people just post and sit idle waiting for reply. May be you are experienced in handling sorting problems, however this is not an appreciable way to welcome new members who are willing to learn something from good teachers like you.
Anyways, let's not get into war of words. I just made that comment to you to let you know my scenario. Thanks a lot for your efforts.
Yes, you are right. Why should I be concerned if I have told you how to do it, where to find examples, and then you point out to me that you might want different values for different runs... :-)
The above is untested (the stuff I've put there, not the original). You have a single record, so you can ditch the STOPAFT=1.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Saini19 wrote:
@Bill/Skolusu:Input2 file may have any digit from 1-7, but at a time it will have only one record, not particularly fixed to numeral '1' only. It may have values as '2', '3' and so on till '7'.
Well you can change your file 2 to be a set value and it doesn't matter what the value is.
Here is a detailed explanation of SET statement with examples (see 25.1 section)