Hi
I was recently asked to convert Ascii to ebcdic packed for a os390 mainframe, I'm using the packeb function but the client says it is not the desired output. I'm a bit clueless of the mainframe enviroment, if there is someone that can advise.
I wrote a small script just to test the output here goes:...
Difinition & Layout
These are 6 fields of a 97 field layout
--------------------------------------------------------
FLD W 80 A
FLD-1 FLD 2 P VALUE 001
Pic s9(3) Comp-3
FLD-2 FLD +02 2 P VALUE 001
Pic s9(3) Comp-3
FLD-3 FLD +04 3 P VALUE 00000
Pic s9(5) Comp-3
FLD-4 FLD +07 2 P VALUE 000
Pic s9(3) Comp-3
FLD-5 FLD +09 3 P VALUE 00000
Pic s9(5) Comp-3
FLD-6 FLD +11 5 A VALUE 'FNUT '
Pic x(5)
---------------------------------------------------------
Code
Here is the code I tried. I don't know how to test the output I currently send it to the client,to test it on the mainframe, but if you know of a win32 viewer that I can use to test the output for OS390, will be awsome.
-----------------------------------------------------------
#!c:\perl\bin\perl -w
use Convert::IBM390 qw(:all);
unless (open(OUTPUT, ">a2e.txt")) {
die ("cannot open configuration file \n");
}
@var=("001","001","00000","000","00000","FNUT");
foreach(@var)
{
print $_;
}
#$template='p1.0 p1.0 p3.0 p1.0 p3.0 E5';
$template='p3 p3 p5 p3 p5 E5';
$ebout = packeb($template, @var);
print OUTPUT ($ebout);
-----------------------------------------------------------
Thank You
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.