View previous topic :: View next topic |
Author |
Message |
cooolguyin Beginner
Joined: 15 Jun 2005 Posts: 2 Topics: 1
|
Posted: Wed Jun 15, 2005 9:38 am Post subject: interview question i faced |
|
|
here is the interview Q i faced in cts
There are two files one with the records in sorted order , no duplicates and other with unsorted order with duplicates..I want the third file which should contain the records that are in both the first and second file but no duplicates.. should not use merge or sort verb!!. and the output file should be in the sorted order!
could you just tell me the logic of this pgm?
Thanks in advance |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
Posted: Wed Jun 15, 2005 9:47 am Post subject: |
|
|
cooolguyin,
Step1 : code a sort step for sorting the second file on key fields and remove the dups
Step2 : Now compare file1 and file2 and generate the output.
The logic of comparing and writting to the output files is described here with examples.
Hope this helps...
Cheers
Kolusu _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Wed Jun 15, 2005 10:32 am Post subject: |
|
|
I am not sure if I understand the whole problem correctly in that I don?t know from which file we must create our output FROM. However, assuming that the output would be coming from the 1st file, I think I would approach it this way???.
The pseudo code might be something like this:
Load all of the keys from file 2 into a table
Loop:
Read a record from file 1
Search table of keys
When key found, write record to file 3 from file 1
Go to Loop
Depending on the number of records(keys) in file 2, you might consider performing a table sort once you have loaded your table. Then by modifying your SEARCH, you could gain some efficiencies.
This solution is based upon the idea that you are not supposed to use SORT either internally(in program) or externally (via JCL).
Hope this helps.....
DTF
________
Building
Last edited by dtf on Tue Feb 01, 2011 1:56 pm; edited 1 time in total |
|
Back to top |
|
|
cooolguyin Beginner
Joined: 15 Jun 2005 Posts: 2 Topics: 1
|
Posted: Wed Jun 15, 2005 10:57 am Post subject: |
|
|
HI Kolusu,
Thanks for your reply but where to see the example for comparing and writing the output file?
this is the interview question i got
1) I have 2 files.i want fo merge these records and i want to store in a 3rd file.i want to do without Merge utility and Merge verb also.
2) I want to update the records KSDS-VSAM file from the record number 90 to 100. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12359 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
|
|