145 pts.
 Junk characters in CSV conversion through CPYTOIMPF
Hi, I am sending data from iseries to excel through CPYTOIMPF i've used this command in CLLE, in query output there is a char field value is '01.03.2011' but when i see in output by wrklnk temp it shows some junk data in this field . RUNQRY     QRY(ADO150Q) CPYTOIMPF  FROMFILE(ADO150F) TOSTMF(/temp/tst.csv) +                  MBROPT(*REPLACE) STMFCODPAG(*PCASCII) +              RCDDLM(*CRLF) FLDDLM(',') DATFMT(*EUR) can any body suggest ,where i am wrong Thanks

Software/Hardware used:
clle
ASKED: March 11, 2011  10:05 AM
UPDATED: March 15, 2011  9:46 PM
  Help
 Approved Answer - Chosen by carlosdl

Below is the output of dspffd for that perticular field DT.

Does that field not have a CCSID assigned for it? This looks like the field's CCSID rather than your system's QCCSID:

CODED CHARACTER SET IDENTIFIER . . . . . : 65535

A CCSID of 65535 defines the field as binary data. CPYTOIMPF doesn't know what characters to use. Technically, data defined as 65535 cannot be represented as readable/printable characters because that CCSID has no alphabet, no language, no region. It's essentially the same as trying to open an image file with NOTEPAD in Windows.

Prior to V5R3, CPYTOIMPF wasn't correctly handling CCSIDs. At V5R3 (and in some V5R3 PTFs), CCSID handling was corrected which brought the need for changes in procedures that used CPYTOIMPF or CPYFRMIMPF on some systems. Systems that didn't have system value QCCSID set to the CCSID that fit the language and region that the system system handled, or that had files that had CCSIDs that weren't defined, needed attention.

The V5R3 Memo to Users discusses changes in the CPYFRMIMPF and CPYTOIMPF command changes topic on page 26.

Information APAR II13784 provides some additional information and some suggested fixes.

In your case, you might create a VIEW over your file and use the VIEW as input to CPYTOIMPF. SQL based on something like this might be used:

CREATE VIEW mylib/ADO150FV ( DT37 ) AS
      SELECT
             cast( DT as char (10) CCSID 37 )
         FROM mylib/ADO150F

I only listed one field -- DT -- which was CAST as CCSID 37 and given the name DT37. You'd want to include all of the fields in the file, and you'd want to CAST each of them away from CCSID 65535 if that's what they had. Also, you would only use CCSID 37 if that's appropriate for your system.

You'd use names for the library and the view that meet your requirements.

I don't know what your system QCCSID value is yet, so I can't guess what you should use. You might use DSPJOB against your interactive job to see what the system guesses your job CCSID ought to be.

Tom

ANSWERED:  Mar 14, 2011  10:26 PM (GMT)  by carlosdl

 
Other Answers:

i observed this working fine v5r3

but i am using v5r4

Last Wiki Answer Submitted:  March 11, 2011  12:27 pm  by  Rpgle400tech   145 pts.
Latest Answer Wiki Contributors:  Rpgle400tech   145 pts.
To see other answers submitted to the Answer Wiki: View Answer History.


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


 

it shows some junk data in this field .

Please show us the output from DSPFFD ADO150F for that field. Also, what is your system’s QCCSID system value?

Tom

 108,330 pts.

 

Hi Tom

Below is the output of dspffd for that perticular field DT.

DT CHAR 10 10 75 BOTH
FIELD TEXT . . . . . . . . . . . . . . . : substr(digits(t02.pexp),1,2)||’-'||substr(digits(t

CODED CHARACTER SET IDENTIFIER . . . . . : 65535

 145 pts.

 

Thanks Tom,

Now its working fine…

 145 pts.

 

i observed this working fine v5r3
but i am using v5r4

That’s certainly possible. Without knowing system QCCSID at both V5R3 and V5R4 and job CCSID at both V5R3 and V5R4 (not “Default coded character set identifier”) and relevant PTFs at both V5R3 and V5R4 along with a couple other possible elements, there’s no certainty of success.

Even at V7R1, if configuration is irregular, results are uncertain.

Tom

 108,330 pts.