Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 31 Mar 2006 @ 13:58:27 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Error tables created by TD utilities
 
From:   Geoffrey Rommel

  Has anyone tried to extract/decrypt the error row from the data parcel column within the error tables created by FASTLOAD.  


Many times. DataParcel contains the record in raw bytes as it came from the source system. There may be some additional fields on the front (lengths and such). If the record came from a mainframe, the data will be in EBCDIC. The Perl script below will display the record in character and hex form.


  I would like to recycle rows put into the data conversion error table by FASTLOAD.  


Not sure what you mean here, but it would be best to correct the source data and/or the FastLoad script and rerun the job. See the FastLoad Reference, section "Handling FastLoad Errors".

     #!/usr/bin/perl
     # Take a file of printable hex digits, such as those shown in a
     # Teradata load error table, and print them in character with
     # hex vertical.
     # Options:
     #     -wN  Width at which to break the lines; default=78.
     #     -a   Show plain ASCII characters (up to '~') only. Default is
     #          to show all characters up to x'FF' except controls.
     #     -e   Assume data is EBCDIC.
     use Getopt::Std;
     getopts("w:ae");
     $WIDTH = $opt_w || 78;
     $ASCII_ONLY = $opt_a;
     $EBCDIC = $opt_e;
     if ($EBCDIC) {
        $TRAN_TBL =
       ' ' x 64 .
       '           .<(+|&         !$*); -/         ,%_>?         `:#@\'="'.
       ' abcdefghi       jklmnopqr       ~stuvwxyz   [               ]  '.
       '{ABCDEFGHI      }JKLMNOPQR      \\ STUVWXYZ      0123456789      ';
     # Printable ASCII characters
     } elsif ($ASCII_ONLY) {
        $TRAN_TBL = (' 'x32) .
          ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO' .
          'PQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ' . (' 'x128);
     } else {
        $TRAN_TBL = (' 'x32);
        for ($c = 32; $c < 127; $c++) { $TRAN_TBL .= chr($c); }
        $TRAN_TBL .= ' 'x34;
        for ($c = 161; $c < 256; $c++) { $TRAN_TBL .= chr($c); }
     }
     # "Zone" and "numeric" portions
     $ZONES = '0'x16 . '1'x16 . '2'x16 . '3'x16 . '4'x16 . '5'x16 .
      '6'x16 . '7'x16 . '8'x16 . '9'x16 . 'A'x16 .
      'B'x16 . 'C'x16 . 'D'x16 . 'E'x16 . 'F'x16;
     $NUMS = '0123456789ABCDEF'x16;
     # Dashes
     $DASHES = '-'x256;
     while (<>) {
        chomp;
        $chars = pack("H*", $_);
        print_line($chars);
     }
     # Print a line in EBCDIC|ASCII and hex with line breaks and such.
     sub print_line {
      my $line = shift;
      print fcs_xlate($line, $TRAN_TBL), "\n";
      print fcs_xlate($line, $ZONES), "\n";
      print fcs_xlate($line, $NUMS), "\n";
      print fcs_xlate($line, $DASHES), "\n";
     }
     # Full Collating Sequence translation
     sub fcs_xlate {
      my ($in, $table) = @_;
      my ($i, $result);
      $result = '';
      for ($i=0; $i < length($in); $i++) {
         $result .= substr($table, ord(substr($in, $i,1)), 1);
      }
      return $result;
     }


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023