View previous topic :: View next topic |
Author |
Message |
yadav2005 Intermediate

Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Fri Mar 02, 2007 10:18 am Post subject: DB2 program logic needed |
|
|
I have a file with some records and the fields are :
Code: |
EMPNO EMPNAME CLASS
1 ABC A
2 DEF A
3 PQR A
.
.
|
I have to write a logic which will read each EMPNO from the file and has to query a DB2 table in which for a CLASS A there are always two marks associated as below:
Code: |
CLASS MARKS
A 1
A 2
|
I want to form a output file which should have as below:
Code: |
EMPNO EMPNAME CLASS MARKS
1 ABC A 1
1 ABC A 2
2 DEF A 1
2 DEF A 2
3 PQR A 1
3 PQR A 2
.
.
|
If the input number of records are X then the output records should be 2X. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 02, 2007 10:29 am Post subject: |
|
|
yadav2005,
Code: |
1. open file
2. read file
3. open cursor
4. fetch cursor until end of cursor
5. for every fetch move the values to output file
6. write output
7. close cursor
8. Repeat step 2 thru 7 until end of file
9. close file
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|