![]() |
| Import CSV file into PF in IBM i |
Easy way to import CSV file into PF
The CPYFRMIMPF is the command to copy this CSV file to the PF.
/home/EASYCLASS/TODAY.csv
Work with Links to browse IFS stream file.
WRKLNK
Work with Object Links
Directory . . . . : /home/EASYCLASS
Type options, press Enter.
2=Edit 3=Copy 4=Remove 5=Display 7=Rename 8=Display attributes
11=Change current directory ...
Opt Object link Type Attribute Text
PF20 STMF
SAVF1 STMF
TODAY.CSV STMF
UCSfile STMF
UCSfile2 STMF
UCSfile4 STMF
Browse : /home/EASYCLASS/TODAY.CSV
Record : 1 of 3 by 18 Column : 1 97 by 131
Control :
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....
************Beginning of data**************
4 ,NAME4 ,ADDRESS4 ,"PART2
4 ,NAME4 ,ADDRESS4 ,"PART2
4 ,NAME4 ,ADDRESS4 ,"PART2
************End of Data********************
Copy From Import File (CPYFRMIMPF)
Type choices, press Enter.
From stream file . . . . . . . . FROMSTMF > '/home/EASYCLASS/TODAY.CSV'
From file: FROMFILE
File . . . . . . . . . . . . .
Library . . . . . . . . . . *LIBL
Member . . . . . . . . . . . . *FIRST
To data base file: TOFILE
File . . . . . . . . . . . . . > PF20
Library . . . . . . . . . . > EASYCLASS1
Member . . . . . . . . . . . . *FIRST
Replace or add records . . . . . MBROPT *ADD
Stream file record length . . . STMFLEN *TOFILE
To CCSID . . . . . . . . . . . . TOCCSID *FILE
Record delimiter . . . . . . . . RCDDLM > *LFCR
Record format of import file . . DTAFMT *DLM
String delimiter . . . . . . . . STRDLM *NONE
This takes the data in the CSV file and inserts it into the physical file 'PF20'
Selection or command
===>
F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=Information Assistant
F23=Set initial menu
3 records copied to member PF20.
RUNQRY *N PF20
Display Report
Report width . . . . . : 100
Position to line . . . . . Shift to column . . . . . .
Line ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10
IDN NAME ADDR1 ADDR2
000001 4 NAME4 ADDRESS4 "PART2
000002 4 NAME4 ADDRESS4 "PART2
000003 4 NAME4 ADDRESS4 "PART2
****** ******** End of report ********
