I am using the CPYFRMIMPF to copy data from a TXT file into a DB file. The delimiter is a ']' character. The command runs but no records are copied. The error says "0 records copied from member TXT. Copy command ended because of error". Upon further review I found "The copy did not complete for reason code 7. " The error " 7 - The FROMFILE numeric field *N contain blank characters, or other characters that are not valid for a numeric field."
I don't understand how an inbound field can be defined as numeric when it is a TXT file.
what it means is that the data in the from file element that is to be mapped to a numeric field is invalid for a numeric field. You might try adding RPLNULLVAL(*FLDDFT) to your CPYFRMIMPF command.
You might also have a header record in the .txt file. Check the input file for the header record (column definitions) and delete if present. For eample, a colum heading of "Number of widgets".
...and I forgot, once you've determined that there is a header record....you can skip it using the parameter FROMRCD to start a record number 2. I always like to prompt the command (f4) and see what my options are.
Since every record is being dropped, it may be that you have numeric fields in physical files that are not numeric in all records, or you may have .txt data larger than the PF field. Probably the same thing is wrong for all records. Having one bad record should not abort the job.
Good luck,
The more of those you can supply, the better.
Comments so far are all valid, but it might just be that the incoming file doesn't match the database file at all or that one or more parameters for CPYFRMIMPF need to be changed.
Tom
Used the RPLNULLVAL(*FLDDFT) option in my command and while the command is copying the records to the "To File", I only get the first field from the TXT file.
...all fields in the DB2 file are defined as Alpha fields.
That's a good start. Now we only need to see the CPYFRMIMPF command and at least one line from the import file. Those might be enough to suggest an answer, or they might indicate what additional info is needed.
Tom
Try adding STRDLM(*NONE) to your CPYFRMIMPF command. The default is STRDLM(*DBLQUOTE) and there are no quoted columns in your sample.
I would first guess that the command looks at the first portion of the first row and sees [S0100113]. Since it doesn't find any quotes, it tries to generate a numeric value.
I don't recall a delimited file that didn't include any indication of which columns were strings and which ones weren't, so this might take some experimentation. It's possible that this format is outside of what the basic CPYFRMIMPF function can handle.
Tom
All I get from the input file is the first field of every record.
I keep missing that piece, though it's hard to tell without experimenting. CPYFRMIMPF might be trying to interpret each column based on content since you allowed it to default to STRDLM(*DBLQUOTE) and don't have any quotes. It figures that the first column must be a string because it found a character that wasn't a digit.
Then it tries to handle the next column and finds only digits in each row. It gets a numeric value and attempts to put it into a character column in the table -- hits an error.
Let us know if STRDLM(*NONE) makes any difference. I won't be surprised whether it works or fails, but it's worth a try.
Tom
Tom, changed the parm to *NONE for STRDLM but unfortunately no change. I tried several other options but have had no success. The data is coming from D&B, I think I'll go back and ask for a CSV file. Maybe I'll have better luck with that.
That is, I ran just about the minimum necessary.
One obvious difference is that I used a streamfile as input rather than a physical file. Do you have a reason for using a physical file? That seems to me to add complexity that isn't needed. One specific complexity would be that you have fixed-length records in your physical file that don't seem to match up with the varying lengths of your sample data. I can't tell what characters might be present at the end of your records.
Tom
I can’t tell what characters might be present at the end of your records.
Display your physical file member again. Then switch the display to hex mode with F10='Display hexadecimal'. Look at the end of the records to see if anything but x'40' characters are there.
Your data might have CR/LF characters embedded at the ends of the data or anything anywhere out to the ends of the lines.
Tom
Discuss This Question: 17  Replies
Hi
I am using
CPYFRMIMPF FROMSTMF(&SRCDIR) TOFILE(&SRCLIB/&SRCFILE +
&SRCMBR) MBROPT(*REPLACE) RCDDLM(*ALL) +
STRDLM(*DBLQUOTE) STRESCCHR(*NONE) +
RMVBLANK(*NONE) FROMRCD(*FIRST *END) +
ERRRCDOPT(*REPLACE) RPLNULLVAL(*FLDDFT)
in my source i have value like this
* NAMED CONSTANTS FOR 'XLATE' COMMAND
D SPC C CONST(',?*_%~¦')
D BLK C CONST(' ')
i ma copying my source and when I am copying it is removing special char from CONST. I am getting this
* NAMED CONSTANTS FOR 'XLATE' COMMAND
D SPC C CONST('
D BLK C CONST(' ')
Can any one help please how to resolve it.