CALL
The CALL statement allows you to invoke stored procedures.
Format 1
EXEC SQL [ AT Database ]
 
  CALL Procedure-Name ( [ Parameters ] ) [ INTO Host-Variable ]
 
END-EXEC
Format 2
EXEC SQL [ AT Database ]
 
  [ Host-Variable = ] CALL Procedure-Name ( [ Parameters ] ) 
 
END-EXEC
Syntax Rules
1. Multiple parameters must be separated by commas.
2. Each parameter name might be followed by the parameter type. The type can be IN, OUT or INOUT.
General Rules
1. Database identifies the active connection that will execute the query and must be previously defined using a Format 4 DECLARE statement.
2. Only one destination Host-Variable is allowed. If the stored procedure returns multiple fields or multiple rows, rely on a cursor defined using a Format 1 DECLARE statement.
3. If the parameter type is not specified, the Compiler sets the type according to the HOSTVAR Directive directive or by the iiscobol.compiler.esql.procedure.ProcedureName configuration property. If neither the HOSTVAR Directive nor the iscobol.compiler.esql.procedure.ProcedureName configuration property is present, then the type is set at runtime according to the iscobol.esql.default_param_type configuration property.
Examples
Call a Stored Procedure that updates values on a totals table (the logic of the update is DB Server based and stored)
exec sql
  call update_totals()
end-exec
Call a Stored Procedure with an input parameter and an output parameter, storing the result in a destination data item
exec sql
  call proc1(:p1 IN, :p2 OUT) into :exit-status
end-exec