Field Function

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Field Function

Post by kiran kumar »

Hi,

I have a requirement to separate out record which has a comma in it.

RECORD: rec1,rec2,rec3

the output I need be
rec1
rec2
rec3

I tried to read the RECORD using filed function as
Field(RECORD,',',1):CHAR(13):Field(RECORD,',',2):CHAR(13):Field(RECORD,',',3)

And the server is LINUX

But, I am unable to satisfy this requirement. Am I doing wrong here?

Can you please suggest on this.


Regards,
Kiran Kumar
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Field Function

Post by SURA »

1) Are you trying to convert columns to rows?

2) In you example it is having 3 values (rec1,rec2,rec3). All the records are having 3 values or it varies!
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

I am reading records and if it matches a condition I am dumping them in a single column (which is as above) with a comma separated in between them.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your Field() function call is syntactically correct. Is your target a sequential file? If so, then you need to use CHAR(10) as the record delimiter. If not, you need to give us a better explanation of exactly what it is you are trying to accomplish, i.e. what your requirement is.
Last edited by chulett on Wed May 23, 2012 8:03 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

Hi,

This actually worked with a Field function. there was some issue with the delimiter I'm passing in and I corrected it.

Now, I have another issue in-line with this.

the RECORD values varies and it has a comma as a delimiter as rec1,rec2,rec3,rec4.....and so on.

Can you please suggest how can i put this dynamic value into an order as:
rec1
rec2
rec3
rec4....

Can you please suggest.


Regards,
Kiran Kumar
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

chulett wrote:Your Field() function call is syntactically correct. Is your target a sequential file? If so, then you need to use CHAR(10) as the record delimiter. If not, you need to give us a better explanation of exactly what it is you are trying to accomplish, i.e. what your requirement is.
My Target is an Oracle Database. Can i use Char(13)?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, if that's really what you want. :?

What's not working about it? Why not just Convert() the commas to carriage returns?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

It worked. But, I am unable to trap the dynamic values.

can you please share any clue?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I already did. Convert() won't care how "dynamic" it is... assuming I understand what you mean by that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kiran kumar
Participant
Posts: 25
Joined: Wed May 02, 2007 1:07 am

Post by kiran kumar »

Sorry, Craig.

My Mistake. The issue is resolved.
Post Reply