简体   繁体   中英

Data Transfer from IBM i (AS400) export multiple files

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.

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.

Probably off topic for SO...

But take a look at the Copy to import file (CPYTOIMPF) command in a 5250 session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM