Page 1 of 1

invalid external function

Posted: Mon Mar 27, 2006 12:23 am
by rmrama
Hello,

I tried some of the suggestions already available in this site, to no avail. Hope someone can help me.

I'm trying to create a C++ routine for Datastage usage. Code:

$ cat returnValue.c
#include <iostream.h>

int fnReturnValue()
{
//dscdscdscdsdc;
//return 100;
cout << "hello\n" ;
return 0;

}

I compiled and produced object and shared library files using the following commands in a make file named makeDS (executed as make -f makeDS):

/opt/aCC/bin/aCC -O +z -c returnValue.c -o returnValue.o

/opt/aCC/bin/aCC -b -c returnValue.c -o returnValue.sl

I then created a parallel routine name FuncRetValue and specified the /home/test/returnValue.sl as the library path and Library as type. I specified fnReturnValue as the external subroutine.

When i try to compile a job with a transformer calling this new routine, i get the following error:

External routine library name 'returnValue.sl' is invalid, routine FuncRetValue(ParamMaster.Transformer_1)

Am i doing something wrong?

Thanks in advance!

Regards,
M. Ramanathan

Posted: Mon Mar 27, 2006 1:17 am
by kumar_s
What is the Object type you specified.
Object or Library?
Assign to Object and give you object file with the path in the library path.

Posted: Mon Mar 27, 2006 3:03 am
by rmrama
Hello Kumar,

I tried 2 ways:

1 - selected Type = Library and specified the returnValue.sl as the path
2 - selected Type = Object and specified the returnValue.o as the path

The error message i specified comes out when i select option 1 with the following inside the More button:


*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S1_ParamMaster_Transformer_1 transform operator.
0003: //
0004:
0005: // define external functions used
0006: extern int32 fnReturnValue();
0007:
0008: // define our input/output link names
0009: inputname 0 DSLink6;
0010: outputname 0 DSLink4;
0011:
0012: global {
0013: // Job parameter declaration
0014: string SRCDBNME;
0015: string SRCDBPWD;
0016: string TGTDBNME;
0017: string TGTDBPWD;
0018: }
0019:
0020: initialize {
0021: // define our row rejected variable
0022: int8 RowRejected0;
0023:
0024: // define our null set variable
0025: int8 NullSetVar0;
0026:
0027: }
0028:
0029: mainloop {
0030: // initialise our row rejected variable
0031: RowRejected0 = 1;
0032:
0033: // evaluate columns (no constraints) for link: DSLink4
0034: DSLink4.SRCDBNME = SRCDBNME;
0035: DSLink4.SRCDBPWD = SRCDBPWD;
0036: DSLink4.TGTDBNME = TGTDBNME;
0037: DSLink4.TGTDBPWD = TGTDBPWD;
0038: DSLink4.Row = fnReturnValue();
0039: writerecord 0;
0040: RowRejected0 = 0;
0041: }
0042:
0043: finish {
0044: }
0045:
*** End of Internal Generated Transformer Code

The error for option 2 is this:

Output from transformer compilation follows:

##I TFCN 000001 02:02:29(000) <main_program>
Ascential DataStage(tm) Enterprise Edition 7.5.1A
Copyright (c) 2004, 1997-2004 Ascential Software Corporation.
All Rights Reserved


##I TUTL 000031 02:02:29(001) <main_program> The open files limit is 2048; raising to 4096.
##I TOSH 000002 02:02:29(002) <main_program> orchgeneral: loaded
##I TOSH 000002 02:02:29(003) <main_program> orchsort: loaded
##I TOSH 000002 02:02:29(004) <main_program> orchstats: loaded
##I TFSC 000001 02:02:29(007) <main_program> APT configuration file: /opt/dstage/Ascential/DataStage/Configurations/handson.apt
##I TFSC 000000 02:02:29(008) <main_program>
This step has no datasets.

It has 1 operator:
op0[1p] {(sequential APT_CombinedOperatorController:
(APT_LicenseCountOp in APT_LicenseOperator)
(APT_LicenseCheckOp in APT_LicenseOperator)
) on nodes (
node0[op0,p0]
)}
It runs 1 process on 1 node.
##W TCOS 000049 02:02:29(009) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##W TCOS 000049 02:02:29(010) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##I TCOS 000022 02:02:29(012) <main_program> Explanation:
Step has 1 operator.
???, invoked with args: -inputschema record ( Field001: string[6]; inRec: *; ) -outputschema record ( Field001: string; Field002: string; Field003: string; Field004: string; Field005: int32; outRec: *; ) -expressionfile RT_SC295/V0S2_CopyOfPollingJobControl_Transformer_2.trx -flag compile -staticobj /home/sgarb/returnValue.o -compiler /opt/aCC/bin/aCC -compileopt +DD64 -O -c -ext -z +Z -linker /opt/aCC/bin/aCC -linkopt +DD64 -b -Wl,+s -Wl,+vnocompatwarnings -name V0S2_CopyOfPollingJobControl_Transformer_2 -dir /opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O

