Mahmad rafi shaik
Mahmad rafi shaik

Reputation: 9

How i can add a catch block inside the for each block ( in progress 4gl) when the error is occurs i want to move to the next records

I have tried

DO ON ERROR UNDO , THROW: 
    FOR EACH ttFileData NO-LOCK: 
        CREATE ttCustomerDetails. 
        ASSIGN 
            ttCustomerDetails.ttcustmId   = INTEGER (ENTRY(2 , ttFileData.ttLine)) 
            ttCustomerDetails.ttfirstName = ENTRY(3 , ttFileData.ttLine) 
            ttCustomerDetails.ttgender    = ENTRY(6 , ttFileData.ttLine) 
            ttCustomerDetails.ttsalary    = DECIMAL (ENTRY( 13 , ttFileData.ttLine)) 
            ttCustomerDetails.ttcountry   = ENTRY(5 , ttFileData.ttLine) 
            ttCustomerDetails.ttage       = INTEGER ( ENTRY (7 , ttFileData.ttLine)) 
            ttCustomerDetails.ttTenure    = INTEGER (ENTRY (8 , ttFileData.ttLine)) 
            ttCustomerDetails.ttDOB       = obj1custmomerDetail:calculateDOB(INPUT ttCustomerDetails.ttcustmId , INPUT TABLE ttCustomerDetails)
            ttCustomerDetails.ttemail     = obj1custmomerDetail:createEMAIL(INPUT ttCustomerDetails.ttcustmId , INPUT TABLE ttCustomerDetails). 
 
        CATCH e AS Progress.Lang.Error: 
            MESSAGE "error:" e:GetMessage(1) VIEW-AS ALERT-BOX. 
            FIND NEXT ttFileData. 
        END CATCH. 
    END.
END.

The error I'm getting is

FIND cannot be processed for a FOR EACH mode record.

Upvotes: -1

Views: 266

Answers (1)

Mike Fechner
Mike Fechner

Reputation: 7192

You don't need the

 FIND NEXT ttFileData. 

inside the CATCH block. The CATCH block handles the error and the FOR EACH loop will just move to the next iteration - which moves to the next record.

Upvotes: 3

Related Questions