50 pts.
 CPYTOPCD
I have problem in CPYTOPCD command; I have on PF and one flat file, My RPG1 program dump data first in PF then RPG2 program dump data with (~) saprater  In Flat file, Then my CL program dump data from flat file to QDLS folder in TXT format, when I open the TXT folder in last row I see some wild character CPYTOPCD   FROMFILE (BIDETAIL) TOFLR(&FOLDER1)  TODOC(&FILE2) REPLACE(*YES)            How can I avoid this wild character?   

Software/Hardware used:
CPYTOPCD
ASKED: August 17, 2009  11:22 AM
UPDATED: August 17, 2009  3:19 PM

Answer Wiki:
I'm having a bit of difficulty understanding process and problem 1. Pgm RPG1 - creates PF 2. Pgm RPG2 - reads PF and writes flat file with '~' seperators 3. CPYTOPCD copies flat file but last record has an unexpected value. Questions 1. Are all other rows in the file exactly like the flat file? 2. Is there a row in the flat file that represents the last row of the output file or is the row of the output file extra? 3. Can you tell us or show us what the "wild" chararcter looks like? Phil
Last Wiki Answer Submitted:  August 17, 2009  1:23 pm  by  philpl1jb   44,180 pts.
All Answer Wiki Contributors:  philpl1jb   44,180 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I believe you are seeing the end of file characters (look at the help text for the command for “Format of PC data (TRNFMT)”). By default the command adds this to the document. I believe you would get what you want by using the CPYTOIMPF on the first file (assuming it has externally defined fields) and inserting the character you want for the field separator. This would eliminate the second program.

You might end up with something like this:

CPYTOIMPF FROMFILE(BIDETAIL) TOSTMF('/qdls/somefolder/textfile.txt')  
   RCDDLM(*CRLF) STRDLM('"') FLDDLM('~')

You could even put the file in some other directory. I prefer to avoid using the QDLS folder and create a directory in the IFS that I control authority to.

 1,145 pts.