Issue an UPDATE statement to insert values into selected columns in a table. The WHERE clause identifies the rows in the table that are to be updated. You then specify simple expressions in the SET clause to indicate how you want to update the identified column.
Keep this information in mind when using the UPDATE statement:
Note: If you are updating multiple columns, specify a SET clause with multiple colname operands and separate the operands with commas.
Use this syntax in an AOF rule or an OPS/REXX program:
ADDRESS SQL "UPDATE keywords"
{tablename}
{SET colname=string|:hostvar|NULL}
[WHERE searchcriteria]
[SYSTEM(ALL|EXT|sysnames)]
[SYSWAIT(seconds)]
[OUTPUT|NOOUTPUT]
[SYSPLEX]
Use this syntax to invoke the statement from a TSO terminal, a TSO/E REXX program, or a TSO CLIST:
OPSQL UPDATE
{tablename}
{SET colname=string|:hostvar|NULL}
[WHERE searchcriteria]
You may specify these operands for the UPDATE statement:
Defines the name of the table you are updating.
Defines the name of the column into which you are inserting data. You can specify the colname value as a string, a host variable name, or as NULL. To update multiple columns, include multiple colname clauses in your UPDATE statement, and separate them with commas.
(Optional) For a searched operation, the criteria on a WHERE clause can be any valid search criteria. For information about specifying search criteria, see Searched Operations in the chapter “Using the Relational Data Framework” in the User Guide.
(Optional) For a cursor operation, the criteria on a WHERE clause must include CURRENT OF cursorname, which causes the function to be performed on the current row being processed in the cursorname operation.
Note: See the example that follows.
(Optional) Performs cross-system SQL operations. Specify one of these values:
Routes the SQL command to all active MSF-defined systems, including the local system.
Routes the SQL command to all remote, active MSF-defined systems.
Routes the SQL command to the specified systems. You may specify from one to eight system names as the value of sysnames.
For more information, see Notes on Performing Cross-system SQL Operations in the chapter “Using the Relational Data Framework” in the User Guide.
(Optional). Defines the number of seconds the SQL processor waits for output from a remote system. You may specify a value between 1 and 300 seconds.
Do not specify a value for SYSWAIT if you specify the SYSTEM(ALL), SYSTEM(EXT), or NOOUTPUT keywords.
(Optional) Indicates whether the command returns output to the external data queue. Specify OUTPUT to have output returned; otherwise, specify NOOUTPUT.
NOOUTPUT is implied when:
(Optional) Reduces the scope of the SYSTEM(ALL|EXT) operand to MSF connected systems that belong to the same z/OS sysplex as the command issuer. The keyword has no effect on a list of explicit system names.
Examples: UPDATE
These examples illustrate the use of the UPDATE statement:
Suppose that you want to alter the SYSTEMS table by changing the current state value for the CICS1 system to UP. To do this, you would use this SQL statement in an AOF rule:
ADDRESS SQL "UPDATE SYSTEMS SET CURRENT_STATE = 'UP' WHERE NAME = 'CICS1'"
You have one or more rules that execute when CA OPS/MVS starts up, and you want to set the current state of all systems to DOWN. You plan to decide later whether a specific system should be up or down. You could invoke the SQL statement from a rule as follows:
ADDRESS SQL "UPDATE SYSTEMS SET CURRENT_STATE = 'DOWN'"
The absence of the WHERE clause from this statement signals that you want to update the CURRENT_STATE column in all rows.
To set the value of the STATUS column to UP for the current row in a cursor operation called STATDOWN, you could include this SQL statement in a TSO CLIST:
OPSQL UPDATE APPLICATIONS SET STATUS = 'UP' WHERE CURRENT OF STATDOWN
| Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |