SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
File Concatenation

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
File Concatenation
Author Message
Mark Chappell



Joined: 21 Jun 2000
Posts: 4

Post File Concatenation Reply with quote

How can I concatenate multiple files with the same record layout into one file name?

Wed Jun 21, 2000 11:34 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: File Concatenation Reply with quote

Make job that will execute
"CMD /b copy file_a + file_b + file_c sum_file"

or use
Run("CMD /b copy file_a + file_b + file_c sum_file", "", process_id)

or use a combination of FileReadAll, Concat, FileWrite statements if you have a need to implement a more complicated algorithm including error checking or inserting empty lines or something else

: How can I concatenate multiple files with the same record layout into one
: file name?

Wed Jun 21, 2000 12:33 pm View user's profile Send private message
Mark Chappell



Joined: 21 Jun 2000
Posts: 4

Post Re: File Concatenation Reply with quote

Unfortunately when I tried the section solution (Run...), I received an "UNC not supported" error message.

I need the ability to concatenate a series of files that use the UNC for the server name into an output file that also contains a UNC server. The input and output paths also contain spaces, so I figure I need quotes around the paths and file names.

Something like:

Run("CMD /b copy "\\SERVER1\In File\Input file*.tmp" "\\SERVER1\Out File\Output file.txt"", "", process_id)

What is the most simple method within 24x7 of accomplishing this task?

Thanks again.

: Make job that will execute
: "CMD /b copy file_a + file_b + file_c sum_file"

: or use
: Run("CMD /b copy file_a + file_b + file_c sum_file", "",
: process_id)

: or use a combination of FileReadAll, Concat, FileWrite statements if you have
: a need to implement a more complicated algorithm including error checking
: or inserting empty lines or something else

Thu Jul 06, 2000 3:38 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: File Concatenation Reply with quote

Prefix special characters like ", \, t - tab, n - new line, r - carriage return, with a backslash.

Example:
Run("CMD /b copy \"\\\\SERVER1\\In File\\Input file*.tmp\" \"\\\\SERVER1\\Out File\\Output file.txt\"", "", process_id)

Turn on the tracing feature so you can easily see how the script is executed and script paramaters are converted before they are passed to JAL statements (e.g. how the real Run command looks like)

: Unfortunately when I tried the section solution (Run...), I received an
: "UNC not supported" error message.

: I need the ability to concatenate a series of files that use the UNC for the
: server name into an output file that also contains a UNC server. The input
: and output paths also contain spaces, so I figure I need quotes around the
: paths and file names.

: Something like: Run("CMD /b copy "\\SERVER1\In File\Input
: file*.tmp" "\\SERVER1\Out File\Output file.txt"",
: "", process_id)

: What is the most simple method within 24x7 of accomplishing this task?

: Thanks again.

Thu Jul 06, 2000 4:03 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7839

Post Re: File Concatenation Reply with quote

The most simple method within 24x7 to concatenate a series of files is to use
FileReadAll, FileWrite pair for reading and writing files.

Example:
Dim file_list, string
Dim file_name, string
Dim full_name, string
Dim file_num, number
Dim no_more, boolean
Dim buffer, string

// open output file for writing with the Append option enabled
FileOpen "\\\\SERVER1\\Out File\\Output file.txt", "StreamMode", "Write", True, file_num

// get list of input files
Dir "\\\\SERVER1\\In File\\Input file*.tmp", file_list
isEqual file_list, "", no_more

// loop throught the list
LoopUntil no_more, NEXT_FILE

// get next file name

GetToken ",", file_list, file_name

Concat "\\\\SERVER1\\Out File\\", file_name, full_name

// perform I/O

FileReadAll full_name, buffer

FileWrite file_num, buffer

// check if there are more items in the list

isEqual file_list, "", no_more
NEXT_FILE:

// close the output file
FileClose file_num

================================================

: Unfortunately when I tried the section solution (Run...), I received an
: "UNC not supported" error message.

: I need the ability to concatenate a series of files that use the UNC for the
: server name into an output file that also contains a UNC server. The input
: and output paths also contain spaces, so I figure I need quotes around the
: paths and file names.

: Something like: Run("CMD /b copy "\\SERVER1\In File\Input
: file*.tmp" "\\SERVER1\Out File\Output file.txt"",
: "", process_id)

: What is the most simple method within 24x7 of accomplishing this task?

: Thanks again.

Thu Jul 06, 2000 4:19 pm 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.