Custom Stage in Windows

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
ks489
Participant
Posts: 14
Joined: Fri Apr 15, 2005 1:45 pm

Custom Stage in Windows

Post by ks489 »

Hi,

I would like to develop a Custom stage in windows environment.

I found out that there is no PXEngine/examples in windows server unlike its unix counterpart.

So i just copied hello.C and hello.h files in windows and tried to compile with VC++ 7.0

But i got error like <stings.h> not found . I guess this header file is very specific to unix environment. If i have to develop in windows, can any one guide me what would be the steps. I have read documentation about unix, but could not find any under windows environment.

Also like shared objects (so) in unix, we need to build dll in windows? how can we do that ? any one knows nmake or make utility /commands to achieve this.

regards,
Kash.
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Re: Custom Stage in Windows

Post by sud »

Search this forum my dear friend :D
It has been covered number of times before.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

<stings.h> ought not to be found. Try <string.h> or <strings.h> (depending on your actual header file name). Compiler options are required to tell the compiler where the header files are.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Also try #include "string.h". See if your compiler recognizes that.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ks489
Participant
Posts: 14
Joined: Fri Apr 15, 2005 1:45 pm

Re: Custom Stage in Windows

Post by ks489 »

Thanks Ray, DSGuru

The file i have mentioned, is defined in one of the framework include folder.
<apt_util/rtti.h>

So i am not very confident modifying this file to some other name like "string.h" or <string.h>

What is surprising is there is no documentation what so ever for Windows DS EE (7.5.x2) which comes with standard installation.

All the documents refer to unix operating system.

Also like shared objects (so) in unix, we need to build dll in windows? how can we do that ? any one knows nmake or make utility /commands to achieve this.

regards,
Kash.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What does your helloworld.c program look like. Can you paste it here so that i can compile and run it on my unix box and confirm whether the code is correct or you really are missing the "string.h" library.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ks489
Participant
Posts: 14
Joined: Fri Apr 15, 2005 1:45 pm

hello.C

Post by ks489 »

I really appreciate your gesture DSGuru.

Here is the code:
There are basically two files
hello.h and hello.C

Basically hello.h has a macro APT_DECLARE_RTTI(HelloWorldOp);
now this macro is including <rtti.h>, which in return includes string.h

// -------------------------------------------------------------------
// hello.h -- a trivial operator written using Orchestrate's C++ API.
//
// Copyright (C) 1997 Torrent Systems, Inc. All Rights Reserved.
// Torrent Systems, Inc. grants licensed ORCHESTRATE users permission to
// copy and modify this program for development of ORCHESTRATE applications.
//
// Purpose: Prints "Hello, World" a specified number of times,
// and copies its input stream to its output stream
// -------------------------------------------------------------------

#include <apt_framework/orchestrate.h> // for Orchestrate classes and functions

// All operators are derived from the APT_Operator class
class HelloWorldOp : public APT_Operator
{
// These macros define Orchestrate's persistence mechanism for this operator
APT_DECLARE_PERSISTENT(HelloWorldOp);
APT_DECLARE_RTTI(HelloWorldOp);

public:
// Constructor
HelloWorldOp();

//
// C++ initialization methods for this operator
// (called from the initializeFromArgs_ method)
//

// sets number of times to print
void setNumTimes(APT_Int32 numTimes);

// sets whether to print in uppercase
void setUppercase(bool uppercase);

protected:

// OSH initialization function -- makes operator "OSH-aware"
virtual APT_Status
initializeFromArgs_(const APT_PropertyList &args,
APT_Operator::InitializeContext context);

// Pre-parallel initialization
virtual APT_Status describeOperator();

// Parallel execution method
virtual APT_Status runLocally();

private:

//
// Member variables and internal methods
//

// number of times to print
APT_Int32 numTimes_;

// whether to print in upper case
bool uppercase_;

};




FILE 2::hello.C
// -------------------------------------------------------------------
// hello.C -- a trivial operator written using Orchestrate's C++ API.
//
// Copyright (C) 1997 Torrent Systems, Inc. All Rights Reserved.
// Torrent Systems, Inc. grants licensed ORCHESTRATE users permission to
// copy and modify this program for development of ORCHESTRATE applications.
//
// Purpose: Prints "Hello, World" a specified number of times,
// and copies its input stream to its output stream
//
// Input Schema: record ( in:* )
// Output Schema: record ( out:* )
//
// -------------------------------------------------------------------

// Operator header file
#include "hello.h"
#include <apt_framework/osh_name.h>

// These macros define Orchestrate's persistence mechanism for this operator
APT_IMPLEMENT_RTTI_ONEBASE(HelloWorldOp, APT_Operator);
APT_IMPLEMENT_PERSISTENT(HelloWorldOp);
APT_REGISTER_OPERATOR(HelloWorldOp, hello);

// Operator constructor
HelloWorldOp::HelloWorldOp()
: numTimes_(1),
uppercase_(false)
{}

//
// C++ initialization methods for this operator
// (called from the initializeFromArgs_ method)
//

// sets number of times to print
void
HelloWorldOp::setNumTimes(APT_Int32 numTimes) {
numTimes_ = numTimes;
}

