Right now I do not have anything more than the ability to copy files to the UNIX machine and use DataStage designer on the DataStage server. Because of this I've been compiling my C code in a UNIX environment and then copying that logic over with WinSCP.
The following is my C code:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *replace_str(char *str, char *orig, char *rep);
int ReplaceToJulian(char *stringIn);
int ReplaceToJulian(char *stringIn)
{
char *stringInput = replace_str(stringIn, "Rate Effective ","");
char *tokenOne = strtok( stringInput, "/");
char *tokenTwo = strtok( NULL, "/");
char *tokenThree = strtok( NULL, "/");
int month = (int) strtol(tokenOne, (char **)NULL, 10);
int day = (int) strtol(tokenTwo, (char **)NULL, 10);
int year = (int) strtol(tokenThree, (char **)NULL, 10);
int a = (14-month)/12;
int y = year+4800-a+2000;
int m = month+12*a-3;
int JDN = day + (153*m+2)/5 + 365*y + y/4 - y/100 + y/400 - 32045;
return JDN;
}
char *replace_str(char *str, char *orig, char *rep)
{
static char buffer[4096];
char *p;
if(!(p = strstr(str, orig))) // Is 'orig' even in 'str'?
return str;
strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
buffer[p-str] = '\0';
sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
return buffer;
}
Code: Select all
gcc -fpic -c ReplaceToJulian.c
gcc -shared -o ProphixLib.so ReplaceToJulian.o
The error thrown from DataStage is as follows:
Code: Select all
Output from transformer compilation follows:
##I IIS-DSEE-TFCN-00001 15:36:39(000) <main_program>
IBM InfoSphere DataStage Enterprise Edition 9.1.0.6525
Copyright (c) 2001, 2005-2012 IBM Corporation. All rights reserved
##I IIS-DSEE-TFCN-00006 15:36:39(001) <main_program> conductor uname: -s=AIX; -r=1; -v=6; -n=cadapp06bao; -m=00F608DE4C00
##I IIS-DSEE-TOSH-00002 15:36:39(002) <main_program> orchgeneral: loaded
##I IIS-DSEE-TOSH-00002 15:36:39(003) <main_program> orchsort: loaded
##I IIS-DSEE-TOSH-00002 15:36:39(004) <main_program> orchstats: loaded
##W IIS-DSEE-TOSH-00049 15:36:39(007) <main_program> Parameter specified but not used in flow: DSPXWorkingDir
##E IIS-DSEE-TBLD-00076 15:37:13(000) <main_program> Error when checking composite operator: Subprocess command failed with exit status 2,048.
##E IIS-DSEE-TFSR-00019 15:37:13(001) <main_program> Could not check all operators because of previous error(s)
##W IIS-DSEE-TFTM-00012 15:37:13(002) <transform> Error when checking composite operator: The number of reject datasets "0" is less than the number of input datasets "1".
##W IIS-DSEE-TFEV-00025 15:37:13(003) <transform> Error when checking composite operator: Converting number to string.
##W IIS-DSEE-TFEV-00023 15:37:13(004) <transform> Error when checking composite operator: Implicit conversion from source type "Int32" to result type "String".
##W IIS-DSEE-TFEV-00025 15:37:13(005) <transform> Error when checking composite operator: Converting number to string.
##W IIS-DSEE-TFEV-00023 15:37:13(006) <transform> Error when checking composite operator: Implicit conversion from source type "Int32" to result type "String".
##W IIS-DSEE-TBLD-00000 15:37:13(007) <main_program> Error when checking composite operator: Output from subprocess: 1500-030: (I) INFORMATION: std::_Tree<std::_Tmap_traits<APT_UString,APT_OutputAccess
##W IIS-DSEE-TBLD-00000 15:37:13(008) <main_program> Error when checking composite operator: Output from subprocess: orBase *,std::less<APT_UString>,std::allocator<std::pair<const APT_UString,APT_OutputAccessorBase *> >,0> >::_Insert(bool, _Nodeptr, const value_type &): Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.
##W IIS-DSEE-TBLD-00000 15:37:13(009) <main_program> Error when checking composite operator: Output from subprocess: ld: 0711-715 ERROR: File /datafiles/PROPHIX/ReplaceToJulian.o cannot be processed.
The file must be an object file, an import file, or an archive.
##I IIS-DSEE-TBLD-00079 15:37:13(010) <transform> Error when checking composite operator: /usr/vacpp/bin/xlC_r -L/opt/IBM/InformationServer/Server/Projects/ETL/RT_BP39.O/ -L/opt/IBM/InformationServer/Server/PXEngine/lib -L/opt/IBM/InformationServer/Server/PXEngine/user_lib -G -q64 -lorchaix64 -lorchcoreaix64 -lorchbuildopaix64 /datafiles/PROPHIX/ReplaceToJulian.o /opt/IBM/InformationServer/Server/Projects/ETL/RT_BP39.O/V3S0_BurdenRate_Load_Strip_Null_Dates.tmp.o -o /opt/IBM/InformationServer/Server/Projects/ETL/RT_BP39.O/V3S0_BurdenRate_Load_Strip_Null_Dates.o.
##E IIS-DSEE-TCOS-00029 15:37:13(011) <main_program> Creation of a step finished with status = FAILED. (BurdenRate_Load.Strip_Null_Dates)
*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V3S0_BurdenRate_Load_Strip_Null_Dates transform operator.
0003: //
0004:
0005: // define external functions used
0006: extern int32 ReplaceToJulian(string stringIn);
0007:
0008: // define our input/output link names
0009: inputname 0 Split_US_Dates;
0010: outputname 0 String_Dates;
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 = 0;
0022: }
0023:
0024: mainloop {
0025:
0026: // initialise the rejected row variable
0027: RowRejected0 = 1;
0028:
0029: // evaluate constraint and columns for link: String_Dates
0030: if ((Split_US_Dates.Date != InterVar0_0))
0031: {
0032: String_Dates.Date = ReplaceToJulian(Split_US_Dates.Date);
0033: writerecord 0;
0034: RowRejected0 = 0;
0035: }
0036: }
0037:
0038: finish {
0039: }
0040:
*** End of Internal Generated Transformer Code
For the object file my setup was as follows:
Routine Name: ReplaceToJulian
External Name: ReplaceToJulian
Object type: Object
Return Type: int
Library path: /datafiles/ReplaceToJulian.o
Arguments:
name=stringIn
type=char*
Are there any suggestions on how to remedy this? Any help or direction would be much appreciated.
Thank You,
Nathan