Merging Three simple Text files
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Merging Three simple Text files
Hi All,
What is the best way to merge three sequential files?
All three sequential files have just one same field with same length.
I also need to purge these three files after they are merged into one.
I thought about having three sequential file stages one after the other with transformers in between and final sequential stage which has the merged data.
Another idea was using a merge stage. Can I use Merge Stage to merge three files into one?
And I'm thinking of using an 'After job subroutine' which calls a batch file
to purge these three input files.
Any suggestions or other ideas are very much welcome,
Thanks much,
Naveen.
What is the best way to merge three sequential files?
All three sequential files have just one same field with same length.
I also need to purge these three files after they are merged into one.
I thought about having three sequential file stages one after the other with transformers in between and final sequential stage which has the merged data.
Another idea was using a merge stage. Can I use Merge Stage to merge three files into one?
And I'm thinking of using an 'After job subroutine' which calls a batch file
to purge these three input files.
Any suggestions or other ideas are very much welcome,
Thanks much,
Naveen.
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi NaveenD,
Why dont you use a simple batch script and call it in the before stage?. The batch script can be something like this
If your standardize the file names, it will be much simpler to make use of the wildcards in your batch script.
Why dont you use a simple batch script and call it in the before stage?. The batch script can be something like this
Code: Select all
type file1.txt file2.txt file3.txt > bigfile.txt
del /Q file*.txt
Thanks,
Naveen
Naveen
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi pnchowdary,
Thanks for your response. What is the " /Q" for in the command you sent?
Also, I have to put a date and timestamp into the BIGFILE name. I'm currently doing this using datastage. I'm not sure whether the same can be achieved using DOS script.
Is there any command in DOS which just clears the file instead of deleting it?
Please let me know. Thanks a lot,
Naveen.
Thanks for your response. What is the " /Q" for in the command you sent?
Also, I have to put a date and timestamp into the BIGFILE name. I'm currently doing this using datastage. I'm not sure whether the same can be achieved using DOS script.
Is there any command in DOS which just clears the file instead of deleting it?
Please let me know. Thanks a lot,
Naveen.
the output of "DEL /?" Gives us:
Code: Select all
C:\Documents and Settings\guest3>del /?
Deletes one or more files.
DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
names Specifies a list of one or more files or directories.
Wildcards may be used to delete multiple files. If a
directory is specified, all files within the directory
will be deleted.
/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for archiving
- Prefix meaning not
If Command Extensions are enabled DEL and ERASE change as follows:
The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Create the target file using a generic name then use an after-stage subroutine like this one to change the file name.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.