Hi,
a few weeks ago I saw a questiion about using perl to convert
packed decimal fields (COBOL comp-3 ) to decimals.
the following perl fuction will do the job on HP3000 and HP9000 processors:
sub pack2dec {
my $packfield = shift;
my $num = unpack('H*',$packfield);
my $sign = 1;
if ( $num =~ /[FD]/ ){
$sign = -1;
}
$num =~ s/\D.*//g;
$num = $sign * $num;
return $num;
}
thanks
Michael
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *