Importing a CSV into a Physical File

From Your Next Level of Support
Jump to navigationJump to search

Based upon the guide from racingmars / Mainframes & More with Matthew: https://www.youtube.com/watch?v=8kAEcep1AdA

Let's say you uploaded WRDL/400 to your AS/400 and want to use the master wordlist CSV supplied. How do you import this file other than typing out the words one by one with DFU? Utilizing the Installable Filesystem (IFS) present in V3R1 and newer, it's easy. Make sure you have TCP/IP and the FTP server running on your AS/400 host, then follow these commands.

This guide uses the built-in Windows FTP command-line client and assumes WRDL.CSV is relative to the directory you started FTP from.

open <your AS/400's hostname or IP address>

Log in with the appropriate username and password.

quote site namefmt 1

This tells the FTP server to use the unix-style directory and pathing system instead of the OS/400 native one.

mkdir tmp

put wrdl.csv /tmp/wrdl.csv

You must specify a leading slash on the destination parameter, otherwise the OS/400 FTP server will not know where to put your file. When the upload completes, you are done with the FTP side of things.

CRTSRCPF WORDLE/ERROR

Creates an error log file that our next command will use to log lines that did not import. Failure to create this file will cause our next command to fail.

CPYFRMIMPF

From Stream File: '/tmp/wrdl.csv'
To data base file:
   File: WRDLWORDS
   Library: WORDLE
   Member: *FIRST
Record delimiter: *CRLF
Error record file:
   File: ERROR
   Library: WORDLE
   Member: ERROR

This will copy the Wordle CSV into the WRDLWORDS file automatically. Any errors will be populated into the ERROR file.

Launch the program that needs this data and should be populated.