Theo Kouwenhoven
asked on
Import file problem
Hi Experts,
I Have a found a behavior in the CPYTOIMPF.
Situation:
1. I Create a file that must be send as atachment
2. I Create a file with 1 record containing all field headers (with semicol.) Like Number;Description;Price;Q ty
3. Copy the headers record to the IFS with CPYTOIMPF TOCCSID(*PCASCII)
4. Copy the other file to the same IFS file with CPYTOIMPF TOCCSID(*PCASCII)
After step 3 the IFS file contains a the headers and looks normal.
After step 4 the records are added, but the line with headers is scrambled
Example:
Ö £ ¥ ^ÆÔâ@å £ @ ^Ö¥ ¢£^Ò £ Ö ¢
the "^" is probably the original ";"
CCSID *STDASCII has the same problem
I'm out of ideas :-)
Thanks
Murph
I Have a found a behavior in the CPYTOIMPF.
Situation:
1. I Create a file that must be send as atachment
2. I Create a file with 1 record containing all field headers (with semicol.) Like Number;Description;Price;Q
3. Copy the headers record to the IFS with CPYTOIMPF TOCCSID(*PCASCII)
4. Copy the other file to the same IFS file with CPYTOIMPF TOCCSID(*PCASCII)
After step 3 the IFS file contains a the headers and looks normal.
After step 4 the records are added, but the line with headers is scrambled
Example:
Ö £ ¥ ^ÆÔâ@å £ @ ^Ö¥ ¢£^Ò £ Ö ¢
the "^" is probably the original ";"
CCSID *STDASCII has the same problem
I'm out of ideas :-)
Thanks
Murph
ASKER
Hi,
Yes the CCSID was also my first thoughts, so I checked the file with option 8 in WRKLNK and see
CCSID = 1252 (after step-3 and also after step-4)
In the navigator it's not working, because of a bad installed version by my Customer.
If I need to check that also, I have to ask deskside support and that takes day's or weeks.
Regards,
Murph
Yes the CCSID was also my first thoughts, so I checked the file with option 8 in WRKLNK and see
CCSID = 1252 (after step-3 and also after step-4)
In the navigator it's not working, because of a bad installed version by my Customer.
If I need to check that also, I have to ask deskside support and that takes day's or weeks.
Regards,
Murph
ASKER
More info:
First CL is executing:
CPYTOIMPF FROMFILE(QTEMP/TMPTXT) TOSTMF(&TARGET) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
Second CL executes:
CPYTOIMPF FROMFILE(QTEMP/TMPDATA) TOSTMF(&TARGET) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
QTEMP/TMPTXT contains 1 record of 1 field:
Txt1;Txt2;Txt3;Txt4;.....T xt35
QTEMP/TMPDATA contains the real data that sould be exported
First CL is executing:
CPYTOIMPF FROMFILE(QTEMP/TMPTXT) TOSTMF(&TARGET) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
Second CL executes:
CPYTOIMPF FROMFILE(QTEMP/TMPDATA) TOSTMF(&TARGET) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
QTEMP/TMPTXT contains 1 record of 1 field:
Txt1;Txt2;Txt3;Txt4;.....T
QTEMP/TMPDATA contains the real data that sould be exported
ASKER
S_O_L_V_E_D :-)
The 2 inputfiles had different CCSID's
The datafile was created from DDS and had CCSID 37
While the TMPTXT file was created with a record-length (no source) and hed CCSID 65535.
Surprised me that this affected the data in the result file.
Not understanding why....
But by Creating the TMPTXT file from a sourse it's solved
Thanks for the support
The 2 inputfiles had different CCSID's
The datafile was created from DDS and had CCSID 37
While the TMPTXT file was created with a record-length (no source) and hed CCSID 65535.
Surprised me that this affected the data in the result file.
Not understanding why....
But by Creating the TMPTXT file from a sourse it's solved
Thanks for the support
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Murph,
I just replicated your issue (on a V5R3 machine), and when I completed step 3 and used EDTF (WRKLNK Option 2) to view the resulting stream file, it showed me the results in EBCDIC in spite of the fact that the file was showing 1252. It also showed diagnostic message CPDB610 :
Message . . . . : File CCSID incorrect.
Cause . . . . . : The file CCSID was 01252, 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.
This explains why it originally looked right.
- Gary
I just replicated your issue (on a V5R3 machine), and when I completed step 3 and used EDTF (WRKLNK Option 2) to view the resulting stream file, it showed me the results in EBCDIC in spite of the fact that the file was showing 1252. It also showed diagnostic message CPDB610 :
Message . . . . : File CCSID incorrect.
Cause . . . . . : The file CCSID was 01252, 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.
This explains why it originally looked right.
- Gary
ASKER
Not the right answer, BUT the right and understandable explenation why this was happening
Thanks Gary
Thanks Gary
ASKER
Gary,
Normaly I would reclaim the points, but your explenation was clear...
Thanks
Have a great Weekend!!!!
Normaly I would reclaim the points, but your explenation was clear...
Thanks
Have a great Weekend!!!!
EDTF will do it's best to figure out what CCSID should be used to display the data if it finds an inconsistency. The CPDB610 message is sent when the happens. It knew that the bytes couldn't possibly be CCSID 1252 since the conversion failed when it first tried to generate the display.
It then tried with CCSID 37 and got no conversion errors, so it said that "...the data in the file looks like EBCDIC."
For the first CPYTOIMPF command, try making this change:
CPYTOIMPF FROMFILE(QTEMP/TMPTXT) TOSTMF(&TARGET) +
FROMCCSID( 37 ) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
Let the command know that it should treat the data as CCSID(37) and it should work with 65535 data.
Or, of course, you can also just create the file with the appropriate CCSID as you already did.
CCSIDs become extremely important whenever data moves from one system to another. It can be hard to see that a problem exists as long as the data is only moving to different files on the same system. Bring a second system into it all, even a PC, and problems can become visible quickly... or maybe not until much later.
An old saying goes "A man with one watch always knows what time it is. A man with two watches never knows." We might change it like "A man with one system always knows what his data says...".
Tom
It then tried with CCSID 37 and got no conversion errors, so it said that "...the data in the file looks like EBCDIC."
For the first CPYTOIMPF command, try making this change:
CPYTOIMPF FROMFILE(QTEMP/TMPTXT) TOSTMF(&TARGET) +
FROMCCSID( 37 ) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF) +
STRDLM(*NONE) RMVBLANK(*BOTH) FLDDLM(';')
Let the command know that it should treat the data as CCSID(37) and it should work with 65535 data.
Or, of course, you can also just create the file with the appropriate CCSID as you already did.
CCSIDs become extremely important whenever data moves from one system to another. It can be hard to see that a problem exists as long as the data is only moving to different files on the same system. Bring a second system into it all, even a PC, and problems can become visible quickly... or maybe not until much later.
An old saying goes "A man with one watch always knows what time it is. A man with two watches never knows." We might change it like "A man with one system always knows what his data says...".
Tom
ASKER
Amazing,
Working more then 20 years with the AS/400 and still learning every day :-)
Working more then 20 years with the AS/400 and still learning every day :-)
You can check the CCSID of files in the IFS using iseries Navigator.
Right click the file and look at Properties > Storage.