// sets whether to print in uppercase
void
HelloWorldOp::setUppercase(bool uppercase) {
uppercase_ = uppercase;
}

//
// OSH initialization function -- makes operator "OSH-aware"
//
// This method is called by OSH to initialize the operator from its
// command-line arguments. OSH calls this method with the property list
// that was generated by the operator's wrapper file.
//
// This method is called twice, with different values for "context":
//
// 1. context == eInitial --> before describeOperator() is called
// 2. context == eRun --> before runLocally() is called
//
// You can initialize on the eInitial call (as this example does)
// and use Orchestrate's persistence mechanism to distribute the
// initialization data. In this case, the eRun call does nothing.
//
// You can also initialize the operator identically on both calls,
// and ignore the persistence mechanism altogether. For simple operators
// that don't have a lot of internal "state", this might be preferable.
//

// macros used in initializeFromArgs_()
#define isNumber(PROP) ( PROP.kind() == APT_Property::eDFloat )
#define getDFloat(PROP) ( PROP.valueDFloat() )
#define getInt32(PROP) ( (APT_Int32) PROP.valueDFloat() )
#define isInt32(PROP) ( getDFloat(PROP) == getInt32(PROP) )

// OSH initialization function
APT_Status
HelloWorldOp::initializeFromArgs_(const APT_PropertyList &args,
APT_Operator::InitializeContext context)
{
APT_Status status=APT_StatusOk;

// do nothing on eRun call
if (context == APT_Operator::eRun) return status;

// iterate over property list
int i, nprops = args.count();
for (i = 0; i < nprops && status==APT_StatusOk; i++) {

// get the name of the property item
APT_Property prop = args;
APT_Identifier name(prop.name());

// uppercase property, sets boolean flag if present
if (name == "uppercase") {
setUppercase(true);
}

// numtimes property, sets numTimes_ value
else if (name == "numtimes") {
if (isNumber(prop) && isInt32(prop))
setNumTimes(getInt32(prop));
else {
cout << "Error: 'numtimes' property is not an integer." << endl;
status = APT_StatusFailed;
}
}

else {
cout << "Error: Unrecognized property '" << name << "'." << endl;
status = APT_StatusFailed;
}
}

return status;
}

//
// Orchestrate persistence mechanism
//
// This method is called before the operator is parallelized,
// to archive the values of its member variables,
// and again after parallelization, to restore those variables
// from the archived values in each parallel copy of the operator.
//

void
HelloWorldOp::serialize(APT_Archive& archive, APT_UInt8)
{
archive || numTimes_;
archive || uppercase_;
}

//
// Pre-parallel initialization
//
// This method is called just before the operator is parallelized,
// to set important operator properties
//

APT_Status
HelloWorldOp::describeOperator()
{
// select parallel execution
setKind(eParallel);

// set number of inputs/outputs
setInputDataSets(1);
setOutputDataSets(1);

// set input/output schemas and define transfer
setInputInterfaceSchema("record ( in:* )", 0);
setOutputInterfaceSchema("record ( out:* )", 0);
declareTransfer("in", "out", 0, 0);

// this operator has no "state", and hence is checkpointable
setCheckpointStateHandling(eNoState);

return APT_StatusOk;
}


// Parallel execution method
APT_Status
HelloWorldOp::runLocally()
{
APT_Status status = APT_StatusOk;

// define a cursor for the input data set
APT_InputCursor inCur;
setupInputCursor(&inCur, 0);

// define a cursor for the output data set
APT_OutputCursor outCur;
setupOutputCursor(&outCur, 0);

// iterate over the available input records
while(inCur.getRecord() && status == APT_StatusOk) {

// transfer the record from "in" to "out"
transfer(0);

// write the output record
outCur.putRecord();
}

// print "hello, world" specified number of times
int i;
for (i=0; i<numTimes_; i++) {
if (uppercase_)
cout << "Hello, World" << endl;
else
cout << "hello, world" << endl;
}

return status;
}
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

These are not C routines. These are Orchestrate C++ API's. :?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ks489
Participant
Posts: 14
Joined: Fri Apr 15, 2005 1:45 pm

C++ Apis

Post by ks489 »

DSguru2B wrote:These are not C routines. These are Orchestrate C++ API's. :? ...
Thts right, DSGuru Orchestrate C++ APIs. i have been trying to develop a custom stage using these routines. But as it is under Windows i did not find any supporting document for the same.

I started off with helloworld.C to see clear my fundas and then i can move further. But got stuck, as it is not compiling under windows.

Regards,
Kash.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Does the transformer stage work at your end? If you are having compilation problems with that as well then you have to set the compiler and linker environment variables properly.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ks489
Participant
Posts: 14
Joined: Fri Apr 15, 2005 1:45 pm

Compiler works fine.

Post by ks489 »

DSguru2B wrote:Does the transformer stage work at your end? If you are having compilation problems with that as well then you have to set the compiler and linker environment variables properly. ...
Yep, Transformer stage works fine. So i guess the Compiler options are working fine for VC++ .net compiler.

-Kash.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, kinda running out of options here. Get in touch with support and report your issue to them. See what they have to say.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply