I am trying to write server routine in datastage, but not getting how to start.
Can anyone tell me the syntax for writting routines or provided the link for good material for wrtting routines?
This forum has many posts with examples; as does the documentation.
You posted in the Parallel forum. DS Server Routines can be called from Parallel Jobs only as Before/After job subroutines or if you include Server Transform stages.
The programming language is DataStage BASIC, which is quite close to UniVerse BASIC (now owned by Rocket Software). Again, the documentation offers the full programming manual for download as a PDF.
Perhaps you could tell us what you want to do and you will get better answers.
Decided to push this over to the General forum where we can discuss all aspects of routine creation. And why create a routine that already exists and ships with the product? It's called "KeyMgtGetNextValue". If you find it and open it up as if you were going to edit it (don't) you'll be able to see the source code.
As to the "any transformation" question, that's basically a yes - no pun intended. The BASIC language that ships with DataStage is very powerful... what you can do with it is limited only by your skill set.
-craig
"You can never have too many knives" -- Logan Nine Fingers
this is a message forum and not an SMS chat, so please try to communicate using real words to avoid errors. While smileys are common, please use the word "for" rather than "4" and "you" rather than "u"; it makes things much easier to understand for those of us, including myself, to whom English is not our mother tongue.
Did you follow the link I posted earlier? That contains a lot of information on the programming language and also points to examples, and there are also a lot of examples here in the various threads.
As Craig has stated, there are embedded methods of creating sequences in Datastage. The simplest is using either @INROWNUM or @OUTROWNUM in transform stages, then you have the key management routines that Craig has alluded to.
Asking for code like this isn't going to get you many responses. What will work is if you write your own code and ask specific questions when you get stuck.
Here's a rough approach, in the DataStage designer choose File -> New and choose a new Server Routine. In the screen give it a name and make sure that it is a server Function. Look at the "Arguments" tab, it will have one default argument called "Arg1".
Now click on the "Code" and enter the following source code:
Save and compile. Then create a server job and in the derivation for a column, click on the "..." and select "DS Routine" and navigate to your newly created routine in the list; insert it and give it an appropriate numeric input column or constant and you are good to go.
The product ships with all kinds of "sample" code, pretty much every routine includes the source code. Find them and start examining them, one of the best way to learn how things work is to study working things.
-craig
"You can never have too many knives" -- Logan Nine Fingers