Problem solve Get help with specific problems with your technologies, process and projects.

Automate AS/400 database file to excel

Is there a way to automate the transfer (via a CL/RPG program, etc.) of a file from the AS/400 to a network server so that any user could access the data for import to Excel?

Here is a way to automate AS/400 database file to excel. For example, lets assume that we would like to copy file myfile from library mylib to NT server, the server name is ntserver:

1.Use the Make Directory (MKDIR) command to add a server directory to the /QNTC directory. All functional Windows NT servers in the local subnet are automatically created. Those Windows NT servers outside the local subnet must be added using the MKDIR command. In our case MKDIR '/QNTC/NTSERVER? would add the NTSERVER server into the QNTC file system directory structure to enable access of files and directories on that server.

2. Use cpytoimpf to copy the AS/400 database file to a comma delimited file as follows:
TOstmf(/qntc/ntserver/c/temp/f.csv) FLDDLM(',')

This will create a comma-delimited file on the NT server in directory temp with the name f.csv. Please note that cpytoimpf creates the comma-delimited file directly to the NT server. We could send the cpytoimpf output to the user by other means (for example, use snddst email capabilities).

Dig Deeper on FTP

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.