Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Add new line character to and ebcdic file

by jethro (Monsignor)
on Apr 15, 2013 at 08:33 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1028702]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-19 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found