ascii to ebcdic or ebcdic to ascii translation

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
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

ascii to ebcdic or ebcdic to ascii translation

Post by wblack »

I'm using a column import that takes a schema file and reads in a file that's partially ascii and partially ebcdic. Most columns are either ascii or ebcdic and can be specified which in the schema file but I have one that consist of both ascii and ebcdic characters so I have to read it in that way. Is there a way of translating data character by character from within a single column. I was thinking about using the looping portion of the transformer and then translating it. Is there a better way or can this even be done?

record {binary, big_endian, record_format={type=implicit}, delim=none, final_delim=none}
(
irlstno:uint32;
ircmstrt:uint8 {link_keep};
ircfnm:uint8 {link_keep};
ircuser:uint8 {link_keep};
irstrt:string[max=255] {ebcdic, reference='ircmstrt'};
iruser:string[max=255] {reference='ircuser'};
}
William Black
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Are you saying that:

1) The column can contain a string which is either all ebcdic or all ascii and that can vary from row to row, or
2) The column can contain a string which is mixed ebcdic and ascii?

If #1, is there a separate indicator which can tell you whether the string is ascii or ebcdic? If so, simply use that to split the row to one of two column import stages to convert the column data then funnel the rows back together.

You could also use a BuildOp, or maybe a parallel routine called from a transformer (both are C++), for both situations. This would be more efficient that what could be coded with transformer logic alone.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Post by wblack »

I'm saying that some fields are ascii and some are ebcdic, but there's one field that's a combination of ascii and ebcdic. The first byte is the description of the field followed by a length byte of the data followed by the data segment. The first two bytes are ascii and the data segment is ascii.
William Black
shamshad
Premium Member
Premium Member
Posts: 147
Joined: Wed Aug 25, 2004 1:39 pm
Location: Detroit,MI

Post by shamshad »

Are you downloading the file from mainframe system?
Datawarehouse Consultant
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Post by wblack »

No, the file isn't from a mainframe/
William Black
wblack
Premium Member
Premium Member
Posts: 30
Joined: Thu Sep 23, 2010 7:55 am

Post by wblack »

The first byte of the column in question has a binary indicator (description of the field), followed by a byte for the binary length of the data segment followed by the ebcdic data segment where the length byte tells the length.
William Black
Post Reply