
Chapter 5
Section 5.3
Using VSAM OTDs
Using Views
VSAM eWay Adapter User’s Guide
52
Sun Microsystems, Inc.
5.3
Using Views
Views are used to look at data from selected columns within selected tables. View OTDs
are read-only.
For select operations, see
“Select Operations” on page 51
.
5.4
Using Prepared Statements
You can perform table operations with prepared statements with the same method
nodes you use for the regular table operations, that is, select, update, insert, and delete
SQL operations.
Prepared statements allow you to create any valid SQL statements that comply with
ANSI standards. Using this feature, you can execute
select
statements such as
joins
and
union
,
insert
,
update
and
delete
operations. You can also include database operations
such as
to_date
, to manipulate input or output values. Parameter markers are also
supported.
Any prepared statement you create shows up in the Collaboration Editor (Java) on the
OTD where it was created, as a node with the name you assigned to it. You can
implement the statement by dragging its node onto the method box for the action (the
desired select, update, insert, or delete operation) in which you want the statement to
be used.
Note:
When using a Prepared Statement, the
ResultsAvailable()
method will always
return true. Although this method is available, you should not use it with a ‘while’
loop. Doing so would result in an infinite loop at runtime and will stop all of the
system’s CPU. If it is used, it should only be used with the ‘if’ statement.
To use a prepared statement in a Collaboration (Java)
1
Using the Enterprise Designer and VSAM OTD wizard, create an OTD that contains
a prepared statement. See
“Add Prepared Statement” on page 41
for details.
2
Create the desired Collaboration Definition (Java) using this OTD.
The Collaboration Editor (Java) displays the OTD with a
Prepared Statement
node.
In the OTD structure, you can see both the input parameter and the result set
represented as nodes.
3
You can assign a
Literal
value or the input from another OTD to the parameter.
4
To run the prepared statement, select the
executeQuery
method from the
Prepared
Statement
node.
5
To view the result set after the query is finished, create a
while
rule. For the
condition, create a
next
method from the result set node (
$Statement1Results
in the
example). You can continue creating your business logic by adding more Business
Rules, if desired.