View previous topic :: View next topic
|
Author |
Message |
sujithsamuel
New User
Joined: 22 Dec 2006 Posts: 11 Location: Chennai
|
|
|
|
Hi
I have a requirement in which i need to select records from a file which are having incremental data. E.g.
My input file has the following records
abcdef1234
abcdef12345
abcdef123456
cdef456
cdef4
cdef678
My output file should be
abcdef123456
cdef456
cdef678
The LRECL for the file is 80 bytes.
Kindly clarify
Thanks |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
sujithsamuel,
How do you define "incremental"? Are you looking for a difference of certain number between 2 consecutive records? Also, please use code tags to keep alignment of your sample input data. What is the field size for both the fields (abcdef and 1234)?
Thanks, |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
And why do you have 2 output records for 'cdef' when you only have 1 for 'abcdef'? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
my guess
records are <incrementalized> based on a common root
abcdef records share a common root 1234
cdef record are in two groups
one with a root 4
one with a root 678
anyway it might be an interesting problem for something that could be worded
as strict incremental substring matching
but really the way the question is posed looks more like a puzzle
since we answer on our own time and at no charge I feel that we are entitled
to a proper explanation of the business need for such a nonsense ( the way the question is worded ) |
|
Back to top |
|
|
sujithsamuel
New User
Joined: 22 Dec 2006 Posts: 11 Location: Chennai
|
|
|
|
Dear Enrico
abcdef1234
abcdef12345
abcdef123456
cdef456
cdef4
cdef678
My output file should be
abcdef123456
cdef456
cdef678
The LRECL for the file is 80 bytes.
The reason abcdef123456 is only selected is that abcd1234 and abcd12345 are already present in the record abcdef123456.
I have to select a record which is the superset of all the existing records and discard all the other records which are a subset of any existing record.
By the same logic since cdef4 is already contained in cdef456, it was not selected.
Thanks |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
since I understood Your question no reason to address me personally,
but You! did You read and understand my reply ? looks like not
as I said before we have the requirement that ..
Quote: |
since we answer on our own time and at no charge I feel that we are entitled
to a proper explanation of the business need for such a nonsense |
in other words ...
when You hire a paid <consultant> You have the right to ask him/her to do something without explanation
since we answer on our own time and at no charge we are entitled to some respect and not be treated like children and bossed around
You should feel at least the ethical duty of telling the reason for the requirement
if You are not prepared to do so, You should not ask help on a forum
also explaining the business requirement might help to find a better description and definition of the technical aspects of the requirement
Kindly clarify |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
follow on ...
anyway You need to define properly incremental...
should the <incremented> character be srictly incremental like in the sample You posted or
qwert123
qwert123567
qwert12356790
should give back
qwert12356790 ???
the 4 and th 8 are missing
asdf7654
asdf7654321
should give back
asdf7654321 ???
there is quite a difference between prefix string matching as in the samples I posted
it could be called <incremental> by length or by proper substringing
Your examples seems to imply a strict/no holes sequencing of partial/full <key>
You see setting a proper/common terminology/dictionary is essential fo proper communication and <requirement> understanding
but... i dare to say that no general purpose utility will be able to do it
and even coding a program will not be a trivial task ! |
|
Back to top |
|
|
|