Issued through ADDRESS SQL statements, SQL commands such as SELECT and FETCH create stem REXX variables. For example, suppose that you have this statement:
ADDRESS SQL "SELECT NAME FROM MYTABLE"
The statement shown above generates these stem REXX variables:
Using the ADDRESS SQL statement above, you could write the following REXX code to display the retrieved NAME column information on your terminal, or to display error messages if the SELECT statement fails:
ADDRESS SQL "SELECT NAME FROM MYTABLE" IF SQLCODE ¬= 0 THEN DO SAY "ADDRESS SQL HOST COMMAND RET CODE =" SQLCODE DO WHILE QUEUED() <> 0 PULL MESSAGES SAY MESSAGES END RETURN END SAY "Number of Variables Created =" NAME.0 DO I = 1 TO NAME.0 SAY NAME.I END
Copyright © 2014 CA.
All rights reserved.
|
|