Step has 0 data entities.
.
##I TCOS 000023 02:02:29(013) <main_program> Dump:
{
text="transform -inputschema record ( Field001: string[6]; inRec: *; )\n-outputschema record ( Field001: string; Field002: string; Field003: string; Field004: string; Field005: int32; outRec: *; )\n-expressionfile RT_SC295/V0S2_CopyOfPollingJobControl_Transformer_2.trx\n-flag compile\n-staticobj '/home/sgarb/returnValue.o'\n-compiler '/opt/aCC/bin/aCC'\n-compileopt '+DD64 -O -c -ext -z +Z'\n-linker '/opt/aCC/bin/aCC'\n-linkopt '+DD64 -b -Wl,+s -Wl,+vnocompatwarnings'\n-name V0S2_CopyOfPollingJobControl_Transformer_2\n-dir /opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O",
line=1, column=1, name="", qualname="",
op={
text="transform -inputschema record ( Field001: string[6]; inRec: *; )\n-outputschema record ( Field001: string; Field002: string; Field003: string; Field004: string; Field005: int32; outRec: *; )\n-expressionfile RT_SC295/V0S2_CopyOfPollingJobControl_Transformer_2.trx\n-flag compile\n-staticobj '/home/sgarb/returnValue.o'\n-compiler '/opt/aCC/bin/aCC'\n-compileopt '+DD64 -O -c -ext -z +Z'\n-linker '/opt/aCC/bin/aCC'\n-linkopt '+DD64 -b -Wl,+s -Wl,+vnocompatwarnings'\n-name V0S2_CopyOfPollingJobControl_Transformer_2\n-dir /opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O",
line=1, column=1, name=transform, qualname=transform,
wrapout={},
wrapperfile=transform, kind=non_wrapper_cdi_op, exec_mode=none,
args="'record ( Field001: string[6]; inRec: *; )'-outputschema'record ( Field001: string; Field002: string; Field003: string; Field004: string; Field005: int32; outRec: *; )'-expressionfile'RT_SC295/V0S2_CopyOfPollingJobControl_Transformer_2.trx'-flag'compile'-staticobj'/home/sgarb/returnValue.o'-compiler'/opt/aCC/bin/aCC'-compileopt'+DD64 -O -c -ext -z +Z'-linker'/opt/aCC/bin/aCC'-linkopt'+DD64 -b -Wl,+s -Wl,+vnocompatwarnings'-name'V0S2_CopyOfPollingJobControl_Transformer_2'-dir'/opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O'"
}
}
.
##E TBLD 000000 02:02:36(000) <main_program> Error when checking composite operator: Subprocess command failed with exit status 256.
##E TFSR 000019 02:02:36(001) <main_program> Could not check all operators because of previous error(s)
##W TFCP 000000 02:02:36(002) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##W TFCP 000025 02:02:36(003) <transform> Error when checking composite operator: Converting number to string.
##W TFCP 000000 02:02:36(004) <transform> Error when checking composite operator: Implicit conversion from source type "Int32" to result type "String".
##W TBLD 000000 02:02:36(005) <main_program> Error when checking composite operator: Output from subprocess: "/opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O/V0S2_CopyOfPollingJobControl_Transformer_2.C", line 87: warning #2550-D: variable "sPadChar" was set but never used
static UChar sPadChar = 0;
^

##W TBLD 000000 02:02:36(006) <main_program> Error when checking composite operator: Output from subprocess:

##W TBLD 000000 02:02:36(007) <main_program> Error when checking composite operator: Output from subprocess: ld: Can't find library or mismatched ABI for -lorchhpia64
Fatal error.

##I TFCP 000000 02:02:36(008) <transform> Error when checking composite operator: /opt/aCC/bin/aCC -L/opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O/ -L/opt/dstage/Ascential/DataStage/PXEngine/lib -L/opt/dstage/Ascential/DataStage/PXEngine/user_lib +DD64 -b -Wl,+s -Wl,+vnocompatwarnings -lorchhpia64 -lorchcorehpia64 -lorchbuildophpia64 /home/sgarb/returnValue.o /opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O/V0S2_CopyOfPollingJobControl_Transformer_2.tmp.o -o /opt/dstage/Ascential/DataStage/Projects/hands_on/RT_BP295.O/V0S2_CopyOfPollingJobControl_Transformer_2.so.
##E TCOS 000029 02:02:36(009) <main_program> Creation of a step finished with status = FAILED. (CopyOfPollingJobControl.Transformer_2)

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



Regards,
M. Ramanathan

Posted: Mon Mar 27, 2006 4:38 am
by rmrama
Kumar got it!!

I compiled the c program using many options suggested and one of them worked. It took me awhile to figure out which one. Finally:

To compile and produce object file:
aCC +DD64 -O -c -ext -z +Z file_name.c

To link object file:
aCC +DD64 -b -Wl,+s -Wl,+vnocompatwarnings file_name.o

Both switches for compiling and linking are available in the APT_COMPILEOPT and APT_LINKOPT variables in Administrator.

I did the rest as you asked and the Datastage job compiled and executed well! Thanks!

Regards,
M. Ramanathan