Convert Special Character Issue

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
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Convert Special Character Issue

Post 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
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Press CTRL + Shift +6+6 in Microsoft word to get the character. Copy the character and paste in the transformer
You are the creator of your destiny - Swami Vivekananda
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post 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
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use this command to remove the special character in your input file

Code: Select all

tr -d \\036 < input file
You are the creator of your destiny - Swami Vivekananda
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi,

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

Thanks everyone for the inputs.
NJ
Post Reply