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


In reply to Re: MCP Format Data by Old_Gray_Bear
in thread MCP Format Data by SteveS832001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.