How to write Routine ?

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
Rimi
Participant
Posts: 8
Joined: Wed Feb 28, 2007 10:25 am

How to write Routine ?

Post 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.
BalageBaju
Participant
Posts: 34
Joined: Fri Sep 22, 2006 10:59 pm
Location: India

Post 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.
Regards,
Balaji.
ganesh123
Participant
Posts: 70
Joined: Tue Feb 20, 2007 3:22 pm
Location: NJ,USA
Contact:

Post 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.
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could undertake some training
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rimi
Participant
Posts: 8
Joined: Wed Feb 28, 2007 10:25 am

Post by Rimi »

Thanks all for replies .

BalageBaju

where is this online manual is available?

Thanks.
BalageBaju
Participant
Posts: 34
Joined: Fri Sep 22, 2006 10:59 pm
Location: India

Post by BalageBaju »

Goto Start Menu--> Programs-->Ascential Datastage-->Online Manuals-->Datastage Documentation..

You will find all the documents related to datastage here.
Regards,
Balaji.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get into Help from Designer or Manager and open the topic BASIC Tasks
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Rimi
Participant
Posts: 8
Joined: Wed Feb 28, 2007 10:25 am

Post 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.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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) 
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
smrutiranjannayak
Participant
Posts: 22
Joined: Mon Apr 02, 2007 4:02 am
Location: MUMBAI
Contact:

You can try this

Post 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
Smrutiranjan Nayak
Post Reply