I am trying to find a way to append all of the Excel files in a given directory to a file on our AS/400. I can do them one at a time, but it's a time consuming process to have to go through. Is there a way to use the Data Transfer tool and pass it a range of files? I know I can create a batch to execute multiple Data Transfers, but they still need the file name hard coded. Any ideas?
Software/Hardware used:
ASKED:
April 21, 2011 1:45 PM
UPDATED:
May 2, 2011 10:56 PM
…all of the Excel files in a given directory…
First, what kind of file do you mean when you say “Excel” files? Generally, Data Transfer doesn’t handle Excel files although the BIFF formats can work, but only Excel seems to know how to combine multiple parts (if it can). Otherwise the files need to be in some intermediate file format such as .CSV, or the Excel File Transfer add-in can be used interactively to transfer worksheet entries.
A data transfer request (a *.DTT or *.TTO file) can specify to replace or append to a member. When the RFROMPCB command executes a *.DTT request, the transfer runs according to the current content of the *.DTT file.
Because a *.DTT file is just a text file, any text edit function can modify it and any text function can create it. That is, any PC program can update the file to change the name of the file being transferred. Or any PC program can create a new *.DTT file for RFROMPCB to execute.
The “hardcoding” only applies during the actual execution of the transfer.
A .BAT file might loop through a directory of Excel files and update a *.DTT file for each file name in the directory. The update should also set the ‘replace’ attribute with ‘append’ for each file after the first one. Once the update is done, the RFROMPCB command can be run.
If these are all .CSV files, you might just concatenate them all together and run them through a single transfer. Other options might be possible for other formats.
Tom