View previous topic :: View next topic |
Author |
Message |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Nov 10, 2006 3:07 pm Post subject: avoiding cursor and coding for a new query |
|
|
Hai All,
I have a COBOL DB2 Program and i am generating a output file which has one record for each employee number by getting data from DB2 table but with 5 different cursors and each cursor is getting the desired fields which are required for generating the output file but with Employee number as a common field in all the cursors and each cursor is using different tables.Now i want to avoid using cursors in the program and i would like to generate the file by unload the data from DB2 table using utility which will retreive me all the information pertaining to a single employee number by number.
I am in the assumption to code new query as exactly as present in the cursor query doing some minor cosmetic modifications (just copying).Is this the efficient way of doing it or should i need to check all 5 cursors query what fields they are retreiving and code a query which gets me all the info.Please suggest me in this regard. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Fri Nov 10, 2006 4:29 pm Post subject: |
|
|
shekar123,
Option 1:
1. unload all the 5 tables with required columns
2. Use sort/easytrieve to match and combine the 5 records into a single record.
Option : 2
1. Code a sql joing all the 5 tables in a single query and unload it. If the tables have huge data then the peformance will be terrible with the join.
Post your cursor queries and let me check if we can come up a singleton sql to unload from all the 5 tables.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|