View previous topic :: View next topic
|
Author |
Message |
kalaignar_S Warnings : 1 New User
Joined: 06 Jan 2006 Posts: 21
|
|
|
|
Hi..
I have 2 sequential files (master and transaction) having a common field (called empno).
How can i check whether the empno available in master file not in transaction file and vise-versa?
In a cobol program for a file one open and close premitted..
Please help in this regard.
Thanks
Kalaignar |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
You need to write a sepearate sort step(s) in which, both the files are sorted on empno key.
Then you can write a cobol program based on key matching algorithm. With this approach, you need not open and close both the files more than once.
Thanks,
Parikshit. |
|
Back to top |
|
|
kalaignar_S Warnings : 1 New User
Joined: 06 Jan 2006 Posts: 21
|
|
|
|
Please let me know the details in detail.. |
|
Back to top |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
Hi,
Pls refer the below code for ur prob.
Code: |
C300-CHECK-KEY-MATCH SECTION.
********************************************************
THIS PARAGRAPH PERFORMS KEY COMPRASION OF MSTR
AND TRANS FILE
********************************************************
IF X06-TRANS-KEY = X05-MSTR-KEY
PERFORM C310-CHECK-DATA-MATCH
PERFORM C100-READ-TRANS
PERFORM C200-READ-MSTR
ELSE
IF X06-TRANS-KEY < X05-MSTR-KEY
MOVE 'B' TO X04-RECORD-MATCH
PERFORM C400-ERROR-MSG
PERFORM C100-READ-TRANS
ELSE
MOVE 'M' TO X04-RECORD-MATCH
PERFORM C400-ERROR-MSG
PERFORM C200-READ-MSTR
END-IF
END-IF
.
|
Thanks,
Dipanshu G. |
|
Back to top |
|
|
dipanshu
New User
Joined: 16 Jan 2006 Posts: 53 Location: pune
|
|
|
|
Hi,
This is to remind u the above code is only applicable after both the files r sorted.
Thanks,
Dipanshu G. |
|
Back to top |
|
|
|