ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Cpyfrmimpf errrcdfile

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cpyfrmimpf errrcdfile

    I am using CPYFRMIMPF in a CL without ERRRCDFILE which runs ok with a few truncation errors in the job log. When I add ERRRCDFILE the CL no longer runs. I created the error file as CRTDUPOBJ and also CRTSRCPF. I guess I am not sure how to define the error file and IBM docs don't really say how http://publib.boulder.ibm.com/iserie...l/cpyfrmim.htm . Any ideas on how to define this error table?

    USING CRTDUPOBJ
    Code:
        Cause . . . . . :   File FILENETER in DWEXTLIB is not the correct file type   
          for the copy command. -- The Copy From Import File (CPYFRMIMPF) command     
          require a source, DDM, program described physical, or externally described  
          physical file for the Field Definition File (FLDDFNFILE)  and the Error     
          Record File (ERRRCDFILE). Recovery  . . . :   Do one of the following to    
          change the file name on the parameter and try the request again: -- Specify 
          the correct file type on the FLDDFNFILE, or ERRRCDFILE parameter. -- 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 length 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.

    USING CRTSRCPF
    Code:
     Message . . . . :   TOMBR(*FIRST) not allowed for file FILENETER in DWEXTLIB.     
     Cause . . . . . :   TOMBR(*FIRST) is not allowed because the to-file FILENETER    
       in library DWEXTLIB does not contain any members. Recovery  . . . :             
       Specify a member name on the TOMBR parameter.  Then try the request again.

  • #2
    Re: Cpyfrmimpf errrcdfile

    on the CRTSRCPF message if you notice...it's complaining that there are no members! create a member in that source PF and try it
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Cpyfrmimpf errrcdfile

      Originally posted by tomholden View Post
      on the CRTSRCPF message if you notice...it's complaining that there are no members! create a member in that source PF and try it
      Thanks Tom my program now runs! However none of the truncation errors in the log are being added to my error table.

      Comment


      • #4
        Re: Cpyfrmimpf errrcdfile

        I know its RPG, but .... here is how I check for errors
        PHP Code:

                
        //                                                                                 
                // CRTSRCPF FILE(QTEMP/SOURCE) RCDLEN(2000) MBR(ERRORS)                            
                //                                                                                 
                                                                                                   
                
        cmdstring 'CRTSRCPF FILE(QTEMP/SOURCE) RCDLEN(2000)' +                           
                            
        ' MBR(ERRORS)';                                                        
                
        cmdlength = %len(%trim(cmdstring));                                                
                
        monitor;                                                                           
                 
        $command(cmdstring:cmdlength);                                                    
                
        on-error;                                                                          
                
        endmon;                                                                            


        ........ 
         
        //                                                                                         
         // CPYFRMIMPF FROMSTMF('/home/HR/ceridian/Savings-Reserve 070210.csv')                     
         // TOFILE(CERIDIAN/SAVINGS) RCDDLM(*CRLF)  ERRRCDFILE(QTEMP/SOURCE ERRORS)                                                  
         //                                                                                         
                                                                                                    
            
        exsr $ErrorSetup;      // This is basically the few lines at top of source example (the create source PF stuff above)                                                                 
            
        cmdstring 'CPYFRMIMPF FROMSTMF(' Q  +                                               
                       %
        trim(filename) + ') ' +                                                 
                       
        ' TOFILE(CERIDIAN/SAVINGS) RCDDLM(*CRLF) ' +                                 
                       
        ' MBROPT(*REPLACE) ERRRCDFILE(QTEMP/SOURCE ERRORS)';                         
             
        cmdlength = %len(%trim(cmdstring));                                                    
             
        monitor;                                                                               
              
        $command(cmdstring:cmdlength);                                                        
             
        on-error;                                                                              
              
        exsr $CheckErrors;                                                                    
             
        endmon;                                                                                
              
        //--------------------------------------------------------                                 
              // $CheckErrors - check to see if there are errors                                         
              //--------------------------------------------------------                                 
                   
        begsr $checkErrors;                                                                   
                                                                                                         
                    
        clear errortotal;                                                                    
                    
        exec sql                                                                             
                     select coalesce
        (count(*),0)                                                         
                     
        into errortotal from qtemp/source ;                                               
                     
        // files are always sent with headers                                               
                     // The headers are all *CHAR so when CPYRFMIMPF attempts                            
                     // to process - an error is generated EVERY Time... so assume & ignore!             
                     //                                                                                  
                     
        if errortotal 1;   // read the file send messages                                 
                      
        emperror 'Employees in Error: ';                                                 
                      
        sqlstmt3 'select srcdta from qtemp/source';                                      
                      
        openList3();                                                                       
                      
        dow fetchNext3();                                                                  
                       
        // first field is the employee number build string of employees for the           
                       // email.    

                        
        str = %scan(',':sqldata3);                                                         
                        if 
        str > *zeros;                                                                   
                         
        len = (str 1);                                                                  
                         
        chr5 = %subst(sqldata3:1:len);                                                    
                         if %
        check('0123456789 'chr5) = *zeros ;  // all decimal data  must be employee# 
                          
        if %len(%trim(emperror)) > 19;                                                   
                           
        emperror = %trim(emperror) + ', ';                                              
                          endif;                                                                           
                           
        emperror = %trim(emperror) + '  ' + %trim(chr5);                                
                         endif;                                                                            
                        endif;                                                                             
                       
        enddo;                                                                              
                       
        closeList3();                                                                       
                                                                                                           
                       
        cmdstring 'SNDDST TYPE(*LMSG) ' +                                                 
                                   
        ' TOINTNET((profilechange@liebovich.com))' +                            
                                   
        ' DSTD(' 'Download Error' +                                   
                                   
        ') MSG(' +                                                          
                                   %
        trim(emperror) +                                                       
                                   
        ')  LONGMSG(' +       
                                   %
        trim(emperror) + ')';                            
                                                                                         
                       
        cmdlength = %len(%trim(cmdstring));                               
                       
        monitor;                                                          
                        
        $command(cmdstring:cmdlength);                                   
                       
        on-error;                                                         
                       
        endmon;                                                           
                                                                                         
                      endif;                                                             
                                                                                         
                    
        endsr
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Cpyfrmimpf errrcdfile

          The error file will not pick up any truncation going on. The error file should only pick up those records that would cause the command to fail. If you notice the command only logs warning messages in the job log when any data is truncated. It's a royal pain. I wish IBM would have at least listed the record number and the field in question in the log message.

          Comment


          • #6
            Re: Cpyfrmimpf errrcdfile

            Thanks everyone!

            Comment

            Working...
            X