View previous topic :: View next topic
|
Author |
Message |
NatashaN
New User
Joined: 07 Mar 2022 Posts: 2 Location: India
|
|
|
|
Hi All,
I have 2 files
File 1 - 80 bytes
Prefix low - 8 bytes
Prefix High - 8 bytes
Date - 10 bytes
File 2 - 80 bytes
Card number - 15 bytes
I want the card numbers in output file by checking if that particular card number lies between the low - high prefix or equal.
Attached the files how it looks.
Please guide me how to achieve this using DFSORT.
Thanks in advance,
Natasha |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
1. Use Code button instead of attachements to present your cade, and your samples.
2. What is Date field in your output?
3. This task is presented as an example between #5 and #10 in ANY SORT manual. (Hence, you did not read any of manuals) |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1246 Location: Bamberg, Germany
|
|
|
|
It can be achieved w/ a JOINKEYS operation and is not very complicated. Find a field that is common in F1 and F2, use that as a key. REFORMAT what fields you need from F1 and F2.
Use OUTFIL to INCLUDE only records that match your criteria.
In case sequence of records should be pertained, add a SEQNUM beforehand. SORT on that seqnum and that's it.
Code: |
****** ******************
000001 987563104563856
000002 234561997654980
000003 234561007654980
****** ****************** |
|
|
Back to top |
|
|
NatashaN
New User
Joined: 07 Mar 2022 Posts: 2 Location: India
|
|
|
|
Hi Joerg.Findeisen and sergeyken,
Thanks for the response.
Below is my File 1 - so the prefix ranges value from low to high which is of 8 bytes.
****** *****************************
000001 12345500 12345599 2022-03-07
000002 23456100 23456199 2022-03-07
000003 98756300 98756399 2022-03-07
****** ****************************
Below is file 2 - which contains card number of 15 bytes. So if the first 8 bytes of card number from file 2 falls between low - high range of file 1 then that card number is required in my output.
********************
987563104563856
786512349087675
234561997654980
234561007654980
********************
Not able to achieve this for 2 fields compare range. And the date field is just an additional in file1 which is not required for my operation.
[/code][/quote] |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1246 Location: Bamberg, Germany
|
|
|
|
Please show what you have tried. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2018 Location: USA
|
|
|
|
NatashaN wrote: |
Hi Joerg.Findeisen and sergeyken,
Thanks for the response.
Below is my File 1 - so the prefix ranges value from low to high which is of 8 bytes.
****** *****************************
000001 12345500 12345599 2022-03-07
000002 23456100 23456199 2022-03-07
000003 98756300 98756399 2022-03-07
****** ****************************
Below is file 2 - which contains card number of 15 bytes. So if the first 8 bytes of card number from file 2 falls between low - high range of file 1 then that card number is required in my output.
********************
987563104563856
786512349087675
234561997654980
234561007654980
********************
Not able to achieve this for 2 fields compare range. And the date field is just an additional in file1 which is not required for my operation.
[/code] |
Use Code button to present your code, AND all your samples, including input AND output. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1246 Location: Bamberg, Germany
|
|
|
|
I give this one more try. Are prefix ranges value from low to high always starting with the same digit?
No answer means you solved the issue by yourself already. Good then. |
|
Back to top |
|
|
|