|
|
Archives of the TeradataForum
Message Posted: Mon, 24 Feb 2003 @ 20:06:19 GMT
Subj: | | Re: Fastload Error Table question |
|
From: | | Geoffrey Rommel |
| Is there a way to unload the Dataparcel column from the Error1 table from a Fastload into a CHAR format? | |
The following Perl program, although rudimentary, will do the trick. Convert::IBM390 is available from CPAN.
#!/usr/bin/perl -w
#--- TERADATA UTILITY
# Take the hex digits shown in a FastLoad or MultiLoad error table
# and display them in characters, either as ASCII or as EBCDIC.
# NOTE: The printed characters will not necessarily be the same as
# the input; they may contain blanks where the original was null, etc.
#
# Syntax: $0 [-ae] [filename]
# -a Display records as ASCII (default)
# -e Display records as EBCDIC
# filename File containing the printed hex digits as shown in the
# error table. stdin may be used.
#
use Getopt::Std;
use Convert::IBM390 qw(eb2ascp);
$opt_e = '';
getopts('ae');
$charset = ($opt_e) ? 'ebcdic' : 'ascii';
while (<>) {
chomp;
$orig = pack('H*', $_);
if ($charset eq 'ebcdic') { print eb2ascp($orig), "\n"; }
else { print "$orig\n"; }
}
| |