Returning array from BuildOp
Moderators: chulett, rschirm, roy
Returning array from BuildOp
Hi All, I have created a BuildOp stage which needs to return an array value. I need to return the value in date_out4 via the output interface outdata1. How can we return an array from BuildOp to datastage. What datatype we need to mention in datastage for date_out4? I tried like below,
APT_String date_out4[8];
oudata1.date_out4[1]=year1;
oudata1.date_out4[2]=month1;
oudata1.date_out4[3]=day1;
But it is giving error as follows... Please help
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 768.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 45: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 46: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 47: Error: The left operand cannot be assigned to.
3 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource19638-0.C -o /tmp/bosource19638-0_s.o.
APT_String date_out4[8];
oudata1.date_out4[1]=year1;
oudata1.date_out4[2]=month1;
oudata1.date_out4[3]=day1;
But it is giving error as follows... Please help
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 768.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 45: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 46: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 47: Error: The left operand cannot be assigned to.
3 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource19638-0.C -o /tmp/bosource19638-0_s.o.
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Thank You For Your Reply...I tried as follows...
[b]APT_String date_out4[8],temp[8];
temp[1]=year1;
temp[2]=month1;
temp[3]=day1;
outdata1.date_out4=temp;[/b]
I got the error as follows..
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 48: Error: Cannot assign APT_String* to APT_String without "APT_String::operator=(const APT_String&)";.
1 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource26803-0.C -o /tmp/bosource26803-0_s.o.
[b]And I tried as....[/b]
[b]APT_String date_out4[8],temp[8];
temp[1]=year1;
temp[2]=month1;
temp[3]=day1;
outdata1.date_out4[1]=temp[1];
outdata1.date_out4[2]=temp[2];
outdata1.date_out4[3]=temp[3];
writeRecord(0);[/b]
I got the error as...
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 768.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 48: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 49: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 50: Error: The left operand cannot be assigned to.
3 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource28236-0.C -o /tmp/bosource28236-0_s.o.
Any idea of how to return an array value???
[b]APT_String date_out4[8],temp[8];
temp[1]=year1;
temp[2]=month1;
temp[3]=day1;
outdata1.date_out4=temp;[/b]
I got the error as follows..
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 48: Error: Cannot assign APT_String* to APT_String without "APT_String::operator=(const APT_String&)";.
1 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource26803-0.C -o /tmp/bosource26803-0_s.o.
[b]And I tried as....[/b]
[b]APT_String date_out4[8],temp[8];
temp[1]=year1;
temp[2]=month1;
temp[3]=day1;
outdata1.date_out4[1]=temp[1];
outdata1.date_out4[2]=temp[2];
outdata1.date_out4[3]=temp[3];
writeRecord(0);[/b]
I got the error as...
Operator Generation Failed
buildop -f -BC /auto/opt/Studio8/SUNWspro/bin/CC -BL /auto/opt/Studio8/SUNWspro/bin/CC -C buildop -H buildop -O buildop -W buildop buildop/date.opd
##E TBLD 000000 Subprocess command failed with exit status 768.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/date.opd)", line 48: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 49: Error: The left operand cannot be assigned to.
"Per-Record Code (buildop/date.opd)", line 50: Error: The left operand cannot be assigned to.
3 Error(s) detected.
##I TBLD 000000 /auto/opt/Studio8/SUNWspro/bin/CC -KPIC -O -I/detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop -I/detld2/etl/ascential/Ascential/DataStage/PXEngine/include -dalign -O -PIC -library=iostream -c /detld2/etl/ascential/Ascential/DataStage/Projects/SFB/buildop/bosource28236-0.C -o /tmp/bosource28236-0_s.o.
Any idea of how to return an array value???
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
What I meant was to use a temporary char variable as below
Code: Select all
char tempStr[9]; // assuming 8 + 1 null
outdata1.date_str4 = tempStr; // direct setting without positional values
Re: Returning array from BuilOp
Never having tried a buildop I'm not sure what an APT_String is but guess a char pointer which then asks what are you trying to return, a set of dates or just one date?Grace J. wrote: APT_String date_out4[8];
oudata1.date_out4[1]=year1;
oudata1.date_out4[2]=month1;
oudata1.date_out4[3]=day1;
If just one date, return just one string and strip it into day/month/year in DS (pretty much what Sainath has suggested).
If a set of dates, then you need to allocate space to the string for each date or assign date_out4 to the address of year1 etc (date_out4 looks to be a pointer, therefore it needs to look at an address not a value).
From what I can see, option 1 is what you are looking for.
(Of course, this is quite likely down to the fact I haven't done a buildop but why have you declared a date_out4 and then attempt to assign a value to oudata1.date_out4?)
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom