10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Use Exec 4GL Statements in 3GL ProceduresThe 3GL procedure also declares the following local variables:scale_factornrowsiUsed to calculate each Y-axis positionSpecifies the number of rows in the array; used in the while loop andreturned to the calling frameSpecifies the index for the while looprow_handleSpecifies a handle for a row in the arrayThe following code is the declaration section of the 3GL procedure:int scale_y_array (low_value, high_value,low_y_point, high_y_point, array_handle)double *low_value, *high_value;int low_y_point, high_y_point;exec sql begin declare section;long array_handle;exec sql end declare section;{exec sql begin declare section;double scale_factor, value;int nrows; /* number of rows in array */int i; /* index for while loop */long row_handle;exec sql end declare section;}Note: Variables used in exec 4GL or exec SQL statements must be:• Declared in the following statements:– exec SQL begin declare section– exec SQL end declare section• Preceded by a colon when used in a statementTo determine the scale factor, this procedure performs the followingcalculation:/* Calculate scale factor one time only */scale_factor = (low_y_point-high_y_point)/(*high_value-*low_value);302 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!