SteveS832001 has asked for the wisdom of the Perl Monks concerning the following question:

I am using Unisys's MCP file copier I would like to be able to copy files that I need in mcp format: Is there anyway to do this with a Perl script/program. The file names would always remain the same.

I am not just trying to copy files their is a difference between the copied file and a file copied in mcp format
The reason we put it in mcp format, is so the main frame can process the files

Replies are listed 'Best First'.
Re: MCP Format Data
by Old_Gray_Bear (Bishop) on Jun 27, 2005 at 23:10 UTC
    Questions from the Gallery --
    1. Are the output records to be a fixed length (ie 94 characters)?
    2. Are the line terminations included in that length?
    3. Is there _anything_ funny about the encoding? You aren't trying to do ASCII in one side and EBCDIC out the other?

    Assuming the answers are 'yes', 'yes', and 'no', then the logic runs like this pseudo code:

    open input_file open output_file while (get-next-record) { rec_length = length(record) if (rec_length > 92) { Throw A Fit And Exit With An Error } else { record = " " x (92 - rec_length) . record ."crlf" write record to output_file } }
    English Explaination --

    Read each record in your input, pad it on the left to 92 characters, append your line termination, and write the resultant string to a new file. Repeat until done-enough.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: MCP Format Data
by Joost (Canon) on Jun 27, 2005 at 21:58 UTC
Re: MCP Format Data
by NetWallah (Canon) on Jun 27, 2005 at 22:12 UTC
    Back in the old days, SYSTEM/DUMPALL would do the re-blocking for you when necessary ...

         "There are only two truly infinite things. The universe and stupidity, and I'm not too sure about the universe"- Albert Einstein