我正在使用Convert::IBM390
将 EBCDIC 文件转换为 ASCII 文件。
#!/usr/bin/perl -w
use warnings;
use Convert::IBM390 qw(:all);
open EBCDIC, "<D:/EBCDIC.txt" or die "error -> opening $!";
open ASCII, ">D:/ASCII.txt" or die "error -> opening $!";
my $text;
my $template = 'e15.0 e15 z4 I2 I2 i2 N16.0 p11.0';
binmode EBCDIC;
while (read (EBCDIC, $buffer, 67))
{
@fields = unpackeb($template, $buffer);
$text= join(",",@fields);
print ASCII $text."\n";
}
close EBCDIC;
close ASCII;
我在这个链接中得到了这个脚本
当 EBCDIC 数据包含Little Endian 或 Big Endian整数时,我遇到了问题。
我已经搜索了解包这些字符并使用了N/n V/v但这些东西在这个模块中不被接受。错误为
Invalid type in unpackeb: 'N'
来自大型机的 EBCDIC 文件包含以下列:
EBCDIC Decimal(15,0)
EBCDIC String(15)
Zoned Decimal(4)
unsigned little endian integer(2)
unsigned big endian integer(2)
signed big endian integer(2)
big endian decimal(16,0)
packed decimal(11,0)
有什么建议么 ?