Problems with simple buildops

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
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Hi Bob,

Sorry I can't help you with your specific problem.

Just a word of caution though... Don't reinvent the wheel.

Parallel jobs already have a lot of builtin functions like Field, Index, Len, etc.

Mike
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Look at the documentation for buildops or read the header files ($APT_ORCHHOME/include/apt_util). They are broken out by datatype and have tons of examples. Odds are good that most of what you are looking for already exists. Like Mike said, don't reinvent the wheel - unless you can make a better one!

Brad.
It is not that I am addicted to coffee, it's just that I need it to survive.
boxtoby
Premium Member
Premium Member
Posts: 138
Joined: Mon Mar 13, 2006 5:11 pm
Location: UK

Post by boxtoby »

Thanks guys, most helpful.

I certainly agree that we don't want to reinvent the wheel, but sometimes these things can be useful!

Bob.
Bob Oxtoby
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Sorry, didn't mean to ive the wrong impression. Buildops are awesome - we have chosen to use them over transformers in all of our jobs.

What I meant was that I am guessing much of the functionality you are looking for is already available in buildops. For example, I know there is a length function for strings:

Code: Select all

myint = in.myString.length();
If you need to copy strings or do substrings, use the = and substring functions:

Code: Select all

out.newString = in.oldString;
out.newString = in.oldString.substring(0,5);
I am not familiar with Field and Index, as I have never done any Basic or routines. Hope this provides a good start.

Brad.
It is not that I am addicted to coffee, it's just that I need it to survive.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

There is a string function available for buildops that returns the standard C-type string array for an input datatype APT_String:

Code: Select all

    const char buffer[];
    buffer = in.myStrField.terminatedContent();
You can get the length of buffer using the following:

Code: Select all

    int len = strlen(buffer);
Hope this helps.

Brad.
It is not that I am addicted to coffee, it's just that I need it to survive.
Post Reply