SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Converting files from UNIX to DOS

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Converting files from UNIX to DOS
Author Message
lucky_luuk



Joined: 18 Jan 2010
Posts: 12

Post Converting files from UNIX to DOS Reply with quote
I'm using statement FileReplaceEx to convert UNIX files to DOS/Windows files.

Converting a (local)file from 7,5 Mb takes about 35 minutes and that's a very long time.
Is it possible to convert such a file in less minutes?
Mon Jan 18, 2010 11:40 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
Yes. It is sure possible. Generally if script performance is an issue, please consider using a VBScript which are generally faster than JAL scripts. As an example of fast processing, a VBScript job can load the entire file into the memory at once, replace symbols and save result in 1 step. Here is a code template for doing that:

Code:
Sub Main
   Const ForReading = 1, ForWriting = 2
   Dim fso, f, t

   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
   t  =  f.ReadAll

   Set f = fso.OpenTextFile("c:\converted_testfile.txt", ForWriting, True)
   f.Write replace(t, vbLf, vbCrLf)
End Sub


The above method is not good in case files get very large. To make this process working reliable and able to handle files of any size, consider making the script for reading input file line by line, replacing symbols and writing lines to the output file. It is still should be pretty fast. The on-line VBScript Guide includes description of all required methods including code examples.

Another solution, if you get your file from Unix using FTP, you can set ASCII transfer mode for the FTP and then the resulting file won't need any conversion. This is the most efficient method. For more details see description of JAL's FTPConfig method in the on-line help
Mon Jan 18, 2010 12:15 pm View user's profile Send private message
lucky_luuk



Joined: 18 Jan 2010
Posts: 12

Post Reply with quote
Thanks for the quick answer.
I tried the VBScript but it isn't fast enough.
Is it possible to run a program (executable) after transferring the file(s)?
There are several executables available on the internet (unix2dos.exe...) and they work very fast.
Wed Jan 20, 2010 10:59 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
Sure., it can be done.

I don't know how you transfer the file. If that is a JAL script type job, you can add RunAndWait command after FTPDownload. For an example use of RunAndWait, either paste this command from Edit/Paste JAL Statement menu, or copy one of the examples from the on-line help file.
Wed Jan 20, 2010 11:05 am View user's profile Send private message
lucky_luuk



Joined: 18 Jan 2010
Posts: 12

Post Reply with quote
Thanks, i'll try it
Wed Jan 20, 2010 11:44 am View user's profile Send private message
lucky_luuk



Joined: 18 Jan 2010
Posts: 12

Post Reply with quote
I made a script with RunAndWait to execute a DOS program in the command line and it was very successful and fast.
Thu Feb 11, 2010 6:33 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7952

Post Reply with quote
I'm glad it worked for you.
Thu Feb 11, 2010 9:41 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.