Page 1 of 1

Searching the data

Posted: Fri Jul 21, 2006 2:06 pm
by Craig.rse
hi,
I just joined the forum, I have a very strange request
This is what i need to do:
I have data coming only in one column, I need to pull out the data from inside the column like this:
In the last row I finish on FindNext(ACB1), here i need to search for rule name $POUND(ACB1) and bring it to join it right below FINDNEXT(KDEP).
the concept is like this I have a txt file and need to find a way to search for $POUND(AC**)(or it can be $POUND(ACB) OR $POUND(A**) and cut the next four or five rows of data till i hit the next FINDNEXT(ADE) and have it to come back and join below FINDNEXT(ACB1).
Its like we ran out of space below could not attach any more data, we needed to use FINDNEXT(name of the rule) so that we could search for this rule and attach it at later point. So if the rule is prefixed with $POUND, we need to find if it matches the suffix of FINDNEXT and attach the record there

$POUND(PK**)
ABCDES ssfed Record kp
ID(4930**) READ WRITE ACESS
PQ(5490303)
GPW(23232)
PID(kfeas) FINDNEXT(KDEP)

$POUND(KDE)
ABCDES dke Record po
ID(5940**) READ WRITE ACESS
PQ(5493)
GPW(29928)
PID(kdew) FINDNEXT(ACB1)

Thanks, Craig R

Posted: Fri Jul 21, 2006 2:25 pm
by kcbland
Welcome aboard. This is the craziest thing I've seen posted. Could you please state your situation another way? I cannot comprehend the steps the logic needs to follow.

I do understand that you have a non-structured file with record start and end markers. What I don't understand is your terminology like "cut the next for or five rows" and "come back and join below".

We'll give you as much help as you need, we just need to understand it first :lol:

Posted: Fri Jul 21, 2006 8:11 pm
by DSguru2B
I guess you will be better off writting a sed/awk script in manipulating your data.

Posted: Sat Jul 22, 2006 12:56 am
by ray.wurlod
Data with embedded navigation instructions. Rather old-fashioned technology, but it rang some old bells (used to see this kind of thing with paper tape "files"). Tricky to do with DataStage, which is about flows, and can only really remember one row back. You'd need at least two passes through the data with DataStage, the first re-casting the data into a more useable format.

I agree that a sed or awk script is probably a preferable approach.

Posted: Sat Jul 22, 2006 2:28 am
by kumar_s
Is it something like, searching for POUND(A**) and attach the rest of lines till we reach FINDNEXT(**, to the previously found FINDNEXT(***

So that your required output should be
POUND...
..
..
FINDNEXT..
..
..
FINDNEXT...
...
..?????

Posted: Sat Jul 22, 2006 7:19 am
by Craig.rse
Thanks for writing,
well, yes after FINDNEXT, it needs to look for POUND bring it back up and then output would look like this

Start
POUND...
..
..
FINDNEXT..
POUND..
...
...
...
POUND..
...
...
...
POUND..
...
...
...

...
..?????

Posted: Sat Jul 22, 2006 6:35 pm
by ray.wurlod
What do you need to do with all the intervening lines? Do they become separate columns in a single row? What is the terminating condition for a row? Does each $POUND introduce a new row in the output? Some extra specification would be useful in trying to find a solution: what should be the form of the output? What do the arguments to POUND and FINDNEXT indicate? What if the argument to POUND does not start with "A"? And so on.