C++ Function in Transformer

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
sohasaid
Premium Member
Premium Member
Posts: 115
Joined: Tue May 20, 2008 3:02 am
Location: Cairo, Egypt

C++ Function in Transformer

Post by sohasaid »

Dears,

I have created the a C++ function to convert from hexa-decimal to decimal, compiled and used this function as an external routine in Transformer in Linux environment without any issue.


But when i tried to do the same on an Windows 2008 R2 Enterprise edition, compiled the .cpp file using : APT_COMPILER APT_COMPILEOPT fileName APT_LINKER APT_LINKOPT

(/D APT_USE_ANSI_IOSTREAMS /D _WIN32 /D _MBCS /nologo /W3 /WX- /Gm- /EHa /MD /GS- /fp:precise /Zc:wchar_t- /Zc:forScope /Gd /TP /Zi /Oy- /c C:\test.cpp /link /INCREMENTAL:NO /NOLOGO /DLL /DEBUG /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO /MACHINE:X86)


it compiled successfully, then i have created the External Routine using the output file from the compilation step.

when i used the routine in a transformer it fails to compile the job and raises the following error :


Output from transformer compilation follows:

Code: Select all


##I IIS-DSEE-TFCN-00001 08:37:16(000) <main_program> 
IBM InfoSphere DataStage Enterprise Edition 9.1.0.6670 
Copyright (c) 2001, 2005-2012 IBM Corporation. All rights reserved



##I IIS-DSEE-TFCN-00006 08:37:16(001) <main_program> conductor uname: -s=Windows Server 2008; -r=Service Pack 2; -v=6.0; -n=BIDEVELOPMENT; -m=x86-Intel
##I IIS-DSEE-TOSH-00002 08:37:16(002) <main_program> orchgeneral: loaded
##I IIS-DSEE-TOSH-00002 08:37:16(003) <main_program> orchsort: loaded
##I IIS-DSEE-TOSH-00002 08:37:16(004) <main_program> orchstats: loaded
##W IIS-DSEE-TOSH-00049 08:37:16(007) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##E IIS-DSEE-TFSR-00019 08:37:19(000) <main_program> Could not check all operators because of previous error(s)
##W IIS-DSEE-TFTM-00012 08:37:19(001) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##I IIS-DSEE-TBLD-00000 08:37:19(002) <main_program> Error when checking composite operator: Output from subprocess: V0S0_Untitled1_Transformer_0.C


##I IIS-DSEE-TBLD-00000 08:37:19(003) <main_program> Error when checking composite operator: Output from subprocess: C:\IBM\InformationServer\Server\Projects\TXXXXX\RT_BP144.O\V0S0_Untitled1_Transformer_0.C(213) : warning C4101: 'output' : unreferenced local variable

C:\IBM\InformationServer\Server\Projects\TXXXXX\RT_BP144.O\V0S0_Untitled1_Transformer_0.C(208) : warning C4101: 'input' : unreferenced local variable


##I IIS-DSEE-TBLD-00000 08:37:19(004) <main_program> Error when checking composite operator: Output from subprocess: V0S0_Untitled1_Transformer_0.tmp.o : error LNK2019: unresolved external symbol "__int64 __cdecl hexa_to_int(char *)" (?hexa_to_int@@YA_JPAD@Z) referenced in function "protected: virtual void __thiscall APT_TransformOperatorImplV0S0_Untitled1_Transformer_0::processInputRecordChild(int,int * const,int * const)" (?processInputRecordChild@APT_TransformOperatorImplV0S0_Untitled1_Transformer_0@@MAEXHQAH0@Z)

C:\IBM\InformationServer\Server\Projects\TXXXXX\RT_BP144.O\V0S0_Untitled1_Transformer_0.dll : fatal e
##I IIS-DSEE-TBLD-00000 08:37:19(005) <main_program> Error when checking composite operator: Output from subprocess: rror LNK1120: 1 unresolved externals


##W IIS-DSEE-TFEV-00025 08:37:19(006) <transform> Error when checking composite operator: Converting number to string.
##W IIS-DSEE-TFEV-00023 08:37:19(007) <transform> Error when checking composite operator: Implicit conversion from source type "Int64" to result type "String".
##E IIS-DSEE-TCOS-00029 08:37:19(008) <main_program> Creation of a step finished with status = FAILED. (Untitled1.Transformer_0)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the  transform operator.
0003: //
0004: 
0005: // define external functions used
0006: extern int64 hexa_to_int(string hex);
0007: 
0008: // define our input/output link names
0009: inputname 0 DSLink2;
0010: outputname 0 DSLink4;
0011: 
0012: initialize {
0013: 	// define our control variables
0014: 	int8 RowRejected0;
0015: 	int8 NullSetVar0;
0016: 
0017: 	// declare our intermediate variables for this section
0018: 	string InterVar0_0;
0019: 
0020: 	// initialise constant values which require conversion
0021: 	InterVar0_0 = "1776";
0022: }
0023: 
0024: mainloop {
0025: 
0026: 	// initialise the rejected row variable
0027: 	RowRejected0 = 1;
0028: 
0029: 	// evaluate columns (no constraints) for link: DSLink4
0030: 	DSLink4.out = hexa_to_int(InterVar0_0);
0031: 	writerecord 0;
0032: 	RowRejected0 = 0;
0033: }
0034: 
0035: finish {
0036: }
0037: 
*** End of Internal Generated Transformer Code
 

Kindly share your thoughts.

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

Post by ray.wurlod »

Does the folder in which the library/object exists appear in the PATH when this job is executed? (Check the entry in the job log that contains environment variable values.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sksdsx
Participant
Posts: 12
Joined: Fri Jan 31, 2014 9:40 am

Post by sksdsx »

Hi sohasaid,

Did The issue get resolved? if yes how Please share the solution .


Hi ray,

I am facing similar issue as the job is not getting compiled there is no entry in the directory. how can i find out whether the path exists and if it does not where do I add it.

Appreciate your time.

Thanks In Advance!
To succeed in life, you need two things: ignorance and confidence--Mark Twain
Post Reply