server routine vs parallel routine

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
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

server routine vs parallel routine

Post by zulfi123786 »

I guess both kind of routines use the same BASIC code (Please correct if wrong), then why is it so that a server routine cannot be used in Parallel job and vice versa

Thank you.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You are completely wrong. Parallel routines must be written in C++ (definitely not any kind of BASIC language) then compiled and linked. Finally an entry must be placed in the repository recording the existence, location and required arguments of the routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srikanth386
Participant
Posts: 26
Joined: Sun Dec 23, 2007 3:21 am
Location: hyderabad

Re: server routine vs parallel routine

Post by srikanth386 »

Server routines are written in Basic language and called in server job environment but the Parallel routines are written in c++ language(not in basic level language) and called din parallel job environment......
SRIKANTH
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Server routines can be called from server jobs, from sequences, from BASIC Transformer stages in parallel jobs and from server Transformer stages in server shared containers in parallel jobs.

Parallel routines can only be called from Transformer or certain custom stage types in parallel jobs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

In server routines we can pass Nulls in arguments which can be checked inside the routine with IsNull() function but guess Nulls cannot be passed to and from parallel routines.... Am i right? guess we need to replace nulls with dummy values before passing as arguments.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're wrong. Nulls can be passed to parallel routines - but the routine has to be able to handle null arguments.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

okay. could you please brief me how to make the routine handle nulls or give me any reference to where it is documented.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

Wrote a small Parallel routine to get started with........ this one takes 2 integers and returns the sum........works fine Hurray!!!!
But due to some reason the routines with character arguments are not working
I am trying to pass 2 char arguments and then check if they are equal, the function returns an integer 1 if equal else 0;

#include <iostream.h>

int CharComp(char a, char b){
int c;
if (a==b) c=1;
else c=0;
return c;
}

The job aborts with this error :

Transformer_46: Failed to load the library "V0S46_checking1_Transformer_46.o"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V0S46_checking1_Transformer_46": rtld: 0712-001 Symbol CharComp__FUcT1 was referenced
from module /data/ds/hbus/projectlib/dpr_hbus_dev/RT_BP6744.O/V0S46_checking1_Transformer_46.o(), but a runtime definition
of the symbol was not found..


I am including the transformer code from the project directory:

==> cat V0S46_checking1_Transformer_46.trx.osh
transform -inputschema record
(
DELTA_FLAG:nullable string[];
)
-outputschema record
(
DELTA_FLAG:string[];
One:int32;
)
-expressionfile [&DSPXSourceDir]/V0S46_checking1_Transformer_46.trx
-flag compile
-staticobj '/data/ds/hbus/dev/landing/CharComp.o'
-compiler '/usr/vacpp/bin/xlC_r'
-compileopt '-O -c -qspill=32704'
-linker '/usr/vacpp/bin/xlC_r'
-linkopt '-G'
-name V0S46_checking1_Transformer_46
-dir /data/ds/hbus/projectlib/dpr_hbus_dev/RT_BP6744.O

vh2ldcdv02:{HBUS}:/data/ds/hbus/projectlib/dpr_hbus_dev/RT_SC6744
==> cat V0S46_checking1_Transformer_46.trx
//
// Generated file to implement the V0S46_repos_Transformer_46 transform operator.
//

// define external functions used
extern int32 CharComp(int32 a,int32 b);

// define our input/output link names
inputname 0 lnkItemRed;
outputname 0 DSLink47;

initialize {
// define our row rejected variable
int8 RowRejected0;

// define our null set variable
int8 NullSetVar0;

}

mainloop {
// initialise our row rejected variable
RowRejected0 = 1;

// evaluate columns (no constraints) for link: DSLink47
DSLink47.DELTA_FLAG = lnkItemRed.DELTA_FLAG;
DSLink47.One = CharComp(1 , 3);
writerecord 0;
RowRejected0 = 0;
}

finish {
}


I then changed the arguments type from char to int and rewrote the c++ code as :

#include <iostream.h>

int CharComp(int a,int b){
int c;
if (a==b) c=1;
else c=0;
return c;
}

It then worked fine ...............Could anyone tell me where the issue is?
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

It worked when the type of input arguments in the routine was changed from char to char*, guess the transformer passes the address and not the values to the Parallel routine.
I would be very thankful if anyone helps me in handling NULL values in Parallel routines, when i pass NULL able columns as arguments how do we make C++ code to work with nulls and how do we check from inside the code if the value is NULL?

Thanks in advance
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

In c++ its a mere empty string
for array the terminator will be at array[0], hence you can check if array[0]='\0'
or in case of pointers you can use .empty() to check if its null.

But i dont think you need to do anything special just to handle null values, it shouldn't drop any record.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

priyadarshikunal wrote:But i dont think you need to do anything special just to handle null values, it shouldn't drop any record.
Transformer_46,0: Field 'DELTA_FLAG' from input dataset '0' is NULL. Record dropped.

It is dropping records when null value is passed as an argument.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Read the manual. Null is represented internally as a byte with only its most singificant bit set.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

ray.wurlod wrote:Read the manual. Null is represented internally as a byte with only its most singificant bit set.
Could you please tell me which mannual would help me in this regard
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Parallel Job Developer's Guide - search in it for "out of band null".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

ray.wurlod wrote:You're wrong. Nulls can be passed to parallel routines - but the routine has to be able to handle null arguments.
How do we make the Parallel routine handle nulls ? Is it by using makenull() function and convert the in-band nulls to out-band nulls and check the same in the routine?

thanks in advance.
Post Reply