Page 1 of 1

Build op - Float comparison.

Posted: Mon Mar 05, 2007 8:12 am
by bikan
generation of build op fails for incorrect operator =='
If condition with == works fine for all string constants but fails for decimal constants.

Here is the code

Code definition.
==============
char BLOCKA=' ';
char BLOCKB=' ';
==============

code - Per records
=======================
doTransfer(0);
BLOCKA = ' ';
BLOCKB = ' ';

if (CHD_EXTERNAL_STATUS == 'B')
{
BLOCKA = 'B';
BLOCKB = 'H';
}
else if (CHD_STATUS_REASON_CODE = 89)
#==> Here is where it fail, the data is decimal and is defined decimal in metadata;

{
BLOCKA = 'Z';
BLOCKB = 'H';

}
writeRecord(0);

==============================

Error Message:

Operator Generation Failed

buildop -f -BC /usr/vacpp/bin/xlC_r -BL /usr/vacpp/bin/xlC_r -C buildop -H buildop -O buildop -W buildop buildop/BlkCode.opd

##E TBLD 000000 Subprocess command failed with exit status 256.
##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/BlkCode.opd)", line 25.33: 1540-0218 (S) The call does not match any parameter list for "operator=".

##I TBLD 000000 /usr/vacpp/bin/xlC_r -O -I/data/ds/ccs/projectlibs/dpr_ccs_dev/buildop -I/opt/tools/ds/Ascential/DataStage/PXEngine/include -O -c -qspill=32704 /data/ds/ccs/projectlibs/dpr_ccs_dev/buildop/bosource1151424-0.C -o /data/ds/tmp/bosource1151424-0_s.o.
##W TBLD 000000 Output from subprocess: "/opt/tools/ds/Ascential/DataStage/PXEngine/include/apt_util/decimal.h", line 317.16: 1540-1283 (I) "APT_Decimal::operator=(const APT_Decimal &)" is not a viable candidate.
"Per-Record Code (buildop/BlkCode.opd)", line 25.10: 1540-1289 (I) The implicit object parameter of type "APT_Decimal &" cannot be initialized with an implied argument of type "const APT_Decimal".
"/opt/tools/ds/Ascential/DataStage/PXEngine/include/apt_util/decimal.h", line 300.16: 1540-1283 (I) "APT_Decimal::operator=(APT_DFloat)" is no
##W TBLD 000000 Output from subprocess: t a viable candidate.

##W TBLD 000000 Output from subprocess: "Per-Record Code (buildop/BlkCode.opd)", line 25.10: 1540-1289 (I) The implicit object parameter of type "APT_Decimal &" cannot be initialized with an implied argument of type "const APT_Decimal".
====================================

Thanks
bikan

Posted: Mon Mar 05, 2007 8:18 am
by DSguru2B
For a check you need two equal signs. You have only one ("else if (CHD_STATUS_REASON_CODE = 89)")

Posted: Tue Mar 06, 2007 6:17 am
by bikan
I have == it was not working too. I made mistake while writing post.

Posted: Tue Mar 06, 2007 7:55 am
by DSguru2B
Do me a favour, dont type your code out, copy paste it from the buildop. This way we can see the actual code and compare it to the error message. Also surround your code in code tags please.

Posted: Wed Mar 07, 2007 3:43 am
by bikan
Here You Go...

===================================
Code definition.
==============
char BLOCKA=' ';
char BLOCKB=' ';
==============

code - Per records
=======================
doTransfer(0);
BLOCKA = ' ';
BLOCKB = ' ';

if (CHD_EXTERNAL_STATUS == 'B')
{
BLOCKA = 'B';
BLOCKB = 'H';
}
else if (CHD_STATUS_REASON_CODE == 89)
#==> Here is where it fail, the data is decimal and is defined decimal in metadata;

{
BLOCKA = 'Z';
BLOCKB = 'H';

}
writeRecord(0);

Posted: Wed Mar 07, 2007 8:51 am
by DSguru2B
I am not that experience in BuildOps, I go for routines. But instead of comparing with 89, specify a const float and initialize it with 89. Do your comparison with that variable. Also before you try that, try changing your data type to float and then run your code, unchanged, and see if the error persists. If it does, try the first suggestion I gave.

Posted: Wed Mar 07, 2007 1:21 pm
by ray.wurlod
To what object does CHD_EXTERNAL_STATUS belong? Where have you declared this?