Alternate to UNIX `grep` in Datastage Basic

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
Madhusv
Participant
Posts: 35
Joined: Sat May 07, 2005 1:38 am
Contact:

Alternate to UNIX `grep` in Datastage Basic

Post by Madhusv »

Hi All,

I am writing after job routine .

I need function which gets the line of the search string, I want to take first part of the line(here i can use Field). Delimiter in the line is /.

Is there any alternate to UNIX `grep` in Datastage Basic Or is there any other logic to do the same.

Also can i use DSExecute to interact with UNIX(AIX) shell.


Regards,
Madhu
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

If you are talking about using search and replace on the data in the file you are better off doing it in the job via a transformer. Otherwise the easiest way to do grep is to call the grep command via dsexecute. Have a look at the DataStage BASIC Guide or do a forum search for the dozens of dsexecute examples.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,

You can do the same from Datastage Basic.
You can use DSExecutable to do the same. This is to perform all the unix command in that.
You can store it into a variable and use the field function to partion.

Regards
Kumar
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

If you want to find a string then use INDEX() in BASIC. Do a search. How to use INDEX() in BASIC has been covered a lot. You need UPCASE() or DOWNCASE() to make it case insensitive.
Mamu Kim
Post Reply