Non-ascii character problem

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
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Non-ascii character problem

Post by abc123 »

I have to read a file which when I do:
od -xc
gives the characters as follows:

1 2 3 4 272 5 6 7 272 \r \n

272 is the field delimiter. How do I tell Datastage to ignore this character?

What I thought:
1)Read the columns as 1 more, for example, the first column above as char(5) and use a Left function downstream.

2)On the sequential fle stage, use the Filter option and use a Unix command. I don't know how to do this. Help appreciated.

Any other ideas?
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Fixed-width file or delimited file?

Since you say that character is a delimiter, I would assume it is a variable delimited file.

Just define that character as your delimiter character.

If it is a fixed-width file, just define char(1) fillers to consume the characters that you want to ignore.

Mike
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

It is not a fixed width file. I thought of defining that character as a delimiter but I don't know what that character is. It is not one of the ASCII or extended ASCII characters. It looks like a temperature degree sign but how do I put that as a delimiter?
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Just try a regular copy&paste. It might just end up looking like a box in DataStage, but that would only mean DataStage can't display the pasted value. I like to use ^A (0x01) as a delimiter in delimited files, and the only way I know to enter it is via copy&paste.

Mike
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When you import the table definition specify &h0110 as the delimiter character.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Ray, where in the 'Import Orchestrate Schema' window would you specify that?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This isn't an Orchestrate schema, so you should not be using that option. You should be using Import > Table Definition > Sequential File.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

When I enter &h0110 in the Other Delimiter box, I get the error message:

Error: invalid character specification '&0h110'. You can enter any single character, or you can enter the ASCII code for a character either as a decimal number, or as atwo hexadecimal digits prefixed by &H. To specify no quote character, use 000 or &H00.
stuartjvnorton
Participant
Posts: 527
Joined: Thu Apr 19, 2007 1:25 am
Location: Melbourne

Post by stuartjvnorton »

abc123 wrote:When I enter &h0110 in the Other Delimiter box, I get the error message:

Error: invalid character specification '&0h110'. You can enter any single character, or you can enter the ASCII code for a character either as a decimal number, or as atwo hexadecimal digits prefixed by &H. To specify no quote character, use 000 or &H00.
Your '0' and 'h' are swapped around.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

I mistyped it in the error message.
bashbal
Premium Member
Premium Member
Posts: 23
Joined: Mon Mar 01, 2004 12:26 pm
Location: Milwaukee, WI
Contact:

Use Hex value for delimiter

Post by bashbal »

The file dump od -xc shows the delimiter in octal format. The value 272 translates to Hex BA or Decimal 186.

Specifying this delimiter in a Server sequential stage is obvious; you just enter the decimal 186 or &hBA in the delimiter field. This is readily available in the Help.

It is also possible to do this in parallel sequential file stages properties. To do this, go to the format->Field Defaults->Delimiter and enter a backslash followed by a 'x', then the Hex value. In this case it would be "\xBA". NOTE: I did this with "Delimiter" not "Delimiter String".

I did not find this in the Help. I found it by trial-and-error.
dalvigirish
Participant
Posts: 5
Joined: Thu Dec 29, 2005 1:33 am

Post by dalvigirish »

I was able to use \x8F (delimiter is hex 8F) in delimiter string and can view the data, but can't use this string in delimiter.
Thanks and Regards,
Girish Dalvi
Post Reply