ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

using error file on cpyfrmimpf

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

  • using error file on cpyfrmimpf

    I have a CL doing a cpyfrmimpf and I want to output to an error file, when I test I am going message Field Definition or Error file ICRLESTER in MYLIB not allowed. Originally I had the error file as an sql table but found some online info that said it should be multi member dds file, not sure why the error message?

    The error file is dds file with multiple members

    R ICREERR
    SRCSEQ 6S 2 TEXT('SEQUENCE NBR')
    SRCDAT 6S 0 TEXT('SEQUENCE DATE')
    SRCDTA 500 TEXT('DATA')

    and the CL command
    DCL VAR(&ERRFILE) TYPE(*CHAR) LEN(9) +
    VALUE('ICRLESTER')

    CLRPFM FILE(ICRLESTER)
    CPYFRMIMPF FROMSTMF(&UPFILE) TOFILE(ICRECOMP) +
    MBROPT(*REPLACE) RCDDLM(*CRLF) +
    STRDLM(*NONE) STRESCCHR(*NONE) FROMRCD(3) +
    ERRRCDFILE(&ERRFILE) ERRRCDOPT(*REPLACE) +
    RPLNULLVAL(*FLDDFT) IDCOL(*FROMFLD)

  • #2
    If you look at the help for error message CPF2885, you'll see this (excerpt):

    Code:
        -- When using the FROMSTRMF parameter with the ERRRCDFILE parameter, the
      ERRRCDFILE must be a source physical file. If the records in the FROMSTRMF
      are fixed, the ERRRCDFILE must be greater than or equal to the record lengt
      of the tofile.  If the records in the FROMSTRMF are delimited, the         
      ERRRCDFILE must have a minimum record length equal to the sum of the TOFILE
      record length,the number of fields in the TOFILE and 813.
    So your ERRRCDFILE needs to be a source physical file. Instead of creating it with DDS and CRPF, simply create it with the CRTSRCPF command.

    Comment


    • #3
      Scott Klement thanks

      Comment

      Working...
      X