Reputation: 11
I am using the data transfer tool to export files from the AS400 to CSV. With 500+ files to export, I was hoping there would be a way to do this for multiple files concurrently.
I have tried saving the transfer options as a .TTO, but I am still only able to have that work for one file at a time. I could use a .bat to execute multiple .TTO files but would still need a .TTO generated for each file.
Any ideas would be greatly appreciated.
Upvotes: 1
Views: 2203
Reputation: 11473
I don't know of any command that does this, or any third party tool for that matter, but if you are willing to write a .bat program to do it, why not use a CL program with CPYTOIMPF to loop through the file names and write the CSV to the IFS. If you set up QNTC properly, this can even be directed to a network share.
Here is some example code:
pgm
dclprcopt log(*no) +
dftactgrp(*no) actgrp(*new)
dclf explstf
dcl &ifspath *char 64 value('/ifspath/')
dcl &ifsname *char 64
dowhile cond('1')
rcvf
monmsg msgid(CPF0864) exec(leave)
chgvar &ifsname (&ifspath |< &filename |< '.csv')
cpytoimpf fromfile(&filelib/&filename) +
tostmf(&ifsname) mbropt(*replace) +
stmfccsid(*pcascii) +
rcddlm(*crlf) dtafmt(*dlm) +
strescchr(*strdlm) rmvblank(*trailing)
enddo
out:
endpgm
&filename
and &filelib
would be fields in file explstf
.
NOTE: CPYTOIMPF
does not require any special definition file so you can use this with 500+ files without too much work.
Upvotes: 1
Reputation: 23793
Probably off topic for SO...
But take a look at the Copy to import file (CPYTOIMPF) command in a 5250 session.
Upvotes: 0