Searching the data

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Craig.rse
Participant
Posts: 2
Joined: Fri Jul 21, 2006 1:58 pm

Searching the data

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post 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:
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I guess you will be better off writting a sed/awk script in manipulating your data.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
Last edited by ray.wurlod on Sat Jul 22, 2006 6:32 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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...
...
..?????
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Craig.rse
Participant
Posts: 2
Joined: Fri Jul 21, 2006 1:58 pm

Post 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..
...
...
...

...
..?????
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply