I am rather new to the whole IBM i (as400), rpgle scene.
I was given the task to export some information into XML format.
I was able to make the output of the information correct, the problem arose when I used CPYTOPCD to copy the information to the XML file.
For some reason I have yet to understand or even find information about, CPYTOPCD only copies a fraction of the data when I use from within my program. When I go to the as400 command line though, it copies the entirety of the data without problem.
The only difference I can see when I do this is that in the command line the CPYTOPCD command all fits within the one row while in the program I must use the '+' and move on to the next row to finish the command.
I have looked on many different sites but I cannot find a similar problem. Perhaps I am not phrasing the problem correctly and that has been my biggest problem.
I apologize if I may not be explaining the situation well enough so please let me know what other information I could supply to make it easier.
Thank you very much for any help you can provide.
edit: I don't know if this is part of the problem or not but I figured I might as well add it in just in case. When I check on the outputted XML, where it ends, which is half way through some tag that it has written before without problem, it puts a small box. From what I have found online I think it is a whitespace character but I am not sure.
edit2: CLP is this multiple times for different files.
CLRPFM FILE(SDIXW4)
CALL PGM(SDI812)
CPYTOPCD FROMFILE(SDIXW4) TOFLR('AUDIT') +
TODOC(RELLOC.XML) REPLACE(*YES) +
TRNFMT(*NOTEXT)
edit3: I am going to try the suggestion that Charles gave. Hopefully this bypasses the problem I am getting with CPYTOPCD. I will update this after testing the new form. Thanks again for all your help.
I had the same problem some time ago ... CPYTOPCD didn't export all records from my file ... but I called the command through QCMDEXEC at the end of my RPG code but was enough a "close myfile" befor QCMDEXEC to solve it. Do you end your rpg code with a "return" or a "seton LR" ?