in reply to Re: Add new line character to and ebcdic file
in thread Add new line character to and ebcdic file

No i am not removing \n from the ascii lines. I convert the \n to EBCDIC. But when i print all the records into a file, i find all the records in one line rather than each record a line.
  • Comment on Re^2: Add new line character to and ebcdic file

Replies are listed 'Best First'.
Re^3: Add new line character to and ebcdic file
by hdb (Monsignor) on Apr 15, 2013 at 09:47 UTC

    On your ASCII based machine, this is to be expected unless your editor supports EBCDIC. How does the file look on the mainframe? Do you also see everything in one line?

Re^3: Add new line character to and ebcdic file
by Anonymous Monk on Apr 15, 2013 at 10:29 UTC
    Where did the newline go?
    $ perl -MData::Dump -MConvert::EBCDIC -e " dd Convert::EBCDIC::ascii2e +bcdic(qq{hi\n}); " "\x88\x89%" $ perl -MData::Dump -MConvert::EBCDIC -e " dd Convert::EBCDIC::ascii2e +bcdic(qq{\r\n}); " "\r%" $ perl -MData::Dump -MConvert::EBCDIC -e " dd Convert::EBCDIC::ascii2e +bcdic(qq{\n}); " "%"

    % must be ebcdic for \n

      I can see '%' in my output file. Here is the sample of how it is being printed:
      ð÷ððððððððððòðòòðõñóðóñðóðððóùðòøøð +ðððððððððððððððððððððððððððÃððððððð +ððððððððððððððððððððððððððððððððððà +°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ãðððððððððððð%ð +÷ðòñ@@@@@@@ðñðñõòòðñóðòòôððóòñöóñðöùö@@ +@óðõòõñùòñöððððôùøöóùöõòðùõ@@ð@@ððõùð +ððððððð@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ðò@ððððððððððà +°Ã°Ã°Ã°Ã°Ã°Ã°Ã°Ã@@@@@@@@@@@@@@@@@@@@@@@@@%ð÷ðòñ@@@@@@@ðñðñõ +òòðñóðòòôððóòñöóñðöùö@@@óðõòõñùòñöðð +ðÃ÷ðóøøöòðððóðóôùøöóùöõòðùõ@@ð@@ððõùð +ððððððð@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ðò@ðððððÃ@@@@@@@@@@ +@@@@@@@@@@@@@@@@@@@@@@@@@@@@%
      I need the above to be printed line by line not continously.
        I get an input file, which i read line wise and then convert each record from ascii to ebcdic format. After conversion, i have to write this to an output file. Then read the next record and do the same and print it in the next line.

        Why do you need to print out the ebcdic file into a human readable ascii format? In your op your requirement is to convert the input file record by record into ebcdic lines which you have done. This is then then sent to IBM. IBM will presumably do any necessary conversions into readable formats if they need to.

        Asked in different words: What you want is translate everything to EBCDIC except the newlines so that you can look at the output on your ASCII terminal?