Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 5

DEP file

Dep no
D01 Read Dep file
D02 if read successful write dept in output
D03 read emp file sequentially and check if department number is match
D04 if dep dep no = emp dep no
D05 read flat file seq and check if emp emp no is matching with flat file e
calculate salary
EMP file write output as per the report format
empno dep no employee details
111 D05
222 D04 D01 D02 D04 D05
333 D01
444 D02
555 D05
666 D02

Flat file
Empno Rate per hour
111
222
333
444
555
partment number is matching
each time emp file should be opened and closed
is matching with flat file emp no

employee details
pened and closed
DEP table
Dep no
D01
D02
D03
D04
D05

EMP table
empno dep no
333 D01 111 D05
444 D02 222 D04
666 D02 333 D01

222 D04 444 D02

555 D05 555 D05


666 D05 666 D02

Flat file
Empno Rate per hour
111
222
333
444
555
First cursor
Using cursor select dept column details

Second cursor
using cursor select emp details
order by dept no

Perform cursor1

Cursor1
open cursor1
perform fetch dep para until sqlcode = 100
close cursor1

fetch dep para


fetch dep records
if sqlcode = 0
write dep header in output file

perform open cursor2 para until sqlcode=100


close cursor

Open cursor2 para


open cursor 2
fetch emp record
if sqlcode=0 and if dept no in both the table matchs
read flat file and check if emp empno is matching with flat file emp n
calculate salary
write output file

You might also like