5 pts.
 Sending Multiple Files to the AS/400 Automatically
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

Answer Wiki:
Can you use a wild card name? You can also create a directory on the IFS.. Then read through the directory with an RPGLE program. Get the file name and read throught the data. Then export it to wherever.. Or if you can save them as a CSV file you can copy it right into a PF. I have some examples as soon as I can find them and get them on here.. Send me your email
Last Wiki Answer Submitted:  April 25, 2011  3:12 pm  by  RonKoontz   1,780 pts.
All Answer Wiki Contributors:  RonKoontz   1,780 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

…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

 108,095 pts.