SQL/MP Programming Manual for COBOL
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for COBOL—529758-003
10-32
Displaying Output
You also use the USING DESCRIPTOR clause with the FETCH statement to write 
column values to an output buffer specified in the program’s variable declarations. The 
output SQLDA describes a list of memory locations into which FETCH copies the data.
Using Cursors With an UPDATE WHERE CURRENT Clause
To use UPDATE WHERE CURRENT with a static SQL cursor, specify a FOR UPDATE 
OF clause with a column list in the DECLARE CURSOR statement. In contrast, to use 
UPDATE WHERE CURRENT with a dynamic SQL cursor, you must specify a FOR 
UPDATE OF clause in the SELECT statement that defines the cursor.
This example shows an UPDATE WHERE CURRENT operation with a dynamic SQL 
cursor. In the example, the host variable HOSTVAR contains the SELECT statement to 
define the cursor. The host variable :SALVAR receives the selected values.
PROCEDURE DIVISION.
 MOVE "SELECT SALARY FROM =EMPLOYEE FOR UPDATE OF SALARY"
 TO HOSTVAR.
 EXEC SQL PREPARE S1 FROM :HOSTVAR END-EXEC.
 EXEC SQL DECLARE C1 CURSOR FOR S1 END-EXEC.
 EXEC SQL OPEN C1 END-EXEC.
 EXEC SQL FETCH C1 INTO :SALVAR END-EXEC.
 EXEC SQL
 UPDATE =EMPLOYEE SET SALARY = SALARY * 1.20
 WHERE CURRENT OF C1
 END-EXEC.
Displaying Output
There are several ways to display column values. Three ways to display column values 
are:
Using the Names Buffer to Display Output
Displaying Names as Headings on page 10-33
Using DATA-TYPE to Evaluate Column Values on page 10-33
Using the Names Buffer to Display Output
After the FETCH operation for each row, you can display output by performing 
essentially the same operations you did to prompt for input. However, you might 
display the column names at a different point. 










