Page 1 of 1

How to write Routine ?

Posted: Wed Mar 28, 2007 6:19 am
by Rimi
Hi everyone ,

I am new to Datastage Routines ,I don't know how to write rourine .I am not getting any document that i can refer .
So please if anybody having any document related to routine pls send me .

Thanks .
Rimi.

Posted: Wed Mar 28, 2007 6:40 am
by BalageBaju
Hi Rimi,

You will get all the information about routines in BASIC reference manual which is available in Online manuals. Go through that you will get idea.

Also search the forum if you got any doubts, lot of posts are available about routines.

Posted: Wed Mar 28, 2007 6:46 am
by ganesh123
There are two types of routines:

1) Transform routines
2) Before-After job sub-routines

*Before-After routines could be used/written within Transformer or even Shell scripts are used/written.

For transform routines in the repository just right click on Routines and make new server routines. You can also use inbuilt functions which are already there.

Posted: Wed Mar 28, 2007 7:06 am
by ray.wurlod
You could undertake some training

Posted: Wed Mar 28, 2007 11:33 pm
by Rimi
Thanks all for replies .

BalageBaju

where is this online manual is available?

Thanks.

Posted: Thu Mar 29, 2007 12:03 am
by BalageBaju
Goto Start Menu--> Programs-->Ascential Datastage-->Online Manuals-->Datastage Documentation..

You will find all the documents related to datastage here.

Posted: Thu Mar 29, 2007 4:55 am
by ray.wurlod
Get into Help from Designer or Manager and open the topic BASIC Tasks

Posted: Mon Apr 02, 2007 3:06 am
by Rimi
thanks all..

Can anyone tell the unix command for counting the number of files in directory
if i use (ls <home directory> |wc -1) it s showing error wc illegal .

I want to write the following in routine
Call DSExecute("UNIX","(ls <home directory> |wc -1)",UnixOutput,SystemReturnCode)

thanks
Rimi.

Posted: Mon Apr 02, 2007 4:16 am
by kumar_s
Its not wc -1 but its -l.
In addtion to that for clarity, Assign it to a variable Say

Code: Select all

CountFiles = "ls ":pHomeDirectory:"|wc -l", and use Call DSExecute("UNIX",CountFiles,UnixOutput,SystemReturnCode) 

You can try this

Posted: Mon Apr 02, 2007 4:35 am
by smrutiranjannayak
Rimi wrote:thanks all..

Can anyone tell the unix command for counting the number of files in directory
if i use (ls <home directory> |wc -1) it s showing error wc illegal .

I want to write the following in routine
Call DSExecute("UNIX","(ls <home directory> |wc -1)",UnixOutput,SystemReturnCode)

thanks
Rimi.

Hey Rimi ,

To answer your 1st qs :

1) You can open ds manager and right click on routines and click on create routines . Then a new screen will come with 5/6 tabs i guess .
Here two tabs are imp . one is Code and other is argument tab .

In routine code page you just need to write a code( tht depends on your req. means what your routine is intented to do...since routine prform as functions) .
You can write the code in basic .

e.g , let suppose you want to write a routine to match some fields

begin
case 1
Ans = 'a'
case 2
Ans ='b'

like this
Then mention Ans as argument in required tab....then compile and use it...simple.....!!!

2) I think " ls -l|wc -l" will work ...just try it in the directory for which you want to take the count of files......


Cheers