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 Call 3GL ProceduresIn the following example, the callproc statement calls the 3GL procedurenamed my3glprocedure:callproc my3glprocedure;When the procedure returns a value, you can specify a variable in the callingframe or procedure to receive the return value. The return variable must be asimple variable of the same data type as the return value.In the following example, returnvalue is an integer variable:returnvalue = callproc my3glprocedure;How You Can Pass Parameters to 3GL ProceduresTo pass parameters to a 3GL procedure, you specify a list of expressions.Because you do not include parameter names, you must specify theparameters by position. The syntax for calling a 3GL procedure is:[return_variable =] callproc procedurename[(expression | byref(variable){, expression | byref(variable)})]Each expression in the list must correspond to a parameter in the 3GLprocedure parameter list. You must verify that each expression matches thedata type and position of the corresponding parameter. The expression youpass to the 3GL procedure can be a constant or any legal OpenROADexpression, so long as the resulting data type is compatible with the data typeof the corresponding 3GL procedure parameter.Because 3GL procedures do not allow null values, you cannot pass a simplevariable with a value of null. If your variable is nullable in 4GL, you can pass itusing the ifnull function. This function helps ensure that a fixed value, insteadof a null, is passed when a null in encountered.For more information about the ifnull function, see the Language Reference<strong>Guide</strong> online help.Examples—Passing Parameters to a 3GL Procedure:The following example calls a C procedure, my3glprocedure. This procedure'sthree parameters are simple data types: two integers and a varchar. Thesecond parameter references intvar, a 4GL integer variable, and the thirdreferences a 4GL varchar variable called video.title:callproc my3glprocedure(256, 3 + intvar,'Free movie this week is ' + video.title);296 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!