Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Curtis Johnson <Curtis dot Johnson at OAG dot STATE dot TX dot US>
Subject: Packed Fields (BCD)
Date: Sep 21 1998 3:42PM

I realize that this question is not exactly specific to sybperl..
but I thought there might be a few people that have run into
this issue on this list...

We have a file that has packed decimal fields (specifically,
Driver License Number) and we need to bcp this or a
modified file into a Sybase table.  

It is my understanding that packed decimal is just
binary-coded decimal, with the last 4 bits representing the
sign.  I understand how to read and convert it (on paper...),
but I have some 17 million rows...

Are there any functions (sybase, perl, sybperl) that handle
such conversions for me?  I thought that my best bet would
be to read the file and write a new one (with a PERL script)
that is in standard sybchar data type format...

Any ideas?