Hi all,
I have a server job that writes to two text files. I plan to append the second text file to the first. What is the best way to do this? A calling job sequence will be using the appended text file to email to assigned users.
Thanks,
Seyed
How to append two text files
Moderators: chulett, rschirm, roy
Post Job Exec is best way. Since you are on Windows I think the syntax is
copy /b file1+file2 destfile
copy /b file1+file2 destfile
Last edited by asorrell on Wed Oct 23, 2013 3:10 pm, edited 1 time in total.
Hi Andy,
Appreciate your suggestion. I tried the following,
and then got the following error:
Which looks like a permission issue.
Thanks again,
Seyed
Appreciate your suggestion. I tried the following,
Code: Select all
copy /b #OFP##FILE_NM# + #OFP##FILE_NM2# output
Code: Select all
DataStage Job 224 Phantom 5716
Program "DSP.ActiveRun": Line 51, Exception raised in GCI subroutine:
Access violation.
Attempting to Cleanup after ABORT raised in stage SchemaCompIndexes_test..Command_Stage_74
DataStage Phantom Aborting with @ABORT.CODE = 3
Thanks again,
Seyed
Andy,
I just made the following changes,
Command:
Output to file
I confirmed that the first files were appended and placed into the 3rd file. Next, I would have to do something like
However, the job still fails with the same error as before
Thanks again,
Seyed
I just made the following changes,
Command:
Code: Select all
copy /b #OFP##FILE_NM# + #OFP##FILE_NM2# #OFP##FILE_NM3#
Code: Select all
#OFP##FILE_NM#
Code: Select all
move /Y #OFP##FILE_NM3# #OFP##FILE_NM#
Code: Select all
DataStage Job 224 Phantom 5664
Program "DSP.ActiveRun": Line 51, Exception raised in GCI subroutine:
Access violation.
Attempting to Cleanup after ABORT raised in stage SchemaCompIndexes_test..Command_Stage_74
DataStage Phantom Aborting with @ABORT.CODE = 3
Seyed
Seyed,
I don't have access to a Windows install right now to try the command. What I'd suggest is actually putting the command in manually (no parameters) and see if it will actually execute the copy command when it is hardcoded. If that works, then start replacing parameters one at a time to see what causes it to fail.
Also - please note that you might have to add path names to the command to get it to work!
I don't have access to a Windows install right now to try the command. What I'd suggest is actually putting the command in manually (no parameters) and see if it will actually execute the copy command when it is hardcoded. If that works, then start replacing parameters one at a time to see what causes it to fail.
Also - please note that you might have to add path names to the command to get it to work!
Hi Andy,
Thank you for your help. The problem with errors that I was getting has been resolved. The reason for this error was that I was assigning the 'Output to file' to the same file name as the first input file (#OFP##FILE_NM#). We changed the name to something like (#OFP#FILE_NM#.txt) and that resolved this error. I didn't know that the purpose of the 'Output to file' column was to save the resulting DOS messages.
Continued success,
Seyed
Thank you for your help. The problem with errors that I was getting has been resolved. The reason for this error was that I was assigning the 'Output to file' to the same file name as the first input file (#OFP##FILE_NM#). We changed the name to something like (#OFP#FILE_NM#.txt) and that resolved this error. I didn't know that the purpose of the 'Output to file' column was to save the resulting DOS messages.
Continued success,
Seyed