Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Add new line character to and ebcdic file

by jethro (Monsignor)
on Apr 15, 2013 at 08:33 UTC ( #1028702=note: print w/ replies, xml ) Need Help??


in reply to Add new line character to and ebcdic file

Are you removing the \n from the ascii lines with chomp? If yes, don't do that and presumably the EBCDIC lines should have the EBCDIC equivalent of \n at the end.

If this isn't the answer, could you tell us why there should be an \n at the end of a line even though the source file doesn't have one?


Comment on Re: Add new line character to and ebcdic file
Re^2: Add new line character to and ebcdic file
by gkol0279 (Initiate) on Apr 15, 2013 at 09:26 UTC
    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.

      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?

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1028702]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2014-07-31 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls