Ü  Create Stream File from PF and Create PF from Stream File

 

(1) CRTDIR DIR('''/HOME/DIR1''')

(2) COPY ANY DATABASE FILE IN QTEMP AND CREATE FILE AMINEM/MAST.

(3) CPYTOIMPF FROMFILE(AMINEM/MAST) TOSTMF('/HOME/DIR1/XXX.TXT') RCDDLM(*CR)

    STRDLM(' ') FLDDLM('|')                                             

    All records copied from file MAST in AMINEM.

(4) WRKLNK '/HOME/DIR1/XXX.TXT'  

 


Browse : /HOME/DIR1/XXX.TXT
Record :       1   of      19 by  18                      Column :    1     59 by 131
Control :
 
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+.  
************Beginning of data**************
150  |100000000113|EUR|P00000000068
150  |100000000122|EUR|P00000000068
150  |100000000127|EUR|P00000000088
150  |100000000128|EUR|P00000000081
150  |100000000129|USD|P00000000068
150  |100000000130|EUR|P00000000089
150  |100000000132|USD|P00000000091
150  |100000000133|USD|P00000000088
150  |100000000134|EUR|P00000000096
150  |100000000135|EUR|P00000000089
150  |100000000136|EUR|P00000000093
150  |100000000137|USD|P00000000094
150  |100000000138|USD|P00000000089
150  |100000000139|USD|P00000000095
150  |100000000140|USD|P00000000087
150  |100000000142|USD|P00000000086
150  |100000000143|EUR|P00000000092
150  |100000000144|USD|P00000000088
 
F3=Exit   F10=Display Hex   F12=Cancel   F15=Services   F19=Left   F20=Right

 

(5) CREATE AN OBJECT AMINEM/MASTC WITH NORECORD AND SAME RECORD FORMAT.

(6) TO COPY RECORDS FROM STREAM FILE TO FILE AMINEM/MASTC

CPYFRMIMPF FROMSTMF('/HOME/DIR1/XXX.TXT') TOFILE(AMINEM/MASTC *FIRST) 
           RCDDLM(*CR) STRDLM(' ') FLDDLM('|') 
		   DECPNT(*COMMA) DATFMT(*ISO) RPLNULLVAL(*FLDDFT)    

   

  19 records copied to member MASTER.                                       

(7) CHECK THE FILE IF IT HAS BEEN PROPERLY COPIED.

    RUNQRY *N AMINEM/MASTC 

 

***Use CPYFRMSTMF when working with a file that doesn't have fields. 
   For example, a source file, a PTF cover letter, a save file, etc.
***Use CPYFRMIMPF when the text file has separate fields and 
   they need to be written to a PF that has separate fields defined.

 











User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy