NAME
Convert::IBM390p -- functions for manipulating mainframe data
SYNOPSIS
use Convert::IBM390p qw(...whatever...);
$eb = asc2eb($string);
$asc = eb2asc($string);
$asc = eb2ascp($string);
$num = pdi($packed [,ndec]);
$packed = pdo($num [,outbytes [,ndec]]);
@lines = hexdump($string [,startaddr [,charset]]);
DESCRIPTION
Convert::IBM390p supplies various functions that you may find useful when messing with IBM System/3[679]0 data. No functions are exported automatically; you must ask for the ones you want.
By the way, this module is called "IBM390p" because it will deal with data from any mainframe operating system. Nothing about it is specific to MVS, VM, VSE, or OS/390.
FUNCTIONS
- asc2eb STRING
-
Converts a character string from ASCII to EBCDIC. The translation table is taken from the LE/370 code set converter EDCUI1EY; it translates ISO8859-1 to IBM-1047. For more information, see "IBM C/C++ for MVS/ESA V3R2 Programming Guide", SC09-2164.
- eb2asc STRING
-
Converts a character string from EBCDIC to ASCII. EBCDIC character strings ordinarily come from files transferred from mainframes via the binary option of FTP. The translation table is taken from the LE/370 code set converter EDCUEYI1; it translates IBM-1047 to ISO8859-1 (see above).
- eb2ascp STRING
-
Like eb2asc, but the output will contain only printable ASCII characters.
- pdi PACKED [NDEC]
-
Packed Decimal In: converts an EBCDIC packed number to a Perl number. The first argument is the packed field; the second (optional) is a number of decimal places to assume (default = 0). For instance:
pdi(x'00123C') => 123 pdi(x'01235D', 2) => -12.35 pdi(x'0C', 1) => 0
If the first argument is not a valid packed field, pdi will return the undefined value. By default, no warning message will be issued in this case, but if you set the variable $Convert::IBM390p::warninv to 1 (or any other true value), a warning will be issued.
- pdo NUMBER [OUTBYTES [NDEC]]
-
Packed Decimal Out: converts a Perl number to a packed field. The first argument is a Perl number; the second is the number of bytes to put in the output field (default = 8); the third is the number of decimal places to round to (default = 0). For instance:
pdo(-234) => x'000000000000234D' pdo(-234, 5) => x'000000234D' pdo(356.777, 5, 2) => x'000035678C' pdo(0, 4) => x'0000000C'
If the first argument is not a valid Perl number, pdo will return the undefined value. By default, no warning message will be issued in this case, but if you set the variable $Convert::IBM390p::warninv to 1 (or any other true value), a warning will be issued.
- hexdump STRING [STARTADDR [CHARSET]]
-
Generate a hexadecimal dump of STRING. The dump is similar to a SYSABEND dump in MVS: each line contains an address, 32 bytes of hexadecimal data, and the same data in printable form. This function returns an array of lines, each of which is terminated with a newline. This allows them to be printed immediately; for instance, you can say "print hexdump($crud);".
The second and third arguments are optional. The second specifies a starting address for the dump (default = 0); the third specifies the character set to use for the printable data at the end of each line ("ascii" or "ebcdic", in upper or lower case; default = ascii).
AUTHOR
Convert::IBM390p was written by Geoffrey Rommel <grommel@sears.com> in January 1999.