Great and wise perl monks. I seek wisdom.
I have a UNIX shell script on Sun/Solaris 10. In my script I ftp a file to the MVS mainframe (binary mode of course). There are several fields in each row of data in the file that need to be compressed into the MVS packed decimal (comp-3) format prior to ftp'ing the file to the mainframe dataset. I want to us a perl inline command (see below) in the UNIX shell script (if possible) in order to make those field conversions.
/usr/bin/perl -wpe 's/([0-9A-Za-z]{9})/pack("C",hex($1))/ge' < input_file > output_fileWhat I am wondering is: A. Is this even possible? B. If it is possible, is there a specific template to use in the pack function call (ie. I don't think "C" is the correct one etc.) in order to convert specific fields in each row of data to packed decimal (comp-3) format? (ie. the fields on MVS are PIC 9(7) COMP-3, or PIC 9(9) COMP-3 etc.)
Many kind thanks for your specific response regarding this specific solution. (I did read through the history logs but did not find a mention of this specific solution). jayw
In reply to ASCII text on UNIX (Sun/Solaris 10) to MVS packed decimal (comp-3) using perl pack inline command by jayw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |