![Previous Topic: How SQL Processes Null Values](574.png)
![Next Topic: The ADDRESS SQL Environment and Host Variables](573.png)
Using the Relational Data Framework › Storing Data in and Requesting Data From Relational Tables › SELECT Statement—Request Data from a Table
SELECT Statement—Request Data from a Table
You request data from a table through the SELECT statement. For example, to fetch the current state of the CICS system from the SYSTEMS table, you could include this line in an AOF rule:
ADDRESS SQL
"SELECT CURRENT_STATE INTO :CUR_STATE FROM SYSTEMS",
"WHERE NAME='CICS'"
The syntax for this statement breaks down like this:
- The ADDRESS SQL command invokes SQL to process the statement.
- The clause SELECT CURRENT_STATE INTO:CUR_STATE tells CA OPS/MVS to fetch an item from the CURRENT_STATE column and place it in a REXX variable called CUR_STATE.
- The clause FROM SYSTEMS WHERE NAME='CICS' tells SQL which item to fetch from which table. In this case, the item is the current state value from the row in the SYSTEMS table where CICS appears in the NAME column.
When this statement executes, CA OPS/MVS sets the following variables:
- CUR_STATE.0 = 1 (1 is the number of rows selected)
- CUR_STATE.1 = DOWN (DOWN is the value in the first row selected)
- SQLCODE=0 (0 is the result of the SELECT statement)
More information:
Specifying Stem Names
Copyright © 2014 CA.
All rights reserved.
![Previous Topic: How SQL Processes Null Values](574.png) ![Next Topic: The ADDRESS SQL Environment and Host Variables](573.png)
|
|