Archives of the TeradataForum
Message Posted: Wed, 08 Sep 2004 @ 13:25:03 GMT
Subj: | | Re: Load ASCII using TDAT Utility with HEX input data. |
|
From: | | Geoffrey Rommel |
| I have a client sending me data to load that contains packed decimal columns. I thought that would be easy enough to handle, but it turns
out that the values inside the packed fields are hexadecimal. | |
I take you to mean that the fields contain the usual stuff that is in packed fields. For instance, '01234C'x is a packed-decimal field of 3
bytes (5 digits) with the value +1234; the C in the final nybble is a positive sign. If it does not look like valid packed fields, it was probably
garbled in the FTP transmission, and you'll have to start over.
(By the way, everybody, it is not really correct to say that a field contains "hexadecimal values". Every field contains hexadecimal values!
Hex is just another way of spelling out what is in the bytes.)
> DEFINE
> ID_COL (CHAR(1))
> ,SIZE_CODE (DECIMAL(5,0)) <==== This is defined
> on the client provided record layout as "S9(05) Comp-3".
> FILE = TEST_LOAD.DAT;
Decimal(5,0) would be correct if you were running from the mainframe. Since you are specifying an actual file name, I take it that you
are running this on a Unix or Windows client. Seems to me you have these options:
1. Run FastLoad or MultiLoad from the mainframe instead.
2. Run the file through a conversion before loading it. You can avoid writing your own conversion code by using Perl and the Perl
module Convert::IBM390.
3. Write an INMOD to convert the records on the fly -- faster to run but slower to write.
|