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'};
}
ascii to ebcdic or ebcdic to ascii translation
Moderators: chulett, rschirm, roy
ascii to ebcdic or ebcdic to ascii translation
William Black
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,
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.
All generalizations are false, including this one - Mark Twain.
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