View previous topic :: View next topic
|
Author |
Message |
sivasree03
New User
Joined: 12 Sep 2008 Posts: 8 Location: chennai
|
|
|
|
Hi,
I have 100 strings in FILE1 and I have FILE2 with the length of 32756 bytes. I have to search each and every string from FILE1 in FILE2. This string can be in any place in FILE2. If the sting found in FILE2 then I have to write entire record from FILE2 to FILE3.
Is there any way I can do this thru SORT. Please post the SORT card for this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
How many records are in file2? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use DFSORT's substring search to do this kind of thing. For example:
Code: |
OPTION COPY
INCLUDE FORMAT=SS,
COND=(1,32752,EQ,C'string001',OR,
1,32752,SS,EQ,C'string002',OR,
...
1,32752,SS,EQ,C'string100')
|
However, you can only search up to position 32752, not 32756.
If you don't want to hardcode the INCLUDE statement, you can generate it from the strings in input file1. |
|
Back to top |
|
|
sivasree03
New User
Joined: 12 Sep 2008 Posts: 8 Location: chennai
|
|
|
|
Thanks Frank, We will be having millions of records in FILE2 and I don't want to hard code strings in SORT CARD. Can you let me know the logic to get the strings from FILE1. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I don't know what having millions of records in FILE2 has to do with hardcoding the strings from FILE1. But if you want me to show you how to generate the control statement from the records in FILE1, tell me the starting position and length of the string in the FILE1 records. Also, tell me the RECFM and LRECL of FILE1. |
|
Back to top |
|
|
|