0

Convert::IBM390EBCDIC ファイルを 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 データにリトル エンディアンまたはビッグ エンディアンの整数が含まれていると問題が発生します。

これらの文字のアンパックを検索してN/n V/vを使用しましたが、このモジュールでは受け入れられません。としてエラーが発生しました

Invalid type in unpackeb: 'N'

メインフレームからの EBCDIC FILE は、次の列で構成されます。

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)

助言がありますか ?

4

1 に答える 1