Troubleshooting
Problem
Using the command CPYTOIMPF to create an IFS stream file as a result, you might see weird data in the result file when fields in the source file exceed a length of 4096. Data seem to be cut into multiple pieces instead of put into one single line.
Example:
We have a file, containing a single field defined with a length of 4100. We perform a CPYTOIMPF on this file and store the result into a stream file like:
Record Format Information
Record format . . . . . . . . . . . . . . . : LEN4100
Format level identifier . . . . . . . . . . : 388BB3C169BE8
Number of fields . . . . . . . . . . . . . : 1
Record length . . . . . . . . . . . . . . . : 4100
Record format . . . . . . . . . . . . . . . : LEN4100
Format level identifier . . . . . . . . . . : 388BB3C169BE8
Number of fields . . . . . . . . . . . . . : 1
Record length . . . . . . . . . . . . . . . : 4100
CPYTOIMPF FROMFILE(<anylib>/LEN4100) TOSTMF('/<anyfolder>/LEN4100.txt')
MBROPT(*REPLACE) FROMCCSID(*FILE) STMFCCSID(874) STMFAUT(*INDIR) RCDDLM('*LF')
DTAFMT(*FIXED)
Cause
When we take a look into the file using e.g. DSPF we see a 'cut' of each line into 132 bytes pieces! So the output seems to be wrong ! Same for EDTF....
BUT..when we download the file to a PC and take a look into the file, using e.g. NotePad++, we see indeed that the length of the line is correct!
So that's because EDTF/DSPF is limited to 4096 Bytes and breaks every line longer than that!
This is NOT documented anywhere so far.
Resolving The Problem
Use any other editor, mapping a network drive to the IBM i's path to view the data.
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CQ3AAM","label":"IBM i Db2->CPYTOIMPF \/ CPYFRMIMPF"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
Modified date:
14 July 2021
UID
ibm16471231