View previous topic :: View next topic
|
Author |
Message |
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
Hi,
I have a requirement to search a text in a file . for eg.
File 1 contains the list of strings which I want to search.
LRECL: 80, the strings are present in cols 1:8.
File 2 is also of LRECL 80 but it may/maynot contain the above strings but in any position.
I want to read each record from file 1( 1:8) and search the same in File 2.
If the record is found, write the string(1:8) into the o/p file.
Is it posiible o achive this using SORT/ICETOOL? If so please provide me the code. If you need any more details please let me know.
Thanks for your time and help.! |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Arnab,
Quote: |
File 1 contains the list of strings which I want to search.
LRECL: 80, the strings are present in cols 1:8. |
How many records/strings are you expecting? If the limit is within include cond using file1, we can prepare sort card in runtime and search the req string in file2. |
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
File 1 contains around 1500 recs.. If this is an issue then we can split the file into lesser number of records and run also.
Thanks,
Arnab |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Arnab,
Quote: |
If the record is found, write the string(1:8) into the o/p file. |
Which file data? File1 or File2. |
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
Murali,
Data from File 1 i.e the 8 bytes should come in the o/p.
Thanks again.! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Arnab,
It's not clear what exactly what you're trying to do or what you want for output. Can there be duplicates within file1? Can a string from file1 be found in only one record in file2, or can it be found in multiple records in file2? Do you want only one instance of a string in the output file, or do you want one instance of the string for each record that has that string?
Do you want the output sorted by the string values or in the original order of the file2 records?
Please show an example of the records in each input file and what you expect for output. |
|
Back to top |
|
|
arnab
New User
Joined: 13 Mar 2006 Posts: 59 Location: UK
|
|
|
|
Hi Frank,
there can be no duplicates in FILE1 but there can be multiple occurences of the string in FILE2. My requirement is: IF there is even one occurence of the string from file1 in file2 , I should have the string as o/p . basically I have a list of jobs for an application in FILE1. File 2 contains all the schedules of this application. Now I have to find all the jobs which are there in the schedule. Instead of manually finding them I want to do it using a sort/ICETOOL.
for eg file1 contains:
PIUPDSD
in File 2:
JOB PIUPDSD
RUN TODAY;
Now File 3 should contain PIUPDSD.
Please let me know if you need any more information.
Also I would like to know How to create SORTCARDS a runtime.
Thanks and regards,
Arnab |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Let's call what you're looking for the jobname:
Is the jobname always in the same place in file2 or can it be in different places in different records? Can a record in file2 have more than one jobname or can it only have one jobname?
Please give a better example of the input records (with more jobnames that are found and not found) and what you want for output. Showing one instance does not help much. Also, please use ubb code tags around the examples, e.g. <code> before the records and </code> after the records with [ instead of < and ] instead of > so we can see the spaces in the records. |
|
Back to top |
|
|
|