<< V5R4M0 and Windows XP Pro >>
Background:
My client company was recently acquired by another company which runs their
business on SAP. Consequently, [until they get us converted to SAP] we have
been tasked with ETL activities lately to support integration of data from
our JDE system with systems on the parent company.
Toward that end, we have created a process which will convert an EBCDIC
database file to a Unicode database file on the System i.
It is actually quite simple - to convert a System i file to Unicode, you
create DDS for a new file that has the same fields as the original file,
specifying CCSID(1208) for the non-numeric fields, set the job CCSID to the
appropriate CCSID, then use CPYF FROMFILE(EBCDICFILE) TOFILE(UNICODEFIL)
FMTOPT(*MAP). FMTOPT(*MAP) causes the file manager to perform the
conversion from EBCDIC to Unicode during the copy function.
For example, we have a DDS-defined Unicode file [all fields are CCSID(1208)]
containing Japanese Kanji data on the System i named TDC4011. [The
original JDE file was defined as CCSID(939).]
We want to export this Unicode file via QNTC to a folder on the Windows XP
system as Unicode data, so I executed the following command:
CPYTOIMPF
FROMFILE(MYLIB/TDC4011)
TOSTMF('/QNTC/ServerName/sharedfiles/TDC4011.TXT')
MBROPT(*ADD)
FROMCCSID(*FILE)
STMFCODPAG(*STMF)
RCDDLM(*CRLF)
RMVBLANK(*NONE)
DTAFMT(*DLM)
FLDDLM(X'05') [ tab-delimited ]
Here is the problem:
This works fine the first time around, when the stream file on the Windows
machine does NOT exist - after running the CPYTOIMPF command, I can open the
Windows file with notepad and I can see the kanji characters.
HOWEVER, if I execute this command again (copying the same data again from
the System i side) WITHOUT first deleting the file on the Windows machine in
order to append data to the existing Windows file, the newly added records
are NOT correct - if I use notepad to view the file the original records
appear fine, but the Kanji characters in the appended data on the Windows
file look like garbage.
When the file already exists on the Windows system, if I use WRKLNK
'/QNTC/ServerName/sharedfiles' and use option 8 to view the attributes of
the Windows file, it is CCSID(1252).
I already know that CCSID(1208) is not supported via QNTC on Windows files,
but is CPYTOIMPF working as designed? See the help text below for
STMFCODPAG.
- sjl
From the help for CPYTOIMPF:
Stream file code page (STMFCODPAG) - Help
Specifies the method of obtaining the stream file code
page and the coded character set identifier (CCSID)
equivalent of the code page that is used for data
conversion.
*STMF
If the stream file exists, and data conversion is
requested, the CCSID equivalent of the code page
associated with the stream file is used to perform the
conversion.
If the stream file does not exist, the code page
equivalent of the source database file CCSID is used
and associated with the stream file....
As an Amazon Associate we earn from qualifying purchases.