10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How You Can Use Exec 4GL Statements in 3GL ProceduresOperationSet member of an arraySet row in an array as deletedStatementsetrowsetrow deletedFor the complete syntax of exec 4GL statements, see the Language Reference<strong>Guide</strong>.Example—Passing an Array to a 3GL ProcedureHow You Can Call the 3GL ProcedureAssume, for example, a frame that displays a line chart constructeddynamically from values in a database table. This frame calls a 4GL procedurenamed scale_y_array to calculate an array of Y-axis values. The scale_y_arrayprocedure can be written in embedded SQL to enhance performance whencalculating many graph points.The following sections describe a 3GL version of the scale_y_array procedure.When the frame calls the scale_y_array procedure, the frame passes an array(sales_array) whose data type is the saleschart_data user class. Two of theattributes in this class are significant to the 3GL procedure:sales_value (float not null)Contains the dollar sales for a given quarter of the fiscal year quarter(quarter)y (integer not null)Contains the Y-axis coordinate for each quarter to be displayed, aftercompletion of the procedureThe frame also passes simple variables to the 3GL procedure. These variablesare used to calculate the scale factor used to plot each point on the graph.The line in the script that calls the scale_y_array procedure would be replacedby the following code if scale_y_array were an embedded SQL procedure:/* Pass highest and lowest dollar amounts by** reference to ensure portability when passing** floating point parameters to C procedures. */vmax = 1000.0;vmin = 0.0;callproc scale_y_array(byref(vmin), byref(vmax),ymax - (labelheight*2), 0, sales_array);300 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!