SET TERM !! ;
CREATE PROCEDURE CALC_PROD (
	LCP FLOAT,
	LCY FLOAT,
	IFC FLOAT)
AS
	DECLARE VARIABLE AN_FL INTEGER;
	DECLARE VARIABLE SEM_FL INTEGER;
	DECLARE VARIABLE IRF FLOAT;
BEGIN
	IRF = LCP - IFC;
	FOR SELECT  N_PLT, AN, SEMAINE, SURFACE 
		FROM PLANTING 
		WHERE ID_SECT = 'Y1'
		INTO :nplt,:anp,:semp,:surf
	DO
		BEGIN
			SEM_FL = :SEMP + IFR;
			IF (SEM_FL>53) THEN
				AN_FL = :ANP + 1;
/*				SEM_FL = SEM_FL - 52;	*/
			ELSE
				AN_FL = :ANP;
		END
END !!
SET TERM ; !!             