Hello all, do you know if for copy a DB2 file into IFS directory in streamfile which will need to be csv file on other system, do I have to specify a specific CCSID for this? I have the name with .csv extension and *PCASCII specified
Announcement
Collapse
No announcement yet.
CPYTOIMPF command parameters for csv file
Collapse
X
-
I saw the CCSID with CHGPF.. the single way I can figure out to find it.. and I saw that it is *HEX and I can't change it with CHGPF to specify another one because this is a program described file.. Explicitly specified CCSIDs or file restrictions present. - reason code 4
Message ID . . . . . . : CPD322D Severity . . . . . . . : 20
Message type . . . . . : Diagnostic
Date sent . . . . . . : 06/27/18 Time sent . . . . . . : 07:50:07
Message . . . . : Explicitly specified CCSIDs or file restrictions present.
Cause . . . . . : The CCSID(s) for file FILE1 in library LIB1 can not
be changed because of reason 4. The reason codes are:
4 - The file is a program described file.
Comment
-
I would prefer to keep CPYTOIMPF because I have a custom program special desinged for this, it is inside a process, which is a generic process to be applied for many cases.. so, with CPYTOIMPF what will be the choices? I necessarily need to have in IFS a streamfile which can be .csv file on the remote server, which is unix, after the transfer.. no matter what is the CCSID of the DB2 file.. until now I did the copy with CPYTOIMPF with this parameters, using *PCASCII :
FROMCCSID *FILE
TOCCSID *FILE
STMFCCSID *STMF
STMFCODPAG > *PCASCII
.. but I can modify all of those parameters because I have a setup table were I keep all of those parameters for CPYTOIMPF, if I have a special case where I need some particular settings.
So what do you recommend? the interesting thing is that for many DB2 files copied with this command, with STMFCODPAG = *PCASCII all the things are good and I have the stream file in a good format, with code page 1252 and it is well interpreted on the remote server as .csv file.. probably the DB2 file has a good CCSID after the copy into IFS and this is the reason for what I do not have any issue.
What I want is to be independent of the CCSID of the DB2 file, even if I have a DB2 file with *HEX as CCSID I want to be able to copy into IFS with an appropriate CCSID and transfer it and being well interpreted as .csv..
Comment
-
The problem is with programmed described files since they are created with a CCSID value of 65535 (or *HEX) which is treated as binary data and not converted. If you can determine when you're dealing with a program described file, then add the FROMCCSID parameter to the CPYTOIMPF command as John.sev99 suggested. Also, the STMFCODPAG parameter is deprecated, use the STMFCCSID parameter instead.
Comment
-
It's hex data - neither we nor the system has any idea of how that data should be interpreted. For example, if the first byte of data in the file is hex 40, if we were to interpret that as a character, in EBCDIC that would be a space but in ASCII that would be a @ character. What if it was some other text encoding scheme? Maybe the programmer didn't intend it to be a character? Maybe hex 40 represents a number, in which case it would be 64 if written as an integer number, or 4 if a packed decimal or something else maybe for some other encoding scheme. Or maybe it has some other meaning like a pixel in a picture or an amplitude in a sound file or something else? How can the system possibly know what the data represents? Only you can determine that based on your knowledge of what's written in the file.Last edited by john.sev99; June 28, 2018, 05:34 PM.
Comment
-
in that files I have some text, only data to be sent to another system, with information about some products etc.. the issue is that I transferred under ssh/sfp this file from IFS, copied before with CPYTOIMPF command with *PCASCII at STMFCODPAG parameter.. before this change the file was sent directly from DB2 with FTP, and as I said, this DB2 file has CCSID = *HEX..
What I need to put to be well interpreted on the other system, it must be .csv, before, with FTP it was good interpreted
Comment
Comment