SET statements

SET statements

 

  

Hi all,



I have the following SET statements in a stored procedure. The stored
procedure runs up to the point that it encounters the SET statements and
then stops. The results panel in Stored Procedure Builder shows that the
parameters (right side of equations) have the appropriate values based
on test data supplied for the run but the SET parameters (in Bold) a
NULL value is returned.



SET OLDBDGTUNITS = ((MTHLYUNITS_0) * (MONTHS_BETWEEN));

SET NEWBDGTUNITS = ((BUDGETEDUNITS_0) - (OLDBDGTUNITS));

SET SERVICECOST1 = ((NEWBDGTUNITS) * (NPDD_SVS_RATE));

SET SERVICECOST2 = ((OLDBDGTUNITS) * (SVSRATE1));

SET TOTAL_AMOUNT = ((SERVICECOST1) + (SERVICECOST2) + (AMOUNT));



The DECLARE statements are shown below:



DECLARE BUDGETEDUNITS_0 SMALLINT;

DECLARE OLDBDGTUNITS SMALLINT;

DECLARE NEWBDGTUNITS SMALLINT;

DECLARE SERVICECOST1 DEC(7,2);

DECLARE SERVICECOST2 DEC(7,2);

DECLARE MONTHS_BETWEEN SMALLINT;

DECLARE MTHLYUNITS_0 SMALLINT;

DECLARE AMOUNT DEC(7,2);

DECLARE TOTAL_AMOUNT DEC(7,2);

DECLARE SVSRATE1 DEC(7,2);

DECLARE NPDD_SVS_RATE DECIMAL(6,2);





I created a separate stored procedure with the SET statements. When I
run the stored procedure, I insert the values in the "specify parameter
values" window, the statements return the expected value.



What am I missing here? I don't understand why the statements will work
in one stored procedure but not another.



I am running DB2 V7.1 on Z/OS.



Thank you,



Richard N. Olsen

Database Administrator

SC Department of Disabilities & Special Needs

Email: [Email address protected]




DB2 & UDB email list listserv db2-l LazyDBA home page