I am trying to find the index of a character (whitespace) in a string in a custom buildop. When I generate the buildop I get an error that .find is not part of the APT_String class. How can I accomplish this in a buildop? Any help would be appreciated.
ray.wurlod wrote:The API is documented in the Parallel Job Advanced Developer's Guide.
But why are you reinventing the wheel? The inbuilt Index() function can perform the task you describe. ...
Ray,
I tried to use the index function with no luck... I was doing it like so... but getting errors. I'm not in front of the code right now so I cannot give you the exact error. Is this the correct way to use "index".
Your Index() function syntax is good (assuming you have a Then and an Else clause for the If, and that this is an expression in a Transformer stage rather than in Build stage code). Therefore please post any error message; there is not enough information for us to suggest anything more.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod wrote:Your Index() function syntax is good (assuming you have a Then and an Else clause for the If, and that this is an expression in a Transformer stage rather than in Build stage code). Therefore please post any error message; there is not enough information for us to suggest anything more.
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-0256 (S) A parameter of type "int" cannot be initialized with an expression of type "const char [2]".
"File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-1205 (I) The error occurred while converting to parameter 2 of "index(const char *, int)".
ray.wurlod wrote:Your Index() function syntax is good (assuming you have a Then and an Else clause for the If, and that this is an expression in a Transformer stage rather than in Build stage code). Therefore please post any error message; there is not enough information for us to suggest anything more.
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-0256 (S) A parameter of type "int" cannot be initialized with an expression of type "const char [2]".
"File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-1205 (I) The error occurred while converting to parameter 2 of "index(const char *, int)".
Thanks,
Seth
You don't need a buildop for this. if you create a stage variable inside a transformer using the following code :
ray.wurlod wrote:Your Index() function syntax is good (assuming you have a Then and an Else clause for the If, and that this is an expression in a Transformer stage rather than in Build stage code). Therefore please post any error message; there is not enough information for us to suggest anything more.
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-0256 (S) A parameter of type "int" cannot be initialized with an expression of type "const char [2]".
"File Scope Code (buildop/SSN_JEN_FIX.opd)", line 103.18: 1540-1205 (I) The error occurred while converting to parameter 2 of "index(const char *, int)".
Thanks,
Seth
You don't need a buildop for this. if you create a stage variable inside a transformer using the following code :
index is a Basic function only available inside a ttransformer. It is not a c function
Is there a way to do this inside the C code buildop? We would have to modify a lot of jobs if we do it with a transform and we would like to do this with the buildop.
1)You can find the occurrence of sub string in string using offsetOfSubstring() function, It is a APT_STRING function.
2)If sub string is found then find the index of sub string using occurrences() function,it is also a APT_STRING function.[/i]