ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CPYFRMIMPF error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CPYFRMIMPF error

    I am trying to copy a .csv file from the IFS to a DB file which has 3 alpha fields in it. The .csv file has 3 columns, each column contains both alpha and numeric values. That shouldn't matter though since my DB file is defined with all alpha fields. The alpha fields are all large enough to accomodate the 3 columns of the .csv file. WHen I do the copy, I get a message back saying 626 records copied, 40 records not copied becuse they did not mee the selection criteria.. It doesn't give me any indication of what is wrong with the 40 records. I have tried various combinations of RCDDLM(*CR, CRLF, LF, ALL, etc.), STRDLM, etc. How can I figure out what is wrong with the records that were not copied or how can I format my CPYFRMIMPF correctly.

    CPYFRMIMPF FROMSTMF('/home/myfile.csv')
    TOFILE(MYLIB/MYFILE)
    MBROPT(*REPLACE)
    RCDDLM(*CRLF)
    DTAFMT(*DLM)

  • #2
    Re: CPYFRMIMPF error

    There is a parm on CPYFRMIMPF for and Error Record file that it writes records in error to, that would at least let you know what 40 records have errors. That might help identify the problem. Do any of the numbers have commas or and alpha values have double quotes in them?

    Comment


    • #3
      Re: CPYFRMIMPF error

      I noticed that there are 40 records in the .CSV file that have blanks (they appear as ,, in the .csv file). I also noticed that the target DB file doesn't have any blanks for the 2nd field. So, it appears that the rows in the .csv file that have blanks are the ones being excluded. I'm not sure why CPYFRMIMPF would exclude them.

      Comment


      • #4
        Re: CPYFRMIMPF error

        You have to specify the RPLNULLVAL(*FLDDFT) parameter when you have a record with no data in one of the columns if the DB file does not allow nulls.

        Comment


        • #5
          Re: CPYFRMIMPF error

          Originally posted by Brian Rusch View Post
          You have to specify the RPLNULLVAL(*FLDDFT) parameter when you have a record with no data in one of the columns if the DB file does not allow nulls.
          That was it!. I added RPLNULLVAL(*FLDDFT) and all the records were copied.

          much thanks

          Comment

          Working...
          X