HI,
i m running a query and it is an update query..i want it to write it to a ps file and count the number of rows updated.so my question is how to write the updated fields alone to the ps...and how the cursor to be used..because using cursors oly we can write the result fetched to a ps file..?????????and one more thing cursor are supposed to be declared oly for select stmts or could it be used for update also?
update query
Moderators: Kalicharan, Moderator Group
COBOL DB2 FINAL TABLE
Hi Rekha,
welcome to mainframegurukul.com.
I am giving answer as per my understanding of your question.
i assume, you want the row that got updated by the query and want to write it to PS.
Here is the solution. In db2 8, we can select row that got updated currently.
Ex.
Above example will give the details about the record currently updated.
Note : FINAL TABLE is a key word.
regarding your question on cursors - We can use cursor for updates also, for that,
we need to use FOR UPDATE OF option in CURSOR definition.
if my answer not cleared your doubt, let me know.
welcome to mainframegurukul.com.
I am giving answer as per my understanding of your question.
i assume, you want the row that got updated by the query and want to write it to PS.
Here is the solution. In db2 8, we can select row that got updated currently.
Ex.
Code: Select all
SELECT SSN, ADDRESS , Y, Z FROM FINAL TABLE
( UPDATE TABLE1
SET ADDRESS := :WS-ADDRESS
WHERE SSN := 10290 )
Note : FINAL TABLE is a key word.
regarding your question on cursors - We can use cursor for updates also, for that,
we need to use FOR UPDATE OF option in CURSOR definition.
if my answer not cleared your doubt, let me know.
Natarajan
Chennai
Chennai
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page