CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Add new line character to and ebcdic file


New User

Apr 15, 2013, 12:46 AM

Post #1 of 2 (701 views)
Add new line character to and ebcdic file Can't Post

Hi, i am a bit new to perl. Need an answer:
I wrote a script to convert an ascii file into an ebcdic file using the Convert::EBCDIC qw(ebcdic2ascii ascii2ebcdic).

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.
After conversion this file will be sent to IBM mainframe system for further processing. Now what is happening is i append "\n" to print the next record in a new line and the \n will be in ascii and not EBCDIC.

How can i convert the \n to be ebcdic in file and yet work as ascii while printing? Any suggestions?


Apr 15, 2013, 11:57 AM

Post #2 of 2 (684 views)
Re: [gkol0279] Add new line character to and ebcdic file [In reply to] Can't Post

Your are probably asking the wrong question. Perl's /n is a 'logical' newline. By default perl I/O maps it to the character (or sequence) used by the operating system that is running. Perl uses \012 which is also what unix uses. This character is the same in ASCII and EPCIDIC.

I have not used an IBM mainframe in over fifteen years. What I remember may be all wrong today. Back in the day, IBM did not have anything called a 'file'. This was much deeper than just a naming convention. Data was stored as a sequence of records, not characters. There were many ways to store these records (none of them involved a newline sequence at all). The choice depended on the data.

Today you also have internet conventions. I have no idea how IBM deals with them.

I know that I am not offering much practical advice, but I do hope I am helping you to ask the right questions.
Good Luck,


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives