View previous topic :: View next topic
|
Author |
Message |
kalaignar_S Warnings : 1 New User
Joined: 06 Jan 2006 Posts: 21
|
|
|
|
1. how to view comp values in cobol
2. I have two sequential files (transaction & master), both have a common field called emp-no.
my requirement - Read transaction file and search whether trans-emp-no is available in master file. if available then update master file with transaction data else write a new record in the master file.
Thanks
Kalaignar |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
1. how to view comp values in cobol |
Move them to corresponding Normal Variables and DISPLAY accordingly.
Quote: |
2. I have two sequential files (transaction & master), both have a common field called emp-no.
my requirement - Read transaction file and search whether trans-emp-no is available in master file. if available then update master file with transaction data else write a new record in the master file. |
So what is the problem...
Regards,
Priyesh. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
kalaignar_S,
This is a very simple two file compare.
Step 1. Both master and transaction file must be sorted in Emp-No order.
Step 2. Two file compare. (pseudo code)
Code: |
OPEN INPUT MASTER-FILE
TRANSACTION-FILE
OUTPUT MEW-MASTER-FILE
READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO.
PERFORM
UNTIL MASTER-FILE-EOF
AND TRANSACTION-FILE-EOF
IF MASTER-EMP-NO = TRANS-EMP-NO
UPDATE MASTER-RECORD FROM TRANSACTION-RERCORD
WRITE NEW-MASTER-RECORD FROM MASTER-RECORD
READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO
ELSE
IF MASTER-EMP-NO > TRANS-EMP-NO
WRITE NEW-MASTER-RECORD FROM TRANSACTION-RECORD
READ TRANSACTION-FILE AT END MOVE HIGHT-VALUES TO TRANS-EMP-NO
ELSE
WRITE NEW-MASTER-RECORD FROM MASTER-RECORD
READ MASTER-FILE AT END MOVE HIGH-VALUES TO MASTER-EMP-NO
END-IF
END-IF
END-PERFORM
CLOSE MASTER-FILE
TRANSACTION-FILE
NEW-TRANSACTION-FILE
|
Dave, |
|
Back to top |
|
|
|