Copy From Import File CPYFRMIMPF in IBM i |
What is Copy From Import File (CPYFRMIMPF)
The Copy From Import File (CPYFRMIMPF) command copies all or part of an import file/stream file to the TOFILE.
Copy stream file to PF using CPYFRMIMPF
First we'll use the IFS file we created using CPYTOIMPF command.
/home/EASYCLASS/pf20
Data contained in file 'PF20'
Browse : /home/EASYCLASS/pf20 Record : 1 of 1 by 18 Column : 1 133 by 131 Control : ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3. ************Beginning of data************** 4 ,"NAME4 ","ADDRESS4 ","PART2 ************End of Data********************
Copy From Import File (CPYFRMIMPF) Type choices, press Enter. From stream file . . . . . . . . FROMSTMF > '/HOME/EASYCLASS/PF20' 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 *DBLQUOTE String escape character . . . . STRESCCHR *STRDLM Remove blanks . . . . . . . . . RMVBLANK *LEADING Field delimiter . . . . . . . . FLDDLM ',' Decimal point . . . . . . . . . DECPNT *PERIOD Decimal float rounding mode . . DECFLTRND *HALFEVEN Date format . . . . . . . . . . DATFMT *ISO Time format . . . . . . . . . . TIMFMT *ISO Copy from record number: FROMRCD Copy from record number . . . *FIRST Number of records to copy . . *END Errors allowed . . . . . . . . . ERRLVL *NOMAX Error record file: ERRRCDFILE File . . . . . . . . . . . . . *NONE Library . . . . . . . . . . Member . . . . . . . . . . . . Replace or add records . . . . . ERRRCDOPT *ADD Replace null values . . . . . . RPLNULLVAL *NO Identity column . . . . . . . . IDCOL *GEN Remove column names . . . . . . RMVCOLNAM *NO
This takes the data in the IFS stream file '/HOME/EASYCLASS/PF20' and inserts it into the physical file 'PF20'
Selection or command ===> F3=Exit F4=Prompt F9=Retrieve F23=Set initial menu 1 records copied to member PF20.
Display Report Report width . . . . . : 130 Position to line . . . . . Shift to column . . . . . . Line ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10....+...11....+...12... IDN NAME ADDR1 ADDR2 000001 4 NAME4 ADDRESS4 PART2 000002 4 NAME4 ADDRESS4 PART2 ****** ******** End of report ********
Copy file with one non numeric field to PF using CPYFRMIMPF
Data contained in file 'PF21'
Display Report Report width . . . . . : 110 Position to line . . . . . Shift to column . . . . . . Line ....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+...10....+...11 PF21 000001 4 ,"NAME4 ","ADDRESS4 ","PART2 " 000002 4 ,"NAME4 ","ADDRESS4 ","PART2 " 000003 1 ,"testname ","testaddr1 ","testaddr2 " ****** ******** End of report ********
Copy From Import File (CPYFRMIMPF) Type choices, press Enter. From stream file . . . . . . . . FROMSTMF From file: FROMFILE File . . . . . . . . . . . . . > PF21 Library . . . . . . . . . . > EASYCLASS1 Member . . . . . . . . . . . . *FIRST To data base file: TOFILE File . . . . . . . . . . . . . > PF20 Library . . . . . . . . . . > EASYCLASS1 Member . . . . . . . . . . . . *FIRST Replace or add records . . . . . MBROPT *ADD From CCSID . . . . . . . . . . . FROMCCSID *FILE To CCSID . . . . . . . . . . . . TOCCSID *FILE Record delimiter . . . . . . . . RCDDLM *EOR Record format of import file . . DTAFMT *DLM String delimiter . . . . . . . . STRDLM *DBLQUOTE
Here, This takes the data in file 'PF21' with a non-numeric field and inserts it into physical file 'PF20'.
Selection or command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=Information Assistant F23=Set initial menu 3 records copied from member PF21.
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 1 testname testaddr1 testaddr2 ****** ******** End of report ********
Copy SRCPF member to PF using CPYFRMIMPF
Columns . . . : 1 100 Browse EASYCLASS1/DDSTODDL2 SEU==> MBR4NEW FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0 *************** Beginning of data *************************************************************************************** 0001.00 4 ,"NAME4 ","ADDRESS4 ","PART2 000000 0002.00 4 ,"NAME4 ","ADDRESS4 ","PART2 000000 0003.00 4 ,"NAME4 ","ADDRESS4 ","PART2 000000 ****************** End of data ******************************************************************************************
Copy From Import File (CPYFRMIMPF) Type choices, press Enter. From stream file . . . . . . . . FROMSTMF From file: FROMFILE File . . . . . . . . . . . . . > DDSTODDL2 Library . . . . . . . . . . > EASYCLASS1 Member . . . . . . . . . . . . > MBR4NEW To data base file: TOFILE File . . . . . . . . . . . . . > PF20 Library . . . . . . . . . . > EASYCLASS1 Member . . . . . . . . . . . . *FIRST Replace or add records . . . . . MBROPT *ADD From CCSID . . . . . . . . . . . FROMCCSID *FILE To CCSID . . . . . . . . . . . . TOCCSID *FILE Record delimiter . . . . . . . . RCDDLM *EOR Record format of import file . . DTAFMT *DLM String delimiter . . . . . . . . STRDLM *DBLQUOTE
This takes the data in Source file member 'MBR4NEW' and inserts it into physical file 'PF20'
Selection or command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel F23=Set initial menu 3 records copied from member MBR4NEW.
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 ********