Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Want to Insert the rows that are retreived from CURSOR

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vjya

New User


Joined: 08 Dec 2006
Posts: 1
Location: Hyderabad

PostPosted: Sun Mar 29, 2009 6:21 pm    Post subject: Want to Insert the rows that are retreived from CURSOR
Reply with quote

Hi All, Here is my requirement:

1. Read the rows from DB(cursor).
2.Copy the same rows and change the value of ISTC ID and insert them on to the same table.

Please tell me ...if there is any easiest and efficient way to do this.

(Backgroud: I have declared a cusror, fetched one by one, modified the field ISTC ID and inserted one by one...which is a big process to do icon_sad.gif )

Thankyou,
Vjya.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Mar 29, 2009 7:18 pm    Post subject:
Reply with quote

you could
  1. dump the table
  2. modify the qsam file
  3. load the table from the modified qsam file.


obvious problems: duplicate keys.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Mon Mar 30, 2009 12:47 pm    Post subject: Reply to: Want to Insert the rows that are retreived from CU
Reply with quote

vjya,

It would have been helpful for us to suggest, if you could have shared the unique index fields ,cursor and insert clause definition.

Doubt: Do you actually want to insert another set of rows with exactly the same values except "ISTC ID" or You wish to update the "ISTC ID" field.

You may think of the following options in case of an update .

1. If you can uniquely identify "ISTC ID" by some filter criteria (using unique index) then u might try directly updating the same.

2. If the above scenario is not possible then u might go for a multi row fetch feature of DB2. This improves the fetch processing by as much as 50%. So, instead of fetching a row at a time you can use multifetch and update the same.

In case of an insert, you might try multi row fetch and multi row insert feature ...not sure how will you handle the duplicates.

WTF
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us