ASCII 2 EBCDIC Command Line

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

ASCII 2 EBCDIC Command Line

Postby yelnocer » Mon Aug 14, 2006 1:04 pm

Is there a simple command line string that will convert file A in ASCII to File B in EBCDIC?
User avatar
yelnocer
Newbie
 
Posts: 2
Joined: Sun Aug 13, 2006 11:00 pm

Re: ASCII 2 EBCDIC Command Line

Postby Mofi » Mon Aug 14, 2006 2:23 pm

No. The page Command Line Parameters in the help of UltraEdit describes all command line parameters. You could write a macro which converts every open file to EBCDIC and saves it with same name or copies the content of the ASCII file, pastes it into a new file, converts it to EBCDIC and saves the new file with a name based on the name of the ASCII file. This macro saved into a macro file can then be executed with 1 or more ASCII files via command line.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: ASCII 2 EBCDIC Command Line

Postby yelnocer » Mon Aug 14, 2006 4:49 pm

Bummer - Thanx....
User avatar
yelnocer
Newbie
 
Posts: 2
Joined: Sun Aug 13, 2006 11:00 pm

Re: ASCII 2 EBCDIC Command Line

Postby Harlekin » Wed Aug 03, 2011 9:29 am

As I am a User and not a real programmer, could anyone post the script or macro which will do this. And pls also the instruction on how to implement this?
Thank you
User avatar
Harlekin
Newbie
 
Posts: 1
Joined: Wed Aug 03, 2011 9:22 am

Re: ASCII 2 EBCDIC Command Line

Postby Mofi » Wed Aug 03, 2011 10:13 am

Copy following few lines into a new file and save this file for example as ASCIItoEBCDIC.js into a directory of your choice.

Code: Select all
for (var nDocIndex = 0; nDocIndex < UltraEdit.document.length; nDocIndex++) {
   var sNewFileName = UltraEdit.document[nDocIndex].path.replace(/\./,"_EBCDIC.");
   UltraEdit.document[nDocIndex].toEBCDIC();
   UltraEdit.document[nDocIndex].setActive();
   UltraEdit.saveAs(sNewFileName);
}

This script can be added to the list of scripts by opening Scripting - Scripts and pressing button Add.

The script converts all files currently open in UltraEdit from ASCII to EBCDIC and saves all files in the same directory as original file with same name, but with _EBCDIC inserted before the point separating file name with path from file extension. The script will fail if the file path contains a point. The script will overwrite the original file if the file name has no point. For example file

C:\Temp\Test.txt

is converted from ASCII to EBCDIC and saved as

C:\Temp\Test_EBCDIC.txt

You can now start UltraEdit, open all files you want to convert and run the script from menu Scripting or the Script List view.

If you want to run the script from within a batch file to convert for example all files with extension TXT you can use following command line in the batch file

"full path to UltraEdit program directory\uedit32.exe" /fni *.txt /s,e="full path to script file\ASCIItoEBCDIC.js"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to UltraEdit General Discussion