|
Dave, I don't know about Scott's example but in the information I found on using IFS files from RPG you have to close and reopen the file to set the codepage. I struggled with the codepage issue for months in my spare time until I found this information. I have included a sample of how I do it. // Create the file and set the codepage. Receive descriptor (pointer) for // future file operations. OutPath = %TrimR(OutPath) + x'00'; FileDesc = ifsOpen(%TrimR(OutPath) :TxtWrt + ', codepage=850'); // Close and reopen the file. This is required to perform translation // from our current job CCSID into the ascii codepage. THIS IS REQUIRED! RtnCd = ifsClose( FileDesc ); FileDesc = ifsOpen(%TrimR(OutPath) :TxtWrt); Rick -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Dave Boettcher Sent: Thursday, March 25, 2004 12:06 PM To: rpg400-l@xxxxxxxxxxxx; RPGIV@xxxxxxxxxxxxxxx Subject: IFS File - Code Page (second try) Perhaps someone can help me. Searching google, search400, IBM inforcenter etc have not given me enough information to know what is wrong. So... Using Scott Klement's tutorial on "Working with IFS in RPG", I have written (using the term "written" loosely) a program to read a PC file (a text file in csv style format - Sample of data: "392033962","P","150","","","","","","","220.56750","0","-37380","0","0","03102004) from a software package. The RPGIV program scans the data for ,"- and rearranges the data so that the negative sign is after the number. (When I changed this using Word Pad, CPYFRMSTMF then correctly interpreted the number and copied to our iSeries file.) I have set up the open so that, I think, CCSID 00819 will be used for ASCII. c eval outfile = open('/QDLS/ANZCHKS/AZPCFile': c O_TRUNC + O_CREAT + O_WRONLY c +O_CODEPAGE: c S_IRWXU + S_IRWXG +S_IRWXO : c 819) However, my problem now is that the CCSID seems to be incorrect. The CPYFRMSTMF command gives this error (edited for space) Message ID . . . . . . : CPF2845 Severity . . . . . . . : 40 Message type . . . . . : Diagnostic Date sent . . . . . . : 03/25/04 Time sent . . . . . . : 10:39:47 Message . . . . : The copy did not complete for reason code 9. Cause . . . . . : The Copy From Import File (CPYFRMIMPF) command, or Copy To Import File (CPYTOIMPF) command could not be completed for reason 9. The reason codes are: 9 - The data for the field JEURAB is not valid for the data type of the TOFILE. Recovery . . . : Do the following for the reason code: 9 - Change the data in the FROMFILE. When I look at the file on the iSeries, I get this error: Message ID . . . . . . : CPDB610 Severity . . . . . . . : 20 Message type . . . . . : Information Date sent . . . . . . : 03/25/04 Time sent . . . . . . : 11:20:03 Message . . . . : File CCSID incorrect. Cause . . . . . : The file CCSID was 00819, but the data in the file looks like EBCDIC. A CCSID of 00500 is being used. Recovery . . . : If another CCSID is needed, use F15 to change to the desired CCSID. When I look at the file on the PC, I see this: ùððððññôkñkk×ÉÒkõk×ÉÒÇÁÄÁÔâkÁ*"¢@Ã*¤*£@Ä**£@**@È*"£* I am sure that there is an error on my part somewhere but I cannot figure out what it is. TIA, Dave Boettcher
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.