I have written like this in my code, but my operator is not generated.
can you please tell me what else I need to add.
how should I specify the header file declarations.
here my input column is CloseDate(in the varchar datatype) and output column(which is in timestamp datatype ) is outdate
out.outdate= in.CloseDate;
out.myTmsp.set(in.CloseDate, "%yyyy-%mm-%dd %hh:%nn:%ss.000000");
---Thanks
bcarlson wrote:Okay, here's an example.
Datafile:
0001|2005-07-04 10:15:01.123456
0002|2005-07-04 10:25:02.123456
0003|2005-07-04 10:35:03.123456
0004|2005-07-04 10:45:04.123456
0005|2005-07-04 10:55:05.123456
Sequential Stage input schema:
Buildop uses the same schema as input, and the same for output, except a new field called myTmsp is added at the end (definition = myTmsp: nullable timestamp[microseconds].Code: Select all
-schema record {final_delim=end, record_delim='\\n', delim='|', null_field=''} ( recid:int32 {max_width=4}; datetimeString:nullable string[26] {max_width=50}; )
Buildop logic:
The whole job is seq -> buildop -> datasetCode: Select all
out.recid = in.recid; out.datetimeString = in.datetimeString; // Example input date string is "2005-07-04 10:15:01.123456" // Populate myTmsp from datetimeString using set() function out.myTmsp.set(in.datetimeString, "%yyyy-%mm-%dd %hh:%nn:%ss.6");
Contents of the dataset (generated with orchadmin dump -name mydataset.ds):
recid:1 datetimeString:2005-07-04 10:15:01.123456 myTmsp:2005-07-04 10:15:01.123456
recid:2 datetimeString:2005-07-04 10:25:02.123456 myTmsp:2005-07-04 10:25:02.123456
recid:3 datetimeString:2005-07-04 10:35:03.123456 myTmsp:2005-07-04 10:35:03.123456
recid:4 datetimeString:2005-07-04 10:45:04.123456 myTmsp:2005-07-04 10:45:04.123456
recid:5 datetimeString:2005-07-04 10:55:05.123456 myTmsp:2005-07-04 10:55:05.123456
As for finding these functions, I guess the documentation is really lacking - the PX doc has no mention of the buildop functions. You'll need to look in the header files themselves: <your Ascential root dir>/DataStage/PXEngine/include/apt_util/time.h
Hope this helps.
Brad.