Page 1 of 1

Convert Special Character Issue

Posted: Tue Jun 01, 2010 2:37 pm
by jagadam
Hi,

I have a requirement to convert one special character("") to empty (Need to drop this character when encountered).The sequence of keys to generate the special character is:CTRL + Shift +6.

I have used the convert function as

Convert("","",lnk_db_xfm_po_part_dimension.NM_PART).

But the transformer is throwing a compilation error

Property value cannot contain UniVerse mark characters.
Property name is: Value
Invalid data is : //
// Generated file to implement the V0S17_CopyOfCopyOfDRD5558_ex_OTO_XFM_PO_PART_DIMENSION transform operator.
//

// define our input/output link names
inputname 0 lnk_db_xfm_po_part_dimension;
outputname 0 lnk_xfm_ds_po_part_dimension;

initialize {
// define our row rejected variable
int8 RowRejected0;

// define our null set variable
int8 NullSetVar0;

// declare our intermediate variables for this section
string InterVar0_0;
string InterVar0_1;
string InterVar0_2;

// initialise constant values which require conversion
InterVar0_0 = "1845561";
InterVar0_1 = "
";
InterVar0_2 = "";
}

mainloop {
// initialise our row rejected variable
RowRejected0 = 1;

// evaluate constraint and columns for link: lnk_xfm_ds_po_part_dimension
if ((trimc_string(lnk_db_xfm_po_part_dimension.ID_PART) == InterVar0_0))
{
lnk_xfm_ds_po_part_dimension.NM_PART = replace_substring(InterVar0_1 , InterVar0_2 , lnk_db_xfm_po_part_dimension.NM_PART);
writerecord 0;
RowRejected0 = 0;
}
}

finish {
}

Will replace with: //
// Generated file to implement the V0S17_CopyOfCopyOfDRD5558_ex_OTO_XFM_PO_PART_DIMENSION transform operator.
//

// define our input/output link names
inputname 0 lnk_db_xfm_po_part_dimension;
outputname 0 lnk_xfm_ds_po_part_dimension;

initialize {
// define our row rejected variable
int8 RowRejected0;

// define our null set variable
int8 NullSetVar0;

// declare our intermediate variables for this section
string InterVar0_0;
string InterVar0_1;
string InterVar0_2;

// initialise constant values which require conversion
InterVar0_0 = "1845561";
InterVar0_1 = "*";
InterVar0_2 = "";
}

mainloop {
// initialise our row rejected variable
RowRejected0 = 1;

// evaluate constraint and columns for link: lnk_xfm_ds_po_part_dimension
if ((trimc_string(lnk_db_xfm_po_part_dimension.ID_PART) == InterVar0_0))
{
lnk_xfm_ds_po_part_dimension.NM_PART = replace_substring(InterVar0_1 , InterVar0_2 , lnk_db_xfm_po_part_dimension.NM_PART);
writerecord 0;
RowRejected0 = 0;
}
}

finish {
}

Property value cannot contain UniVerse mark characters.
Property name is: Derivation
Invalid data is : Convert("
","",lnk_db_xfm_po_part_dimension.NM_PART)
Will replace with: Convert("*","",lnk_db_xfm_po_part_dimension.NM_PART)

Property value cannot contain UniVerse mark characters.
Property name is: ParsedDerivation
Invalid data is : Convert("
", "", lnk_db_xfm_po_part_dimension.NM_PART)
Will replace with: Convert("*", "", lnk_db_xfm_po_part_dimension.NM_PART)

Can anyone please suggest me how to achieve this.

Thanks in advance

Posted: Tue Jun 01, 2010 2:49 pm
by anbu
Press CTRL + Shift +6+6 in Microsoft word to get the character. Copy the character and paste in the transformer

Posted: Tue Jun 01, 2010 3:08 pm
by jagadam
Hi,

Thanks for your reply.

To be more specific I am creating XML file and handling the reserved characters in the XML Output stage. But when the target side tried to use the XML file for their process they got the following error

ABCDE.xml: Loader is throwing errors due to invalid XML character 0x1e
Thu May 27 10:44:53 CDT 2010,Error in processing file /c/abcde.20100521-171128.xml:org.xml.sax.SAXException: **Parsing Fatal Error **
Line: 1
URI: null
Message: An invalid XML character (Unicode: 0x1e) was found in the element content of the document.
Thu May 27 10:44:53 CDT 2010,Exception during dataload task [ABCDE] :com.prosrm.taskmanager.ImException: com.prosrm.common.OperationFailedException: org.xml.sax.SAXException: **Parsing Fatal Error **

So when I looked at the source data I see a non-printable character in one of the fields which caused this issue and they recommended to use CTRL + Shift +6 sequence of keys to generate the special character and drop this character when encountered.

Thanks

Posted: Tue Jun 01, 2010 3:20 pm
by anbu
Use this command to remove the special character in your input file

Code: Select all

tr -d \\036 < input file

Posted: Tue Jun 01, 2010 3:21 pm
by chulett
You need to find the decimal value of that character and then use CHAR(xxx) in your Convert() function rather than the actual character.

Posted: Mon Jun 07, 2010 10:17 am
by jagadam
Hi,

Used CHAR(xxx) in your Convert() function and it worked.

Thanks everyone for the inputs.