View previous topic :: View next topic |
Author |
Message |
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Mon Sep 25, 2006 11:16 am Post subject: Comparsion using tables |
|
|
Hai all,
My Input file is having 100000 records with layout EMP NO, Dep NO
Eno Dno
001 A001
001 B001
001 C001
002 D001
003 E001
003 F003
004 G004
005 H002
Each employee may be work under 10 dept maximum.
My requirement is
a) I have to read all the records one by one and all the input record for same ENO are read and store the each DNO in working storage table.
i.e for 001 - A001, B001, C001 have to store in working storage table
Then using the ENO in the input file below query will execute
SELECT DNO, SALARY FROM EMP WHERE ENO = :ENO (from Input file)
It may retrive more than one row.
The selected rows (DNO) must be match with DNO in working storage table on the below condition
a) IF all the rows selected from the query matched with working storage table then perform PARA1
b) IF one of DNO in the working storage table is not match with any of the DNO retrived from query then perform PARA2
c ) IF one of the DNO selected from Query is not match with any of the DNO in the WS-table then perform PARA3
Note : I have to process the record one by one. i.e first i have process 001 for all the condition and then 002 then 003 .....
Thanks.... |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Mon Sep 25, 2006 11:37 am Post subject: |
|
|
sanjayr321,
1. open the file
2. Read the file
3. Load the file into an internal table until the end of file
4. Close the file
5. Now process each record from the internal table
6. open the cursor
7. Fetch the cursor until sqlcode=100.for each row fetched use SEARCHALL to check if the fetched value matches. Peform the 3 paragraph logic based on the match
8.close the cursor.
Repeat steps 6 thru 8 for all the records in the internal table.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Tue Sep 26, 2006 12:45 pm Post subject: |
|
|
Thanks for reply Kolusu...
Can u give me sample code for comparsion of variables b/w two WS-Tables. Since iam new to this one.... |
|
Back to top |
|
|
|
|